From ad5c4cc086a40708e66040574ff1d465b66304b6 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期四, 07 八月 2025 10:36:25 +0800
Subject: [PATCH] 新增

---
 pages/tabBar/count/count.wxss         |    2 
 pages/tabBar/firstPage/firstPage.wxss |    2 
 pages/index/index.wxml                |    6 
 pages/index/index.wxss                |    8 
 pages/tabBar/current/current.js       |   74 ----
 pages/tabBar/count/productDetail.js   |   76 ++--
 pages/tabBar/count/countDetail.js     |   77 +++--
 pages/tabBar/count/count.js           |  139 +++++-----
 pages/tabBar/firstPage/firstPage.js   |  225 ++++++++++------
 pages/index/index.js                  |  123 +++-----
 pages/tabBar/current/current.wxml     |    4 
 project.config.json                   |    2 
 utils/http.js                         |    8 
 13 files changed, 368 insertions(+), 378 deletions(-)

diff --git a/pages/index/index.js b/pages/index/index.js
index 43e57a6..8f55672 100644
--- a/pages/index/index.js
+++ b/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(){
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index cde7c5b..1ce2a24 100644
--- a/pages/index/index.wxml
+++ b/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>
\ No newline at end of file
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 6c9c120..adb8a49 100644
--- a/pages/index/index.wxss
+++ b/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;
diff --git a/pages/tabBar/count/count.js b/pages/tabBar/count/count.js
index 4281629..f9f6803 100644
--- a/pages/tabBar/count/count.js
+++ b/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();
   },
diff --git a/pages/tabBar/count/count.wxss b/pages/tabBar/count/count.wxss
index 248386b..564f03c 100644
--- a/pages/tabBar/count/count.wxss
+++ b/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 {
diff --git a/pages/tabBar/count/countDetail.js b/pages/tabBar/count/countDetail.js
index a673611..f7f4291 100644
--- a/pages/tabBar/count/countDetail.js
+++ b/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) {
diff --git a/pages/tabBar/count/productDetail.js b/pages/tabBar/count/productDetail.js
index 0750f2b..0f474c9 100644
--- a/pages/tabBar/count/productDetail.js
+++ b/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) {
diff --git a/pages/tabBar/current/current.js b/pages/tabBar/current/current.js
index aa1a8ab..07d43cc 100644
--- a/pages/tabBar/current/current.js
+++ b/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'
+          });
+        }
+      });
     }
   },
 
diff --git a/pages/tabBar/current/current.wxml b/pages/tabBar/current/current.wxml
index 612d5f4..90946ed 100644
--- a/pages/tabBar/current/current.wxml
+++ b/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?'零头入库':'--'}}
diff --git a/pages/tabBar/firstPage/firstPage.js b/pages/tabBar/firstPage/firstPage.js
index 995d3e1..abe9538 100644
--- a/pages/tabBar/firstPage/firstPage.js
+++ b/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,
diff --git a/pages/tabBar/firstPage/firstPage.wxss b/pages/tabBar/firstPage/firstPage.wxss
index c13e771..0ee6324 100644
--- a/pages/tabBar/firstPage/firstPage.wxss
+++ b/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 {
diff --git a/project.config.json b/project.config.json
index 9f69a82..c0e095c 100644
--- a/project.config.json
+++ b/project.config.json
@@ -19,7 +19,7 @@
     }
   },
   "compileType": "miniprogram",
-  "libVersion": "3.8.1",
+  "libVersion": "3.8.9",
   "appid": "wx8143ce5b2f2b1ecc",
   "projectname": "危化品管理",
   "condition": {},
diff --git a/utils/http.js b/utils/http.js
index 08c620f..248b1a2 100644
--- a/utils/http.js
+++ b/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' // 替换为你的登录页路径

--
Gitblit v1.9.2