feat: 支持vip转移

This commit is contained in:
xiaojunnuo
2024-09-23 14:04:33 +08:00
parent e85b4da2e3
commit 361e8fe7ae
12 changed files with 104 additions and 55 deletions
@@ -23,3 +23,11 @@ export async function UnbindUser(userId: number) {
data: { userId }
});
}
export async function UpdateLicense(data: any) {
await request({
url: "/sys/account/updateLicense",
method: "post",
data
});
}
@@ -10,6 +10,7 @@ import { onMounted, ref } from "vue";
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import * as api from "./api";
import { notification } from "ant-design-vue";
const iframeRef = ref();
const userStore = useUserStore();
@@ -21,7 +22,12 @@ type SubjectInfo = {
expiresTime?: number;
};
onMounted(() => {
const iframeClient = new IframeClient(iframeRef.value);
const iframeClient = new IframeClient(iframeRef.value, (e: any) => {
notification.error({
message: " error",
description: e.message
});
});
iframeClient.register("getSubjectInfo", async (req) => {
const subjectInfo: SubjectInfo = {
subjectId: settingStore.installInfo.siteId,
@@ -47,6 +53,15 @@ onMounted(() => {
const userId = req.data.userId;
await api.UnbindUser(userId);
});
iframeClient.register("updateLicense", async (req) => {
await api.UpdateLicense(req.data);
await userStore.reInit();
notification.success({
message: "更新成功",
description: "专业版已激活"
});
});
});
</script>
@@ -46,7 +46,7 @@ export async function GetObj(id: any) {
* @returns {*}
* @constructor
*/
export function getPermissionIds(roleId: any) {
export async function getPermissionIds(roleId: any) {
return await request({
url: apiPrefix + "/getPermissionIds",
method: "post",
@@ -61,7 +61,7 @@ export function getPermissionIds(roleId: any) {
* @returns {*}
* @constructor
*/
export function DoAuthz(roleId: any, permissionIds: any) {
export async function DoAuthz(roleId: any, permissionIds: any) {
return await request({
url: apiPrefix + "/authz",
method: "post",