#
whycq
2022-12-17 d4d79adc60cc7e8871c09ced48fc3334fb97a5ed
pages/login/login.vue
@@ -44,7 +44,8 @@
            load: {
               loading: false,
               btnText: '登录'
            }
            },
            baseUrl: 'http://192.168.4.188:9528'
         }
      },
      onLoad:function(){
@@ -65,7 +66,7 @@
         onLogin() {
            let that = this
            uni.request({
               url: 'http://localhost:9528/login.action',
               url: that.baseUrl + '/login.action',
               fail(result) {
                  uni.showToast({title: '请求失败'})
               },
@@ -77,13 +78,17 @@
                  "content-type": "application/json"
               },
               success(result) {
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
                  }
                  let res = result.data
                  if (res.code === 200 ){
                     that.load.loading = true;
                     that.load.btnText = '登录中';
                     uni.setStorageSync('token', res.data.token);
                     uni.setStorageSync('userName', that.user.userName);
                     uni.setStorageSync('baseUrl','http://localhost:9528')
                     uni.setStorageSync('baseUrl',that.baseUrl)
                     setTimeout(()=> {
                        uni.showToast({title: '登录成功'})
                        setTimeout(()=> {