Mr.Zhang
2023-09-01 a52f13d719ee9cd53f129f4c59dcad783977fce9
minipro_standard/pages/login/login.vue
@@ -7,26 +7,53 @@
      </view>
      <view class="bg_w rd8 ptb30 pl40 bbox com-input flex input-height">
         <image src="@/static/login_ic_code@2x.png" mode="" class="img40 mr25"></image>
         <u--input placeholder="企业代码" border="none"></u--input>
         <u--input placeholder="企业代码" border="none" v-model="loginForm.companyId"></u--input>
      </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"></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>
         <u--input placeholder="密码" border="none"></u--input>
         <u--input placeholder="密码" border="none" v-model="loginForm.password"></u--input>
      </view>
      <view class="login-btn mt80">立即登录</view>
      <view class="login-btn mt80" @click="loginAction">立即登录</view>
   </view>
</template>
<script>
   import { wxAccountLogin, getUserInfo } from '@/util/api/index.js'
   export default {
      data() {
         return {
            bgImg: require('@/static/login_bg@2x.png')
            loginForm: {
               companyId: '',
               username: '',
               password: ''
            }
         };
      },
      methods: {
         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'
                  })
               }
            }
         }
      }
   }
</script>
@@ -45,7 +72,6 @@
         height: 100%;
      }
      .login-log {
         // margin-top: ;
         margin: 356rpx auto 0 auto ;
         left: 0;
         right: 0;
@@ -64,7 +90,7 @@
      }
   }
   .input-height {
      height: 100rpx;
      height: 100rpx;
   }
   .com-input {
      margin-top: -60px;