jiangping
2024-09-02 843d0abd014ec20424844546fc57a9f976f366ba
pda/pages/index/login.vue
@@ -3,7 +3,7 @@
    <image class="login_bg" src="@/static/login_bg@2x.png" />
    <image class="login_logo" src="@/static/logo@2x.png" mode="widthFix" />
    <view class="login_title" style="marginTop: 40rpx;">安泰物流智慧园区</view>
    <view class="login_title" style="marginBottom: 80rpx;">物流车管理系统</view>
    <view class="login_title" style="marginBottom: 60rpx;">数字化月台调度平台</view>
    <view class="login_list">
      <view class="login_list_item">
        <image src="@/static/login_ic_phone@2x.png" mode="widthFix" />
@@ -42,8 +42,8 @@
  data() {
    return {
      form: {
        account: '',
        password: '',
        username: '13996529050',
        password: '123456',
      },
      isShowProtocol: false,
      ProtocolFlag: false,
@@ -53,13 +53,40 @@
  },
  onLoad() {
    // this.initCaptcha()
    this.initCaptcha()
  },
  methods: {
    ...mapMutations(["setToken", "setUserInfo"]),
    changeFalg() {
      this.ProtocolFlag = !this.ProtocolFlag
    },
      onLogin() {
        const { form, ProtocolFlag } = this
        if (!form.username) return uni.showToast({
          title: '账号不能为空',
          icon: 'none'
        })
        if (!form.password) return uni.showToast({
          title: '密码不能为空',
          icon: 'none'
        })
        loginPost({
          ...form,
            code: 1,
          uuid: this.captcha.uuid,
          openId: this.$store.state.openId
        }).then(res => {
          if (res.code === 200) {
            this.setToken(res.data)
            getUserInfo().then(ress => {
              this.setUserInfo(ress.data)
              uni.redirectTo({
                url: "/pages/index/index"
              })
            })
          }
        })
    },
    getContent() {
      getSystemDictData({
@@ -78,41 +105,6 @@
        this.captcha = res.data
      })
    },
    onLogin() {
      const { form, ProtocolFlag } = this
      if (!ProtocolFlag) return uni.showToast({
        title: '请先阅读并同意用户协议',
        icon: 'none'
      })
      if (!form.username) return uni.showToast({
        title: '账号不能为空',
        icon: 'none'
      })
      if (!form.password) return uni.showToast({
        title: '密码不能为空',
        icon: 'none'
      })
      if (!form.code) return uni.showToast({
        title: '验证码不能为空',
        icon: 'none'
      })
      loginPost({
        ...form,
        uuid: this.captcha.uuid,
        openId: this.$store.state.openId
      }).then(res => {
        if (res.code === 200) {
          this.setToken(res.data)
          getUserInfo().then(ress => {
            this.setUserInfo(ress.data)
            uni.redirectTo({
              url: "/pages/staff/index"
            })
          })
        }
      })
    }
  }
}
</script>
@@ -120,9 +112,8 @@
<style lang="scss" scoped>
.login {
  width: 100%;
  height: 100vh;
  display: flex;
  padding-top: 160rpx;
  padding-top: 100rpx;
  box-sizing: border-box;
  align-items: center;
  flex-direction: column;