tanghaolin
2022-09-07 f6ed109d2075ec9dd2a15d606be0a43129d080c9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
  <div class="loginBox">
    <van-nav-bar>
      <template #left>
        <van-icon @click="pageBack" name="arrow-left" size="18" />
      </template>
      <template #title>
        <label>{{$t('simpleLoginPage.forgetPassword.TR')}}</label>
      </template>
    </van-nav-bar>
    <div class="login_main">
      <van-form colon validate-trigger="onSubmit" :show-error="true">
        <van-field
          required
          v-model="fromData.TelPhoneNumber"
          name="telphone"
          :label="$t('header.telPhoneNumber.TR')"
          :placeholder="$t('simpleLoginPage.formValidate.TelPhone0.TR')"
          :rules="[{validator:isNull,message:$t('simpleLoginPage.formValidate.TelPhone1.TR')}]"
          autocomplete
        />
       <van-field :disabled="isDisableUserType" name="userType" :label="$t('simpleLoginPage.userType.TR')">
          <template #input>
            <van-switch
              :disabled="isDisableUserType"
              v-model="fromData.userType"
              active-value="#3b3b3b"
              size="20"
            ></van-switch>
            <span
              style="margin-left:5px;"
              :style="fromData.userType?'color:#3b3b3b':''"
            >{{fromData.userType?$t('simpleLoginPage.userType0.TR'):$t('simpleLoginPage.userType1.TR')}}</span>
          </template>
        </van-field>
        <div style="margin: 16px;">
          <van-button
            class="loginBtn"
            round
            block
            type="info"
            @click="onSubmit"
            native-type="submit"
          >{{$t('header.define.TR')}}</van-button>
        </div>
      </van-form>
    </div>
  </div>
</template>
 
<script>
import constParas from "@/utils/constParas";
import languageMixin from "@/mixin/language";
export default {
  mixins: [languageMixin],
  data() {
    return {
      m_Title: "",
      isDisableUserType:false,
      fromData: {
        userType:false,
        TelPhoneNumber:""
      },
    };
  },
  mounted() {
    this.m_Title =  this.getSoftName();;
    document.title  = this.m_Title
    this.isDisableUserType = window.pageConfig.LoginPage.isClickUserType;
    this.fromData.userType = window.pageConfig.LoginPage.isOnlyEmplyeeLogin;
  },
  methods: {
    //提交表单验证成功时触发
    onSubmit(values) {
      let _this = this;
      if (this.fromData.TelPhoneNumber == "") {
        return;
      }
      // console.log("submit", values)
      let Toast = _this.$toast;
      //console.log(this.$refs[formName],237)
      let url = this.$globalConfig.WebApiUrl.MainUrl + "v1/UserInfo/SendPwdToMsg";
      let data = {
        UserType: this.fromData.userType
          ? constParas.UserType.Employee
          : constParas.UserType.OuterUser,
        Telphone:this.fromData.TelPhoneNumber
      };
      // console.log(data,11)
      this.$axios({
        url: url,
        method: "post",
        params: data, //get 用params,post 用 data
        headers: { "Content-Type": "application/json" }
      })
        .then(function(res) {
           console.log(res);
          let resdata = res.data;
          if (resdata.Code != 0) {
            Toast(resdata.Message);
            return;
          }
          Toast.success(`${_this.$t('simpleLoginPage.sendSuccess.TR')}`);
        })
        .catch(msg => {
          // console.log(msg);
          // _this.$notify.error({
          //   title: "登录提示",
          //   duration: 1500,
          //   message: msg,
          // });
        });
    },
    isNull(str) {
      if (str == "") return false;
      return true;
    },
    //返回上一页
    pageBack() {
      this.$router.go(-1);
    }
  }
};
</script>
 
<style lang="scss">
</style>