feat: 账号绑定

This commit is contained in:
xiaojunnuo
2024-09-23 01:52:42 +08:00
parent e86756e4c6
commit e0466409d0
3 changed files with 60 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
import { request } from "/@/api/service";
export function PreBindUser(userId: number) {
request({
url: "/sys/account/preBindUser",
method: "post",
data: { userId }
});
}

View File

@@ -9,7 +9,7 @@ import { IframeClient } from "@certd/lib-iframe";
import { onMounted, ref } from "vue";
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import * as api from "./api";
const iframeRef = ref();
const userStore = useUserStore();
@@ -22,7 +22,7 @@ type SubjectInfo = {
};
onMounted(() => {
const iframeClient = new IframeClient(iframeRef.value);
iframeClient.register("getSubjectInfo", (req) => {
iframeClient.register("getSubjectInfo", async (req) => {
const subjectInfo: SubjectInfo = {
subjectId: settingStore.installInfo.siteId,
installTime: settingStore.installInfo.installTime,
@@ -31,11 +31,22 @@ onMounted(() => {
};
return subjectInfo;
});
iframeClient.register("preBindSubject", async (req) => {
const userId = req.data.userId;
await api.PreBindUser(userId);
});
});
</script>
<style lang="less">
.cd-page-account {
.fs-page-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.account-iframe {
width: 100%;
height: 100%;