设置页面
This commit is contained in:
285
wuye-manager-uniapp/pageSubPack/setting/change -password.vue
Normal file
285
wuye-manager-uniapp/pageSubPack/setting/change -password.vue
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
<template>
|
||||||
|
<view class="reset-pwd-page">
|
||||||
|
<!-- <view class="status_bar"></view> -->
|
||||||
|
<!-- 顶部导航栏 -->
|
||||||
|
<!-- <view class="nav-bar">
|
||||||
|
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
|
||||||
|
<view class="nav-title">修改密码</view>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<!-- 旧密码输入框 -->
|
||||||
|
<view class="input-item">
|
||||||
|
<uni-easyinput
|
||||||
|
class="input-content"
|
||||||
|
type="password"
|
||||||
|
v-model="oldPassword"
|
||||||
|
placeholder="请输入旧密码"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
@input="checkForm"
|
||||||
|
>
|
||||||
|
</uni-easyinput>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 新密码输入框 -->
|
||||||
|
<view class="input-item">
|
||||||
|
<uni-easyinput
|
||||||
|
class="input-content"
|
||||||
|
type="password"
|
||||||
|
v-model="newPassword"
|
||||||
|
placeholder="请输入新密码(6-16位,含字母+数字)"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
@input="checkForm"
|
||||||
|
>
|
||||||
|
</uni-easyinput>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 确认密码输入框 -->
|
||||||
|
<view class="input-item">
|
||||||
|
<uni-easyinput
|
||||||
|
class="input-content"
|
||||||
|
type="password"
|
||||||
|
v-model="confirmPassword"
|
||||||
|
placeholder="请再次输入新密码"
|
||||||
|
:inputBorder="false"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
@input="checkForm"
|
||||||
|
>
|
||||||
|
</uni-easyinput>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 密码规则提示 -->
|
||||||
|
<view class="pwd-tip">
|
||||||
|
密码规则:6-16位字符,必须包含字母和数字
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 确定按钮 -->
|
||||||
|
<button
|
||||||
|
class="confirm-btn"
|
||||||
|
:disabled="!canConfirm"
|
||||||
|
@click="handleConfirm"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
|
// import { getResetPassword } from '../api/api.js'
|
||||||
|
|
||||||
|
// ========== 响应式数据 ==========
|
||||||
|
// 旧密码
|
||||||
|
const oldPassword = ref('')
|
||||||
|
// 新密码
|
||||||
|
const newPassword = ref('');
|
||||||
|
// 确认密码
|
||||||
|
const confirmPassword = ref('');
|
||||||
|
const placeholderStyle = ref('font-size:24rpx;color:#999')
|
||||||
|
|
||||||
|
// 定义接收上一页传来的参数
|
||||||
|
const phone = ref('');
|
||||||
|
const smsCode = ref('');
|
||||||
|
|
||||||
|
// ========== 计算属性 ==========
|
||||||
|
// 是否可点击确定按钮(包含旧密码必填校验)
|
||||||
|
const canConfirm = computed(() => {
|
||||||
|
// 密码格式规则:6-16位,必须包含字母+数字
|
||||||
|
const pwdReg = /^(?=.*[a-zA-Z])(?=.*\d).{6,16}$/;
|
||||||
|
|
||||||
|
// 校验条件:
|
||||||
|
// 1. 旧密码不为空
|
||||||
|
// 2. 新密码符合格式
|
||||||
|
// 3. 确认密码和新密码一致
|
||||||
|
// 4. 所有密码输入框不为空
|
||||||
|
return oldPassword.value.trim()
|
||||||
|
&& pwdReg.test(newPassword.value)
|
||||||
|
&& newPassword.value === confirmPassword.value
|
||||||
|
&& newPassword.value && confirmPassword.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// ========== 方法 ==========
|
||||||
|
// 返回上一页
|
||||||
|
const goBack = () => {
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面显示时读取缓存参数
|
||||||
|
onShow(() => {
|
||||||
|
// 从缓存读取参数
|
||||||
|
const params = uni.getStorageSync('tempChangePwdParams') || {};
|
||||||
|
// 赋值
|
||||||
|
phone.value = params.phoneNumber || ''
|
||||||
|
smsCode.value = params.verifyCode || ''
|
||||||
|
|
||||||
|
// 校验参数是否完整
|
||||||
|
// if (!phone.value || !smsCode.value) {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '参数异常,请重新操作',
|
||||||
|
// icon: 'error'
|
||||||
|
// })
|
||||||
|
// setTimeout(() => {
|
||||||
|
// goBack()
|
||||||
|
// }, 1500)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 用完删除缓存(避免下次跳转读取旧值)
|
||||||
|
uni.removeStorageSync('tempChangePwdParams');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 实时检查表单状态(可扩展自定义提示)
|
||||||
|
const checkForm = () => {
|
||||||
|
// 可在这里添加实时的表单错误提示,比如:
|
||||||
|
if (newPassword.value && !/^(?=.*[a-zA-Z])(?=.*\d).{6,16}$/.test(newPassword.value)) {
|
||||||
|
// 密码格式错误提示(可选:显示在页面上,而不是toast)
|
||||||
|
// errorTip.value = '密码必须包含字母和数字,长度6-16位'
|
||||||
|
} else if (confirmPassword.value && newPassword.value !== confirmPassword.value) {
|
||||||
|
// errorTip.value = '两次输入的密码不一致'
|
||||||
|
} else {
|
||||||
|
// errorTip.value = ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理确定按钮点击(修改密码逻辑)
|
||||||
|
const handleConfirm = () => {
|
||||||
|
// 二次校验,防止异常点击
|
||||||
|
if (!canConfirm.value) {
|
||||||
|
// 给出具体的错误提示
|
||||||
|
if (!oldPassword.value) {
|
||||||
|
uni.showToast({ title: '请输入旧密码', icon: 'none' });
|
||||||
|
} else if (!/^(?=.*[a-zA-Z])(?=.*\d).{6,16}$/.test(newPassword.value)) {
|
||||||
|
uni.showToast({ title: '新密码格式错误(需6-16位,含字母+数字)', icon: 'none' });
|
||||||
|
} else if (newPassword.value !== confirmPassword.value) {
|
||||||
|
uni.showToast({ title: '两次输入的密码不一致', icon: 'none' });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造请求参数(包含旧密码)
|
||||||
|
let params = {
|
||||||
|
phone: phone.value,
|
||||||
|
smsCode: smsCode.value,
|
||||||
|
oldPassword: oldPassword.value, // 新增旧密码参数
|
||||||
|
newPassword: newPassword.value,
|
||||||
|
confirmPassword: confirmPassword.value,
|
||||||
|
scene: 'reset'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示加载中
|
||||||
|
uni.showLoading({ title: '修改中...' });
|
||||||
|
setTimeout(() =>{
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pageSubPack/setting/setting'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// 调用修改密码接口
|
||||||
|
// getResetPassword(params).then(res => {
|
||||||
|
// uni.hideLoading();
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// uni.showToast({ title: '修改成功', icon: 'success' });
|
||||||
|
// setTimeout(() => {
|
||||||
|
// // 跳转到登录页(替换为你的实际登录页路径)
|
||||||
|
// uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' });
|
||||||
|
// }, 1500)
|
||||||
|
// } else {
|
||||||
|
// uni.showToast({ title: res.msg || "修改失败", icon: 'error' });
|
||||||
|
// }
|
||||||
|
// }).catch(err => {
|
||||||
|
// uni.hideLoading();
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '网络异常,请稍后重试',
|
||||||
|
// icon: 'none'
|
||||||
|
// });
|
||||||
|
// console.error('修改密码失败:', err);
|
||||||
|
// })
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 页面容器 */
|
||||||
|
.reset-pwd-page {
|
||||||
|
padding: 20rpx 40rpx 40rpx;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #F9F9F9;
|
||||||
|
/* background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF ); */
|
||||||
|
}
|
||||||
|
|
||||||
|
.status_bar {
|
||||||
|
width: 100%;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 顶部导航栏 */
|
||||||
|
.nav-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 88rpx;
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-title {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框通用样式 */
|
||||||
|
.input-item {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框内容 */
|
||||||
|
.input-content {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 密码规则提示 */
|
||||||
|
.pwd-tip {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999;
|
||||||
|
text-align: left;
|
||||||
|
margin: -20rpx 0 30rpx 10rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确定按钮 */
|
||||||
|
.confirm-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
background-color: #4D5DFA;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确定按钮禁用状态 */
|
||||||
|
.confirm-btn:disabled {
|
||||||
|
background-color: #99c8ff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 禁用按钮边框重置 */
|
||||||
|
button:after {
|
||||||
|
border: none;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
227
wuye-manager-uniapp/pageSubPack/setting/change-phone.vue
Normal file
227
wuye-manager-uniapp/pageSubPack/setting/change-phone.vue
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
<template>
|
||||||
|
<view class="forget-page">
|
||||||
|
<!-- <view class="status_bar"></view>
|
||||||
|
<view class="nav-bar">
|
||||||
|
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
|
||||||
|
<view class="nav-title">忘记密码</view>
|
||||||
|
</view> -->
|
||||||
|
<!-- 手机号输入框 -->
|
||||||
|
<view class="input-item">
|
||||||
|
<view class="input-icon">
|
||||||
|
<image src="http://47.104.199.163:9090/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
|
</view>
|
||||||
|
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all"
|
||||||
|
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||||
|
</uni-easyinput>
|
||||||
|
</view>
|
||||||
|
<!-- 验证码输入 + 获取验证码按钮 -->
|
||||||
|
<view class="input-item verify-item">
|
||||||
|
<view class="input-icon">
|
||||||
|
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||||
|
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||||
|
</view>
|
||||||
|
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
|
||||||
|
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
||||||
|
</uni-easyinput>
|
||||||
|
<button
|
||||||
|
class="get-verify-btn"
|
||||||
|
:disabled="!canGetVerify || countDown > 0"
|
||||||
|
@click="getVerifyCode"
|
||||||
|
>
|
||||||
|
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
<!-- 确定 -->
|
||||||
|
<button
|
||||||
|
class="forget-btn"
|
||||||
|
:disabled="!canRegister"
|
||||||
|
@click="handleConfirm"
|
||||||
|
>
|
||||||
|
确定
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, onUnmounted } from 'vue';
|
||||||
|
import {getSendCode} from '../api/api.js'
|
||||||
|
|
||||||
|
// ====响应式数据======
|
||||||
|
const phoneNumber = ref('')
|
||||||
|
const verifyCode = ref('')
|
||||||
|
|
||||||
|
const countDown = ref(0)
|
||||||
|
let timer = null;
|
||||||
|
const placeholderStyle = ref('font-size:24rpx')
|
||||||
|
|
||||||
|
// ========== 计算属性 ==========
|
||||||
|
// 是否可获取验证码(手机号格式正确)
|
||||||
|
const canGetVerify = computed(() => {
|
||||||
|
const phoneReg = /^1[3-9]\d{9}$/;
|
||||||
|
return phoneReg.test(phoneNumber.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取验证码
|
||||||
|
const getVerifyCode = () => {
|
||||||
|
if (!canGetVerify.value) return;
|
||||||
|
let params = {
|
||||||
|
phone:phoneNumber.value,
|
||||||
|
scene:'reset'
|
||||||
|
}
|
||||||
|
getSendCode(params).then(res =>{
|
||||||
|
if(res.code === 200){
|
||||||
|
uni.showToast({
|
||||||
|
title: '验证码已发送',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
// 开始60秒倒计时
|
||||||
|
countDown.value = 60;
|
||||||
|
timer = setInterval(() => {
|
||||||
|
countDown.value--;
|
||||||
|
if (countDown.value <= 0) {
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: '验证码发送失败',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
// 是否确认
|
||||||
|
const canRegister = computed(() => {
|
||||||
|
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
|
||||||
|
const verifyReg = /^\d{6}$/; // 验证码6位
|
||||||
|
|
||||||
|
return phoneReg.test(phoneNumber.value)
|
||||||
|
&& verifyReg.test(verifyCode.value)
|
||||||
|
});
|
||||||
|
// 确认
|
||||||
|
const handleConfirm = () =>{
|
||||||
|
// 把参数存到本地缓存
|
||||||
|
uni.setStorageSync('tempChangePwdParams', {
|
||||||
|
phoneNumber:phoneNumber.value,
|
||||||
|
verifyCode: verifyCode.value
|
||||||
|
});
|
||||||
|
if(!canRegister.value){
|
||||||
|
uni.showToast({ title: '请输入',icon: 'error'});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 返回上一页
|
||||||
|
const goBack = () => {
|
||||||
|
uni.navigateBack();
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.forget-page{
|
||||||
|
padding: 20rpx 40rpx 40rpx;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
/* background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF ); */
|
||||||
|
}
|
||||||
|
.status_bar{
|
||||||
|
width: 100%;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
/* 顶部导航栏 */
|
||||||
|
.nav-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
/* height: 88rpx; */
|
||||||
|
margin-bottom: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-title {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
/* 输入框通用样式 */
|
||||||
|
.input-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 验证码输入项特殊布局 */
|
||||||
|
.verify-item {
|
||||||
|
position: relative;
|
||||||
|
padding-right: 220rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框图标 */
|
||||||
|
.input-icon {
|
||||||
|
margin-right: 20rpx;
|
||||||
|
color: #999;
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框内容 */
|
||||||
|
.input-content {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.verify-input {
|
||||||
|
padding-right: 20rpx;
|
||||||
|
}
|
||||||
|
/* 获取验证码按钮 */
|
||||||
|
.get-verify-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 10rpx;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 200rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
background-color: #4D5DFA;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 35rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.get-verify-btn:disabled {
|
||||||
|
background-color: #ccc;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
/* 按钮 */
|
||||||
|
.forget-btn{
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
line-height: 88rpx;
|
||||||
|
background-color: #4D5DFA;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
.forget-btn:disabled{
|
||||||
|
background-color: #99c8ff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
/* 禁用按钮边框 */
|
||||||
|
button:after{
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
210
wuye-manager-uniapp/pageSubPack/setting/setting.vue
Normal file
210
wuye-manager-uniapp/pageSubPack/setting/setting.vue
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
<template>
|
||||||
|
<view class="setting-container">
|
||||||
|
<view class="status_bar"></view>
|
||||||
|
<!-- 顶部导航栏 -->
|
||||||
|
<view class="nav-bar">
|
||||||
|
<view class="nav-left" @tap="goBack">
|
||||||
|
<uni-icons type="left" size="22" color="#000"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="nav-title">设置</view>
|
||||||
|
<view class="nav-right"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<scroll-view class="content" scroll-y="true">
|
||||||
|
<!-- 手机号设置项 -->
|
||||||
|
<view class="setting-item" @tap="goToChangePhone">
|
||||||
|
<view class="item-label">手机号</view>
|
||||||
|
<view class="item-value">{{ phoneNumber }}</view>
|
||||||
|
<uni-icons type="arrowright" size="20" color="#ccc"></uni-icons>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 修改密码设置项 -->
|
||||||
|
<view class="setting-item" @tap="goToModifyPassword">
|
||||||
|
<view class="item-label">修改密码</view>
|
||||||
|
<view class="item-value">{{passwordNumber}}</view>
|
||||||
|
<uni-icons type="arrowright" size="20" color="#ccc"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
|
||||||
|
<!-- 退出登录按钮 -->
|
||||||
|
<view class="logout-btn-wrap">
|
||||||
|
<button class="logout-btn" :disabled="!phoneNumber" @tap="handleLogout">退出登录</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const phoneNumber = ref('15699991212') // 绑定手机号
|
||||||
|
const passwordNumber = ref('ckk123456')
|
||||||
|
|
||||||
|
// 页面加载时可从接口获取用户信息
|
||||||
|
onLoad(() => {
|
||||||
|
// 实际项目中从接口获取用户手机号
|
||||||
|
// getUserInfo().then(res => {
|
||||||
|
// phoneNumber.value = res.phone || ''
|
||||||
|
// })
|
||||||
|
})
|
||||||
|
|
||||||
|
// 返回上一页
|
||||||
|
const goBack = () => {
|
||||||
|
uni.switchTab({
|
||||||
|
url:"/pages/my/my"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转到更改手机号页面
|
||||||
|
const goToChangePhone = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageSubPack/setting/change-phone'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 跳转到修改密码页面
|
||||||
|
const goToModifyPassword = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pageSubPack/setting/change -password'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点击退出登录,显示原生确认弹窗
|
||||||
|
const handleLogout = () => {
|
||||||
|
uni.showModal({
|
||||||
|
title: '退出登录',
|
||||||
|
content: '确定要退出当前账号吗?',
|
||||||
|
confirmText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
confirmLogout() // 确认退出
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认退出登录
|
||||||
|
const confirmLogout = () => {
|
||||||
|
// 模拟退出登录接口请求
|
||||||
|
uni.showLoading({ title: '退出中...' })
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
// 清除本地存储的token等信息
|
||||||
|
uni.removeStorageSync('token')
|
||||||
|
uni.removeStorageSync('userInfo')
|
||||||
|
|
||||||
|
// 提示并跳转到登录页
|
||||||
|
uni.showToast({
|
||||||
|
title: '退出登录成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 跳转到登录页,关闭所有页面
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/loginSub/pwd-login'
|
||||||
|
})
|
||||||
|
}, 800)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 页面容器 */
|
||||||
|
.setting-container {
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.status_bar{
|
||||||
|
width: 100%;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
/* 导航栏样式 */
|
||||||
|
.nav-bar {
|
||||||
|
height: 44px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 15px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
background-color: #fff;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-left {
|
||||||
|
width: 40px;
|
||||||
|
height: 44px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-title {
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right {
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容区域 */
|
||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 设置项样式 */
|
||||||
|
.setting-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 15px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-label {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-value {
|
||||||
|
flex: 1;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #666;
|
||||||
|
margin-right: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 退出登录按钮 */
|
||||||
|
.logout-btn-wrap {
|
||||||
|
padding: 30px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 44px;
|
||||||
|
line-height: 44px;
|
||||||
|
background-color: #4D5DFA;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-btn::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -112,8 +112,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "pageSubPack/setting",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"path": "setting",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "设置",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "change-phone",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "更改手机号码"
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "change -password",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "修改密码"
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
"easycom": {
|
"easycom": {
|
||||||
"autoscan": true,
|
"autoscan": true,
|
||||||
|
|||||||
@@ -128,8 +128,9 @@
|
|||||||
const current = ref(0)
|
const current = ref(0)
|
||||||
|
|
||||||
const currentCommunity = ref('碧桂园小区')
|
const currentCommunity = ref('碧桂园小区')
|
||||||
const bannerList = ref([{
|
const bannerList = ref([
|
||||||
img: '/static/bannar1.png'
|
{
|
||||||
|
img: '/static/imgs/banner1.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
img: '/static/bannar2.png'
|
img: '/static/bannar2.png'
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
});
|
});
|
||||||
} else if (item.title == '设置') {
|
} else if (item.title == '设置') {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '',
|
url: '/pageSubPack/setting/setting',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
wuye-manager-uniapp/static/imgs/banner1.png
Normal file
BIN
wuye-manager-uniapp/static/imgs/banner1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
Reference in New Issue
Block a user