|
@@ -18,16 +18,25 @@
|
|
|
</van-cell-group>
|
|
|
</template>
|
|
|
<template v-if="type == 'password'">
|
|
|
- <van-form input-align="right" @submit="onSubmit">
|
|
|
+ <van-form
|
|
|
+ input-align="right"
|
|
|
+ error-message-align="right"
|
|
|
+ @submit="onSubmit"
|
|
|
+ >
|
|
|
<van-cell-group>
|
|
|
<van-field
|
|
|
v-model="dataForm.password"
|
|
|
+ :type="showType"
|
|
|
label="原密码"
|
|
|
required
|
|
|
- placeholder="请输入原密码"
|
|
|
- clearable
|
|
|
- :rules="[{ required: true, message: '请输入原密码' }]"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template #right-icon v-if="dataForm.password">
|
|
|
+ <van-icon
|
|
|
+ :name="require('@/assets/view.svg')"
|
|
|
+ @click="showPwd"
|
|
|
+ ></van-icon>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
<van-field
|
|
|
v-model="dataForm.newpassword"
|
|
|
type="password"
|
|
@@ -36,7 +45,8 @@
|
|
|
placeholder="请输入新密码"
|
|
|
clearable
|
|
|
:rules="[{ required: true, message: '请输入新密码' }]"
|
|
|
- />
|
|
|
+ >
|
|
|
+ </van-field>
|
|
|
<van-field
|
|
|
v-model="dataForm.confirmpassword"
|
|
|
type="password"
|
|
@@ -47,6 +57,22 @@
|
|
|
:rules="[{ required: true, message: '请再次输入新密码' }]"
|
|
|
@blur="handleBlur"
|
|
|
/>
|
|
|
+ <van-row align="center" class="msg_tip" style="margin-top: 16px">
|
|
|
+ <van-icon name="checked"></van-icon>
|
|
|
+ <van-col>密码由8~16位数字、字母或符号组成</van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row align="center" class="msg_tip">
|
|
|
+ <van-icon name="checked"></van-icon>
|
|
|
+ <van-col>至少含两种以上字符</van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row align="center" class="msg_tip">
|
|
|
+ <van-icon name="warning"></van-icon>
|
|
|
+ <van-col>不能包含连续字符</van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row align="center" class="msg_tip">
|
|
|
+ <van-icon name="warning"></van-icon>
|
|
|
+ <van-col>两次输入的密码不一致</van-col>
|
|
|
+ </van-row>
|
|
|
</van-cell-group>
|
|
|
|
|
|
<van-submit-bar class="save_btn">
|
|
@@ -80,33 +106,37 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
type: "",
|
|
|
title: "",
|
|
|
loading: false,
|
|
|
+ showType: "password",
|
|
|
dataForm: {
|
|
|
username: "",
|
|
|
tel: "",
|
|
|
- password: "",
|
|
|
+ password: "123456",
|
|
|
newpassword: "",
|
|
|
confirmpassword: "",
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({ userInfo: "getUserInfo" }),
|
|
|
+ },
|
|
|
created() {
|
|
|
+ console.log(this.userInfo);
|
|
|
+ this.typeOfNum("ling1234.,/?。,");
|
|
|
this.type = this.$route.query.type;
|
|
|
this.title =
|
|
|
(this.type && (this.type == "account" ? "账号中心" : "更改密码")) || "";
|
|
|
- this.dataForm.username = this.$store.state.username;
|
|
|
- this.dataForm.tel = this.$store.state.userMobile;
|
|
|
- this.dataForm.password = this.plusXing(
|
|
|
- this.$store.state.password,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- "*"
|
|
|
- );
|
|
|
+ this.dataForm.username = this.userInfo.userName;
|
|
|
+ this.dataForm.tel = this.userInfo.mobile;
|
|
|
+ this.dataForm.password = this.userInfo.passWord
|
|
|
+ ? this.plusXing(this.userInfo.passWord, 0, 0, "*")
|
|
|
+ : "";
|
|
|
},
|
|
|
methods: {
|
|
|
/* 部分隐藏处理
|
|
@@ -125,8 +155,35 @@ export default {
|
|
|
str.substring(0, frontLen) + xing + str.substring(str.length - endLen)
|
|
|
);
|
|
|
},
|
|
|
+ showPwd() {
|
|
|
+ this.showType = "text";
|
|
|
+ this.dataForm.password = this.userInfo.passWord;
|
|
|
+ console.log(this.dataForm.password);
|
|
|
+ },
|
|
|
//修改后的密码和原来不能相同
|
|
|
handleBlur() {},
|
|
|
+ typeOfNum(val) {
|
|
|
+ let chsCount = 0;
|
|
|
+ let engCount = 0;
|
|
|
+ let numCount = 0;
|
|
|
+ let otherCount = 0;
|
|
|
+ for (let i = 0; i < val.length; i++) {
|
|
|
+ let num = val.charCodeAt(i); //转unicode码比较
|
|
|
+ if (num >= 19968 && num <= 40869) {
|
|
|
+ //汉字
|
|
|
+ chsCount++;
|
|
|
+ } else if ((num >= 65 && num <= 90) || (num >= 97 && num <= 122)) {
|
|
|
+ //字母
|
|
|
+ engCount++;
|
|
|
+ } else if (num >= 48 && num <= 57) {
|
|
|
+ //数字
|
|
|
+ numCount++;
|
|
|
+ } else {
|
|
|
+ otherCount++; //其他字符
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(chsCount, engCount, numCount, otherCount);
|
|
|
+ },
|
|
|
onSubmit() {
|
|
|
this.loading = true;
|
|
|
setTimeout(() => {
|
|
@@ -148,5 +205,18 @@ export default {
|
|
|
.info_user {
|
|
|
margin: 12px 0 40px 0;
|
|
|
}
|
|
|
+ .msg_tip {
|
|
|
+ padding: 0 16px;
|
|
|
+ .van-icon {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
+ .van-col {
|
|
|
+ color: #999999;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 24px;
|
|
|
+ text-indent: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|