mirror of https://github.com/certd/certd
perf: 专业版试用,无需绑定账号
parent
c6488b58f5
commit
c7c4318c11
|
@ -108,6 +108,23 @@ export class PlusService {
|
||||||
return res.accessToken;
|
return res.accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getVipTrial() {
|
||||||
|
const plusRequestService = await this.getPlusRequestService();
|
||||||
|
await this.register();
|
||||||
|
const res = await plusRequestService.request({
|
||||||
|
url: '/activation/subject/vip/trialGet',
|
||||||
|
method: 'POST',
|
||||||
|
});
|
||||||
|
if (res.license) {
|
||||||
|
await this.updateLicense(res.license);
|
||||||
|
return {
|
||||||
|
duration: res.duration,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
throw new Error('您已经领取过VIP试用了');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async requestWithToken(config: HttpRequestConfig) {
|
async requestWithToken(config: HttpRequestConfig) {
|
||||||
const plusRequestService = await this.getPlusRequestService();
|
const plusRequestService = await this.getPlusRequestService();
|
||||||
const token = await this.getAccessToken();
|
const token = await this.getAccessToken();
|
||||||
|
|
|
@ -73,7 +73,6 @@ export abstract class CertApplyBasePlugin extends AbstractTaskPlugin {
|
||||||
})
|
})
|
||||||
renewDays!: number;
|
renewDays!: number;
|
||||||
|
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: "成功后邮件通知",
|
title: "成功后邮件通知",
|
||||||
value: true,
|
value: true,
|
||||||
|
|
|
@ -7,3 +7,11 @@ export async function doActive(form: any) {
|
||||||
data: form
|
data: form
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getVipTrial() {
|
||||||
|
return await request({
|
||||||
|
url: "/sys/plus/getVipTrial",
|
||||||
|
method: "post",
|
||||||
|
data: {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -12,13 +12,14 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { computed, reactive, ref } from "vue";
|
import { computed, reactive } from "vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from "ant-design-vue";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { useSettingStore } from "/@/store/modules/settings";
|
import { useSettingStore } from "/@/store/modules/settings";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useUserStore } from "/@/store/modules/user";
|
import { useUserStore } from "/@/store/modules/user";
|
||||||
|
|
||||||
const settingStore = useSettingStore();
|
const settingStore = useSettingStore();
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
@ -129,21 +130,27 @@ function goAccount() {
|
||||||
router.push("/sys/account");
|
router.push("/sys/account");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getVipTrial() {
|
||||||
|
const res = await api.getVipTrial();
|
||||||
|
message.success(`恭喜,您已获得专业版${res.duration}天试用`);
|
||||||
|
await settingStore.init();
|
||||||
|
}
|
||||||
|
|
||||||
function openTrialModal() {
|
function openTrialModal() {
|
||||||
Modal.destroyAll();
|
Modal.destroyAll();
|
||||||
|
|
||||||
modal.confirm({
|
modal.confirm({
|
||||||
title: "7天专业版试用获取",
|
title: "7天专业版试用获取",
|
||||||
okText: "立即去绑定账号",
|
okText: "立即获取",
|
||||||
onOk() {
|
onOk() {
|
||||||
goAccount();
|
getVipTrial();
|
||||||
},
|
},
|
||||||
width: 600,
|
width: 600,
|
||||||
content: () => {
|
content: () => {
|
||||||
return (
|
return (
|
||||||
<div class="flex-col mt-10 mb-10">
|
<div class="flex-col mt-10 mb-10">
|
||||||
<div>感谢您对开源项目的支持</div>
|
<div>感谢您对开源项目的支持</div>
|
||||||
<div>绑定袖手账号后,即可获取7天专业版试用</div>
|
<div>点击确认,即可获取7天专业版试用</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,12 @@ export class SysPlusController extends BaseController {
|
||||||
|
|
||||||
return this.ok(true);
|
return this.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post('/getVipTrial', { summary: 'sys:settings:edit' })
|
||||||
|
async getVipTrial(@Body(ALL) body) {
|
||||||
|
const res = await this.plusService.getVipTrial();
|
||||||
|
return this.ok(res);
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// @Get('/test', { summary: Constants.per.guest })
|
// @Get('/test', { summary: Constants.per.guest })
|
||||||
// async test() {
|
// async test() {
|
||||||
|
|
Loading…
Reference in New Issue