2025-11-07 09:56:20 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="set_info_container content_with_back">
|
|
|
|
|
|
<view class="title">设置信息</view>
|
|
|
|
|
|
<u-form class="loginForm commonPage-form" labelPosition="top" :model="userInfo" :rules="rules" :labelStyle="{
|
|
|
|
|
|
fontSize: '14px',
|
|
|
|
|
|
marginTop: '20rpx',
|
|
|
|
|
|
minWidth: '200rpx',
|
|
|
|
|
|
}" ref="loginForm">
|
|
|
|
|
|
<u-form-item label="昵称" prop="nickname">
|
|
|
|
|
|
<u-input v-model="userInfo.nickname" border="surround" placeholder="请输入您的昵称" clearable>
|
|
|
|
|
|
</u-input>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="密码" prop="password">
|
|
|
|
|
|
<u-input v-model="userInfo.password" border="surround" placeholder="请输入密码" :password="!passwordEying">
|
|
|
|
|
|
<u-icon @click="updateEye('passwordEying')" slot="suffix"
|
|
|
|
|
|
:name="passwordEying ? 'eye-off' : 'eye'"></u-icon>
|
|
|
|
|
|
</u-input>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
<view class="feild_desc">6~20位,至少包含数字、字母</view>
|
|
|
|
|
|
<u-form-item label="确认密码" prop="confirmPassword">
|
|
|
|
|
|
<u-input v-model="userInfo.confirmPassword" border="surround" placeholder="请输入密码"
|
|
|
|
|
|
:password="!comfirmEying">
|
|
|
|
|
|
<u-icon @click="updateEye('comfirmEying')" slot="suffix"
|
|
|
|
|
|
:name="comfirmEying ? 'eye-off' : 'eye'"></u-icon>
|
|
|
|
|
|
</u-input>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
</u-form>
|
|
|
|
|
|
<view class="btn">
|
|
|
|
|
|
<u-button :loading="loading" type="primary" @click="doNext">
|
2025-11-25 05:36:02 +08:00
|
|
|
|
进入{{config.name}}
|
2025-11-07 09:56:20 +08:00
|
|
|
|
</u-button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import md5 from "md5";
|
|
|
|
|
|
import MyAvatar from "@/components/MyAvatar/index.vue";
|
2025-11-25 05:36:02 +08:00
|
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
import { businessRegister } from "@/api/login";
|
|
|
|
|
|
import { checkLoginError } from "@/util/common";
|
2025-11-07 09:56:20 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
components: {
|
|
|
|
|
|
MyAvatar,
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
loading: false,
|
|
|
|
|
|
passwordEying: false,
|
|
|
|
|
|
comfirmEying: false,
|
|
|
|
|
|
codeValue: "",
|
|
|
|
|
|
userInfo: {
|
2025-11-27 03:55:38 +08:00
|
|
|
|
mobile: "",
|
2025-11-23 01:01:52 +08:00
|
|
|
|
email: "",
|
2025-11-27 03:55:38 +08:00
|
|
|
|
region: "",
|
2025-11-07 09:56:20 +08:00
|
|
|
|
nickname: "",
|
|
|
|
|
|
password: "",
|
|
|
|
|
|
confirmPassword: "",
|
|
|
|
|
|
},
|
|
|
|
|
|
rules: {
|
|
|
|
|
|
nickname: [{
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请填写真实姓名",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
|
|
|
|
|
}, ],
|
|
|
|
|
|
password: [{
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请输入密码",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
2025-11-23 01:01:52 +08:00
|
|
|
|
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
|
2025-11-07 09:56:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
|
return value.length >= 6;
|
|
|
|
|
|
},
|
|
|
|
|
|
message: "密码太短",
|
|
|
|
|
|
trigger: ["change", "blur"],
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
confirmPassword: [{
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请输入确认密码",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
2025-11-23 01:01:52 +08:00
|
|
|
|
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
|
2025-11-07 09:56:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
|
return value === this.formData.password;
|
|
|
|
|
|
},
|
|
|
|
|
|
message: "两次密码不一致",
|
|
|
|
|
|
trigger: ["change", "blur"],
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
2025-11-25 05:36:02 +08:00
|
|
|
|
computed:{
|
|
|
|
|
|
...mapGetters(["config"]),
|
|
|
|
|
|
},
|
2025-11-07 09:56:20 +08:00
|
|
|
|
onLoad(options) {
|
2025-11-25 05:36:02 +08:00
|
|
|
|
const {userInfo,codeValue} = options;
|
2025-11-07 09:56:20 +08:00
|
|
|
|
this.userInfo = {
|
|
|
|
|
|
...this.userInfo,
|
|
|
|
|
|
...JSON.parse(userInfo),
|
|
|
|
|
|
};
|
|
|
|
|
|
this.codeValue = codeValue;
|
2025-11-23 01:01:52 +08:00
|
|
|
|
if(process.env.NODE_ENV == 'development'){
|
2025-11-25 05:36:02 +08:00
|
|
|
|
//this.userInfo.email = "commiu@outlook.com";
|
|
|
|
|
|
this.userInfo.nickname = "";
|
2025-11-23 01:01:52 +08:00
|
|
|
|
this.userInfo.password = "qwe123";
|
|
|
|
|
|
this.userInfo.confirmPassword = "qwe123";
|
|
|
|
|
|
}
|
2025-11-07 09:56:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
onBackPress() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
updateEye(key) {
|
|
|
|
|
|
this[key] = !this[key];
|
|
|
|
|
|
},
|
|
|
|
|
|
doNext() {
|
|
|
|
|
|
this.$refs.loginForm.validate().then((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.doRegister();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
async doRegister() {
|
|
|
|
|
|
this.loading = true;
|
|
|
|
|
|
const options = {
|
2025-11-23 01:01:52 +08:00
|
|
|
|
code: this.codeValue,
|
2025-11-25 05:36:02 +08:00
|
|
|
|
platform: uni.$u.os(),
|
2025-11-07 09:56:20 +08:00
|
|
|
|
autoLogin: true,
|
2025-11-23 01:01:52 +08:00
|
|
|
|
...this.userInfo,
|
2025-11-27 03:55:38 +08:00
|
|
|
|
region: `+${this.userInfo.region}`,
|
2025-11-23 01:01:52 +08:00
|
|
|
|
password: md5(this.userInfo.password),
|
2025-11-27 03:55:38 +08:00
|
|
|
|
mobile: this.userInfo.mobile
|
2025-11-07 09:56:20 +08:00
|
|
|
|
};
|
|
|
|
|
|
try {
|
|
|
|
|
|
await businessRegister(options);
|
|
|
|
|
|
this.saveLoginInfo();
|
|
|
|
|
|
uni.$u.toast('注册成功')
|
|
|
|
|
|
uni.$u.route("/pages/login/index")
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.log(err);
|
2025-11-23 01:01:52 +08:00
|
|
|
|
if(err.msg=="验证码过期" || err.msg=="验证码错误"){
|
|
|
|
|
|
uni.$u.route("/pages/login/verifyCode/index", {
|
|
|
|
|
|
userInfo: JSON.stringify(this.userInfo),
|
|
|
|
|
|
isRegister: true,
|
|
|
|
|
|
resend: 1,
|
|
|
|
|
|
})
|
|
|
|
|
|
return ;
|
|
|
|
|
|
}
|
2025-11-07 09:56:20 +08:00
|
|
|
|
// uni.$u.toast('注册失败')
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
this.loading = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
saveLoginInfo() {
|
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
|
key: "lastPhoneNumber",
|
2025-11-27 03:55:38 +08:00
|
|
|
|
data: this.userInfo.mobile,
|
2025-11-07 09:56:20 +08:00
|
|
|
|
});
|
|
|
|
|
|
uni.setStorage({
|
|
|
|
|
|
key: "lastAreaCode",
|
2025-11-27 03:55:38 +08:00
|
|
|
|
data: this.userInfo.region,
|
2025-11-07 09:56:20 +08:00
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.set_info_container {
|
|
|
|
|
|
margin-top: var(--status-bar-height);
|
|
|
|
|
|
background: linear-gradient(180deg,
|
|
|
|
|
|
rgba(0, 137, 255, 0.1) 0%,
|
|
|
|
|
|
rgba(255, 255, 255, 0) 100%);
|
|
|
|
|
|
padding-top: 150rpx;
|
|
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
margin-bottom: 116rpx;
|
|
|
|
|
|
padding-bottom: 8rpx;
|
|
|
|
|
|
color: $u-primary;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.feild_desc {
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: $u-tips-color;
|
|
|
|
|
|
margin-top: 4rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
margin-top: 200rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|