|
|
|
@ -52,7 +52,8 @@
|
|
|
|
<view v-if="authType === 'smsLogin'">
|
|
|
|
<view v-if="authType === 'smsLogin'">
|
|
|
|
<view class="head-box u-m-b-60">
|
|
|
|
<view class="head-box u-m-b-60">
|
|
|
|
<view class="u-flex u-m-b-20">
|
|
|
|
<view class="u-flex u-m-b-20">
|
|
|
|
<view class="head-title-active u-m-r-40" @tap="showAuthModal('accountLogin')" style="display: none;">
|
|
|
|
<view class="head-title-active u-m-r-40" @tap="showAuthModal('accountLogin')"
|
|
|
|
|
|
|
|
style="display: none;">
|
|
|
|
账号登录
|
|
|
|
账号登录
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="head-title head-title-line head-title-animation">
|
|
|
|
<view class="head-title head-title-line head-title-animation">
|
|
|
|
@ -345,9 +346,17 @@
|
|
|
|
import FormValidate from "@/shopro/validate/form";
|
|
|
|
import FormValidate from "@/shopro/validate/form";
|
|
|
|
import schema from "@/uview-ui/libs/util/async-validator";
|
|
|
|
import schema from "@/uview-ui/libs/util/async-validator";
|
|
|
|
import wechat from "@/shopro/wechat/wechat";
|
|
|
|
import wechat from "@/shopro/wechat/wechat";
|
|
|
|
import { mapMutations, mapActions, mapState, mapGetters } from "vuex";
|
|
|
|
import jsonrpc from "@/shopro/request/indexJson.js";
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
|
|
mapMutations,
|
|
|
|
|
|
|
|
mapActions,
|
|
|
|
|
|
|
|
mapState,
|
|
|
|
|
|
|
|
mapGetters
|
|
|
|
|
|
|
|
} from "vuex";
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
import apple from "@/shopro/apple";
|
|
|
|
import apple from "@/shopro/apple";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
@ -376,8 +385,8 @@ export default {
|
|
|
|
// 2.短信登录
|
|
|
|
// 2.短信登录
|
|
|
|
smsLogin: {
|
|
|
|
smsLogin: {
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
mobile: "", // 手机号
|
|
|
|
mobile: "1336943778", // 手机号
|
|
|
|
code: "", // 验证码
|
|
|
|
code: "666666", // 验证码
|
|
|
|
isMobileEnd: false // 手机号输入完毕
|
|
|
|
isMobileEnd: false // 手机号输入完毕
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
@ -392,8 +401,8 @@ export default {
|
|
|
|
// 3.注册
|
|
|
|
// 3.注册
|
|
|
|
register: {
|
|
|
|
register: {
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
mobile: "", // 手机号
|
|
|
|
mobile: "1336943778", // 手机号
|
|
|
|
code: "", // 验证码
|
|
|
|
code: "666666", // 验证码
|
|
|
|
password: "", // 密码
|
|
|
|
password: "", // 密码
|
|
|
|
isMobileEnd: false // 手机号输入完毕
|
|
|
|
isMobileEnd: false // 手机号输入完毕
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -454,8 +463,7 @@ export default {
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
|
oldPassword: FormValidate.password,
|
|
|
|
oldPassword: FormValidate.password,
|
|
|
|
newPassword: FormValidate.password,
|
|
|
|
newPassword: FormValidate.password,
|
|
|
|
reNewPassword: [
|
|
|
|
reNewPassword: [{
|
|
|
|
{
|
|
|
|
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
message: "请重新输入密码",
|
|
|
|
message: "请重新输入密码",
|
|
|
|
trigger: ["change", "blur"]
|
|
|
|
trigger: ["change", "blur"]
|
|
|
|
@ -509,7 +517,47 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
...mapActions(["getUserInfo", "showAuthModal"]),
|
|
|
|
...mapActions(["getUserInfoJson", "getUserInfo", "showAuthModal"]),
|
|
|
|
|
|
|
|
// 获取短信验证码
|
|
|
|
|
|
|
|
getSmsCode(type) {
|
|
|
|
|
|
|
|
const that = this;
|
|
|
|
|
|
|
|
if (that.form[this.authType].data.isMobileEnd && !that.disabledCode) {
|
|
|
|
|
|
|
|
jsonrpc("user.smsJson", {
|
|
|
|
|
|
|
|
mobile: that.form[this.authType].data.mobile,
|
|
|
|
|
|
|
|
event: type
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"获取验证码中..."
|
|
|
|
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
if (res.error.code === 200) {
|
|
|
|
|
|
|
|
that.codeChange();
|
|
|
|
|
|
|
|
that.$u.toast("验证码已发送,请注意查收短信");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast(res.msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast("请稍后再试");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if (that.form[this.authType].data.isMobileEnd && !that.disabledCode) {
|
|
|
|
|
|
|
|
that.$http(
|
|
|
|
|
|
|
|
"common.smsSend", {
|
|
|
|
|
|
|
|
mobile: that.form[this.authType].data.mobile,
|
|
|
|
|
|
|
|
event: type
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"获取验证码中..."
|
|
|
|
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
if (res.code === 1) {
|
|
|
|
|
|
|
|
that.codeChange();
|
|
|
|
|
|
|
|
that.$u.toast("验证码已发送,请注意查收短信");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast(res.msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast("请稍后再试");
|
|
|
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 检测
|
|
|
|
// 检测
|
|
|
|
checkValue(e, key) {
|
|
|
|
checkValue(e, key) {
|
|
|
|
@ -536,11 +584,9 @@ export default {
|
|
|
|
[key]: rules
|
|
|
|
[key]: rules
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// 校验
|
|
|
|
// 校验
|
|
|
|
validator.validate(
|
|
|
|
validator.validate({
|
|
|
|
{
|
|
|
|
|
|
|
|
[key]: fieldValue
|
|
|
|
[key]: fieldValue
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
{
|
|
|
|
|
|
|
|
firstFields: true
|
|
|
|
firstFields: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
(errors, fields) => {
|
|
|
|
(errors, fields) => {
|
|
|
|
@ -593,29 +639,6 @@ export default {
|
|
|
|
this.$store.dispatch("showAuthModal", "");
|
|
|
|
this.$store.dispatch("showAuthModal", "");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 获取短信验证码
|
|
|
|
|
|
|
|
getSmsCode(type) {
|
|
|
|
|
|
|
|
const that = this;
|
|
|
|
|
|
|
|
if (that.form[this.authType].data.isMobileEnd && !that.disabledCode) {
|
|
|
|
|
|
|
|
that.$http(
|
|
|
|
|
|
|
|
"common.smsSend",
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mobile: that.form[this.authType].data.mobile,
|
|
|
|
|
|
|
|
event: type
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"获取验证码中..."
|
|
|
|
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
if (res.code === 1) {
|
|
|
|
|
|
|
|
that.codeChange();
|
|
|
|
|
|
|
|
that.$u.toast("验证码已发送,请注意查收短信");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast(res.msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast("请稍后再试");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 倒计时
|
|
|
|
// 倒计时
|
|
|
|
codeChange() {
|
|
|
|
codeChange() {
|
|
|
|
@ -681,8 +704,7 @@ export default {
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
that
|
|
|
|
.$http(
|
|
|
|
.$http(
|
|
|
|
"user.accountLogin",
|
|
|
|
"user.accountLogin", {
|
|
|
|
{
|
|
|
|
|
|
|
|
account: that.form["accountLogin"].data.account,
|
|
|
|
account: that.form["accountLogin"].data.account,
|
|
|
|
password: that.form["accountLogin"].data.password
|
|
|
|
password: that.form["accountLogin"].data.password
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -700,23 +722,37 @@ export default {
|
|
|
|
// 2.短信登录
|
|
|
|
// 2.短信登录
|
|
|
|
async smsLoginSubmit() {
|
|
|
|
async smsLoginSubmit() {
|
|
|
|
let that = this;
|
|
|
|
let that = this;
|
|
|
|
|
|
|
|
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
jsonrpc("user.smsLoginJson", {
|
|
|
|
.$http(
|
|
|
|
mobile: that.form["smsLogin"].data.mobile,
|
|
|
|
"user.smsLogin",
|
|
|
|
verification_code: that.form["smsLogin"].data.code
|
|
|
|
{
|
|
|
|
},
|
|
|
|
|
|
|
|
"登录中..."
|
|
|
|
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
if (res.error.code === 200) {
|
|
|
|
|
|
|
|
// that.getUserInfo(res.result.token);
|
|
|
|
|
|
|
|
that.getUserInfoJson(res.result.token);
|
|
|
|
|
|
|
|
that.closeAuthModal();
|
|
|
|
|
|
|
|
that.$u.toast(res.error.message);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
that.$u.toast(res.error.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/* (await that.validateSubmit()) &&
|
|
|
|
|
|
|
|
that.$http("user.smsLogin", {
|
|
|
|
mobile: that.form["smsLogin"].data.mobile,
|
|
|
|
mobile: that.form["smsLogin"].data.mobile,
|
|
|
|
code: that.form["smsLogin"].data.code
|
|
|
|
code: that.form["smsLogin"].data.code
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"登录中..."
|
|
|
|
"登录中..."
|
|
|
|
)
|
|
|
|
).then(res => {
|
|
|
|
.then(res => {
|
|
|
|
|
|
|
|
if (res.code === 1) {
|
|
|
|
if (res.code === 1) {
|
|
|
|
that.closeAuthModal();
|
|
|
|
that.closeAuthModal();
|
|
|
|
that.getUserInfo(res.data.token);
|
|
|
|
that.getUserInfo(res.data.token);
|
|
|
|
that.$u.toast(res.msg);
|
|
|
|
that.$u.toast(res.msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}); */
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 3.注册
|
|
|
|
// 3.注册
|
|
|
|
@ -725,8 +761,7 @@ export default {
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
that
|
|
|
|
.$http(
|
|
|
|
.$http(
|
|
|
|
"user.register",
|
|
|
|
"user.register", {
|
|
|
|
{
|
|
|
|
|
|
|
|
mobile: that.form["register"].data.mobile,
|
|
|
|
mobile: that.form["register"].data.mobile,
|
|
|
|
code: that.form["register"].data.code,
|
|
|
|
code: that.form["register"].data.code,
|
|
|
|
password: that.form["register"].data.password
|
|
|
|
password: that.form["register"].data.password
|
|
|
|
@ -748,8 +783,7 @@ export default {
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
that
|
|
|
|
.$http(
|
|
|
|
.$http(
|
|
|
|
"user.forgotPwd",
|
|
|
|
"user.forgotPwd", {
|
|
|
|
{
|
|
|
|
|
|
|
|
mobile: that.form["forgotPwd"].data.mobile,
|
|
|
|
mobile: that.form["forgotPwd"].data.mobile,
|
|
|
|
code: that.form["forgotPwd"].data.code,
|
|
|
|
code: that.form["forgotPwd"].data.code,
|
|
|
|
password: that.form["forgotPwd"].data.password
|
|
|
|
password: that.form["forgotPwd"].data.password
|
|
|
|
@ -774,8 +808,7 @@ export default {
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
that
|
|
|
|
.$http(
|
|
|
|
.$http(
|
|
|
|
"user.bindMobile",
|
|
|
|
"user.bindMobile", {
|
|
|
|
{
|
|
|
|
|
|
|
|
mobile: that.form["bindMobile"].data.mobile,
|
|
|
|
mobile: that.form["bindMobile"].data.mobile,
|
|
|
|
code: that.form["bindMobile"].data.code,
|
|
|
|
code: that.form["bindMobile"].data.code,
|
|
|
|
password: that.form["bindMobile"].data.password
|
|
|
|
password: that.form["bindMobile"].data.password
|
|
|
|
@ -797,8 +830,7 @@ export default {
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
(await that.validateSubmit()) &&
|
|
|
|
that
|
|
|
|
that
|
|
|
|
.$http(
|
|
|
|
.$http(
|
|
|
|
"user.changePwd",
|
|
|
|
"user.changePwd", {
|
|
|
|
{
|
|
|
|
|
|
|
|
oldpassword: that.form["changePwd"].data.oldPassword,
|
|
|
|
oldpassword: that.form["changePwd"].data.oldPassword,
|
|
|
|
newpassword: that.form["changePwd"].data.newPassword
|
|
|
|
newpassword: that.form["changePwd"].data.newPassword
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|