#
whycq
2024-03-18 f2232657e8109b0ed4f76b3913e0d4b9713e2af6
pages/LoginDemo/LoginDemo.vue
@@ -30,11 +30,11 @@
               <view class="scroll-item" v-for="net in network">
                  <view class="item-title" style="">{{net.name}}</view>
                  <view style="display: flex;align-items: center;">
                     <input class="settings-input1" type="text" v-model="net.ip">
                     <input class="settings-input1" type="text" v-model="net.ip" placeholder="请输入ip">
                     <text style="font-weight: 900;">:</text>
                     <input class="settings-input2" type="text" v-model="net.port">
                     <input class="settings-input2" type="text" v-model="net.port" placeholder="请输入端口">
                     <text style="font-weight: 900;">/</text>
                     <input class="settings-input3" type="text" v-model="net.address">
                     <input class="settings-input3" type="text" v-model="net.address" placeholder="请输入地址">
                  </view>
               </view>
            </scroll-view>
@@ -74,14 +74,7 @@
               username: '',
               password: ''
            },
            network: [
               {
                  name: 'wcs',
                  ip: '10.10.10.200',
                  port: '9090',
                  address: 'jmwcs'
               }
            ],
            network: [{}],
            load: {
               loading: false,
               btnText: '登录'
@@ -130,10 +123,10 @@
            this.$refs.settings.close()
         },
         async login() {
            uni.reLaunch({
               url: `/pages/project/jmAGV/home`,
            });
            return
            // uni.reLaunch({
            //    url: `/pages/project/jmAGV/home`,
            // });
            // return
            if (!uni.getStorageSync('Network')) {
               uni.showToast({ icon: 'error', title: '请配置网络信息' }) 
               return
@@ -148,7 +141,9 @@
            }
            this.load.loading = true;
            this.load.btnText = '登录中';
            uni.setStorageSync('user', this.user);
            let res = await common.onLogin(this.user)
            console.log(res);
            if (res.code === 200) {
               setTimeout(() => {
                  uni.showToast({
@@ -156,13 +151,13 @@
                  })
                  setTimeout(() => {
                     uni.reLaunch({
                        url: `/pages/home/home`,
                        url: `/pages/project/jmAGV/home`,
                     });
                  }, 300)
                  if (!this.remberPassword) {
                     this.user.password = ''
                  }
                  uni.setStorageSync('user', this.user);
                  // uni.setStorageSync('user', this.user);
               }, 700)
            } else if (res.code === 0) {
               this.load.loading = false;