boke-devops 0.0.30 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +14 -11
- package/packages/boke-devops-vue/package-lock.json +15276 -3531
- package/packages/boke-devops-vue/package.json +60 -58
- package/packages/boke-devops-vue/src/Provider/Provider.vue +6 -0
- package/packages/boke-devops-vue/src/Provider/store.ts +7 -2
- package/packages/boke-devops-vue/src/{AegisUser → UserAvatar}/__tests__/__snapshots__/Avatar.test.js.snap +63 -60
- package/packages/boke-devops-vue/src/{AegisUser/store.ts → UserAvatar/avatar.store.ts} +10 -1
- package/packages/boke-devops-vue/src/UserAvatar/user-avatar-card.vue +188 -0
- package/packages/boke-devops-vue/src/{AegisUser → UserAvatar}/user-avatar-group.vue +2 -2
- package/packages/boke-devops-vue/src/{AegisUser → UserAvatar}/user-avatar.vue +79 -68
- package/packages/boke-devops-vue/src/{AegisUser → UserSelect}/multiple-user-select.vue +13 -22
- package/packages/boke-devops-vue/src/index.ts +22 -22
- package/packages/boke-devops-vue/src/utils/encode.ts +132 -0
- package/packages/boke-devops-vue/types/Provider/store.d.ts +4 -0
- package/packages/boke-devops-vue/types/UserAvatar/avatar.store.d.ts +9 -0
- package/packages/boke-devops-vue/types/UserAvatar/encode.d.ts +1 -0
- package/packages/boke-devops-vue/types/UserAvatar/user-avatar-card.vue.d.ts +24 -0
- package/packages/boke-devops-vue/types/UserAvatar/user-avatar-group.vue.d.ts +44 -0
- package/packages/boke-devops-vue/types/UserAvatar/user-avatar.vue.d.ts +207 -0
- package/packages/boke-devops-vue/types/UserSelect/multiple-user-select.vue.d.ts +106 -0
- package/packages/boke-devops-vue/types/index.d.ts +10 -8
- package/packages/boke-devops-vue/vite.config.ts +29 -29
- package/packages/boke-docs/.dumirc.ts +3 -2
- package/packages/boke-docs/docs/components/Avatar/__test__/__snapshots__/user_avatar.test.js.snap +255 -0
- package/packages/boke-docs/docs/components/Avatar/__test__/user_avatar.test.js +18 -0
- package/packages/boke-docs/docs/components/Avatar/demo/normal.vue +1 -0
- package/packages/boke-docs/docs/components/Avatar/index.md +18 -0
- package/packages/boke-docs/docs/components/AvatarGroup/__test__/__snapshots__/user_avatar.test.js.snap +174 -0
- package/packages/boke-docs/docs/components/AvatarGroup/__test__/user_avatar.test.js +18 -0
- package/packages/boke-docs/docs/components/AvatarGroup/demo/normal.vue +36 -0
- package/packages/boke-docs/docs/components/AvatarGroup/demo/with_provider.vue +59 -0
- package/packages/boke-docs/docs/components/AvatarGroup/index.md +28 -0
- package/packages/boke-docs/docs/components/UserSelect/__test__/__snapshots__/user_select.test.js.snap +347 -0
- package/packages/boke-docs/docs/components/UserSelect/__test__/user_select.test.js +18 -0
- package/packages/boke-docs/docs/components/UserSelect/demo/normal.vue +14 -0
- package/packages/boke-docs/docs/components/UserSelect/index.md +29 -2
- package/packages/boke-docs/node_modules/.cache/logger/umi.log +14 -0
- package/packages/boke-docs/package.json +1 -1
- package/packages/boke-docs/public/logo.png +0 -0
- package/packages/boke-js-bridge/package.json +2 -2
- package/test-setup-env.js +52 -0
- package/vitest.config.js +6 -1
- package/packages/boke-devops-vue/demo/App.vue +0 -62
- package/packages/boke-devops-vue/demo/main.ts +0 -7
- /package/packages/boke-devops-vue/src/{AegisUser → UserAvatar}/__tests__/Avatar.test.js +0 -0
- /package/packages/boke-devops-vue/src/{style/variables.less → utils/style.global.less} +0 -0
@@ -1,59 +1,61 @@
|
|
1
|
-
{
|
2
|
-
"name": "@devops/boke-devops-vue",
|
3
|
-
"version": "0.0.
|
4
|
-
"description": "BokeDevopsUI",
|
5
|
-
"
|
6
|
-
"
|
7
|
-
"
|
8
|
-
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"build": "
|
12
|
-
"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
"ant-design-vue": "^
|
21
|
-
"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"@types/
|
30
|
-
"@types/
|
31
|
-
"@
|
32
|
-
"@
|
33
|
-
"@
|
34
|
-
"@
|
35
|
-
"@
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"stylelint
|
47
|
-
"stylelint-
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
"
|
56
|
-
|
57
|
-
|
58
|
-
|
1
|
+
{
|
2
|
+
"name": "@devops/boke-devops-vue",
|
3
|
+
"version": "0.0.38",
|
4
|
+
"description": "BokeDevopsUI",
|
5
|
+
"author": "Julone",
|
6
|
+
"main": "dist/index.es.js",
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"start": "vite --host",
|
10
|
+
"dev": "npm start",
|
11
|
+
"build:tsc": "vue-tsc --emitDeclarationOnly -d",
|
12
|
+
"build": "pnpm run build:tsc && vite build",
|
13
|
+
"lint": "eslint 'src/**/*.{js,ts,tsx,jsx}' 'examples/**/*.{js,ts,tsx,jsx}' --fix"
|
14
|
+
},
|
15
|
+
"files": [
|
16
|
+
"dist",
|
17
|
+
"types"
|
18
|
+
],
|
19
|
+
"dependencies": {
|
20
|
+
"@ant-design/icons-vue": "^7.0.1",
|
21
|
+
"@devops/boke-devops-vue": "file:",
|
22
|
+
"ant-design-vue": "^4.2.1",
|
23
|
+
"protobufjs": "^7.3.0"
|
24
|
+
},
|
25
|
+
"peerDependencies": {
|
26
|
+
"vue": ">=3.2.0"
|
27
|
+
},
|
28
|
+
"devDependencies": {
|
29
|
+
"@types/lodash": "^4.14.182",
|
30
|
+
"@types/lodash-es": "^4.17.12",
|
31
|
+
"@types/node": "^16.4.13",
|
32
|
+
"@types/qs": "^6.9.7",
|
33
|
+
"@vitejs/plugin-vue": "^2.3.1",
|
34
|
+
"@vitejs/plugin-vue-jsx": "^1.1.7",
|
35
|
+
"@vue/compiler-sfc": "^3.0.5",
|
36
|
+
"@vue/eslint-config-typescript": "^11.0.0",
|
37
|
+
"@web/test-runner": "^0.13.15",
|
38
|
+
"husky": "^7.0.4",
|
39
|
+
"less": "^4.1.1",
|
40
|
+
"lint-staged": "^12.1.2",
|
41
|
+
"lodash": "^4.17.21",
|
42
|
+
"lodash-es": "^4.17.21",
|
43
|
+
"prettier": "^2.4.1",
|
44
|
+
"rollup-plugin-visualizer": "^5.9.0",
|
45
|
+
"sass": "^1.37.5",
|
46
|
+
"stylelint": "~13.13.1",
|
47
|
+
"stylelint-config-prettier": "~9.0.3",
|
48
|
+
"stylelint-less": "1.0.1",
|
49
|
+
"stylelint-order": "~4.1.0",
|
50
|
+
"typescript": "^4.3.5",
|
51
|
+
"vite": "^2.7.1",
|
52
|
+
"vite-plugin-dts": "^3.6.0",
|
53
|
+
"vue-tsc": "^1.0.8"
|
54
|
+
},
|
55
|
+
"license": "MIT",
|
56
|
+
"keywords": [],
|
57
|
+
"authors": [
|
58
|
+
"Julone"
|
59
|
+
],
|
60
|
+
"gitHead": "35743a6fa655ec881297d4c5a2d023c1fe63b58b"
|
59
61
|
}
|
@@ -19,4 +19,10 @@ const props = defineProps({
|
|
19
19
|
const {gc, gs} = mergeConfig(props)
|
20
20
|
provide("globalConfig", gc)
|
21
21
|
provide("globalState", gs)
|
22
|
+
|
23
|
+
console.log(
|
24
|
+
` %c ${'@devops/boke-devops-vue'} %c 由 BOKE运维部 构建 `,
|
25
|
+
'color: #fff; background: #ea3c37; padding:5px 0;',
|
26
|
+
'background: #333; color: #fff; padding:5px 0;',
|
27
|
+
);
|
22
28
|
</script>
|
@@ -1,21 +1,26 @@
|
|
1
1
|
import {reactive} from "vue"
|
2
2
|
import {mergeWith} from "lodash-es"
|
3
3
|
|
4
|
+
// 属性生效规则: 组件Props > 全局Provider的Props > 默认Props
|
4
5
|
export const globalConfig = {
|
5
6
|
avatar: {
|
6
7
|
user_name: "name",
|
7
8
|
dept_name: "dept_name",
|
8
9
|
user_avatar: "avatar",
|
9
|
-
user_id: "user_id"
|
10
|
+
user_id: "user_id" // cmdb中的user_id
|
11
|
+
},
|
12
|
+
avatarCard: {
|
13
|
+
"api_url": process.env.NODE_ENV == 'development'? "https://devopstest.pocketcity.com/api": "//devops.pocketcity.com/api",
|
14
|
+
"enabled": true,
|
10
15
|
}
|
11
16
|
}
|
12
17
|
|
13
|
-
|
14
18
|
export const globalState = reactive({
|
15
19
|
global_always_avatar_is_hihglight: null, //如果设置这个, 自带的头像高亮将失效
|
16
20
|
})
|
17
21
|
|
18
22
|
export const mergeConfig = (props: any) => {
|
23
|
+
|
19
24
|
return {
|
20
25
|
gc: mergeWith({}, globalConfig, props.globalConfig),
|
21
26
|
gs: mergeWith({}, globalState, props.globalState), // TIP: 为什么需要合并到{}, 因为要避免污染全局的属性
|
@@ -1,60 +1,63 @@
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
2
|
-
|
3
|
-
exports[`Link changes the state when hovered 1`] = `
|
4
|
-
<div
|
5
|
-
data-v-
|
6
|
-
style="display: inline-flex;"
|
7
|
-
>
|
8
|
-
<span
|
9
|
-
class="ant-tag css-dev-only-do-not-override-16pw25h ant-tag-default boke-useravator-wrapper"
|
10
|
-
data-v-
|
11
|
-
style="padding: 2px 12px 2px 2px; border-radius: 50px;"
|
12
|
-
>
|
13
|
-
|
14
|
-
<div
|
15
|
-
class="left-icon"
|
16
|
-
data-v-
|
17
|
-
>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
2
|
+
|
3
|
+
exports[`Link changes the state when hovered 1`] = `
|
4
|
+
<div
|
5
|
+
data-v-7871c292=""
|
6
|
+
style="display: inline-flex;"
|
7
|
+
>
|
8
|
+
<span
|
9
|
+
class="ant-tag css-dev-only-do-not-override-16pw25h ant-tag-default boke-useravator-wrapper"
|
10
|
+
data-v-7871c292=""
|
11
|
+
style="padding: 2px 12px 2px 2px; border-radius: 50px;"
|
12
|
+
>
|
13
|
+
|
14
|
+
<div
|
15
|
+
class="left-icon"
|
16
|
+
data-v-7871c292=""
|
17
|
+
>
|
18
|
+
|
19
|
+
<span
|
20
|
+
class="avator-icon ant-avatar ant-avatar-circle ant-avatar-image css-dev-only-do-not-override-16pw25h"
|
21
|
+
data-v-7871c292=""
|
22
|
+
style="width: 28px; height: 28px; line-height: 28px; font-size: 18px;"
|
23
|
+
>
|
24
|
+
<img
|
25
|
+
src="https://s1-imfile.fewebp"
|
26
|
+
/>
|
27
|
+
</span>
|
28
|
+
<!---->
|
29
|
+
|
30
|
+
</div>
|
31
|
+
|
32
|
+
|
33
|
+
<div
|
34
|
+
class="label"
|
35
|
+
data-v-7871c292=""
|
36
|
+
>
|
37
|
+
<span
|
38
|
+
class="realname"
|
39
|
+
data-v-7871c292=""
|
40
|
+
>
|
41
|
+
Julone
|
42
|
+
</span>
|
43
|
+
<span
|
44
|
+
class="id"
|
45
|
+
data-v-7871c292=""
|
46
|
+
>
|
47
|
+
<span
|
48
|
+
data-v-7871c292=""
|
49
|
+
>
|
50
|
+
运维部
|
51
|
+
</span>
|
52
|
+
</span>
|
53
|
+
</div>
|
54
|
+
<!--v-if-->
|
55
|
+
<!--v-if-->
|
56
|
+
|
57
|
+
sdafasd
|
58
|
+
|
59
|
+
|
60
|
+
<!---->
|
61
|
+
</span>
|
62
|
+
</div>
|
63
|
+
`;
|
@@ -7,17 +7,26 @@ export const useCustomProps = () => {
|
|
7
7
|
const injectGlobalConfig = inject("globalConfig") as any
|
8
8
|
const injectGlobalState = inject("globalState") as any
|
9
9
|
const mergedProps = mergeWith({}, globalConfig.avatar, injectGlobalConfig?.avatar, props?.customProps || {});
|
10
|
+
const mergedAvatarCardProps = mergeWith({}, globalConfig.avatarCard, injectGlobalConfig?.avatarCard);
|
11
|
+
|
10
12
|
|
11
13
|
let NAME_KEY = toRef(mergedProps, 'user_name')
|
12
14
|
let AVATAR_KEY = toRef(mergedProps, 'user_avatar')
|
13
15
|
let DEPT_KEY = toRef(mergedProps, 'dept_name')
|
14
16
|
let USERID_KEY = toRef(mergedProps, 'user_id')
|
17
|
+
|
18
|
+
|
15
19
|
const global_always_avatar_is_hihglight = injectGlobalState?.global_always_avatar_is_hihglight || globalState?.global_always_avatar_is_hihglight
|
20
|
+
const global_disabled_avatar_card = injectGlobalConfig?.avatarCard?.enabled == false
|
21
|
+
const AVATAR_CARD_URL = mergedAvatarCardProps.api_url
|
22
|
+
|
16
23
|
return {
|
17
24
|
NAME_KEY,
|
18
25
|
AVATAR_KEY,
|
19
26
|
DEPT_KEY,
|
20
27
|
USERID_KEY,
|
21
|
-
global_always_avatar_is_hihglight
|
28
|
+
global_always_avatar_is_hihglight,
|
29
|
+
global_disabled_avatar_card,
|
30
|
+
AVATAR_CARD_URL
|
22
31
|
}
|
23
32
|
}
|
@@ -0,0 +1,188 @@
|
|
1
|
+
<template>
|
2
|
+
<div
|
3
|
+
class="mps-user-avator-rich-conent"
|
4
|
+
style="display: flex; gap: 16px; flex-direction: row; align-items: flex-start;"
|
5
|
+
>
|
6
|
+
<div style="z-index: 2">
|
7
|
+
<img :src="userinfo.user_icon" style="width: 70px; height: 70px;border-radius: 500px;margin-top: 10px;" />
|
8
|
+
</div>
|
9
|
+
<div style="z-index: 2">
|
10
|
+
<p
|
11
|
+
class="demo-rich-content__name"
|
12
|
+
style="margin: 0 0 6px 0; font-weight: 500"
|
13
|
+
>
|
14
|
+
<a-space :size="12" :spacer="spacer" :wrap="false">
|
15
|
+
<span style="font-weight:bold">{{ userinfo.user_name }}</span>
|
16
|
+
<span class="dept_class">{{ userinfo.dept_name }}</span>
|
17
|
+
<span class="dept_class" v-if="userinfo.dept_name != extraInfo?.min_fs_department_name && extraInfo?.min_fs_department_name">{{ extraInfo?.min_fs_department_name }}</span>
|
18
|
+
</a-space>
|
19
|
+
</p>
|
20
|
+
<p
|
21
|
+
v-if="extraInfo"
|
22
|
+
class="demo-rich-content__mention"
|
23
|
+
style="
|
24
|
+
margin: 0 0 8px 0;
|
25
|
+
font-size: 14px;
|
26
|
+
color: var(--el-color-info);
|
27
|
+
"
|
28
|
+
>
|
29
|
+
<a-space :wrap="true" :size="2">
|
30
|
+
<ATag :bordered="false" color="orange" v-for="el in extraInfogroups" :key="el.name" size="small">
|
31
|
+
{{el.name}}
|
32
|
+
</ATag>
|
33
|
+
<a-button type="link" size="small" @click="seeAllRoles = !seeAllRoles, $emit('pinCard')" style="zoom: 0.8">关联角色({{extraInfogroupsCount}})<CaretDownOutlined :rotate="seeAllRoles?180: 0" /></a-button>
|
34
|
+
</a-space>
|
35
|
+
</p>
|
36
|
+
<p
|
37
|
+
v-if="extraInfo"
|
38
|
+
class="demo-rich-content__mention"
|
39
|
+
style="
|
40
|
+
margin: 0 0 6px 0;
|
41
|
+
font-size: 14px;
|
42
|
+
color: var(--el-color-info);
|
43
|
+
"
|
44
|
+
>
|
45
|
+
<a-space :wrap="true" :size="2">
|
46
|
+
<MpsRoleTag v-for="(el,index) in projectslist" :key="el" size="small">
|
47
|
+
{{el}}
|
48
|
+
</MpsRoleTag>
|
49
|
+
<a-button type="link" size="small" @click="seeAllProjects = !seeAllProjects, $emit('pinCard')" style="zoom: 0.8">关联项目({{projectslistCount}})<CaretDownOutlined :rotate="seeAllProjects?180: 0" /></a-button>
|
50
|
+
</a-space>
|
51
|
+
</p>
|
52
|
+
<p class="demo-rich-content__desc" style="margin: 8px 0 0">
|
53
|
+
<a-space :size="2" :spacer="spacer">
|
54
|
+
<a-button
|
55
|
+
type="primary"
|
56
|
+
size="small"
|
57
|
+
:disabled="!extraInfo"
|
58
|
+
@click="onChat(extraInfo?.fs_open_id)"
|
59
|
+
>
|
60
|
+
飞书联系
|
61
|
+
</a-button>
|
62
|
+
</a-space>
|
63
|
+
</p>
|
64
|
+
<a style="position:absolute; right: 8px; bottom: 8px;float:right; font-size: 12px; opacity: 0.8; color: #ccc; transform: translateY(0px)" href="https://devops.pocketcity.com/">数据来源: Aegis</a>
|
65
|
+
|
66
|
+
</div>
|
67
|
+
<div
|
68
|
+
class="mps-user-avator-rich-conent_after"
|
69
|
+
:style="{
|
70
|
+
'background-image': `url('https://sf3-scmcdn-cn.feishucdn.com/obj/feishu-static/lark/open/app_store/images/banner-2c2539b4.png')`,
|
71
|
+
opacity: 0.4,
|
72
|
+
'background-size': 'cover',
|
73
|
+
'background-position-y': '-30px',
|
74
|
+
}"
|
75
|
+
></div>
|
76
|
+
</div>
|
77
|
+
</template>
|
78
|
+
<style lang="scss" scoped>
|
79
|
+
.mps-user-avator-rich-conent {
|
80
|
+
min-width: 270px;
|
81
|
+
max-width: 350px;
|
82
|
+
:deep(.el-avatar) {
|
83
|
+
img {
|
84
|
+
width: 100%;
|
85
|
+
cursor: zoom-in;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
:deep(.dept_class){
|
89
|
+
color: #333;
|
90
|
+
font-size: 12px;
|
91
|
+
}
|
92
|
+
|
93
|
+
.mps-user-avator-rich-conent_after {
|
94
|
+
content: '';
|
95
|
+
position: absolute;
|
96
|
+
right: 0;
|
97
|
+
bottom: 0;
|
98
|
+
left: 0;
|
99
|
+
top: 0px;
|
100
|
+
z-index: 1;
|
101
|
+
border-radius: 8px;
|
102
|
+
|
103
|
+
background-repeat: no-repeat;
|
104
|
+
background-size: contain;
|
105
|
+
background-position: left top;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
</style>
|
109
|
+
<script>
|
110
|
+
import { defineComponent, createVNode } from 'vue'
|
111
|
+
import {Tag as ATag ,Divider as ADivider, Space as ASpace, Button as AButton} from "ant-design-vue"
|
112
|
+
import {hex_sha1} from "../utils/encode";
|
113
|
+
import {CaretDownOutlined} from "@ant-design/icons-vue"
|
114
|
+
import {useCustomProps} from "./avatar.store"
|
115
|
+
|
116
|
+
export default defineComponent({
|
117
|
+
props: ['userinfo'],
|
118
|
+
components: { MpsRoleTag: ATag, MpsGroupTag: ATag, MpsDictTag: ATag ,ASpace,AButton,ATag,CaretDownOutlined},
|
119
|
+
emit: ['pinCard'],
|
120
|
+
data() {
|
121
|
+
return {
|
122
|
+
showViewer: false,
|
123
|
+
spacer: createVNode(ADivider, {
|
124
|
+
direction: 'vertical',
|
125
|
+
style: { margin: '0 2px' },
|
126
|
+
}),
|
127
|
+
isDark: false,
|
128
|
+
extraInfo: null,
|
129
|
+
seeAllProjects: false,
|
130
|
+
seeAllRoles: false
|
131
|
+
}
|
132
|
+
},
|
133
|
+
computed: {
|
134
|
+
projectslist(){
|
135
|
+
return (this.extraInfo?.projects_list || []).filter((item, index) => {
|
136
|
+
if(this.seeAllProjects) {
|
137
|
+
return true
|
138
|
+
}
|
139
|
+
return index < 4
|
140
|
+
})
|
141
|
+
},
|
142
|
+
projectslistCount(){
|
143
|
+
return (this.extraInfo?.projects_list || [])?.length
|
144
|
+
},
|
145
|
+
extraInfogroups(){
|
146
|
+
return (this.extraInfo?.groups || []).filter((item, index) => {
|
147
|
+
if(this.seeAllRoles) {
|
148
|
+
return true
|
149
|
+
}
|
150
|
+
return index < 4
|
151
|
+
})
|
152
|
+
},
|
153
|
+
extraInfogroupsCount(){
|
154
|
+
return (this.extraInfo?.groups || []).length
|
155
|
+
}
|
156
|
+
|
157
|
+
},
|
158
|
+
methods: {
|
159
|
+
onChat(account) {
|
160
|
+
window.open(`feishu://applink.feishu.cn/client/chat/open?openId=${account}`)
|
161
|
+
},
|
162
|
+
},
|
163
|
+
mounted() {
|
164
|
+
// 预备参数
|
165
|
+
const jsapi_ticket = Math.random().toString(36).substr(2, 18)
|
166
|
+
const noncestr = Math.random().toString(36).substr(2, 7)
|
167
|
+
const user_id = this.userinfo?.user_id
|
168
|
+
const timestamp = Date.now()
|
169
|
+
// 加密参数生成签名
|
170
|
+
const encode = `jsapi_ticket=${jsapi_ticket}&noncestr=${noncestr}&user_id=${user_id}×tamp=${timestamp}`
|
171
|
+
const signature = hex_sha1(encode)
|
172
|
+
// 查询
|
173
|
+
try {
|
174
|
+
const {AVATAR_CARD_URL} = useCustomProps();
|
175
|
+
const api = `/users/getUserInfo/?${encode}&signature=${signature}`
|
176
|
+
fetch(AVATAR_CARD_URL + api,).then(res=> res.json()).then(res=> {
|
177
|
+
if (res.code == 0) {
|
178
|
+
this.extraInfo = res.data
|
179
|
+
}
|
180
|
+
})
|
181
|
+
} catch (error) {
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
},
|
186
|
+
})
|
187
|
+
</script>
|
188
|
+
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<rmp-user-avatar v-else-if="data.length == 1" :data="data[0]" :key="data[0]?.[AVATAR_KEY]" :size="size" :hide-popover="false"
|
4
4
|
:show-text="props.showText" :is_highlight="() => props.is_highlight(data[0])" :tag="props.tag"></rmp-user-avatar>
|
5
5
|
<a-popover v-else show-arrow placement="bottom" destroy-on-close>
|
6
|
-
<div>
|
6
|
+
<div style="display: inline-flex;">
|
7
7
|
<a-avatar-group>
|
8
8
|
<template v-for="(el, index) in data">
|
9
9
|
<a-avatar :src="el?.[AVATAR_KEY]" :key="el?.[AVATAR_KEY]" v-if="index < props.max" :size="$props.size" :class="{ is_highlight: isH(el) }"></a-avatar>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
import { useAttrs } from "vue"
|
26
26
|
import RmpUserAvatar from './user-avatar.vue';
|
27
27
|
import { Popover as APopover, AvatarGroup as AAvatarGroup, Avatar as AAvatar, TypographyText as ATypographyText} from "ant-design-vue"
|
28
|
-
import { useCustomProps } from "./store"
|
28
|
+
import { useCustomProps } from "./avatar.store"
|
29
29
|
import {isFunction} from "lodash-es"
|
30
30
|
|
31
31
|
const props = defineProps({
|