update
This commit is contained in:
@@ -4,7 +4,7 @@ import XNav from "../../components/XNav.vue";
|
||||
import XLink from "../../components/XLink.vue";
|
||||
import XInput from "../../components/XInput.vue";
|
||||
import Api from "../../api/index.js";
|
||||
import {backPage, showToast} from "../../utils/uils.js";
|
||||
import {backPage, showToast, verifyForm} from "../../utils/uils.js";
|
||||
import SendMsg from "../../components/SendMsg.vue";
|
||||
|
||||
const form = reactive({
|
||||
@@ -12,8 +12,28 @@ const form = reactive({
|
||||
captcha: null,
|
||||
password: null,
|
||||
});
|
||||
const rules = {
|
||||
mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
title: '手机号',
|
||||
msg: '手机号错误',
|
||||
required: true,
|
||||
},
|
||||
captcha: {
|
||||
reg: /^\d{6}$/,
|
||||
title: '验证码',
|
||||
msg: '验证码错误',
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
title: '密码',
|
||||
msg: '密码错误',
|
||||
required: true,
|
||||
}
|
||||
}
|
||||
|
||||
const success = async () => {
|
||||
verifyForm(form, rules);
|
||||
const {msg} = await Api.system.editPassword(form);
|
||||
showToast(msg);
|
||||
backPage();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import {reactive} from "vue";
|
||||
import XInput from "../../components/XInput.vue";
|
||||
import XLink from "../../components/XLink.vue";
|
||||
import {showToast, toPage} from "../../utils/uils.js";
|
||||
import {showToast, toPage, verifyForm} from "../../utils/uils.js";
|
||||
import Api from "../../api/index.js";
|
||||
import {useUserStore} from "../../pinia/UserStore/index.js";
|
||||
|
||||
@@ -12,8 +12,22 @@ const form = reactive({
|
||||
mobile: '17502997128',
|
||||
password: '123456',
|
||||
});
|
||||
const rules = {
|
||||
mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
title: '手机号',
|
||||
msg: '手机号错误',
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
title: '密码',
|
||||
msg: '密码错误',
|
||||
required: true,
|
||||
}
|
||||
};
|
||||
|
||||
const success = async () => {
|
||||
verifyForm(form, rules);
|
||||
const {msg, data} = await Api.system.accountLogin(form);
|
||||
showToast(msg);
|
||||
UserStore.isLogin = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import {reactive} from "vue";
|
||||
import XInput from "../../components/XInput.vue";
|
||||
import {showToast, toPage} from "../../utils/uils.js";
|
||||
import {showToast, toPage, verifyForm} from "../../utils/uils.js";
|
||||
import SendMsg from "../../components/SendMsg.vue";
|
||||
import {useUserStore} from "../../pinia/UserStore/index.js";
|
||||
import Api from "../../api/index.js";
|
||||
@@ -12,8 +12,23 @@ const form = reactive({
|
||||
mobile: null,
|
||||
captcha: null,
|
||||
});
|
||||
const rules = {
|
||||
mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
title: '手机号',
|
||||
msg: '手机号错误',
|
||||
required: true,
|
||||
},
|
||||
captcha: {
|
||||
reg: /^\d{6}$/,
|
||||
title: '验证码',
|
||||
msg: '验证码错误',
|
||||
required: true,
|
||||
}
|
||||
};
|
||||
|
||||
const success = async () => {
|
||||
verifyForm(form, rules);
|
||||
const {msg, data} = await Api.system.accountLogin(form);
|
||||
showToast(msg);
|
||||
UserStore.isLogin = true;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {ref} from "vue";
|
||||
import AccountLogin from "./AccountLogin.vue";
|
||||
import PhoneLogin from "./PhoneLogin.vue";
|
||||
import WXOfficialAccount from "../../components/WXOfficialAccount.vue";
|
||||
import {onLoad} from "@dcloudio/uni-app";
|
||||
|
||||
const currentTab = ref(0);
|
||||
const showWX = ref(false);
|
||||
@@ -17,6 +18,11 @@ const tabs = [
|
||||
name: '账号密码登录',
|
||||
},
|
||||
];
|
||||
|
||||
onLoad((options) => {
|
||||
const {showWX: _showWX} = options;
|
||||
showWX.value = _showWX === '1';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -5,28 +5,47 @@ import BulletChat from "../login/BulletChat.vue";
|
||||
import XInput from "../../components/XInput.vue";
|
||||
import SendMsg from "../../components/SendMsg.vue";
|
||||
import Api from "../../api/index.js";
|
||||
import {showToast, verifyForm} from "../../utils/uils.js";
|
||||
import {showToast, toPage, verifyForm} from "../../utils/uils.js";
|
||||
|
||||
const form = reactive({
|
||||
mobile: null,
|
||||
wechat: null,
|
||||
mobile: null,
|
||||
captcha: null,
|
||||
password: null,
|
||||
invite: null,
|
||||
});
|
||||
|
||||
const rules = {
|
||||
wechat: {
|
||||
reg: /^[a-zA-Z0-9_-]{1,19}$/,
|
||||
msg: '微信号错误',
|
||||
title: '微信号',
|
||||
required: true,
|
||||
},
|
||||
mobile: {
|
||||
reg: /^1[3-9]\d{9}$/,
|
||||
msg: '手机号错误'
|
||||
title: '手机号',
|
||||
msg: '手机号错误',
|
||||
required: true,
|
||||
},
|
||||
wechat: {}
|
||||
captcha: {
|
||||
reg: /^\d{6}$/,
|
||||
title: '验证码',
|
||||
msg: '验证码错误',
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
title: '密码',
|
||||
msg: '密码错误',
|
||||
required: true,
|
||||
}
|
||||
};
|
||||
|
||||
const success = async () => {
|
||||
verifyForm(form, rules);
|
||||
const {msg} = await Api.system.register(form);
|
||||
showToast(msg);
|
||||
await toPage(`/pages/login/index?showWX=1`);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ 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";
|
||||
import {showToast, uploadFile} from "../../utils/uils.js";
|
||||
import Api from "../../api/index.js";
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
import EditNickName from './components/EditNickName.vue';
|
||||
@@ -51,6 +53,14 @@ const openTools = (key) => {
|
||||
onShow(() => {
|
||||
UserStore.getUserInfo();
|
||||
})
|
||||
|
||||
const updateAvatar = async () => {
|
||||
const [res] = await uploadFile({count: 1});
|
||||
const {data} = res;
|
||||
const {msg} = await Api.system.saveInfo({avatar: data});
|
||||
showToast(msg);
|
||||
await UserStore.getUserInfo();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -58,9 +68,10 @@ onShow(() => {
|
||||
<x-nav></x-nav>
|
||||
|
||||
<view class="bg-[#fff] !mt-[20rpx]">
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]">
|
||||
<view class="!flex items-center h-[108rpx] px-[32rpx]" @click="updateAvatar">
|
||||
<view class="title">头像</view>
|
||||
<image class="!size-[64rpx] !ml-auto" mode="aspectFill" :src="Avatar"></image>
|
||||
<image class="!size-[64rpx] !ml-auto rounded-[50%]" mode="aspectFill"
|
||||
:src="UserStore?.userInfo?.avatar"></image>
|
||||
<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