feat: 申请试用权限调整

This commit is contained in:
rd
2025-09-11 11:26:51 +08:00
parent 32bc0c4b95
commit 44e1ea9a06
15 changed files with 147 additions and 133 deletions

View File

@ -95,9 +95,9 @@ import axios from 'axios';
import { useUserStore } from '@/stores';
const store = useUserStore();
const userInfo = computed(() => {
return store.userInfo ?? {};
});
// const userInfo = computed(() => {
// return store.userInfo ?? {};
// });
const columns = [
{
@ -120,10 +120,13 @@ const formRef = ref();
const isSendCaptcha = ref(false);
const uploadInputRef = ref();
// console.log(userInfo.value)
const dataSource = computed(() => {
return userInfo.value ? [userInfo.value] : [];
return !isEmpty(store.userInfo) ? [store.userInfo] : [];
});
console.log(dataSource.value)
// 表单校验规则
const formRules = {
mobile: [

View File

@ -98,37 +98,25 @@
</template>
<script setup lang="ts">
import {
Checkbox,
Modal,
Button,
Form,
FormItem,
Input,
Space,
message,
Typography,
Card,
List,
Tabs,
} from 'ant-design-vue';
const { Link } = Typography;
const { TabPane } = Tabs;
import { Button, Checkbox, Form, FormItem, Input, message, Tabs, Typography } from 'ant-design-vue';
import PuzzleVerification from '../PuzzleVerification.vue';
import SelectAccountModal from '../select-account-modal/index.vue';
import { fetchLoginCaptCha, fetchAuthorizationsCaptcha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
import { postClearRateLimiter } from '@/api/all/common';
import { joinEnterpriseByInviteCode } from '@/api/all';
import { ref, reactive, onUnmounted, computed } from 'vue';
import { computed, onUnmounted, reactive, ref } from 'vue';
import { useUserStore } from '@/stores';
import { useEnterpriseStore } from '@/stores/modules/enterprise';
import { handleUserLogin, goUserLogin } from '@/utils/user';
import { handleUserLogin } from '@/utils/user';
import router from '@/router';
import { useRoute } from 'vue-router';
import icon1 from '@/assets/img/login/icon-close.png';
import icon2 from '@/assets/img/login/icon-open.png';
const { Link } = Typography;
const { TabPane } = Tabs;
const setPageType = inject('setPageType');
const formRef = ref();
@ -277,8 +265,9 @@ const onTabChange = () => {
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
if (code === 200) {
userStore.setUserInfo(data);
// 已开通
if (data.primary_enterprise?.subscribe_status === 1) {
if (userStore.isOpenEnterprise) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;
@ -293,14 +282,13 @@ const getProfileInfo = async () => {
}
}
} else {
router.push({name: 'Trial'})
router.push({ name: 'Trial' });
}
}
};
// 提交表单
const handleSubmit = async () => {
console.log('handleSubmit', disabledSubmitBtn.value);
if (disabledSubmitBtn.value) return;
try {

View File

@ -293,8 +293,10 @@ const handleVerificationSubmit = async () => {
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
if (code === 200) {
userStore.setUserInfo(data);
// 已开通
if (data.primary_enterprise?.subscribe_status === 1) {
if (userStore.isOpenEnterprise) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;

View File

@ -1,6 +1,6 @@
<template>
<Layout class="flex justify-center items-center trial-wrap">
<Layout.Header class="header-wrap">
<Layout.Header class="header-wrap cursor-pointer" @click="onLogoClick">
<div class="h-full px-24px">
<div class="w-full h-full relative flex justify-between">
<div class="flex items-center">
@ -65,7 +65,7 @@
</section>
<!-- 建立商务联系中 -->
<section class="w-full" v-if="primary_enterprise.audit_status === 1">
<section class="w-full" v-if="primary_enterprise?.audit_status === 1">
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
<img :src="icon2" width="96" height="96" class="mb-8px" />
<p class="cts !text-18px !lh-26px mb-8px">您的试用申请已提交</p>
@ -87,7 +87,7 @@
</section>
<!-- 试用到期 -->
<section class="w-full" v-if="primary_enterprise.subscribe_status === 4">
<section class="w-full" v-if="primary_enterprise?.subscribe_status === 4">
<div class="rounded-16px bg-#fff px-36px pt-80px pb-60px flex flex-col items-center">
<img :src="icon1" width="96" height="96" class="mb-8px" />
<p class="cts !text-18px !lh-26px mb-8px">试用已到期</p>
@ -113,8 +113,10 @@
</template>
<script setup lang="ts">
import { Layout, Form, Button, FormItem, Input, Steps } from 'ant-design-vue';
import { Button, Form, FormItem, Input, Layout, Steps } from 'ant-design-vue';
import RightSide from '@/layouts/components/navbar/components/right-side/index.vue';
import { useRouter } from 'vue-router';
import { postCreateEnterprises } from '@/api/all/login';
import { exactFormatTime } from '@/utils/tools';
import { handleUserHome } from '@/utils/user';
@ -126,6 +128,7 @@ import icon2 from './img/icon-check.png';
// 0-未开通1-已开通2-试用中3-已到期4-试用结束
type Status = 0 | 1 | 2 | 3 | 4;
const router = useRouter();
const userStore = useUserStore();
const formRef = ref();
const submitting = ref(false);
@ -175,7 +178,7 @@ const formRules = {
};
const primary_enterprise = computed(() => userStore.userInfo?.primary_enterprise);
const hasOpenEnterprise = computed(() => userStore.isOpenEnterprise);
const trialingStepsItems = computed(() => {
return [
{
@ -209,6 +212,16 @@ const trialEndStepsItems = computed(() => {
];
});
const onLogoClick = () => {
if (hasOpenEnterprise.value) {
handleUserHome();
} else {
router.push({
name: 'Trial',
});
}
};
const handleSubmit = async () => {
submitting.value = true;
formRef.value