对接设置接口
This commit is contained in:
@@ -21,8 +21,9 @@
|
|||||||
<view class="upload-area">
|
<view class="upload-area">
|
||||||
<!-- 已上传图片 -->
|
<!-- 已上传图片 -->
|
||||||
<view class="uploaded-img" v-for="(img, index) in imgList" :key="index">
|
<view class="uploaded-img" v-for="(img, index) in imgList" :key="index">
|
||||||
<image :src="img" mode="aspectFill"></image>
|
<image :src="img" mode="aspectFill" class="upload-img"></image>
|
||||||
<text class="del-img" @click="deleteImg(index)">×</text>
|
<image src="http://47.104.199.163:9090/images/imgs/delete.png" class="upload-delete" @click="deleteImage(index)"></image>
|
||||||
|
<!-- <text class="del-img" @click="deleteImg(index)">×</text> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- 上传按钮(最多3张) -->
|
<!-- 上传按钮(最多3张) -->
|
||||||
<view class="upload-btn" @click="chooseImg" v-if="imgList.length < 3">
|
<view class="upload-btn" @click="chooseImg" v-if="imgList.length < 3">
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { addActivityLive, signinActivityLive, uploadImage } from '../api/api.js';
|
import { addActivityLive, signinActivityLive, uploadFile } from '../api/api.js';
|
||||||
|
|
||||||
// 活动ID
|
// 活动ID
|
||||||
const activityId = ref('');
|
const activityId = ref('');
|
||||||
@@ -98,7 +99,7 @@ const chooseImg = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
const deleteImg = (index) => {
|
const deleteImage = (index) => {
|
||||||
imgList.value.splice(index, 1);
|
imgList.value.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -147,9 +148,9 @@ const reLocate = () => {
|
|||||||
// 上传所有图片
|
// 上传所有图片
|
||||||
const uploadAllImages = async () => {
|
const uploadAllImages = async () => {
|
||||||
if (imgList.value.length === 0) return [];
|
if (imgList.value.length === 0) return [];
|
||||||
const uploadPromises = imgList.value.map(img => uploadImage(img));
|
const uploadPromises = imgList.value.map(img => uploadFile(img));
|
||||||
const results = await Promise.all(uploadPromises);
|
const results = await Promise.all(uploadPromises);
|
||||||
return results.map(res => res.data?.url || res.data);
|
return results.map(res => res.url);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交实况
|
// 提交实况
|
||||||
@@ -258,11 +259,20 @@ const submitStatus = async () => {
|
|||||||
height: 80px;
|
height: 80px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.uploaded-img image {
|
.uploaded-img .upload-img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
.uploaded-img .upload-delete{
|
||||||
|
position: absolute;
|
||||||
|
top: -5px;
|
||||||
|
right: -5px;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
border-radius: 3rpx;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
.del-img {
|
.del-img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -5px;
|
top: -5px;
|
||||||
|
|||||||
@@ -131,10 +131,6 @@ export const addVisitorData = (data) =>{
|
|||||||
return post("/api/visitor", data)
|
return post("/api/visitor", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通用文件上传
|
|
||||||
export const uploadImage = (data) => {
|
|
||||||
return upload('/api/resident/file/uploadImage',data);
|
|
||||||
}
|
|
||||||
// 上传单张图片
|
// 上传单张图片
|
||||||
export const uploadFile = (filePath) => {
|
export const uploadFile = (filePath) => {
|
||||||
return upload(filePath,'/api/resident/file/uploadImage');
|
return upload(filePath,'/api/resident/file/uploadImage');
|
||||||
|
|||||||
@@ -121,5 +121,5 @@ export const getComplainDetail = (data) => {
|
|||||||
}
|
}
|
||||||
// 联系物业
|
// 联系物业
|
||||||
export const getManagePhoneData = (data) => {
|
export const getManagePhoneData = (data) => {
|
||||||
return get('/banner/getManagePhone',data)
|
return get('/api/manage/banner/getManagePhone',data)
|
||||||
}
|
}
|
||||||
@@ -1,296 +1,256 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="contentStyle" style="">
|
<view class="contentStyle">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<uni-nav-bar title="更改手机号码" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
|
<uni-nav-bar
|
||||||
|
title="更改手机号码"
|
||||||
|
left-icon="left"
|
||||||
|
@click-left="goBack"
|
||||||
|
background-color="transparent"
|
||||||
|
:border="false"
|
||||||
|
>
|
||||||
</uni-nav-bar>
|
</uni-nav-bar>
|
||||||
|
|
||||||
|
|
||||||
<scroll-view class="page" scroll-y>
|
<scroll-view class="page" scroll-y>
|
||||||
|
|
||||||
<!-- 表单区域 -->
|
<!-- 表单区域 -->
|
||||||
<view class="form-container">
|
<view class="form-container">
|
||||||
<!-- 手机号输入框(带+86前缀) -->
|
<!-- 手机号输入框(带+86前缀) -->
|
||||||
<view class="input-group phone-input">
|
<view class="input-group phone-input">
|
||||||
<image class="iconStyle" src="http://47.104.199.163:9090/images/propertyImgs/phoneIcon.png"></image>
|
<image class="iconStyle" src="http://47.104.199.163:9090/images/propertyImgs/phoneIcon.png"></image>
|
||||||
<input class="input-item" type="number" v-model="phone" placeholder="请输入手机号码"
|
<input
|
||||||
placeholder-class="input-placeholder" maxlength="11" />
|
class="input-item"
|
||||||
|
type="number"
|
||||||
|
v-model="phone"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
placeholder-class="input-placeholder"
|
||||||
|
maxlength="11"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 验证码输入框(带获取验证码按钮) -->
|
<!-- 验证码输入框(带获取验证码按钮) -->
|
||||||
<view class="input-group code-input" style="padding: 0 0 0 20rpx;">
|
<view class="input-group code-input" style="padding: 0 0 0 20rpx;">
|
||||||
<image class="iconStyle" src="http://47.104.199.163:9090/images/propertyImgs/codeIcon.png">️</image>
|
<image class="iconStyle" src="http://47.104.199.163:9090/images/propertyImgs/codeIcon.png"></image>
|
||||||
|
<input
|
||||||
<input class="input-item code-item" type="number" v-model="code" placeholder="请输入验证码"
|
class="input-item code-item"
|
||||||
placeholder-class="input-placeholder" maxlength="6" />
|
type="number"
|
||||||
<button class="code-btn" :disabled="countdown > 0" @click="getCode">
|
v-model="code"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
placeholder-class="input-placeholder"
|
||||||
|
maxlength="6"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="code-btn"
|
||||||
|
:disabled="countdown > 0"
|
||||||
|
@click="getCode"
|
||||||
|
>
|
||||||
{{ countdown > 0 ? `${countdown}s后重发` : '获取验证码' }}
|
{{ countdown > 0 ? `${countdown}s后重发` : '获取验证码' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<view class="bottom-btn">
|
<view class="bottom-btn">
|
||||||
<button class="submit-btn" @click="onSubmit">确定</button>
|
<button class="submit-btn" @click="onSubmit">确定</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import { ref, onUnmounted } from 'vue'
|
||||||
onReady: function(e) {},
|
import { getAuthSendSmsCode, getUserChangePhone } from '../api/apiSub.js'
|
||||||
components: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onUnload() {
|
|
||||||
// 页面卸载时清除定时器
|
|
||||||
if (this.timer) clearInterval(this.timer)
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
phone: '',
|
|
||||||
code: '',
|
|
||||||
countdown: 0,
|
|
||||||
timer: null,
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
// 获取验证码
|
|
||||||
getCode() {
|
|
||||||
// 1. 手机号校验
|
|
||||||
const phoneReg = /^1[3-9]\d{9}$/
|
|
||||||
if (!this.phone) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入手机号',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!phoneReg.test(this.phone)) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '手机号格式不正确',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 模拟发送验证码(替换为实际接口)
|
|
||||||
uni.showLoading({
|
|
||||||
title: '发送中...'
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
uni.showToast({
|
|
||||||
title: '验证码已发送',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 3. 开启60秒倒计时
|
|
||||||
this.countdown = 60
|
|
||||||
this.timer = setInterval(() => {
|
|
||||||
if (this.countdown <= 1) {
|
|
||||||
clearInterval(this.timer)
|
|
||||||
this.countdown = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.countdown--
|
|
||||||
}, 1000)
|
|
||||||
}, 800)
|
|
||||||
},
|
|
||||||
|
|
||||||
// 提交修改
|
|
||||||
onSubmit() {
|
|
||||||
// 1. 基础校验
|
|
||||||
const phoneReg = /^1[3-9]\d{9}$/
|
|
||||||
if (!this.phone) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入手机号',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!phoneReg.test(this.phone)) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '手机号格式不正确',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.code) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入验证码',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
uni.showLoading({
|
|
||||||
title: '更换中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '更换成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
goBack() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/settingIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const statusBarHeight = ref(20)
|
||||||
|
const phone = ref('')
|
||||||
|
const code = ref('')
|
||||||
|
const countdown = ref(0)
|
||||||
|
let timer = null // 定时器无需响应式,用普通变量
|
||||||
|
|
||||||
|
// 获取验证码
|
||||||
|
const getCode = () => {
|
||||||
|
const phoneReg = /^1[3-9]\d{9}$/
|
||||||
|
if (!phone.value) {
|
||||||
|
uni.showToast({ title: '请输入手机号', icon: 'none' })
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
if (!phoneReg.test(phone.value)) {
|
||||||
|
uni.showToast({ title: '手机号格式不正确', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showLoading({ title: '发送中...' })
|
||||||
|
getAuthSendSmsCode({ phone: phone.value, scene: 'register' }).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({ title: '验证码已发送', icon: 'none' })
|
||||||
|
|
||||||
|
// 60秒倒计时
|
||||||
|
countdown.value = 60
|
||||||
|
timer = setInterval(() => {
|
||||||
|
if (countdown.value <= 1) {
|
||||||
|
clearInterval(timer)
|
||||||
|
countdown.value = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
countdown.value--
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '发送失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({ title: '发送失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交修改
|
||||||
|
const onSubmit = () => {
|
||||||
|
const phoneReg = /^1[3-9]\d{9}$/
|
||||||
|
if (!phone.value) {
|
||||||
|
uni.showToast({ title: '请输入手机号', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!phoneReg.test(phone.value)) {
|
||||||
|
uni.showToast({ title: '手机号格式不正确', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!code.value) {
|
||||||
|
uni.showToast({ title: '请输入验证码', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showLoading({ title: '更换中...', mask: true })
|
||||||
|
getUserChangePhone({ newPhone: phone.value, smsCode: code.value,scene:'change_phone' }).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({ title: '更换成功', icon: 'success' })
|
||||||
|
setTimeout(() => goBack(), 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '更换失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({ title: '更换失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
const goBack = () => {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/settingIndex'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面卸载清除定时器
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer) clearInterval(timer)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.contentStyle {
|
.contentStyle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
/* 关键:占满屏幕高度 */
|
background-color: #f9f9f9;
|
||||||
background-color: #f9f9f9;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 0px 40rpx;
|
padding: 0px 40rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
/* background-color: #fff; */
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 底部按钮 */
|
/* 底部按钮 */
|
||||||
.bottom-btn {
|
.bottom-btn {
|
||||||
padding: 20rpx 30rpx 40rpx;
|
padding: 20rpx 30rpx 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 表单容器 */
|
/* 表单容器 */
|
||||||
.form-container {
|
.form-container {}
|
||||||
/* padding: 60rpx 30rpx; */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 输入框组(手机号+验证码行) */
|
/* 输入框组(手机号+验证码行) */
|
||||||
.input-group {
|
.input-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
/* border: 1rpx solid #dcdcdc; */
|
border-radius: 8rpx;
|
||||||
border-radius: 8rpx;
|
margin-bottom: 30rpx;
|
||||||
margin-bottom: 30rpx;
|
padding: 0 20rpx;
|
||||||
padding: 0 20rpx;
|
box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
background-color: #fff;
|
||||||
background-color: #fff;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.iconStyle {
|
.iconStyle {
|
||||||
width:50rpx;
|
width: 50rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phone-input .input-item {
|
.phone-input .input-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
border: none;
|
border: none;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 验证码输入框 */
|
/* 验证码输入框 */
|
||||||
.code-input .code-item {
|
.code-input .code-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
border: none;
|
border: none;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-btn {
|
.code-btn {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #2F77FD;
|
background: #2F77FD;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.code-btn[disabled] {
|
.code-btn[disabled] {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 通用输入框样式 */
|
/* 通用输入框样式 */
|
||||||
.input-item {
|
.input-item {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding-left: 20rpx;
|
padding-left: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-placeholder {
|
.input-placeholder {
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 确定按钮 */
|
/* 确定按钮 */
|
||||||
.submit-btn {
|
.submit-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
line-height: 88rpx;
|
line-height: 88rpx;
|
||||||
background-color: #1677ff;
|
background-color: #1677ff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
border: none;
|
border: none;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-bar {
|
||||||
.status-bar {
|
width: 100vw;
|
||||||
width: 100vw;
|
height: 46px;
|
||||||
height: 46px;
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -34,98 +34,57 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import { ref } from 'vue'
|
||||||
onReady: function(e) {},
|
import { authChangePassword } from '../api/apiSub.js'
|
||||||
components: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
computed: {
|
|
||||||
|
|
||||||
|
|
||||||
},
|
const statusBarHeight = ref(20);
|
||||||
created() {
|
const oldPwd = ref('');
|
||||||
|
const newPwd = ref('');
|
||||||
},
|
const confirmPwd = ref('')
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
/* 设定状态栏默认高度 */
|
|
||||||
statusBarHeight: 20,
|
|
||||||
oldPwd: '',
|
|
||||||
newPwd: '',
|
|
||||||
confirmPwd: '',
|
|
||||||
|
|
||||||
|
|
||||||
|
// 方法
|
||||||
|
const onSubmit = () => {
|
||||||
|
if (!oldPwd.value) {
|
||||||
|
uni.showToast({ title: '请输入原密码', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!newPwd.value) {
|
||||||
|
uni.showToast({ title: '请输入新密码', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (newPwd.value !== confirmPwd.value) {
|
||||||
|
uni.showToast({ title: '两次密码不一致', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showLoading({ title: '修改中...', mask: true })
|
||||||
|
authChangePassword({
|
||||||
|
oldPassword: oldPwd.value,
|
||||||
|
newPassword: newPwd.value,
|
||||||
|
confirmPassword: confirmPwd.value
|
||||||
|
}).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({ title: '修改成功', icon: 'success' })
|
||||||
|
setTimeout(() => goBack(), 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '修改失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
},
|
}).catch((err) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({ title: err.msg || '修改失败', icon: 'none' })
|
||||||
methods: {
|
})
|
||||||
|
|
||||||
// 提交修改
|
|
||||||
onSubmit() {
|
|
||||||
// 1. 基础校验
|
|
||||||
if (!this.oldPwd) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入原密码',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!this.newPwd) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入新密码',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.newPwd !== this.confirmPwd) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '两次密码不一致',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showLoading({
|
|
||||||
title: '修改中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: '修改成功',
|
|
||||||
icon: 'success'
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
setTimeout(() => {
|
|
||||||
// 提交成功后跳转列表页
|
|
||||||
uni.hideLoading();
|
|
||||||
this.goBack();
|
|
||||||
}, 2500);
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
goBack() {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pageSubPack/my/settingIndex',
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const goBack = () =>{
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pageSubPack/my/settingIndex',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
onPullDownRefresh
|
onPullDownRefresh
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
authLogout
|
authLogout, getUserProfile, getUserNotify, changeUserNotify
|
||||||
} from '/pageSubPack/api/apiSub.js'
|
} from '/pageSubPack/api/apiSub.js'
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -47,7 +47,8 @@
|
|||||||
const cacheSize = ref(0)
|
const cacheSize = ref(0)
|
||||||
const settingList = ref([{
|
const settingList = ref([{
|
||||||
title: '更改手机号码',
|
title: '更改手机号码',
|
||||||
type: 'arrow'
|
type: 'text',
|
||||||
|
value: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '修改密码',
|
title: '修改密码',
|
||||||
@@ -144,7 +145,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onSwitchChange = (item, e) => {
|
const onSwitchChange = (item, e) => {
|
||||||
item.checked = e.detail.value
|
const checked = e.detail.value
|
||||||
|
const notifyEnabled = checked ? '1' : '0'
|
||||||
|
changeUserNotify({ notifyEnabled }).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
item.checked = checked
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '更新失败', icon: 'none' })
|
||||||
|
item.checked = !checked
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.showToast({ title: '更新失败', icon: 'none' })
|
||||||
|
item.checked = !checked
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const goBack = () => {
|
const goBack = () => {
|
||||||
@@ -152,6 +165,20 @@
|
|||||||
url: '/pages/myIndex/myIndex'
|
url: '/pages/myIndex/myIndex'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getUserProfile().then(res => {
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
const phone = res.data.phone || ''
|
||||||
|
settingList.value[0].value = phone
|
||||||
|
}
|
||||||
|
})
|
||||||
|
getUserNotify().then(res => {
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
settingList.value[2].checked = res.data.notifyEnabled === '1'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 值班电话 -->
|
<!-- 值班电话 -->
|
||||||
<view class="phone-item" v-for="phoneItems,phoneIndex in item.phoneList" :key="phoneIndex">
|
<view class="phone-item" v-for="phoneItems,phoneIndex in item.phoneList" :key="phoneIndex" @click="callPhone(phoneItems.phoneNum)">
|
||||||
<text class="phone-label">值班电话:</text>
|
<text class="phone-label">值班电话:</text>
|
||||||
<text class="phone-num">{{phoneItems.phoneNum}}</text>
|
<text class="phone-num">{{phoneItems.phoneNum}}</text>
|
||||||
<!-- <text class="phone-icon"></text> -->
|
<!-- <text class="phone-icon"></text> -->
|
||||||
@@ -44,39 +44,52 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import {getManagePhoneData} from '../api/apiSub.js'
|
import { getManagePhoneData } from '../api/apiSub.js'
|
||||||
|
|
||||||
const statusBarHeight = ref(20)
|
const statusBarHeight = ref(20)
|
||||||
const dataList = ref([
|
const dataList = ref([])
|
||||||
{
|
|
||||||
src: 'http://47.104.199.163:9090/images/propertyImgs/community1.png',
|
|
||||||
propertyName: '北境碧桂园小区物业中心',
|
|
||||||
propertyAddress: 'A栋3单元1801',
|
|
||||||
phoneList: [{
|
|
||||||
phoneNum: '080-12312312312',
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
phoneNum: '080-12312312312',
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
// ====方法=====
|
// ====方法=====
|
||||||
function callPhone(phone) {
|
function callPhone(phone) {
|
||||||
uni.makePhoneCall({
|
uni.makePhoneCall({
|
||||||
phoneNumber: phone.replace(/-/g, "")
|
phoneNumber: phone.replace(/-/g, ""),
|
||||||
|
fail: (err) => {
|
||||||
|
console.log('用户取消拨号', err)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function goBack() {
|
function goBack() {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/serviceIndex/serviceIndex',
|
url: '/pages/serviceIndex/serviceIndex',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
onMounted(() => {
|
||||||
}
|
const villageId = uni.getStorageSync('currentVillageId')
|
||||||
|
if (!villageId) {
|
||||||
|
uni.showToast({ title: '请先选择小区', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '加载中...' })
|
||||||
|
getManagePhoneData({ villageId }).then(res => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
const d = res.data
|
||||||
|
dataList.value = [{
|
||||||
|
src: d.villageImageUrl || 'http://47.104.199.163:9090/images/propertyImgs/community1.png',
|
||||||
|
propertyName: d.villageName || '',
|
||||||
|
propertyAddress: d.address || '',
|
||||||
|
phoneList: d.managePhone ? [{ phoneNum: d.managePhone }] : []
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: res.msg || '获取失败', icon: 'none' })
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
uni.showToast({ title: '获取失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user