146 lines
3.6 KiB
Vue
146 lines
3.6 KiB
Vue
<template>
|
||
<view class="table-view">设置新密码</view>
|
||
<view class="text">
|
||
<view class="icon icon-user"> 姓名</view>
|
||
<view><input v-model="upData.name" class="uni-input" type="text" placeholder="请输入姓名" /></view>
|
||
</view>
|
||
<view class="text">
|
||
<view class="icon icon-phone"> 手机号</view>
|
||
<view><input v-model="upData.telephone" class="uni-input" type="number" placeholder="请输入手机号" /></view>
|
||
</view>
|
||
<view class="text">
|
||
<view class="icon icon-lock"> 新密码</view>
|
||
<view><input v-model="upData.password" class="uni-input" password type="text" placeholder="请输入密码" />
|
||
</view>
|
||
</view>
|
||
<view class="text">
|
||
<view class="icon icon-lock"> 确认密码</view>
|
||
<view><input v-model="upData.passwordTwo" class="uni-input" password type="text" placeholder="请输入密码" />
|
||
</view>
|
||
</view>
|
||
|
||
<button type="primary" @click="gaiMiMa" class="zhmm-button">找回密码</button>
|
||
<view @click="toLogin" class="dl-button">账号登录</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { reactive, toRaw } from 'vue'
|
||
import { URL_BASE } from '/common/config.js'
|
||
|
||
const upData = reactive({
|
||
name: '',
|
||
telephone: '',
|
||
password: '',
|
||
passwordTwo: ''
|
||
})
|
||
|
||
const gaiMiMa = () => {
|
||
if (upData.name.length === 0) {
|
||
uni.showToast({ title: '请填写姓名', icon: 'none', duration: 2000 })
|
||
return fasle
|
||
}
|
||
if (upData.telephone.length != 11) {
|
||
uni.showToast({ title: '请填正确手机号', icon: 'none', duration: 2000 })
|
||
return fasle
|
||
}
|
||
|
||
if (upData.password !== upData.passwordTwo) {
|
||
uni.showToast({ title: '两次密码不一致,请检查填写信息', icon: 'none', duration: 2000 })
|
||
return fasle
|
||
}
|
||
|
||
let regStr = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@#$%^&+=!]).{8,16}$/;
|
||
let reg = new RegExp(regStr)
|
||
if (!reg.test(upData.password)) {
|
||
uni.showToast({ title: '密码格式为8-16位,且包含字母、数字和特殊字符', icon: 'none', duration: 2000 })
|
||
return fasle
|
||
}
|
||
|
||
uni.request({
|
||
url: `${URL_BASE}//basic_functions/user/pwdForPhone`,
|
||
data: toRaw(upData),
|
||
method: 'POST',
|
||
sslVerify:false,
|
||
success: (res) => {
|
||
if (res.data.code === "200") {
|
||
if (res.data.data.code === "0") {
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '修改成功,请输入手机号密码登录',
|
||
showCancel: false,
|
||
success: function(res) {
|
||
uni.redirectTo({ url: '/pages/base/denglu' });
|
||
}
|
||
});
|
||
} else {
|
||
uni.showToast({ title: '修改失败,请检查填写信息', icon: 'none', duration: 2000 })
|
||
}
|
||
} else {
|
||
uni.showToast({ title: '修改失败,请检查填写信息', icon: 'none', duration: 2000 })
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
const toLogin = () => {
|
||
uni.redirectTo({
|
||
url: '/pages/base/denglu'
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.table-view {
|
||
width: 328rpx;
|
||
height: 46rpx;
|
||
font-size: 60rpx;
|
||
font-weight: 700;
|
||
line-height: 77rpx;
|
||
color: #00BFBF;
|
||
margin: 0rpx auto;
|
||
padding-top: 128rpx;
|
||
padding-bottom: 128rpx;
|
||
}
|
||
|
||
.text {
|
||
width: 632rpx;
|
||
margin: 30rpx auto;
|
||
border-bottom: 2rpx solid #A9C1E5;
|
||
}
|
||
|
||
.text>view:nth-child(1) {
|
||
font-size: 29rpx;
|
||
font-weight: 400;
|
||
line-height: 50rpx;
|
||
color: #00BFBF;
|
||
padding-bottom: 6rpx;
|
||
}
|
||
|
||
.text>view:nth-child(2) {
|
||
font-size: 33rpx;
|
||
font-weight: 400;
|
||
line-height: 56rpx;
|
||
color: #17386E;
|
||
padding-bottom: 6rpx;
|
||
}
|
||
|
||
.zhmm-button {
|
||
width: 633rpx;
|
||
background-color: #00BFBF;
|
||
margin-left: 58rpx;
|
||
border-radius: 50rpx;
|
||
position: fixed;
|
||
bottom: 100rpx;
|
||
}
|
||
|
||
.dl-button {
|
||
width: 96rpx;
|
||
margin-left: 327rpx;
|
||
position: fixed;
|
||
bottom: 20rpx;
|
||
font-size: 22rpx;
|
||
line-height: 30rpx;
|
||
color: #00BFBF;
|
||
text-decoration: underline;
|
||
}
|
||
</style> |