wankeda
2025-04-25 b3afd18d58cc94bb94b8a91030d1b2fa89f637e6
´úÂë¹ÜÀí/NEWCode/WIDESEAWCS_PDA/pages/login/login.vue
@@ -1,8 +1,12 @@
<template>
   <view class="login">
      <view class="tools">
         <uni-icons  size="48rpx" color="#292C39" @click="doScan"></uni-icons>
         <uni-icons type="gear-filled" size="48rpx" color="#292C39" @click="goSetAddress"></uni-icons>
      </view>
      <view class="login-main">
         <text class="login-main-title">欢迎登录</text>
         <view class="login-main-subtitle">耀能新能源PDA程序</view>
         <view class="login-main-subtitle">赣锋新能源PDA程序</view>
         <view class="login-main-body">
            <!-- <login-input key="username" v-model="user" clearable placeholder="用户名"
               :maxlength="20"></login-input> -->
@@ -17,11 +21,11 @@
                  :maxlength="10"></uni-easyinput>
               <view class="canvas-img-code" @click="refresh()">
                  <img :src="validCodeBase64" :style="{ width: width + 'px', height: height + 'px' }"
                     class="login-validCode-img"/>
                    <!-- <img v-show="validCodeBase64 != ''" :src="validCodeBase64" :style="{ width: width + 'px', height: height + 'px' }"/> -->
                     class="login-validCode-img" />
                  <!-- <img v-show="validCodeBase64 != ''" :src="validCodeBase64" :style="{ width: width + 'px', height: height + 'px' }"/> -->
               </view>
            </view>
            <u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
               @click="login">
               ç™»å½•
@@ -48,13 +52,17 @@
            SYS_DEFAULT_CAPTCHA_OPEN: true,
            validCodeBase64: '',
            validCodeReqNo: '',
            code:'1234'
            code: '1234'
         }
      },
      onLoad(options) {
         this.configSysBaseList()
      },
      methods: {
         //跳转到SetAddress页面
         goSetAddress() {
            this.$u.route('/pages/SetAddress/SetAddress');
         },
         configSysBaseList() {
            // this.$u.get('/api/User/getVierificationCode', null).then(res => {
            //    if (res.code == 200) {
@@ -67,19 +75,19 @@
            //             }
            //          }
            //       })
                  //如果验证码开关是开就加载验证码
                  if (this.SYS_DEFAULT_CAPTCHA_OPEN) {
                     this.loginCaptcha()
                  }
               // }
             // })
            //如果验证码开关是开就加载验证码
            if (this.SYS_DEFAULT_CAPTCHA_OPEN) {
               this.loginCaptcha()
            }
            // }
            // })
         },
         loginCaptcha() {
            this.$u.get('/api/User/getVierificationCode', null).then(res => {
               this.validCodeBase64 =  "data:image/png;base64," + res.img;
               this.validCodeBase64 = "data:image/png;base64," + res.img;
               this.validCodeReqNo = res.uuid
            })
         },
         refresh() {
@@ -104,12 +112,12 @@
               //    UserName: this.user,
               //    VerificationCode: this.SYS_DEFAULT_CAPTCHA_OPEN ? this.code : null
               // }
               this.$u.post('/api/User/login',
               {UUID: this.validCodeReqNo,
               passWord: this.pass,
               userName: this.user,
               verificationCode: this.code}
               ).then(res => {
               this.$u.post('/api/User/login', {
                  UUID: this.validCodeReqNo,
                  passWord: this.pass,
                  userName: this.user,
                  verificationCode: this.code
               }).then(res => {
                  console.log(res)
                  this.$t.message.toast("登录成功")
                  this.$t.message.closeLoading()
@@ -136,6 +144,14 @@
</script>
<style lang="scss" scoped>
   .tools {
      display: flex;
      justify-content: space-between;
      margin-bottom: 32rpx;
      box-sizing: border-box;
      padding: 0 12rpx;
   }
   .login {
      // font-family: PingFangSC-Regular, PingFang SC;
      // background-color: $color-white;