|
|
@@ -1,46 +1,50 @@
|
|
|
<template>
|
|
|
- <FlexCol gap="gap.xl" padding="space.lg">
|
|
|
- <FlexCol center>
|
|
|
- <Text fontConfig="subText">欢迎使用闽南文化数字资源采集</Text>
|
|
|
- <Text fontConfig="subText">技术支持:18649931391</Text>
|
|
|
+ <CommonRoot>
|
|
|
+ <FlexCol gap="gap.xl" padding="space.lg">
|
|
|
+ <FlexCol center>
|
|
|
+ <Text fontConfig="subText">欢迎使用闽南文化数字资源采集</Text>
|
|
|
+ <Text fontConfig="subText">技术支持:18649931391</Text>
|
|
|
+ </FlexCol>
|
|
|
+ <FlexCol position="relative" radius="radius.md" backgroundColor="white" overflow="hidden">
|
|
|
+ <LoadingPage :loading="loading" loadingText="登录中..." />
|
|
|
+ <DynamicForm
|
|
|
+ ref="formRef"
|
|
|
+ :model="formModel"
|
|
|
+ :options="formDefine"
|
|
|
+ />
|
|
|
+ </FlexCol>
|
|
|
+ <FlexCol gap="gap.md">
|
|
|
+ <Button type="primary" block :loading="loading" @click="handleSubmit">
|
|
|
+ 登录
|
|
|
+ </Button>
|
|
|
+ <Button block @click="back()">
|
|
|
+ 返回
|
|
|
+ </Button>
|
|
|
+ </FlexCol>
|
|
|
+ <XBarSpace />
|
|
|
</FlexCol>
|
|
|
- <FlexCol position="relative" radius="radius.md" backgroundColor="white" overflow="hidden">
|
|
|
- <LoadingPage :loading="loading" loadingText="登录中..." />
|
|
|
- <DynamicForm
|
|
|
- ref="formRef"
|
|
|
- :model="formModel"
|
|
|
- :options="formDefine"
|
|
|
- />
|
|
|
- </FlexCol>
|
|
|
- <FlexCol gap="gap.md">
|
|
|
- <Button type="primary" block :loading="loading" @click="handleSubmit">
|
|
|
- 登录
|
|
|
- </Button>
|
|
|
- <Button block @click="back()">
|
|
|
- 返回
|
|
|
- </Button>
|
|
|
- </FlexCol>
|
|
|
- <XBarSpace />
|
|
|
- </FlexCol>
|
|
|
+ </CommonRoot>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
|
-import { toast } from '@/components/utils/DialogAction';
|
|
|
+import { waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
+import { confirm, toast } from '@/components/dialog/CommonRoot';
|
|
|
+import { back, redirectTo } from '@/components/utils/PageAction';
|
|
|
import Button from '@/components/basic/Button.vue';
|
|
|
import XBarSpace from '@/components/layout/space/XBarSpace.vue';
|
|
|
import DynamicForm from '@/components/dynamic/DynamicForm.vue';
|
|
|
import type { IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
|
|
|
import type { FormProps } from '@/components/form/Form.vue';
|
|
|
import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
|
-import { back, redirectTo } from '@/components/utils/PageAction';
|
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
|
import FlexRow from '@/components/layout/FlexRow.vue';
|
|
|
import Text from '@/components/basic/Text.vue';
|
|
|
import LoadingPage from '@/components/display/loading/LoadingPage.vue';
|
|
|
-import { waitTimeOut } from '@imengyu/imengyu-utils';
|
|
|
+import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
|
|
|
+import CommonRoot from '@/components/dialog/CommonRoot.vue';
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
const formRef = ref<IDynamicFormRef>();
|
|
|
@@ -111,14 +115,16 @@ const formDefine: IDynamicFormOptions = {
|
|
|
],
|
|
|
};
|
|
|
|
|
|
+const tipBindWechat = new MemoryTimeOut('TipBindWechat', 1000 * 3600 * 72);
|
|
|
+
|
|
|
async function handleSubmit() {
|
|
|
if (!formRef.value)
|
|
|
return;
|
|
|
try {
|
|
|
await formRef.value.validate();
|
|
|
} catch {
|
|
|
- uni.showToast({
|
|
|
- title: '有必填项未填写,请检查',
|
|
|
+ toast({
|
|
|
+ content: '有必填项未填写,请检查',
|
|
|
icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
@@ -130,8 +136,8 @@ async function handleSubmit() {
|
|
|
? formModel.value.account.trim()
|
|
|
: formModel.value.mobile.trim();
|
|
|
if (!account) {
|
|
|
- uni.showToast({
|
|
|
- title: '请输入账号',
|
|
|
+ toast({
|
|
|
+ content: '请输入账号',
|
|
|
icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
@@ -142,13 +148,32 @@ async function handleSubmit() {
|
|
|
await authStore.loginCollect(account, formModel.value.password, loginType);
|
|
|
toast('您已成功登录');
|
|
|
await new Promise((r) => setTimeout(r, 200));
|
|
|
+
|
|
|
+ let nextPage = '';
|
|
|
if (authStore.loginType === 0) {
|
|
|
- uni.redirectTo({ url: '/pages/collect/inheritor' });
|
|
|
+ nextPage = '/pages/collect/inheritor';
|
|
|
} else if (authStore.loginType === 1) {
|
|
|
- uni.redirectTo({ url: '/pages/collect/admin' });
|
|
|
- } else {
|
|
|
- uni.switchTab({ url: '/pages/user/index' });
|
|
|
+ nextPage = '/pages/collect/admin';
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果用户未绑定微信,提示用户绑定微信
|
|
|
+ if (!authStore.userInfo?.openId && tipBindWechat.isTimeout()) {
|
|
|
+ tipBindWechat.recordTime();
|
|
|
+
|
|
|
+ if (await confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '绑定微信账号后登录更方便,是否前往绑定?',
|
|
|
+ confirmText: '前往绑定',
|
|
|
+ cancelText: '稍后绑定',
|
|
|
+ width: 580,
|
|
|
+ })) {
|
|
|
+ redirectTo('bind-wx', {
|
|
|
+ nextPage
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+ redirectTo(nextPage);
|
|
|
} catch (e) {
|
|
|
showError(e);
|
|
|
} finally {
|