#
whycq
2024-03-14 75c7b41bf31e39e33dcf3a2bb06db704b8890ef8
pages/LoginDemo/LoginDemo.vue
@@ -19,9 +19,6 @@
               <switch :checked='remberPassword' color="#FFCC33" style="zoom:.5" @change="remberChange" />
            </view>
         </view>
         <!-- <view class="button" @click="login" :loading="load.loading">
            {{load.btnText}}
         </view> -->
         <button class="button" @click="login()" :loading="load.loading">{{load.btnText}}</button>
      </view>
      <!-- 设置弹窗区域 -->
@@ -74,20 +71,15 @@
            version: '',
            remberPassword: true,
            user: {
               username: '1',
               password: '2'
               username: '',
               password: ''
            },
            network: [{
                  name: 'wms',
                  ip: '192.168.1.1',
                  port: '8080',
                  address: 'pswms'
               },
            network: [
               {
                  name: 'wcs',
                  ip: '192.168.1.1',
                  ip: '10.10.10.200',
                  port: '9090',
                  address: 'pswcs'
                  address: 'jmwcs'
               }
            ],
            load: {
@@ -121,7 +113,8 @@
      },
      methods: {
         remberChange() {
            this.remberPassword = !this.remberPassword
         },
         settings() {
            if (uni.getStorageSync('Network')) {
@@ -137,6 +130,10 @@
            this.$refs.settings.close()
         },
         async login() {
            // uni.reLaunch({
            //    url: `/pages/project/jmAGV/home`,
            // });
            // return
            if (!uni.getStorageSync('Network')) {
               uni.showToast({ icon: 'error', title: '请配置网络信息' }) 
               return
@@ -153,6 +150,7 @@
            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({
@@ -160,9 +158,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);
               }, 700)
            } else if (res.code === 0) {
               this.load.loading = false;