Mr.Shi
2023-08-29 d8d184a00d3581b3a77aa26864a153f0515524e0
minipro_standard/pages/login/login.vue
@@ -11,7 +11,7 @@
      </view>
      <view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height">
         <image src="@/static/login_ic_phone@2x.png" mode="" class="img40 mr25"></image>
         <u--input placeholder="手机号" border="none" v-model="loginForm.account"></u--input>
         <u--input placeholder="手机号" border="none" v-model="loginForm.username"></u--input>
      </view>
      <view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height">
         <image src="@/static/login_ic_password@2x.png" mode="" class="img40 mr25"></image>
@@ -22,21 +22,37 @@
</template>
<script>
   import { wxAccountLogin, getUserInfo } from '@/util/api/index.js'
   export default {
      data() {
         return {
            loginForm: {
               companyId: '',
               account: '',
               username: '',
               password: ''
            }
         };
      },
      methods: {
         loginAction() {
            uni.reLaunch({
               url: '/pages/workbench/workbench'
         async loginAction() {
            if (!this.loginForm.companyId) return uni.showToast({ title: '企业代码不能为空', icon:"error", duration: 2000 });
            if (!this.loginForm.username) return uni.showToast({ title: '手机号不能为空', icon:"error", duration: 2000 });
            if (!this.loginForm.password) return uni.showToast({ title: '密码不能为空', icon:"error", duration: 2000 });
            let res = await wxAccountLogin({
               companyId: this.loginForm.companyId,
               username: this.loginForm.username,
               password: this.loginForm.password
            })
            if (res.code === 200) {
               let user = await getUserInfo({})
               if (user.code === 200) {
                  await this.$store.commit('SETUSERINFO', user.data)
                  await this.$store.dispatch('getMenuList', 2)
                  uni.reLaunch({
                     url: '/pages/workbench/workbench'
                  })
               }
            }
         }
      }
   }
@@ -56,7 +72,6 @@
         height: 100%;
      }
      .login-log {
         // margin-top: ;
         margin: 356rpx auto 0 auto ;
         left: 0;
         right: 0;
@@ -75,7 +90,7 @@
      }
   }
   .input-height {
      height: 100rpx;
      height: 100rpx;
   }
   .com-input {
      margin-top: -60px;