update
This commit is contained in:
59
src/pages/userInfo/components/EditNickName.vue
Normal file
59
src/pages/userInfo/components/EditNickName.vue
Normal file
@@ -0,0 +1,59 @@
|
||||
<script setup>
|
||||
import {reactive, ref, onMounted} from "vue";
|
||||
import XInfoModal from "../../../components/XInfoModal.vue";
|
||||
import XForm from "../../../components/XForm.vue";
|
||||
import XFormItem from "../../../components/XFormItem.vue";
|
||||
import XInput from "../../../components/XInput.vue";
|
||||
import {useUserStore} from "../../../pinia/UserStore/index.js";
|
||||
import Api from "../../../api/index.js";
|
||||
import {showToast} from "../../../utils/uils.js";
|
||||
|
||||
const XFormRef = ref();
|
||||
const show = defineModel('show');
|
||||
const rules = {
|
||||
nickname: {
|
||||
reg: /^[^]*\S[^]*$/,
|
||||
msg: '请输入正确的微信号',
|
||||
}
|
||||
};
|
||||
const form = reactive({
|
||||
nickname: null,
|
||||
});
|
||||
|
||||
const success = async () => {
|
||||
XFormRef.value.verify();
|
||||
const {msg} = await Api.system.saveInfo({...form, type: 2});
|
||||
showToast(msg);
|
||||
await UserStore.getUserInfo();
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const UserStore = useUserStore();
|
||||
onMounted(() => {
|
||||
form.nickname = UserStore.userInfo.nickname;
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<x-info-modal v-model:show="show" @success="success">
|
||||
<view class="title">修改昵称</view>
|
||||
|
||||
<x-form ref="XFormRef" :model="form" :rules="rules">
|
||||
<x-form-item>
|
||||
<x-input height="72rpx" placeholder="微信号" v-model:model-value="form.nickname"></x-input>
|
||||
</x-form-item>
|
||||
</x-form>
|
||||
</x-info-modal>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.title {
|
||||
color: rgb(29, 33, 41);
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
letter-spacing: 0;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +1,43 @@
|
||||
<script setup>
|
||||
import {reactive, ref} from "vue";
|
||||
import {onMounted, reactive, ref} from "vue";
|
||||
import XInfoModal from "../../../components/XInfoModal.vue";
|
||||
import XForm from "../../../components/XForm.vue";
|
||||
import XFormItem from "../../../components/XFormItem.vue";
|
||||
import XInput from "../../../components/XInput.vue";
|
||||
import SendMsg from "../../../components/SendMsg.vue";
|
||||
import Api from "../../../api/index.js";
|
||||
import {showToast} from "../../../utils/uils.js";
|
||||
import {useUserStore} from "../../../pinia/UserStore/index.js";
|
||||
|
||||
const XFormRef = ref();
|
||||
const UserStore = useUserStore();
|
||||
const show = defineModel('show');
|
||||
const rules = {};
|
||||
const rules = {
|
||||
mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
msg: '请输入正确的手机号',
|
||||
},
|
||||
captcha: {
|
||||
reg: /.+/,
|
||||
msg: '请输入正确的验证码',
|
||||
},
|
||||
password: {
|
||||
reg: /.+/,
|
||||
msg: '请输入正确的密码',
|
||||
},
|
||||
};
|
||||
const form = reactive({
|
||||
phone: null,
|
||||
verificationCode: null,
|
||||
mobile: null,
|
||||
captcha: null,
|
||||
password: null,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = async () => {
|
||||
XFormRef.value.verify();
|
||||
const {msg} = await Api.system.savePassword(form);
|
||||
showToast(msg);
|
||||
await UserStore.getUserInfo();
|
||||
show.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -26,10 +47,10 @@ const success = () => {
|
||||
|
||||
<x-form ref="XFormRef" :model="form" :rules="rules">
|
||||
<x-form-item label="手机号">
|
||||
<x-input height="72rpx" placeholder="微信号" v-model:model-value="form.phone"></x-input>
|
||||
<x-input height="72rpx" placeholder="微信号" v-model:model-value="form.mobile"></x-input>
|
||||
</x-form-item>
|
||||
<x-form-item label="验证码">
|
||||
<send-msg height="72rpx" v-model:model-value="form.verificationCode"></send-msg>
|
||||
<send-msg height="72rpx" :mobile="form.mobile" v-model:model-value="form.captcha" :type="3"></send-msg>
|
||||
</x-form-item>
|
||||
<x-form-item label="新登录密码">
|
||||
<x-input height="72rpx" placeholder="新登录密码" v-model:model-value="form.password"></x-input>
|
||||
|
||||
@@ -5,36 +5,44 @@ import XForm from "../../../components/XForm.vue";
|
||||
import XFormItem from "../../../components/XFormItem.vue";
|
||||
import XInput from "../../../components/XInput.vue";
|
||||
import SendMsg from "../../../components/SendMsg.vue";
|
||||
import {useUserStore} from "../../../pinia/UserStore/index.js";
|
||||
import Api from "../../../api/index.js";
|
||||
import {showToast} from "../../../utils/uils.js";
|
||||
|
||||
const XFormRef = ref();
|
||||
const UserStore = useUserStore();
|
||||
const show = defineModel('show');
|
||||
const rules = {
|
||||
oldPhone: {
|
||||
reg: /^\[1][3-9]\d{9}$/,
|
||||
old_mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
msg: '请输入正确的手机号',
|
||||
},
|
||||
oldVerificationCode: {
|
||||
old_captcha: {
|
||||
reg: /.+/,
|
||||
msg: '请输入正确验证码',
|
||||
},
|
||||
new_mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
msg: '请输入正确的手机号',
|
||||
},
|
||||
newPhone: {
|
||||
reg: /^\[1][3-9]\d{9}$/,
|
||||
msg: '请输入正确的手机号',
|
||||
},
|
||||
newVerificationCode: {
|
||||
new_captcha: {
|
||||
reg: /.+/,
|
||||
msg: '请输入正确的手机号',
|
||||
msg: '请输入正确验证码',
|
||||
},
|
||||
};
|
||||
const form = reactive({
|
||||
oldPhone: null,
|
||||
oldVerificationCode: null,
|
||||
newPhone: null,
|
||||
newVerificationCode: null,
|
||||
old_mobile: null,
|
||||
old_captcha: null,
|
||||
new_mobile: null,
|
||||
new_captcha: null,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = async () => {
|
||||
XFormRef.value.verify();
|
||||
const {msg} = await Api.system.saveMobile(form);
|
||||
showToast(msg);
|
||||
show.value = false;
|
||||
await UserStore.getUserInfo();
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -44,16 +52,26 @@ const success = () => {
|
||||
|
||||
<x-form ref="XFormRef" :model="form" :rules="rules">
|
||||
<x-form-item label="原手机号">
|
||||
<x-input height="72rpx" placeholder="原手机号" v-model:model-value="form.oldPhone"></x-input>
|
||||
<x-input height="72rpx" placeholder="原手机号" v-model:model-value="form.old_mobile"></x-input>
|
||||
</x-form-item>
|
||||
<x-form-item label="验证码">
|
||||
<send-msg height="72rpx" v-model:model-value="form.oldVerificationCode"></send-msg>
|
||||
<send-msg
|
||||
height="72rpx"
|
||||
:mobile="form.old_mobile"
|
||||
v-model:model-value="form.old_captcha"
|
||||
:type="4">
|
||||
</send-msg>
|
||||
</x-form-item>
|
||||
<x-form-item label="原手机号">
|
||||
<x-input height="72rpx" placeholder="新手机号" v-model:model-value="form.oldPhone"></x-input>
|
||||
<x-form-item label="新手机号">
|
||||
<x-input height="72rpx" placeholder="新手机号" v-model:model-value="form.new_mobile"></x-input>
|
||||
</x-form-item>
|
||||
<x-form-item label="验证码">
|
||||
<send-msg height="72rpx" v-model:model-value="form.newVerificationCode"></send-msg>
|
||||
<send-msg
|
||||
height="72rpx"
|
||||
:mobile="form.new_mobile"
|
||||
v-model:model-value="form.new_captcha"
|
||||
:type="5">
|
||||
</send-msg>
|
||||
</x-form-item>
|
||||
</x-form>
|
||||
</x-info-modal>
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
<script setup>
|
||||
import {reactive, ref} from "vue";
|
||||
import {reactive, ref, onMounted} from "vue";
|
||||
import XInfoModal from "../../../components/XInfoModal.vue";
|
||||
import XForm from "../../../components/XForm.vue";
|
||||
import XFormItem from "../../../components/XFormItem.vue";
|
||||
import XInput from "../../../components/XInput.vue";
|
||||
import {useUserStore} from "../../../pinia/UserStore/index.js";
|
||||
import Api from "../../../api/index.js";
|
||||
import {showToast} from "../../../utils/uils.js";
|
||||
|
||||
const XFormRef = ref();
|
||||
const show = defineModel('show');
|
||||
const rules = {
|
||||
wxCode: {
|
||||
reg: /^\[1][3-9]\d{9}$/,
|
||||
wechat: {
|
||||
reg: /^[^]*\S[^]*$/,
|
||||
msg: '请输入正确的微信号',
|
||||
}
|
||||
};
|
||||
const form = reactive({
|
||||
wxCode: null,
|
||||
wechat: null,
|
||||
});
|
||||
|
||||
const success = () => {
|
||||
const success = async () => {
|
||||
XFormRef.value.verify();
|
||||
const {msg} = await Api.system.saveInfo({...form, type: 3});
|
||||
showToast(msg);
|
||||
await UserStore.getUserInfo();
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
const UserStore = useUserStore();
|
||||
onMounted(() => {
|
||||
form.wechat = UserStore.userInfo.wechat;
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -28,7 +40,7 @@ const success = () => {
|
||||
|
||||
<x-form ref="XFormRef" :model="form" :rules="rules">
|
||||
<x-form-item>
|
||||
<x-input height="72rpx" placeholder="微信号" v-model:model-value="form.wxCode"></x-input>
|
||||
<x-input height="72rpx" placeholder="微信号" v-model:model-value="form.wechat"></x-input>
|
||||
</x-form-item>
|
||||
</x-form>
|
||||
</x-info-modal>
|
||||
|
||||
@@ -3,23 +3,32 @@ import {defineAsyncComponent, ref} from "vue";
|
||||
import Right from "../../static/icons/right.png";
|
||||
import Avatar from "../../static/images/Avatar.png";
|
||||
import XNav from "../../components/XNav.vue";
|
||||
import {useUserStore} from "../../pinia/UserStore/index.js";
|
||||
import {onShow} from "@dcloudio/uni-app";
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
import EditNickName from './components/EditNickName.vue';
|
||||
import EditWxCode from './components/EditWxCode.vue';
|
||||
import EditPhone from './components/EditPhone.vue';
|
||||
import EditPassWord from './components/EditPassWord.vue';
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-PLUS
|
||||
const EditNickName = defineAsyncComponent(() => import('./components/EditNickName.vue'));
|
||||
const EditWxCode = defineAsyncComponent(() => import('./components/EditWxCode.vue'));
|
||||
const EditPhone = defineAsyncComponent(() => import('./components/EditPhone.vue'));
|
||||
const EditPassWord = defineAsyncComponent(() => import('./components/EditPassWord.vue'));
|
||||
// #endif
|
||||
|
||||
const UserStore = useUserStore();
|
||||
|
||||
const showTool = ref(false);
|
||||
const tool = ref('EditWxCode');
|
||||
const tools = [
|
||||
{
|
||||
key: 'EditNickName',
|
||||
component: EditNickName,
|
||||
},
|
||||
{
|
||||
key: 'EditWxCode',
|
||||
component: EditWxCode,
|
||||
@@ -38,6 +47,10 @@ const openTools = (key) => {
|
||||
tool.value = key;
|
||||
showTool.value = true;
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
UserStore.getUserInfo();
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -52,9 +65,9 @@ const openTools = (key) => {
|
||||
</view>
|
||||
<view class="h-[3rpx] w-full bg-[rgb(229,230,235)] !ml-[32rpx]"></view>
|
||||
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]">
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]" @click="openTools('EditNickName')">
|
||||
<view class="title">昵称</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">酷酷猛吃</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">{{ UserStore?.userInfo?.nickname }}</view>
|
||||
<image class="!w-[16rpx] !ml-[16rpx]" mode="widthFix" :src="Right"></image>
|
||||
</view>
|
||||
<view class="h-[3rpx] w-full bg-[rgb(229,230,235)] !ml-[32rpx]"></view>
|
||||
@@ -63,21 +76,14 @@ const openTools = (key) => {
|
||||
<view class="bg-[#fff] !mt-[20rpx]">
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]" @click="openTools('EditPhone')">
|
||||
<view class="title">手机号</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">178****0214</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">{{ UserStore?.userInfo?.mobile }}</view>
|
||||
<image class="!w-[16rpx] !ml-[16rpx]" mode="widthFix" :src="Right"></image>
|
||||
</view>
|
||||
<view class="h-[3rpx] w-full bg-[rgb(229,230,235)] !ml-[32rpx]"></view>
|
||||
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]" @click="openTools('EditWxCode')">
|
||||
<view class="title">微信号</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">za395739</view>
|
||||
<image class="!w-[16rpx] !ml-[16rpx]" mode="widthFix" :src="Right"></image>
|
||||
</view>
|
||||
<view class="h-[3rpx] w-full bg-[rgb(229,230,235)] !ml-[32rpx]"></view>
|
||||
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]">
|
||||
<view class="title">昵称</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">酷酷猛吃</view>
|
||||
<view class="!ml-auto whitespace-nowrap value">{{ UserStore?.userInfo?.wechat }}</view>
|
||||
<image class="!w-[16rpx] !ml-[16rpx]" mode="widthFix" :src="Right"></image>
|
||||
</view>
|
||||
<view class="h-[3rpx] w-full bg-[rgb(229,230,235)] !ml-[32rpx]"></view>
|
||||
|
||||
Reference in New Issue
Block a user