This commit is contained in:
Vce 2024-05-13 01:15:55 +08:00
parent ddfd00832f
commit 04512df2f5
5 changed files with 352 additions and 5 deletions

View File

@ -1,5 +1,5 @@
//基础请求地址,需要根据自己的需求切换 //基础请求地址,需要根据自己的需求切换
export const BASE_URL = "http://192.168.34.221:9111/" export const BASE_URL = "http://192.168.34.221:19111/"
//export const BASE_URL = "http://192.168.8.100:10000" //export const BASE_URL = "http://192.168.8.100:10000"
//export const BASE_URL = "http://106.13.16.28:10000" //export const BASE_URL = "http://106.13.16.28:10000"

View File

@ -1681,6 +1681,20 @@
{ {
"navigationBarTitleText" : "" "navigationBarTitleText" : ""
} }
},
{
"path" : "pages/my/userInfo/userInfo",
"style" :
{
"navigationBarTitleText" : "个人中心"
}
},
{
"path" : "pages/my/changePassword/changePassword",
"style" :
{
"navigationBarTitleText" : "修改密码"
}
} }
], ],
// "subPackages":[{ // "subPackages":[{

View File

@ -0,0 +1,204 @@
<template>
<view class="userLogin">
<headers :showBack="true">
<view class="headerName">
修改密码
</view>
</headers>
<u-form style="width: 100%;" :rules="rules" :error-type="['message']" :model="formData" ref="uForm">
<u-form-item prop="account" class="uni-form-item" :border-bottom="false">
<view>当前账号</view>
<input class="uni-input" name="userInfo" readonly :disabled="true" v-model="userInfo.realName"
placeholder="请输入您的账号" />
</u-form-item>
<u-form-item prop="pw" class="uni-form-item" :border-bottom="false">
<view>当前密码</view>
<input class="uni-input" name="pw" v-model="formData.pw" :password="showPassword"
placeholder="请输入您的密码" />
<!-- <u-icon :name="showPassword ? 'eye-off' : 'eye-fill'" @click="showPassword = !showPassword"></u-icon> -->
</u-form-item>
<u-form-item prop="newpw" class="uni-form-item" :border-bottom="false">
<view>新密码</view>
<input class="uni-input" name="newpw" :password="showPassword" v-model="formData.newpw"
placeholder="请输入新密码" />
</u-form-item>
<u-form-item prop="newpwaff" class="uni-form-item" :border-bottom="false">
<view>确认新密码</view>
<input class="uni-input" name="newpwaff" :password="showPassword" v-model="formData.newpwaff"
placeholder="请输入再次新密码" />
</u-form-item>
<!-- <u-form-item prop="email" class="uni-form-item" :border-bottom="false">
<image class="icon" mode="widthFix" src="@/static/login/email.png"></image>
<input class="uni-input" type="email" name="email" v-model="formData.email" placeholder="请输入您的电子邮箱" />
</u-form-item> -->
<view class="uni-form-item submit">
<button type="primary" class="btn" @click="formSubmit">完成</button>
</view>
</u-form>
</view>
</template>
<script>
import headers from '../../../components/headers/headers.vue';
import { exitApp } from "@/utils/tool.js"
export default {
components: {
headers
},
data() {
return {
showPassword: true,
userInfo:{},
formData: {
account: '',
pw: '',
newpw: "",
newpwaff: "",
email: ''
},
rules: {
pw: [{
required: true,
message: '请输入密码',
trigger: ['change', 'blur'],
},
{
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
//
transform(value) {
return String(value);
},
message: '密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数'
}
],
newpw: [{
required: true,
message: '请输入密码',
trigger: ['change', 'blur'],
},
{
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
//
transform: (value) => {
return String(value);
},
message: '密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数'
}
],
newpwaff: [{
required: true,
message: '请输入密码',
trigger: ['change', 'blur'],
}, {
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
//
transform: (value) => {
// console.log(value,this.formData);
if(value != this.formData.newpw){
return false
}
return String(value);
},
message: '两次密码不一致'
}],
email: [{
required: true,
message: '请输入邮箱',
trigger: ['change', 'blur'],
},
{
type: "email",
required: true,
message: '邮箱格式错误',
trigger: ['change', 'blur'],
}
],
}
};
},
onLoad() {
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
methods: {
formSubmit() {
// ->
this.$refs.uForm.validate(valid => {
if (valid) {
//
this.sendRequest({
url: "xmgl/systemUser/xz/updatePw",
data: {
userId:this.userInfo.userId,
oldPassword:this.formData.pw,
showPassword:this.formData.newpwaff,
isCheckCode:0
},
method: "POST",
success: (res) => {
console.log(res);
if (res.code == 200) {
uni.showToast({
title:'修改成功!'
})
this.logout();
}
}
})
}
});
},
logout() {
this.sendRequest({
url: "xmgl/base/logout",
data: {
id: this.userInfo.userId
},
method: "POST",
success() {
exitApp()
},
fail() {
exitApp()
}
})
}
}
}
</script>
<style lang="scss" scoped>
.userLogin {
padding: 30rpx;
.uni-form-item {
display: flex;
padding: 20rpx 10rpx;
width: 100%;
border-bottom: 1rpx solid #ddd;
&.submit {
border: none;
margin-top: 40rpx;
}
.icon {
width: 40rpx;
height: auto;
margin: auto 0;
}
.uni-input {
width: 70%;
padding: 15rpx;
}
.btn {
width: 100%;
}
}
}
</style>

View File

@ -6,10 +6,16 @@
我的 我的
</view> </view>
</headers> </headers>
<view class="userBox"> <view class="usercontonin">
<image class="userImg" src="@/static/userImg.png"></image> <view class="userBox">
<span v-if="uid">{{userInfo.realName}}</span> <image class="userImg" src="@/static/userImg.png"></image>
<span v-else>{{userInfo.account}}</span> <span v-if="uid">{{userInfo.realName}}</span>
<span v-else>{{userInfo.account}}</span>
</view>
<view class="userbtn" @click="goUserInfo()">
<uni-icons2 class="compose" type="compose" size="20"></uni-icons2>
<span>个人中心</span>
</view>
</view> </view>
</view> </view>
<!-- v-if="COMPANY != 'nanchang'" --> <!-- v-if="COMPANY != 'nanchang'" -->
@ -158,6 +164,11 @@
url: '../fileList/fileList' url: '../fileList/fileList'
}) })
}, },
goUserInfo() {
uni.navigateTo({
url: '../my/userInfo/userInfo'
})
},
toMessageCenter() { toMessageCenter() {
uni.navigateTo({ uni.navigateTo({
url: '../messageCenter/messageCenter' url: '../messageCenter/messageCenter'
@ -185,6 +196,25 @@
</script> </script>
<style lang="scss"> <style lang="scss">
.usercontonin{
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 20px;
}
.userbtn {
padding: 6px 20px;
border: 1px solid #FFFFFF;
border-radius: 20px;
display: flex;
align-items: center;
}
.compose{
color: white !important;
}
.myPage { .myPage {
height: 100%; height: 100%;

View File

@ -0,0 +1,99 @@
<template>
<view class="userInfo">
<headers :showBack="true">
<view class="headerName">
个人中心
</view>
</headers>
<view class="userBox">
<image class="userImg" src="@/static/userImg.png"></image>
<span v-if="uid">{{userInfo.realName}}</span>
<span v-else>{{userInfo.account}}</span>
</view>
<view class="userInfo-boxs">
<view class="userInfo-box">
<view>账号名称</view>
<view>{{uid ? userInfo.realName : userInfo.account}}</view>
</view>
<view class="userInfo-box">
<view>电子邮箱</view>
<view>{{userInfo.personMail ? userInfo.personMail : '暂无邮箱'}}</view>
</view>
<view class="userInfo-box" @click="goChangePassword()">
<view>修改密码</view>
<view><uni-icons2 class="arrowright" type="arrowright" size="20"></uni-icons2></view>
</view>
</view>
</view>
</template>
<script>
import headers from '../../../components/headers/headers.vue'
export default {
components: {
headers
},
data() {
return {
userInfo:{},
ui:"",
}
},
onLoad() {
this.uid = uni.getStorageSync('UID');
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
console.log(this.userInfo);
},
methods: {
goChangePassword() {
console.log(11);
uni.navigateTo({
url: '/pages/my/changePassword/changePassword',
})
},
}
}
</script>
<style scoped>
.userInfo{
background-color: #F4F5FE;
height: 100vh;
}
.userBox {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 40px 20px;
font-size: 20px;
background-color: white;
}
.userImg {
width: 50px;
height: 50px;
border-radius: 50%;
/* margin-right: 10px; */
}
.userInfo-boxs {
display: flex;
flex-direction: column;
margin-top: 10px;
background-color: white;
}
.userInfo-box {
height:58px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
}
.userInfo-boxs>.userInfo-box:nth-child(:last-child) {
border-bottom: 1px solid #F4F5FE;
}
</style>