|
|
@@ -8,33 +8,33 @@
|
|
|
</view> -->
|
|
|
|
|
|
<!-- 邮箱输入框 -->
|
|
|
- <!-- <view class="input-group">
|
|
|
+ <view class="input-group">
|
|
|
<text class="title">邮箱:</text>
|
|
|
- <input type="text" v-model="userInfo.mail" placeholder="请输入邮箱地址" />
|
|
|
- </view> -->
|
|
|
+ <input type="text" v-model="userInfo.email" placeholder="请输入邮箱地址" />
|
|
|
+ </view>
|
|
|
|
|
|
- <!-- qq输入框 -->
|
|
|
+ <!-- qqnum输入框 -->
|
|
|
<view class="input-group">
|
|
|
<text class="title">qq:</text>
|
|
|
- <input type="text" v-model="userInfo.qq" placeholder="请输入qq" />
|
|
|
+ <input type="text" v-model="userInfo.qqnum" placeholder="请输入qq" />
|
|
|
</view>
|
|
|
|
|
|
<!-- msn输入框 -->
|
|
|
- <view class="input-group">
|
|
|
+ <!-- <view class="input-group">
|
|
|
<text class="title">msn:</text>
|
|
|
<input type="text" v-model="userInfo.msn" placeholder="请输入msn" />
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
|
|
|
<!-- 用户生日输入框 -->
|
|
|
- <!-- <view class="input-group">
|
|
|
+ <view class="input-group">
|
|
|
<text class="title">用户生日:</text>
|
|
|
<view class="example-body">
|
|
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="userInfo.birthday" @maskClick="maskClick" />
|
|
|
</view>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
|
|
|
<!-- 性别选择器 -->
|
|
|
- <!-- <view class="sex-selector">
|
|
|
+ <view class="sex-selector">
|
|
|
<radio-group @change="handleGenderChange">
|
|
|
<text class="title">性别:</text>
|
|
|
<view class="sexLabel">
|
|
|
@@ -46,7 +46,7 @@
|
|
|
</label>
|
|
|
</view>
|
|
|
</radio-group>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
|
|
|
<!-- 提交按钮 -->
|
|
|
<view class="primaryBtn">
|
|
|
@@ -56,24 +56,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import {
|
|
|
- ref,
|
|
|
- reactive,
|
|
|
- onMounted
|
|
|
- } from 'vue';
|
|
|
+ import {ref,reactive,onMounted} from 'vue';
|
|
|
import { useUserStore } from '@/store/user';
|
|
|
- import { modifyMe } from '@/api/mine';
|
|
|
- import $modal from '@/plugins/modal.js'
|
|
|
+ import { modifyMe,updateMyInfo } from '@/api/mine';
|
|
|
+ import $modal from '@/plugins/modal.js';
|
|
|
+ import $tab from '@/plugins/tab.js'
|
|
|
// 定义用户信息的响应式对象
|
|
|
const thisUser=useUserStore().user;
|
|
|
let userInfo = reactive({
|
|
|
- staffId:thisUser.useId,
|
|
|
+ userId:thisUser.useId,
|
|
|
// desktopPhone: thisUser.desktopPhone,
|
|
|
- // mail: thisUser.email,
|
|
|
- // sex: thisUser.sex,
|
|
|
- // birthday: thisUser.birthday,
|
|
|
- qq:thisUser.qqnum,
|
|
|
- msn:thisUser.msnnum
|
|
|
+ email: thisUser.email,
|
|
|
+ sex: thisUser.sex,
|
|
|
+ birthday: thisUser.birthday,
|
|
|
+ qqnum:thisUser.qqnum,
|
|
|
+ // msn:thisUser.msnnum
|
|
|
});
|
|
|
onMounted(()=>{
|
|
|
console.log('thisUser',thisUser);
|
|
|
@@ -81,9 +78,9 @@
|
|
|
})
|
|
|
|
|
|
|
|
|
- // function handleGenderChange(event) {
|
|
|
- // userInfo.sex = event.detail.value; // 更新性别
|
|
|
- // };
|
|
|
+ function handleGenderChange(event) {
|
|
|
+ userInfo.sex = event.detail.value; // 更新性别
|
|
|
+ };
|
|
|
|
|
|
// // 校验手机号码格式
|
|
|
// function validatePhone(desktopPhone) {
|
|
|
@@ -91,11 +88,11 @@
|
|
|
// return desktopPhoneRegex.test(desktopPhone);
|
|
|
// }
|
|
|
|
|
|
- // // 校验邮箱格式
|
|
|
- // function validateEmail(mail) {
|
|
|
- // const mailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; // 邮箱格式正则
|
|
|
- // return mailRegex.test(mail);
|
|
|
- // }
|
|
|
+ // 校验邮箱格式
|
|
|
+ function validateEmail(email) {
|
|
|
+ const mailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; // 邮箱格式正则
|
|
|
+ return mailRegex.test(email);
|
|
|
+ }
|
|
|
|
|
|
// 处理提交事件
|
|
|
function handleSubmit() {
|
|
|
@@ -107,22 +104,29 @@
|
|
|
// return; // 终止提交
|
|
|
// }
|
|
|
|
|
|
- // if (!validateEmail(userInfo.mail)) {
|
|
|
- // uni.showToast({
|
|
|
- // title: '邮箱格式不正确',
|
|
|
- // icon: 'none'
|
|
|
- // });
|
|
|
- // return; // 终止提交
|
|
|
- // }
|
|
|
- modifyMe(userInfo).then(res=>{
|
|
|
- // console.log(res);
|
|
|
+ if (userInfo.email!==""&&!validateEmail(userInfo.email)) {
|
|
|
+ $modal.showToast('邮箱格式不正确')
|
|
|
+ return; // 终止提交
|
|
|
+ }
|
|
|
+ // modifyMe(userInfo).then(res=>{
|
|
|
+ // // console.log(res);
|
|
|
+ // if("success"==res.returnMsg){
|
|
|
+ // $modal.showToast('修改成功');
|
|
|
+ // useUserStore().GetInfo().then(res=>{
|
|
|
+ // console.log("GetInfo",res);
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ updateMyInfo(userInfo).then(res=>{
|
|
|
if("success"==res.returnMsg){
|
|
|
$modal.showToast('修改成功');
|
|
|
useUserStore().GetInfo().then(res=>{
|
|
|
console.log("GetInfo",res);
|
|
|
})
|
|
|
+ setTimeout(()=>{
|
|
|
+ $tab.navigateBack();
|
|
|
+ },1000)
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
|
|
|
|
|
|
@@ -155,15 +159,85 @@
|
|
|
margin-bottom: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .sex-selector label {
|
|
|
- margin-right: 15rpx;
|
|
|
+ .sex-selector{
|
|
|
+ .sexLabel {
|
|
|
+ margin-top: 10px;
|
|
|
+ padding: 20rpx 20rpx;
|
|
|
+ background-color: white;
|
|
|
+ border: 1px solid gainsboro;
|
|
|
+ label {
|
|
|
+ margin-right: 15rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.primaryBtn {
|
|
|
margin-top: 70rpx;
|
|
|
button {
|
|
|
font-size: calc(18px + .5*(1rem - 16px));
|
|
|
}
|
|
|
}
|
|
|
+ ::v-deep .uni-date {
|
|
|
+ .uni-date-x {
|
|
|
+ padding: 10rpx 20rpx !important;
|
|
|
+ height: 70rpx !important;
|
|
|
+ .uni-icons {
|
|
|
+ font-size: calc(22px + 1.2*(1rem - 16px)) !important;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+
|
|
|
+ .uni-date__x-input {
|
|
|
+ height: auto;
|
|
|
+ font-size: calc(14px + 1.2*(1rem - 16px)) !important;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ::v-deep .uni-calendar__content {
|
|
|
+ margin: -20px;
|
|
|
+ margin-top: 20px;
|
|
|
+ .uni-calendar__header {
|
|
|
+ .uni-calendar__header-text {
|
|
|
+ font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ .uni-calendar__backtoday {
|
|
|
+ padding: 2px 8px 2px 10px !important;
|
|
|
+ font-size: calc(0.75rem + 0px) !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .uni-calendar__box {
|
|
|
+ .uni-calendar__weeks {
|
|
|
+ .uni-calendar__weeks-day {
|
|
|
+ .uni-calendar__weeks-day-text {
|
|
|
+ font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .uni-calendar__weeks-item {
|
|
|
+ .uni-calendar-item__weeks-box-item {
|
|
|
+ .uni-calendar-item__weeks-box-circle {
|
|
|
+ width: calc(8px + .5*(1rem - 16px)) !important;
|
|
|
+ height: calc(8px + .5*(1rem - 16px)) !important;
|
|
|
+ top: calc(5px - .25*(1rem - 16px)) !important;
|
|
|
+ right: calc(5px - .25*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ .uni-calendar-item__weeks-box-text {
|
|
|
+ font-size: calc(14px + .5*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ .uni-calendar-item__weeks-lunar-text {
|
|
|
+ font-size: calc(12px + .5*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .uni-date-changed {
|
|
|
+ .uni-date-changed--time-date {
|
|
|
+ font-size: calc(14px + 1*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ .uni-datetime-picker-text {
|
|
|
+ font-size: calc(14px + 1*(1rem - 16px)) !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
</style>
|