From 348ef4570c3e08e44fb50b7483124ff8eee62ee3 Mon Sep 17 00:00:00 2001
From: JiangQiming <291854119@qq.com>
Date: Fri, 31 Mar 2023 15:08:05 +0800
Subject: [PATCH] fix: 11216
---
src/views/account/Center/bind/index.vue | 80 ++++++++++++++++++-------
1 file changed, 57 insertions(+), 23 deletions(-)
diff --git a/src/views/account/Center/bind/index.vue b/src/views/account/Center/bind/index.vue
index 13dafe71..5d590f9b 100644
--- a/src/views/account/Center/bind/index.vue
+++ b/src/views/account/Center/bind/index.vue
@@ -4,7 +4,7 @@
第三方账户绑定
-
+
@@ -14,9 +14,14 @@
-
![]()
-
账号:admin
-
用户名:超级管理员
+
![]()
+
账号:{{ user?.username }}
+
用户名:{{ user?.name }}
@@ -30,12 +35,13 @@
![]()
-
用户名:-
-
名称:{{ accountInfo?.name || '-' }}
+
账号:{{ bindUser?.result?.username || '-' }}
+
用户名:{{ bindUser?.result?.name || '-' }}
@@ -54,10 +60,18 @@
class="arrow"
:src="getImage('/bind/Vector.png')"
/>
-
+
- 你已通过微信授权,完善以下登录信息即可以完成绑定
+ 你已通过
+ {{
+ bindUser?.type === 'dingtalk-ent-app'
+ ? '钉钉'
+ : '微信'
+ }}
+ 授权,完善以下登录信息即可以完成绑定
@@ -120,7 +134,7 @@ import { Form } from 'ant-design-vue';
import { message } from 'ant-design-vue';
import { applicationInfo, bindAccount } from '@/api/bind';
-import { code, authLogin } from '@/api/login';
+import { code, authLogin, userDetail } from '@/api/login';
const useForm = Form.useForm;
@@ -130,24 +144,44 @@ interface formData {
verifyCode: string;
}
+const iconMap = new Map();
+iconMap.set('dingtalk-ent-app', getImage('/notice/dingtalk.png'));
+iconMap.set('wechat-webapp', getImage('/notice/wechat.png'));
+iconMap.set('internal-standalone', getImage('/apply/provider1.png'));
+iconMap.set('third-party', getImage('/apply/provider5.png'));
+
const token = computed(() => LocalStore.get(TOKEN_KEY));
-// 已登录直接绑定
+/**
+ * 用户信息
+ */
+const user = ref();
+const getDetail = () => {
+ if (!token) return;
+ userDetail().then((res: any) => {
+ user.value = res?.result;
+ });
+};
+getDetail();
+
+/**
+ * 三方应用信息
+ */
+const bindUser = ref();
+const getAppInfo = async () => {
+ const code = getUrlCode();
+ const { result } = await applicationInfo(code);
+ bindUser.value = result;
+};
+getAppInfo();
+
+/**
+ * 获取url参数
+ */
const getUrlCode = () => {
const url = new URLSearchParams(window.location.href);
return url.get('code') as string;
};
-// 三方应用信息
-const accountInfo = ref({
- avatar: '',
- name: '',
-});
-const getAppInfo = async () => {
- const code = getUrlCode();
- const res = await applicationInfo(code);
- accountInfo.value = res?.result?.result;
-};
-getAppInfo();
/**
* 立即绑定