jt
2023-02-15 d8bf63634b1a59b306a487344a5904d9ec9bb5f4
pages/login/index.vue
@@ -146,8 +146,11 @@
               </label>
            </checkbox-group>
         </form>
            <button id='login' type="default" @tap="logind" class="btn_login">{{login}}</button>
         </div>
         <button id='login' type="default" @tap="logind" class="btn_login">{{login}}</button>
         <p style="float:right; margin: 10px 10px;color:#c8c7cc">
            <span>版本号:</span>
            <span>{{version}}</span>
         </p>
         <div class="" style="text-align: center;background: white;border-top: 0px solid #C0C0C0;color: #7cd0f8;position: absolute;bottom: 0;width: 100%;height: 24px;padding-top:3px;font-size: 11px;">
         </div>
      </div>
@@ -191,6 +194,7 @@
            userName:account,
            userPwd:password,
            ischecked:ischecked,
            version:"1.0.0",
         }
      },
      // computed: mapState({
@@ -252,6 +256,18 @@
            
         // },
         logind(){
            if(!this.userServer){
               uni.showModal({title:"提示",content:"未输入网站地址,请重新配置输入!",showCancel:false,confirmText:"取消"});
               return;
            }
            if(!this.userName){
               uni.showModal({title:"提示",content:"未输入用户名,请重新输入!",showCancel:false,confirmText:"取消"});
               return;
            }
            if(!this.userPwd){
               uni.showModal({title:"提示",content:"未输入密码,请重新输入!",showCancel:false,confirmText:"取消"});
               return;
            }
            //检查 "登录状态/锁屏状态" 结束
            var loginInfo = {
               server: this.userServer,
@@ -265,10 +281,19 @@
            this.$data.login="loading......";
            //登录
            this.$store.dispatch('login',loginInfo).then(success=>{
               // console.log(success);
               console.log(success);
               if (success.code == '00000') {
                  //登录成功后清空缓存数据
                  this.$store.commit("areaFunc",null);
                  this.$store.commit("classAttrList",null);
                  this.$store.commit("classGridStyleInfo",null);
                  this.$store.commit("dicValueInfo",null);
                  this.$store.commit("subClassAttrList",null);
                  this.$store.commit("subClassGridStyleInfo",null);
                  //设置全局参数:user-用户信息
                  uni.setStorageSync('server',loginInfo.server);
                  // uni.setStorageSync('account',loginInfo.uname);
                  // uni.setStorageSync('password',loginInfo.pwd);
                  // this.mutatLogin({loginid:success});
@@ -282,19 +307,23 @@
                  //    url:'../index/index?args=9999999999'
                  // });
                  this.login="开始登录";
               }else{
                  uni.showModal({title:"错误",content:success.msg,showCancel:false,confirmText:"取消"});
                  this.login="开始登录";
               }
            }).catch(ex=>{
               // console.log(ex);
               console.log(ex);
               uni.showModal({title:"错误",content:ex.errMsg,showCancel:false,confirmText:"取消"});
               this.login="开始登录";
            });
         }
      },
      onLoad() {
         plus.runtime.getProperty(plus.runtime.appid,(info)=>{
            // console.log(info);
            this.$data.version=info.version;
         });
      }
   }
</script>