c533e456515a9af7fc4bca098f7cf48b9a660e21..41193d186d157937ba052e73dd04c12018e9ecab
2025-08-07 祖安之光
新增
41193d 对比 | 目录
2025-08-07 祖安之光
新增
ad5c4c 对比 | 目录
已修改13个文件
已删除18个文件
1274 ■■■■ 文件已修改
cloud/getHazmatFlow/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlow/index.js 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlow/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlowByPage/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlowByPage/index.js 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlowByPage/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatInfo/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatInfo/index.js 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatInfo/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlow/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlow/index.js 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlow/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlowByPage/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlowByPage/index.js 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductFlowByPage/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductInfo/config.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductInfo/index.js 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getProductInfo/package.json 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.js 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.wxml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.wxss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/count/count.js 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/count/count.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/count/countDetail.js 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/count/productDetail.js 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/current/current.js 74 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/current/current.wxml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/firstPage/firstPage.js 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabBar/firstPage/firstPage.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/http.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud/getHazmatFlow/config.json
文件已删除
cloud/getHazmatFlow/index.js
文件已删除
cloud/getHazmatFlow/package.json
文件已删除
cloud/getHazmatFlowByPage/config.json
文件已删除
cloud/getHazmatFlowByPage/index.js
文件已删除
cloud/getHazmatFlowByPage/package.json
文件已删除
cloud/getHazmatInfo/config.json
文件已删除
cloud/getHazmatInfo/index.js
文件已删除
cloud/getHazmatInfo/package.json
文件已删除
cloud/getProductFlow/config.json
文件已删除
cloud/getProductFlow/index.js
文件已删除
cloud/getProductFlow/package.json
文件已删除
cloud/getProductFlowByPage/config.json
文件已删除
cloud/getProductFlowByPage/index.js
文件已删除
cloud/getProductFlowByPage/package.json
文件已删除
cloud/getProductInfo/config.json
文件已删除
cloud/getProductInfo/index.js
文件已删除
cloud/getProductInfo/package.json
文件已删除
pages/index/index.js
@@ -11,24 +11,37 @@
    userFocused: false,
    codeFocused: false,
    form: {
      username: 'qyyh12345',
      password: 'Gkhy@c413',
      username: '',
      password: '',
      code: '',
      uuid: ''
    },
    isPwd: true,
    isLogining: false
    isLogining: false,
    saveAccount: false
  },
  
  onShow() {
    if(wx.getStorageSync('name') && wx.getStorageSync('pwd')){
    }else{
      wx.clearStorageSync();
    }
  },
  
  onLoad() {
    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })
    console.log(wx.getStorageSync('isSave'),'get1')
    if(wx.getStorageSync('isSave')){
      this.setData({
        saveAccount: true,
        form: {
          username: wx.getStorageSync('username') || '',
          password: wx.getStorageSync('pwd') || '',
          code: '',
          uuid: ''
        }
      })
    }
  },
  
  base64Encode(e) {
@@ -47,7 +60,10 @@
      [field]: e.detail.value  // 动态更新对应字段
    });
  },
  switchChange(e){
    this.setData({ saveAccount: e.detail.value })
    wx.setStorageSync('isSave',e.detail.value)
  },
  Login(){
    if(this.data.form.username == ''){
      wx.showToast({
@@ -71,82 +87,37 @@
    const data = {username, password, code, uuid};
    data.password = this.base64Encode(data.password);
    wx.removeStorageSync('tk');
    // 云开发请求
    cloudApi.queryPost('userList',{username: data.username,password: data.password}).then(res=>{
      if(res.data.length>0){
    // api请求
    api.login(data).then(res => {
      console.log(res,'res')
      if (res.code === 200) {
        this.setData({
          isLogining: false
        });
        const info = cloudApi.changeKey(res.data)
        wx.setStorageSync("username", this.data.form.username);
        wx.setStorageSync("pwd", this.data.form.password);
        wx.setStorageSync("uid", info[0].Id);
        wx.setStorageSync('user', info[0]);
        wx.setStorageSync("tk", res.data.token);
        wx.setStorageSync("uid", res.data.id);
        wx.setStorageSync('user', res.data);
        wx.switchTab({
          url: '/pages/tabBar/firstPage/firstPage'
        });
      }else{
        cloudApi.queryPost('userList',{name: data.username}).then(res=>{
          if(res.data.length>0){
            wx.showToast({
              icon: "none",
              title: '密码错误'
            });
            this.setData({
              'form.password': '',
              isLogining: false
            });
          }else{
            wx.showToast({
              icon: "none",
              title: '用户不存在'
            });
            this.setData({
              form: {
                username: '',
                password: '',
                code: '',
                uuid: ''
              },
              isLogining: false
            });
          }
        })
      } else {
        wx.showToast({
          icon: "none",
          title: res.message
        });
        this.setData({
          isLogining: false
        });
      }
    })
    // api请求
    // api.login(data).then(res => {
    //   console.log(res,'res')
    //   if (res.code === 200) {
    //     this.setData({
    //       isLogining: false
    //     });
    //     wx.setStorageSync("name", this.data.form.username);
    //     wx.setStorageSync("pwd", this.data.form.password);
    //     wx.setStorageSync("tk", res.data.token);
    //     wx.setStorageSync("uid", res.data.id);
    //     wx.setStorageSync('user', res.data);
    //     wx.switchTab({
    //       url: '/pages/tabBar/firstPage/firstPage'
    //     });
    //   } else {
    //     wx.showToast({
    //       icon: "none",
    //       title: res.message
    //     });
    //     this.setData({
    //       'form.password': '',
    //       isLogining: false
    //     });
    //   }
    // }).catch(err => {
    //   this.setData({
    //     'form.password': '',
    //     isLogining: false
    //   });
    // });
    }).catch(err => {
      this.setData({
        'form.password': '',
        isLogining: false
      });
    });
  },
  
  focusUser(){
pages/index/index.wxml
@@ -37,6 +37,10 @@
            <text catchtap="togglePwd" class="iconfont {{isPwd?'icon-view':'icon-view-off'}}"></text>
          </input>
        </view>
        <view class="switch-box">
          <text>记住密码</text>
          <switch type="checkbox" checked="{{saveAccount}}" bindchange="switchChange"/>
        </view>
        <view class="form-item" style="margin-top: 10px;width: 80%;">
          <button 
            class="loginBtn" 
@@ -50,6 +54,6 @@
    </view>
  </view>
  <view class="footer">
    当前版本:1.2
    当前版本:1.0.2
  </view>
</view>
pages/index/index.wxss
@@ -96,6 +96,14 @@
.pswInput{
  position: relative;
}
.switch-box{
  width: 75%;
  margin: 20rpx 0;
}
.switch-box text{
  margin-right: 15rpx;
}
.iconfont {
  position: absolute;
pages/tabBar/count/count.js
@@ -55,25 +55,23 @@
      content: '是否确认退出该账号?',
      success: (res) => {
        if (res.confirm) {
          wx.clearStorageSync();
          wx.navigateTo({
            url: '/pages/index/index'
          });
          // api接口
          // api.loginOut().then(res => {
          //   if(res.code == 200) {
          //     wx.showToast({
          //       title: '账户已退出',
          //       duration: 800
          //     });
          //     setTimeout(() => {
          //       wx.clearStorageSync();
          //       wx.navigateTo({
          //         url: '/pages/index/index'
          //       });
          //     }, 800);
          //   }
          // });
          api.loginOut().then(res => {
            if(res.code == 200) {
              wx.showToast({
                title: '账户已退出',
                duration: 800
              });
              setTimeout(() => {
                if(!wx.getStorageSync('isSave') || wx.getStorageSync('isSave') == false){
                  wx.clearStorageSync();
                }
                wx.navigateTo({
                  url: '/pages/index/index'
                });
              }, 800);
            }
          });
        }
      }
    });
@@ -130,26 +128,25 @@
      });
      return;
    }
    const Id = wx.getStorageSync("uid")
    cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{
      if(res.result == 'success'){
        wx.showToast({
          title: '密码已修改,请重新登录',
          icon: 'none',
          duration: 1500
        });
        wx.clearStorageSync();
        wx.navigateTo({
          url: '/pages/index/index'
        });
      }else{
       wx.showToast({
          title: 密码修改失败,
          duration: 2000
        });
      }
    })
    // const Id = wx.getStorageSync("uid")
    // cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{
    //   if(res.result == 'success'){
    //     wx.showToast({
    //       title: '密码已修改,请重新登录',
    //       icon: 'none',
    //       duration: 1500
    //     });
    //     wx.clearStorageSync();
    //     wx.navigateTo({
    //       url: '/pages/index/index'
    //     });
    //   }else{
    //    wx.showToast({
    //       title: 密码修改失败,
    //       duration: 2000
    //     });
    //   }
    // })
    // const db = wx.cloud.database()
    // db.collection('userList').doc(Id).update({
    //   data: {
@@ -175,39 +172,39 @@
    // })
    // api请求
    // let data = {
    //   id: wx.getStorageSync("uid"),
    //   password: this.base64Encode(this.data.pwdForm.password)
    // };
    // api.resetPwd(data).then((r) => {
    //   if(r.code == 200) {
    //     wx.showToast({
    //       title: '密码已修改,请重新登录',
    //       icon: 'none',
    //       duration: 1000
    //     });
    //     loginOut().then(res => {
    //       if(res.code == 200) {
    //         setTimeout(() => {
    //           wx.clearStorageSync();
    //           wx.navigateTo({
    //             url: '/pages/index/index'
    //           });
    //         }, 1000);
    //       }
    //     });
    //   } else {
    //     wx.showToast({
    //       title: r.message,
    //       icon: 'none'
    //     });
    //   }
    // }).catch((err) => {
    //   wx.showToast({
    //     title: err,
    //     duration: 2000
    //   });
    // });
    let data = {
      id: wx.getStorageSync("uid"),
      password: this.base64Encode(this.data.pwdForm.password)
    };
    api.resetPwd(data).then((r) => {
      if(r.code == 200) {
        wx.showToast({
          title: '密码已修改,请重新登录',
          icon: 'none',
          duration: 1000
        });
        loginOut().then(res => {
          if(res.code == 200) {
            setTimeout(() => {
              wx.clearStorageSync();
              wx.navigateTo({
                url: '/pages/index/index'
              });
            }, 1000);
          }
        });
      } else {
        wx.showToast({
          title: r.message,
          icon: 'none'
        });
      }
    }).catch((err) => {
      wx.showToast({
        title: err,
        duration: 2000
      });
    });
    
    this.closeModal();
  },
pages/tabBar/count/count.wxss
@@ -181,7 +181,7 @@
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  z-index: 99999;
}
.modal-container {
pages/tabBar/count/countDetail.js
@@ -37,53 +37,54 @@
  getList() {
    // cloudApi
    const userId = wx.getStorageSync('user').id
    wx.cloud.callFunction({
      name: 'getHazmatFlowByPage',
      data: {...this.data.examParams,userId: userId}
    }).then(res=>{
      if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
        let list = cloudApi.changeKey(res.result.list)
        if (this.data.examParams.pageNum != 1) {
          this.setData({
            examList: this.data.examList.concat(list),
            totalPage: Math.ceil(res.result.total / res.result.pageSize)
          });
        } else {
          this.setData({
            examList: list,
            totalPage: Math.ceil(res.result.total / res.result.pageSize)
          });
        }
      }else{
        this.setData({
          examList: [],
          totalPage: 0
        });
      }
    })
    // api请求
    // api.getHazmatFlowByUser(this.data.examParams).then(res => {
    //   if(res.code == 200) {
    //     let list = res.data.list ? res.data.list : [];
    // const userId = wx.getStorageSync('user').id
    // wx.cloud.callFunction({
    //   name: 'getHazmatFlowByPage',
    //   data: {...this.data.examParams,userId: userId}
    // }).then(res=>{
    //   if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
    //     let list = cloudApi.changeKey(res.result.list)
    //     console.log(list,'list')
    //     if (this.data.examParams.pageNum != 1) {
    //       this.setData({
    //         examList: this.data.examList.concat(list)
    //         examList: this.data.examList.concat(list),
    //         totalPage: Math.ceil(res.result.total / res.result.pageSize)
    //       });
    //     } else {
    //       this.setData({
    //         examList: res.data.list,
    //         totalPage: res.data.totalPage
    //         examList: list,
    //         totalPage: Math.ceil(res.result.total / res.result.pageSize)
    //       });
    //     }
    //   } else {
    //     wx.showToast({
    //       title: res.message,
    //       icon: 'none'
    //   }else{
    //     this.setData({
    //       examList: [],
    //       totalPage: 0
    //     });
    //   }
    // });
    // })
    // api请求
    api.getHazmatFlowByUser(this.data.examParams).then(res => {
      if(res.code == 200) {
        let list = res.data.list ? res.data.list : [];
        if (this.data.examParams.pageNum != 1) {
          this.setData({
            examList: this.data.examList.concat(list)
          });
        } else {
          this.setData({
            examList: res.data.list,
            totalPage: res.data.totalPage
          });
        }
      } else {
        wx.showToast({
          title: res.message,
          icon: 'none'
        });
      }
    });
  },
  upper(e) {
pages/tabBar/count/productDetail.js
@@ -36,53 +36,53 @@
  getList() {
    // cloudApi
    const userId = wx.getStorageSync('user').id
    wx.cloud.callFunction({
      name: 'getProductFlowByPage',
      data: {...this.data.examParams,userId: userId}
    }).then(res=>{
      if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
        let list = cloudApi.changeKey(res.result.list)
        if (this.data.examParams.pageNum != 1) {
          this.setData({
            examList: this.data.examList.concat(list),
            totalPage: Math.ceil(res.result.total / res.result.pageSize)
          });
        } else {
          this.setData({
            examList: list,
            totalPage: Math.ceil(res.result.total / res.result.pageSize)
          });
        }
      }else{
        this.setData({
          examList: [],
          totalPage: 0
        });
      }
    })
    // api请求
    // api.getProductFlowByUser(this.data.examParams).then(res => {
    //   if(res.code == 200) {
    //     let list = res.data.list ? res.data.list : [];
    // const userId = wx.getStorageSync('user').id
    // wx.cloud.callFunction({
    //   name: 'getProductFlowByPage',
    //   data: {...this.data.examParams,userId: userId}
    // }).then(res=>{
    //   if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
    //     let list = cloudApi.changeKey(res.result.list)
    //     if (this.data.examParams.pageNum != 1) {
    //       this.setData({
    //         examList: this.data.examList.concat(list)
    //         examList: this.data.examList.concat(list),
    //         totalPage: Math.ceil(res.result.total / res.result.pageSize)
    //       });
    //     } else {
    //       this.setData({
    //         examList: res.data.list,
    //         totalPage: res.data.totalPage
    //         examList: list,
    //         totalPage: Math.ceil(res.result.total / res.result.pageSize)
    //       });
    //     }
    //   } else {
    //     wx.showToast({
    //       title: res.message,
    //       icon: 'none'
    //   }else{
    //     this.setData({
    //       examList: [],
    //       totalPage: 0
    //     });
    //   }
    // });
    // })
    // api请求
    api.getProductFlowByUser(this.data.examParams).then(res => {
      if(res.code == 200) {
        let list = res.data.list ? res.data.list : [];
        if (this.data.examParams.pageNum != 1) {
          this.setData({
            examList: this.data.examList.concat(list)
          });
        } else {
          this.setData({
            examList: res.data.list,
            totalPage: res.data.totalPage
          });
        }
      } else {
        wx.showToast({
          title: res.message,
          icon: 'none'
        });
      }
    });
  },
  upper(e) {
pages/tabBar/current/current.js
@@ -83,69 +83,19 @@
        icon: 'none'
      });
    } else {
      // 云开发请求
      if(res.result.indexOf('SJ') >0){
        cloudApi.queryPost('hazmatList',{code: t.data.searchContent}).then(res=>{
          if(res.data.length>0){
              const hazmatId = cloudApi.changeKey(res.data[0]).id
              wx.cloud.callFunction({
                name: 'getHazmatFlow',
                data: {
                  hazmatId: hazmatId
                }
              }).then(res=>{
                if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
                  t.setData({
                    dataList: cloudApi.changeKey(res.result.list)
                  })
                }
              })
          }else {
            wx.showToast({
              title: '该二维码查询不到相关信息',
              icon: 'error',
              duration: 2000
            });
          }
        })
      }else{
        cloudApi.queryPost('productList',{code: t.data.searchContent}).then(res=>{
          if(res.data.length>0){
              const productId = cloudApi.changeKey(res.data[0]).id
              wx.cloud.callFunction({
                name: 'getProductFlow',
                data: {
                  productId: productId
                }
              }).then(res=>{
                if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
                  t.setData({
                    dataList: cloudApi.changeKey(res.result.list)
                  })
                }
              })
          }else {
            wx.showToast({
              title: '该二维码查询不到相关信息',
              icon: 'error',
              duration: 2000
            });
          }
        })
      }
      // api请求
      // api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => {
      //   if(re.code == 200) {
      //     t.setData({
      //       dataList: re.data ? re.data : []
      //     });
      //   } else {
      //     wx.showToast({
      //       title: re.message,
      //       icon: 'none'
      //     });
      //   }
      // });
      api.getHazmatFlowByCode({code: t.data.searchContent}).then(re => {
        if(re.code == 200) {
          t.setData({
            dataList: re.data ? re.data : []
          });
        } else {
          wx.showToast({
            title: re.message,
            icon: 'none'
          });
        }
      });
    }
  },
pages/tabBar/current/current.wxml
@@ -50,8 +50,8 @@
            {{item.updateTime}}
          </view>
          <view wx:if="{{item.user}}">
            <text>{{item.user.department?item.user.department.name:''}}部门的</text>
            <text style="font-weight: bold;margin-right: 6rpx;">{{item.user.name}}</text>
            <text wx:if="{{item.user.department}}">{{item.user.department?item.user.department.name:''}} 的 </text>
            <text style="font-weight: bold;margin-right: 6rpx;color:#2979ff">{{item.user.name}}</text>
              进行了
            <span style="margin-left: 6rpx;" class="{{item.num>=0?'green':'red'}}">
              {{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':item.state==6?'零头入库':'--'}}
pages/tabBar/firstPage/firstPage.js
@@ -56,29 +56,29 @@
  getUserInfo() {
    // 云开发
    const companyId = wx.getStorageSync('user').companyId
    cloudApi.queryPost('userInfoList',{company_id: companyId}).then(res=>{
      if(res.data.length>0){
        this.setData({
          user: cloudApi.changeKey(res.data)[0]
        });
        wx.setStorageSync('userSet', cloudApi.changeKey(res.data)[0])
      }
    })
    // api
    // api.getUserInfo().then(res => {
    //   if(res.code == 200) {
    // const companyId = wx.getStorageSync('user').companyId
    // cloudApi.queryPost('userInfoList',{company_id: companyId}).then(res=>{
    //   if(res.data.length>0){
    //     this.setData({
    //       user: res.data
    //       user: cloudApi.changeKey(res.data)[0]
    //     });
    //     wx.setStorageSync('userSet', res.data);
    //   } else {
    //     wx.showToast({
    //       title: res.message,
    //       icon: 'none'
    //     });
    //     wx.setStorageSync('userSet', cloudApi.changeKey(res.data)[0])
    //   }
    // });
    // })
    // api
    api.getUserInfo().then(res => {
      if(res.code == 200) {
        this.setData({
          user: res.data
        });
        wx.setStorageSync('userSet', res.data);
      } else {
        wx.showToast({
          title: res.message,
          icon: 'none'
        });
      }
    });
  },
  closeModal(){
    this.setData({
@@ -109,87 +109,89 @@
          }
          if(t.data.tabNum == 1) {
            // 云开发请求
            wx.cloud.callFunction({
              name: 'getHazmatInfo',
              data: {
                code: res.result
              }
            }).then(res=>{
              if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
                t.setData({
                  hazmat: cloudApi.changeKey(res.result.list[0]),
                  showModal: true
                })
              }else{
                wx.showToast({
                  title: '无条码信息',
                  icon: 'error',
                  duration: 2000
                });
              }
            })
            // api请求
            // api.getHazmatByCode({code: res.result}).then((re) => {
            //   if(re.code == 200) {
            // wx.cloud.callFunction({
            //   name: 'getHazmatInfo',
            //   data: {
            //     code: 'SJ08202502250003'
            //   }
            // }).then(res=>{
            //   if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
            //     t.setData({
            //       hazmat: re.data,
            //       hazmat: cloudApi.changeKey(res.result.list[0]),
            //       showModal: true
            //     });
            //   } else {
            //     })
            //   }else{
            //     wx.showToast({
            //       title: re.message,
            //       title: '无条码信息',
            //       icon: 'error',
            //       duration: 2000
            //     });
            //   }
            // }).catch(err => {
            //   wx.showToast({
            //     title: err,
            //     duration: 2000
            //   });
            // });
            // })
            // api请求
            api.getHazmatByCode({code: res.result}).then((re) => {
              if(re.code == 200) {
                t.setData({
                  hazmat: re.data,
                  showModal: true
                });
              } else {
                wx.showToast({
                  title: re.message,
                  icon: 'error',
                  duration: 2000
                });
              }
            }).catch(err => {
              wx.showToast({
                title: err,
                duration: 2000
              });
            });
          } else {
            // 云开发请求
            wx.cloud.callFunction({
              name: 'getProductInfo',
              data: {
                code: res.result
              }
            }).then(res=>{
              if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
                t.setData({
                  product: cloudApi.changeKey(res.result.list[0]),
                  showModal: true
                })
              }else{
                wx.showToast({
                  title: '无条码信息',
                  icon: 'error',
                  duration: 2000
                });
              }
            })
            // api请求
            // api.getProductByCode({code: res.result}).then((re) => {
            //   if(re.code == 200) {
            // wx.cloud.callFunction({
            //   name: 'getProductInfo',
            //   data: {
            //     code: res.result
            //   }
            // }).then(res=>{
            //   if(res.result && Array.isArray(res.result.list) && res.result.list.length>0){
            //     t.setData({
            //       product: re.data,
            //       product: cloudApi.changeKey(res.result.list[0]),
            //       showModal: true
            //     });
            //   } else {
            //     })
            //   }else{
            //     wx.showToast({
            //       title: re.message,
            //       title: '无条码信息',
            //       icon: 'error',
            //       duration: 2000
            //     });
            //   }
            // }).catch(err => {
            //   wx.showToast({
            //     title: err,
            //     duration: 2000
            //   });
            // });
            // })
            // api请求
            api.getProductByCode({code: res.result}).then((re) => {
              if(re.code == 200) {
                t.setData({
                  product: re.data,
                  showModal: true
                });
              } else {
                wx.showToast({
                  title: re.message,
                  icon: 'error',
                  duration: 2000
                });
              }
            }).catch(err => {
              wx.showToast({
                title: err,
                duration: 2000
              });
            });
          }
        } else {
          wx.showToast({
            title: '该二维码已失效或不包含条码信息',
@@ -199,10 +201,39 @@
        }
      }
    });
  },
  confirmTake1() {
    const t = this;
    // 云服务请求
    // wx.cloud.callFunction({
    //   name: 'hazmatUsing',
    //   data: {
    //     warehouseId: t.data.hazmat.warehouseId,
    //     basicId: t.data.hazmat.basicId,
    //     companyId: t.data.hazmat.companyId,
    //     cupboardId: t.data.hazmat.cupboardId,
    //     hazmatId: t.data.hazmat.id,
    //     uid: wx.getStorageSync('user').id,
    //     id: t.data.hazmat.Id,
    //     remaining: t.data.hazmat.remaining,
    //     status: 0
    //   }
    // }).then(res=>{
    //   if(res.result.code == 200){
    //       wx.showToast({
    //         title: '取用成功',
    //         icon: 'success',
    //         duration: 2000
    //       });
    //   }
    // })
    // api请求
    api.postHazmatUse(t.data.hazmat.id, 0).then((r) => {
      wx.showToast({
        title: r.message,
@@ -219,6 +250,32 @@
  confirmTake2() {
    const t = this;
    // 云服务请求
    // wx.cloud.callFunction({
    //   name: 'hazmatUsing',
    //   data: {
    //     warehouseId: t.data.hazmat.warehouseId,
    //     basicId: t.data.hazmat.basicId,
    //     companyId: t.data.hazmat.companyId,
    //     cupboardId: t.data.hazmat.cupboardId,
    //     hazmatId: t.data.hazmat.id,
    //     uid: wx.getStorageSync('user').id,
    //     id: t.data.hazmat.Id,
    //     remaining: t.data.hazmat.remaining,
    //     status: 1
    //   }
    // }).then(res=>{
    //   if(res.result.code == 200){
    //       wx.showToast({
    //         title: '取用成功',
    //         icon: 'success',
    //         duration: 2000
    //       });
    //   }
    // })
    // api请求
    api.postHazmatUse(t.data.hazmat.id, 1).then((r) => {
      wx.showToast({
        title: r.message,
pages/tabBar/firstPage/firstPage.wxss
@@ -164,7 +164,7 @@
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  z-index: 99999;
}
.modal-container {
project.config.json
@@ -19,7 +19,7 @@
    }
  },
  "compileType": "miniprogram",
  "libVersion": "3.8.1",
  "libVersion": "3.8.9",
  "appid": "wx8143ce5b2f2b1ecc",
  "projectname": "危化品管理",
  "condition": {},
utils/http.js
@@ -1,6 +1,6 @@
// utils/http.js
const BASE_URL = 'http://192.168.2.58:8083'; // 替换为你的API基础地址
const BASE_URL = 'https://reagent.sinanoaq.cn';
// const BASE_URL = 'http://47.108.222.15:8001';
// 全局配置
const config = {
  showToast: true,       // 默认显示Toast提示
@@ -76,7 +76,9 @@
 * 清除缓存并跳转到首页
 */
function clearStorageAndRedirect() {
  wx.clearStorageSync();
  if(!wx.getStorageSync('isSave') || wx.getStorageSync('isSave') == false){
    wx.clearStorageSync();
  }
  setTimeout(() => {
    wx.reLaunch({
      url: '/pages/index/index' // 替换为你的登录页路径