Skip to content

Commit 6df11ab

Browse files
committed
feat(resource-manager): fix styles
1 parent 92c8006 commit 6df11ab

File tree

3 files changed

+33
-30
lines changed

3 files changed

+33
-30
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
v-model="isShow"
77
:visible-arrow="false"
88
:popper-class="['option-popper', 'fixed-left']"
9+
height="844"
910
>
1011
<div class="source-wrap">
1112
<div class="source-title">
1213
<span>资源</span>
1314
<div class="right">
14-
<tiny-button type="primary" plain @click="setSource"> 确认 </tiny-button>
15+
<tiny-button type="primary" size="mini" plain @click="setSource"> 确认 </tiny-button>
1516
<tiny-icon-close class="tiny-svg-size" @click="closePopover"></tiny-icon-close>
1617
</div>
1718
</div>
@@ -205,6 +206,7 @@ export default {
205206
position: relative;
206207
width: 150px;
207208
height: 96px;
209+
background-color: #f5f5f5;
208210
img {
209211
width: 100%;
210212
height: 100%;

packages/plugins/resource/src/Main.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
>
1111
<template #header>
1212
<svg-button
13-
class="add-collection-icon"
14-
name="add-collection"
13+
class="add-folder-icon"
14+
name="add-folder"
1515
placement="bottom"
1616
tips="新建分组"
1717
@click="openCategoryForm"
@@ -26,7 +26,7 @@
2626
@click="openResourceList(item)"
2727
>
2828
<span>
29-
<svg-icon name="plugin-icon-data"></svg-icon>
29+
<svg-icon name="plugin-icon-resource"></svg-icon>
3030
<span>{{ item.name }}</span>
3131
</span>
3232
<svg-icon name="setting" class="item-setting" @click.stop="openCategoryForm(item)"></svg-icon>

packages/plugins/resource/src/ResourceList.vue

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<template #content>
1010
<div class="resource-list-content">
1111
<tiny-button round @click="openAddSourceForm"><svg-icon name="add"></svg-icon>添加资源</tiny-button>
12+
<tiny-alert
13+
:closable="false"
14+
description="资源名称只能包含中文、英文、数字、下划线、中划线、=、+、()、{}、[]等字符,且以文件后缀名为结尾"
15+
></tiny-alert>
1216
<span class="resource-description">支持上传png、jpg、svg文件,支持批量上传</span>
1317
<div class="action-wrap">
1418
<div>
@@ -95,7 +99,7 @@
9599
:valid-config="{ message: 'inline' }"
96100
:edit-rules="validRules"
97101
>
98-
<tiny-grid-column field="name" title="资源名称" :show-icon="false" :editor="{}">
102+
<tiny-grid-column field="name" title="资源名称" :show-icon="false" width="170" :editor="{}">
99103
<template #edit="data">
100104
<span v-if="data.row.type === 'upload'"> {{ data.row.name }} </span>
101105
<tiny-input
@@ -106,7 +110,7 @@
106110
></tiny-input>
107111
</template>
108112
</tiny-grid-column>
109-
<tiny-grid-column field="resourceUrl" title="资源URL" :show-icon="false" :editor="{}">
113+
<tiny-grid-column field="resourceUrl" title="资源URL" :show-icon="false" width="170" :editor="{}">
110114
<template #edit="data">
111115
<span v-if="data.row.type === 'upload'"></span>
112116
<tiny-input
@@ -122,29 +126,19 @@
122126
<tiny-input v-model="data.row.description" placeholder="请输入资源描述"></tiny-input>
123127
</template>
124128
</tiny-grid-column>
125-
<tiny-grid-column title="操作">
129+
<tiny-grid-column title="操作" width="100">
126130
<template #default="data">
127131
<template v-if="$refs.addSourceGridRef && $refs.addSourceGridRef.hasActiveRow(data.row)">
128-
<tiny-button size="mini" @click="saveRowEvent(data.row)"> 保存 </tiny-button>
129-
<tiny-button size="mini" @click="cancelRowEvent(data)"> 取消 </tiny-button>
132+
<tiny-button type="text" @click="saveRowEvent(data.row)"> 保存 </tiny-button>
133+
<tiny-button type="text" @click="cancelRowEvent(data)"> 取消 </tiny-button>
130134
</template>
131-
<tiny-popconfirm
132-
v-else
133-
title="确认要删除该资源吗?"
134-
type="info"
135-
trigger="click"
136-
@confirm="removeSource(data)"
137-
>
138-
<template #reference>
139-
<svg-icon name="delete"></svg-icon>
140-
</template>
141-
</tiny-popconfirm>
135+
<tiny-button v-else type="text" @click="removeSource(data)">删除</tiny-button>
142136
</template>
143137
</tiny-grid-column>
144138
</tiny-grid>
145139
<template #footer>
146-
<tiny-button type="primary" @click="submitSourceAdd" round>确 定</tiny-button>
147-
<tiny-button @click="cancelAddSource" round>取 消</tiny-button>
140+
<tiny-button type="primary" size="mini" @click="submitSourceAdd" round>确 定</tiny-button>
141+
<tiny-button size="mini" @click="cancelAddSource" round>取 消</tiny-button>
148142
</template>
149143
</tiny-dialog-box>
150144
</teleport>
@@ -161,8 +155,8 @@ import {
161155
Checkbox,
162156
Popover,
163157
DialogBox,
164-
FileUpload,
165-
Popconfirm
158+
Alert,
159+
FileUpload
166160
} from '@opentiny/vue'
167161
import { iconPopup } from '@opentiny/vue-icon'
168162
import { useLayout, useModal, useNotify } from '@opentiny/tiny-engine-meta-register'
@@ -200,8 +194,8 @@ export default {
200194
TinyCheckbox: Checkbox,
201195
TinyPopover: Popover,
202196
TinyDialogBox: DialogBox,
197+
TinyAlert: Alert,
203198
TinyFileUpload: FileUpload,
204-
TinyPopconfirm: Popconfirm,
205199
ButtonGroup,
206200
SearchEmpty,
207201
TinyIconPopup: iconPopup()
@@ -233,8 +227,9 @@ export default {
233227
type: 'string',
234228
validator: ({ row }, value) => {
235229
return new Promise((resolve, reject) => {
236-
if (!/^[a-zA-Z0-9_-]+\.(png|jpg|jpeg|svg)$/.test(value)) {
237-
reject(new Error('资源名成只能包含字母、数字、_和-等字符,且须以文件后缀名结尾'))
230+
const regex = /^[a-zA-Z0-9_\-=+(){}[\]]+\.(png|jpg|jpeg|svg|PNG|JPG|JPEG|SVG)$/i
231+
if (!regex.test(value)) {
232+
reject(new Error('资源名称格式错误'))
238233
} else if (addSourceData.value.find((item) => item._RID !== row._RID && item.name === value)) {
239234
reject(new Error('已存在的资源名称'))
240235
} else {
@@ -252,8 +247,8 @@ export default {
252247
if (type === 'url') {
253248
if (!value) {
254249
reject(new Error('资源URL必填'))
255-
} else if (!/^(http|https):\/\/[^\s]+(\.png|\.jpg|\.jpeg|\.svg)$/.test(value)) {
256-
reject(new Error('URL须以http或https开头,以文件后缀名结尾'))
250+
} else if (!/^(http|https):\/\/[^\s]+$/.test(value)) {
251+
reject(new Error('URL以http或https开头'))
257252
}
258253
}
259254
resolve()
@@ -379,6 +374,7 @@ export default {
379374
})
380375
.then(() => {
381376
getSourceList()
377+
selectedSources.value = []
382378
})
383379
.catch((error) => {
384380
useNotify({
@@ -566,7 +562,7 @@ export default {
566562
left: 0;
567563
right: 0;
568564
bottom: 0;
569-
text-align: center;
565+
text-align: left;
570566
line-height: 28px;
571567
width: 185px;
572568
color: #fff;
@@ -611,6 +607,10 @@ export default {
611607
}
612608
}
613609
610+
:deep(.tiny-button.tiny-button.tiny-button--text) {
611+
padding: 0;
612+
}
613+
614614
.actions {
615615
display: flex;
616616
flex-direction: column;
@@ -624,5 +624,6 @@ export default {
624624
.resource-action {
625625
display: flex;
626626
gap: 8px;
627+
margin-bottom: 16px;
627628
}
628629
</style>

0 commit comments

Comments
 (0)