付延余
2022-08-23 e333d366495e2406618c5b0daf3fe53a759903a6
pages/login/login.vue
@@ -4,11 +4,11 @@
      <view class="inputBox">
         <view class="phone">
            <image src="@/static/login/phone.png" mode="加载错误"></image>
            <input type="text" placeholder="请输入手机号" v-model="formData.username" />
            <input type="text" placeholder="请输入用户名/手机号" v-model="formData.username" />
         </view>
         <view class="password">
            <image src="@/static/login/lock.png" mode="加载错误" />
            <input type="password" placeholder="请输入密码" v-model="formData.password" />
            <input type="password" placeholder="请输入账号密码" v-model="formData.password" />
         </view>
         <view class="loginBtn"><button type="default" @click="loginSubmit">登录</button></view>
      </view>
@@ -22,14 +22,22 @@
   data() {
      return {
         formData:{
            username:'fyy',
            password:'123456!@#'
            username:'',
            password:''
         }
      };
   },
  onShow(){
     // 清除缓存
    if(uni.getStorageSync('userInfo')||uni.getStorageSync('access_token')||uni.getStorageSync('refresh_token')){
      this.$u.toast('成功进入登录页');
      uni.clearStorageSync();
    }
  },
   methods:{
      loginSubmit(){
         // console.log('login');
      console.log('点击登录');
      // console.log('login');
         uni.showLoading({
            title:'登录中...'
         });
@@ -46,14 +54,22 @@
               setTokenType(token_type);
               setRefreshToken(refresh_token);
               setScope(scope);
               this.$store.dispatch('menus')
               redirectHome();
               uni.hideLoading();
            } catch (e) {
               // error
               console.log(e);
            }
         } else{
            uni.showToast({
               title:response.data.msg,
               icon:'error',
               duration:2000
            })
         }
      }
   }
};
</script>
@@ -96,7 +112,7 @@
      }
      .loginBtn {
         margin-top: vww(80);
         button {
            background-color: #007aff;
            color: #ffffff;