Skip to content

Commit 233a38b

Browse files
committed
feat(resources): fix review bugs
1 parent ac064be commit 233a38b

7 files changed

Lines changed: 51 additions & 49 deletions

File tree

packages/configurator/src/source-select-configurator/SourceSelectConfigurator.vue

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,18 @@
7474
</tiny-popover>
7575
</div>
7676
</template>
77-
<script>
77+
<script lang="ts">
7878
import { ref, watch } from 'vue'
79-
import { Popover, Button, Input, Search, Select, Divider, Radio } from '@opentiny/vue'
79+
import type { Component } from 'vue'
80+
import {
81+
Popover as TinyPopover,
82+
Button as TinyButton,
83+
Input as TinyInput,
84+
Search as TinySearch,
85+
Select as TinySelect,
86+
Divider as TinyDivider,
87+
Radio as TinyRadio
88+
} from '@opentiny/vue'
8089
import { iconClose, iconSearch } from '@opentiny/vue-icon'
8190
import { SearchEmpty } from '@opentiny/tiny-engine-common'
8291
import { useNotify } from '@opentiny/tiny-engine-meta-register'
@@ -94,14 +103,14 @@ const closePopover = () => {
94103
95104
export default {
96105
components: {
97-
TinyPopover: Popover,
98-
TinyButton: Button,
99-
TinyInput: Input,
100-
TinySearch: Search,
101-
TinySelect: Select,
102-
TinyDivider: Divider,
103-
TinyRadio: Radio,
104-
SearchEmpty,
106+
TinyPopover: TinyPopover as Component,
107+
TinyButton: TinyButton as Component,
108+
TinyInput: TinyInput as Component,
109+
TinySearch: TinySearch as Component,
110+
TinySelect: TinySelect as Component,
111+
TinyDivider: TinyDivider as Component,
112+
TinyRadio: TinyRadio as Component,
113+
SearchEmpty: SearchEmpty as Component,
105114
TinyIconClose: iconClose(),
106115
TinyIconSearch: iconSearch()
107116
},
@@ -205,7 +214,7 @@ export default {
205214
position: relative;
206215
width: 150px;
207216
height: 96px;
208-
background-color: #f5f5f5;
217+
background-color: var(--te-common-bg-container);
209218
img {
210219
width: 100%;
211220
height: 100%;
@@ -228,10 +237,10 @@ export default {
228237
width: 70px;
229238
height: 22px;
230239
line-height: 22px;
231-
border: 1px solid #fff;
240+
border: 1px solid var(--te-common-bg-popover);
232241
border-radius: 4px;
233242
text-align: center;
234-
color: #fff;
243+
color: var(--te-common-text-inverse);
235244
cursor: pointer;
236245
}
237246
}
@@ -305,7 +314,7 @@ export default {
305314
width: 120px;
306315
height: 78px;
307316
position: relative;
308-
background-color: #f5f5f5;
317+
background-color: var(--te-common-bg-container);
309318
border-radius: 2px;
310319
311320
.tiny-radio {
@@ -334,7 +343,7 @@ export default {
334343
text-align: center;
335344
line-height: 28px;
336345
width: 120px;
337-
color: #fff;
346+
color: var(--te-common-text-inverse);
338347
white-space: nowrap;
339348
overflow: hidden;
340349
text-overflow: ellipsis;

packages/configurator/src/source-select-configurator/http.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*
1111
*/
1212

13-
/* metaService: engine.plugins.appmanage.http */
1413
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
1514

1615
const baseUrl = '/material-center/api'

packages/design-core/assets/plugin-icon-resource.svg

Lines changed: 0 additions & 3 deletions
Loading

packages/plugins/resource/src/Main.vue

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
></svg-button>
1919
</template>
2020
<template #content>
21-
<div class="resouce-list">
21+
<div class="resource-list">
2222
<div
2323
v-for="item in resourceList"
2424
:key="item.id"
@@ -35,7 +35,7 @@
3535
<search-empty :isShow="!resourceList?.length" />
3636
</template>
3737
</plugin-panel>
38-
<resource-setting @create-group="createCategory"></resource-setting>
38+
<resource-setting @create-group="refreshCategory"></resource-setting>
3939
<resource-list></resource-list>
4040
</div>
4141
</template>
@@ -115,14 +115,9 @@ export default {
115115
})
116116
}
117117
118-
const createCategory = () => {
118+
const refreshCategory = () => {
119119
getCategoryList()
120120
}
121-
122-
const updateCategory = (data) => {
123-
resourceList.value = data
124-
}
125-
126121
const openResourceList = (data) => {
127122
setItemActive(data)
128123
openResourceListPanel(data)
@@ -140,14 +135,13 @@ export default {
140135
pluginPanelClosed,
141136
openCategoryForm,
142137
openResourceList,
143-
createCategory,
144-
updateCategory
138+
refreshCategory
145139
}
146140
}
147141
}
148142
</script>
149143
<style lang="less" scoped>
150-
.resouce-list {
144+
.resource-list {
151145
margin: 8px 0;
152146
153147
.resource-item {

packages/plugins/resource/src/ResourceList.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<template>
22
<plugin-setting v-if="isShow" :fixed-name="PLUGIN_NAME.Resource" :align="align" :title="state.title">
33
<template #header>
4-
<button-group>
5-
<svg-button name="close" @click="cancelResourceList"></svg-button>
6-
</button-group>
4+
<svg-button name="close" @click="cancelResourceList"></svg-button>
75
</template>
86

97
<template #content>
@@ -45,7 +43,7 @@
4543
:visible-arrow="false"
4644
trigger="manual"
4745
:content="copyTipContent"
48-
:modelValue="item.id && item.id === copySourceId"
46+
:modelValue="item?.id === copySourceId"
4947
>
5048
<template #reference>
5149
<span @click="copySourceLink(item)">复制</span>
@@ -160,7 +158,7 @@ import {
160158
} from '@opentiny/vue'
161159
import { iconPopup } from '@opentiny/vue-icon'
162160
import { useLayout, useModal, useNotify } from '@opentiny/tiny-engine-meta-register'
163-
import { PluginSetting, ButtonGroup, SvgButton, SearchEmpty } from '@opentiny/tiny-engine-common'
161+
import { PluginSetting, SvgButton, SearchEmpty } from '@opentiny/tiny-engine-common'
164162
import { fetchResourceListByGroupId, batchCreateResource, updateResourceGroup } from './js/http'
165163
166164
const isShow = ref(false)
@@ -196,7 +194,6 @@ export default {
196194
TinyDialogBox: DialogBox,
197195
TinyAlert: Alert,
198196
TinyFileUpload: FileUpload,
199-
ButtonGroup,
200197
SearchEmpty,
201198
TinyIconPopup: iconPopup()
202199
},
@@ -304,9 +301,7 @@ export default {
304301
// eslint-disable-next-line no-console
305302
console.error('Clipboard operation failed:', e)
306303
} finally {
307-
setTimeout(() => {
308-
copySourceId.value = ''
309-
}, 2000)
304+
copySourceId.value = ''
310305
}
311306
}
312307

packages/plugins/resource/src/ResourceSetting.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,23 @@ export default {
8282
const generalForm = ref()
8383
8484
const rules = reactive({
85-
name: [{ required: true, message: '必填', trigger: 'blur' }]
85+
name: [
86+
{ required: true, message: '必填', trigger: 'blur' },
87+
{ min: 1, max: 32, message: '长度在1-32之间', trigger: 'blur' },
88+
{
89+
type: 'string',
90+
validator: (value) => {
91+
return new Promise((resolve, reject) => {
92+
const regex = /^[a-zA-Z0-9_\-\u4e00-\u9fa5]+$/i
93+
if (!regex.test(value)) {
94+
reject(new Error('分组名称只能包含中文、英文、数字、下划线、中划线等字符'))
95+
} else {
96+
resolve()
97+
}
98+
})
99+
}
100+
}
101+
]
86102
})
87103
const saveResourceSetting = () => {
88104
generalForm.value.validate((valid) => {

packages/plugins/resource/src/js/http.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*/
1212

13-
/* metaService: engine.plugins.appmanage.http */
13+
/* metaService: engine.plugins.resource.http */
1414
import { getMetaApi, getMergeMeta, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
1515

1616
const baseUrl = '/material-center/api'
@@ -66,11 +66,3 @@ export const createResourceGroup = (params: any) =>
6666
// 资源管理 -- 修改资源分组信息-包括删除
6767
export const updateResourceGroup = (id: number, params: any) =>
6868
getMetaApi(META_SERVICE.Http).put(`${baseUrl}/resource-group/update/${id}`, params)
69-
70-
// 资源管理 -- 查询资源分组详情
71-
export const fetchResourceGroupDetail = (id: number) =>
72-
getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/detail/${id}`)
73-
74-
// 资源管理 -- 删除资源分组
75-
export const deleteResourceGroup = (id: number) =>
76-
getMetaApi(META_SERVICE.Http).get(`${baseUrl}/resource-group/delete/${id}`)

0 commit comments

Comments
 (0)