Skip to content

Commit f650a6f

Browse files
committed
refactor: 优化用户管理代码
1 parent 293718f commit f650a6f

File tree

11 files changed

+259
-267
lines changed

11 files changed

+259
-267
lines changed

src/constant/common.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
interface LabelValueItem { label: string, value: number, color: string }
1+
interface LabelValueItem { label: string, value: number, color?: string }
2+
3+
/** @desc 状态 */
24
export const DisEnableStatusList: LabelValueItem[] = [
35
{ label: '启用', value: 1, color: 'green' },
46
{ label: '禁用', value: 2, color: 'red' },
57
]
8+
9+
/** @desc 性别 */
10+
export const GenderList: LabelValueItem[] = [
11+
{ label: '男', value: 1 },
12+
{ label: '女', value: 2 },
13+
{ label: '未知', value: 0 },
14+
]

src/types/components.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ declare module 'vue' {
5151
SecondForm: typeof import('./../components/GenCron/CronForm/component/second-form.vue')['default']
5252
TextCopy: typeof import('./../components/TextCopy/index.vue')['default']
5353
UserSelect: typeof import('./../components/UserSelect/index.vue')['default']
54-
UserSelectContent: typeof import('./../components/UserSelect/component/UserSelectContent.vue')['default']
5554
Verify: typeof import('./../components/Verify/index.vue')['default']
5655
VerifyPoints: typeof import('./../components/Verify/Verify/VerifyPoints.vue')['default']
5756
VerifySlide: typeof import('./../components/Verify/Verify/VerifySlide.vue')['default']

src/views/dashboard/workplace/components/Carousel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
<script lang="ts" setup>
2323
const images = [
2424
{
25-
src: `https://continew.top/qrcode-text.png?${new Date().getTime()}`,
25+
src: `https://continew.top/qrcode-text.jpg?${new Date().getTime()}`,
2626
url: 'https://continew.top/about/intro.html',
2727
},
2828
{
29-
src: `https://continew.top/sponsor.png?${new Date().getTime()}`,
29+
src: `https://continew.top/sponsor.jpg?${new Date().getTime()}`,
3030
url: 'https://continew.top/sponsor.html',
3131
},
3232
]

src/views/dashboard/workplace/components/Project.vue

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,8 @@
4949
</a-typography-text>
5050
</a-typography-paragraph>
5151
</template>
52-
<template #avatar>
53-
<a-avatar-group :size="32" :max-count="7">
54-
<a-avatar
55-
v-for="(contributor, idx) in item.contributors"
56-
:key="idx"
57-
:title="contributor.name"
58-
>
59-
<img :src="contributor.avatar" alt="avatar" />
60-
</a-avatar>
61-
</a-avatar-group>
62-
</template>
6352
</a-card-meta>
64-
<template v-if="!loading && item.status !== '孵化'" #actions>
53+
<template #actions>
6554
<a-tooltip content="点个 Star 吧">
6655
<span class="icon-hover">
6756
<a :href="item.url" target="_blank" rel="noopener"><IconThumbUp :size="20" /></a>
@@ -75,9 +64,6 @@
7564
</template>
7665

7766
<script lang="ts" setup>
78-
import axios, { type AxiosRequestConfig, type AxiosResponse } from 'axios'
79-
import qs from 'query-string'
80-
8167
const list = [
8268
{
8369
alias: 'ContiNew Admin',
@@ -140,43 +126,6 @@ const list = [
140126
statusColor: 'rgb(var(--warning-6))',
141127
},
142128
]
143-
144-
const get = <T = unknown>(url: string, params?: object, config?: AxiosRequestConfig): Promise<ApiRes<T>> => {
145-
return new Promise((resolve, reject) => {
146-
axios
147-
.request<T>({
148-
method: 'get',
149-
url,
150-
params,
151-
paramsSerializer: (obj) => {
152-
return qs.stringify(obj)
153-
},
154-
...config,
155-
})
156-
.then((res: AxiosResponse) => resolve(res.data))
157-
.catch((err: { msg: string }) => reject(err))
158-
})
159-
}
160-
161-
const loading = ref(false)
162-
// 查询数据
163-
const getDataList = async () => {
164-
try {
165-
loading.value = true
166-
for (const item of list) {
167-
const { data } = await get(`https://api.charles7c.top/git/repos/contributors/${item.owner}/${item.name}`)
168-
item.contributors = data
169-
}
170-
} catch (err) {
171-
// console.log(err)
172-
} finally {
173-
loading.value = false
174-
}
175-
}
176-
177-
onMounted(() => {
178-
getDataList()
179-
})
180129
</script>
181130

182131
<style scoped lang="less">
@@ -185,9 +134,9 @@ onMounted(() => {
185134
overflow: hidden;
186135
.badge {
187136
position: absolute;
188-
font-size: 10px;
189-
height: 16px;
190-
line-height: 16px;
137+
font-size: 11px;
138+
height: 18px;
139+
line-height: 18px;
191140
text-align: center;
192141
width: 74px;
193142
color: #fff;

0 commit comments

Comments
 (0)