Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
wangshuaiswim 2023-03-31 16:06:37 +08:00
commit a286a1e222
3 changed files with 60 additions and 24 deletions

View File

@ -4,7 +4,7 @@
<div class="content"> <div class="content">
<div class="title">第三方账户绑定</div> <div class="title">第三方账户绑定</div>
<!-- 已登录-绑定三方账号 --> <!-- 已登录-绑定三方账号 -->
<template v-if="!token"> <template v-if="!!token">
<div class="info"> <div class="info">
<j-card style="width: 280px"> <j-card style="width: 280px">
<template #title> <template #title>
@ -14,9 +14,14 @@
</div> </div>
</template> </template>
<div class="info-body"> <div class="info-body">
<img :src="getImage('/bind/jetlinksLogo.png')" /> <img
<p>账号admin</p> :src="
<p>用户名超级管理员</p> user?.avatar ||
getImage('/bind/jetlinksLogo.png')
"
/>
<p>账号{{ user?.username }}</p>
<p>用户名{{ user?.name }}</p>
</div> </div>
</j-card> </j-card>
<img :src="getImage('/bind/Vector.png')" /> <img :src="getImage('/bind/Vector.png')" />
@ -30,12 +35,13 @@
<div class="info-body"> <div class="info-body">
<img <img
:src=" :src="
accountInfo?.avatar || iconMap.get(
getImage('/bind/wechat-webapp.png') bindUser?.applicationProvider,
) || getImage('/apply/provider1.png')
" "
/> />
<p>用户名-</p> <p>账号{{ bindUser?.result?.username || '-' }}</p>
<p>名称{{ accountInfo?.name || '-' }}</p> <p>用户名{{ bindUser?.result?.name || '-' }}</p>
</div> </div>
</j-card> </j-card>
</div> </div>
@ -54,10 +60,18 @@
class="arrow" class="arrow"
:src="getImage('/bind/Vector.png')" :src="getImage('/bind/Vector.png')"
/> />
<img :src="getImage('/bind/wechat-webapp.png')" /> <img
:src="iconMap.get(bindUser?.applicationProvider)"
/>
</div> </div>
<div class="desc"> <div class="desc">
你已通过微信授权,完善以下登录信息即可以完成绑定 你已通过
{{
bindUser?.type === 'dingtalk-ent-app'
? '钉钉'
: '微信'
}}
授权,完善以下登录信息即可以完成绑定
</div> </div>
<div class="login-form"> <div class="login-form">
<j-form layout="vertical"> <j-form layout="vertical">
@ -120,7 +134,7 @@ import { Form } from 'ant-design-vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { applicationInfo, bindAccount } from '@/api/bind'; import { applicationInfo, bindAccount } from '@/api/bind';
import { code, authLogin } from '@/api/login'; import { code, authLogin, userDetail } from '@/api/login';
const useForm = Form.useForm; const useForm = Form.useForm;
@ -130,24 +144,44 @@ interface formData {
verifyCode: string; 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 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 getUrlCode = () => {
const url = new URLSearchParams(window.location.href); const url = new URLSearchParams(window.location.href);
return url.get('code') as string; 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();
/** /**
* 立即绑定 * 立即绑定

View File

@ -57,7 +57,7 @@ const getTreeData = () => {
if (props.mode === 'api') { if (props.mode === 'api') {
tree[i].schemas = item.components.schemas; tree[i].schemas = item.components.schemas;
tree[i].children = combData(item.paths); tree[i].children = combData(item.paths);
} else if (i < values.length - 2) { } else if (i < values.length - 1) {
const paths = filterPath( const paths = filterPath(
item.paths, item.paths,
values[values.length - 1].result as string[], values[values.length - 1].result as string[],

View File

@ -225,6 +225,8 @@ const defaultImg = getImage('/apply/provider1.png');
const iconMap = new Map(); const iconMap = new Map();
iconMap.set('dingtalk-ent-app', getImage('/bind/dingtalk.png')); iconMap.set('dingtalk-ent-app', getImage('/bind/dingtalk.png'));
iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png')); iconMap.set('wechat-webapp', getImage('/bind/wechat-webapp.png'));
iconMap.set('internal-standalone', getImage('/apply/provider1.png'));
iconMap.set('third-party', getImage('/apply/provider5.png'));
const onFinish = async () => { const onFinish = async () => {
try { try {