File tree Expand file tree Collapse file tree 4 files changed +68
-11
lines changed
src/views/mall/product/spu/form Expand file tree Collapse file tree 4 files changed +68
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ VITE_OPEN=true
11
11
VITE_APP_TENANT_ENABLE = true
12
12
13
13
# 验证码的开关
14
- VITE_APP_CAPTCHA_ENABLE = true
14
+ VITE_APP_CAPTCHA_ENABLE = false
15
15
16
16
# 百度统计
17
17
VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc
Original file line number Diff line number Diff line change 58
58
"pinia" : " ^2.1.6" ,
59
59
"qrcode" : " ^1.5.3" ,
60
60
"qs" : " ^6.11.2" ,
61
+ "sortablejs" : " ^1.15.0" ,
61
62
"steady-xml" : " ^0.1.0" ,
62
63
"url" : " ^0.11.3" ,
63
64
"video.js" : " ^7.21.5" ,
82
83
"@types/nprogress" : " ^0.2.0" ,
83
84
"@types/qrcode" : " ^1.5.2" ,
84
85
"@types/qs" : " ^6.9.8" ,
86
+ "@types/sortablejs" : " ^1.15.4" ,
85
87
"@typescript-eslint/eslint-plugin" : " ^6.7.2" ,
86
88
"@typescript-eslint/parser" : " ^6.7.2" ,
87
- "@unocss/transformer-variant-group" : " ^0.56.1" ,
88
89
"@unocss/eslint-config" : " ^0.56.1" ,
90
+ "@unocss/transformer-variant-group" : " ^0.56.1" ,
89
91
"@vitejs/plugin-legacy" : " ^4.1.1" ,
90
92
"@vitejs/plugin-vue" : " ^4.3.4" ,
91
93
"@vitejs/plugin-vue-jsx" : " ^3.0.2" ,
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div ref =" elTagWrappingRef" >
3
+ <template v-if =" activityOrders && activityOrders .length > 0 " >
4
+ <el-tag
5
+ v-for =" activityType in activityOrders"
6
+ :key =" activityType"
7
+ :type =" promotionTypes.find((item) => item.value === activityType)?.colorType"
8
+ class =" mr-[10px]"
9
+ >
10
+ {{ promotionTypes.find((item) => item.value === activityType)?.label }}
11
+ </el-tag >
12
+ </template >
13
+ <template v-else >
14
+ <el-tag
15
+ v-for =" type in promotionTypes"
16
+ :key =" type.value as number"
17
+ :type =" type.colorType"
18
+ class =" mr-[10px]"
19
+ >
20
+ {{ type.label }}
21
+ </el-tag >
22
+ </template >
23
+ </div >
24
+ </template >
25
+ <script lang="ts" setup>
26
+ import Sortable from ' sortablejs'
27
+ import type { DictDataType } from ' @/utils/dict'
28
+
29
+ defineOptions ({ name: ' ActivityOrdersSort' })
30
+ const props = defineProps <{
31
+ promotionTypes: DictDataType []
32
+ activityOrders: number []
33
+ }>()
34
+ const emit = defineEmits <{
35
+ (e : ' update:activityOrders' , v : number [])
36
+ }>()
37
+ const elTagWrappingRef = ref () // elTag 容器 Ref
38
+
39
+ const initSortable = () => {
40
+ new Sortable (elTagWrappingRef .value , {
41
+ swapThreshold: 1 ,
42
+ animation: 150 ,
43
+ onEnd : (el ) => {
44
+ const innerText = el .to .innerText
45
+ // 将字符串按换行符分割成数组
46
+ const activityOrder = innerText .split (' \n ' )
47
+ // 根据字符串中的顺序重新排序数组
48
+ const sortedActivityOrder = activityOrder .map ((activityName ) => {
49
+ return props .promotionTypes .find ((item ) => item .label === activityName )?.value
50
+ })
51
+ emit (' update:activityOrders' , sortedActivityOrder as number [])
52
+ }
53
+ })
54
+ }
55
+ onMounted (async () => {
56
+ await nextTick ()
57
+ initSortable ()
58
+ })
59
+ </script >
Original file line number Diff line number Diff line change 41
41
</el-form-item >
42
42
</el-col >
43
43
<el-col :span =" 24" >
44
- <!-- TODO @puhui999:tag展示暂时不考虑排序;支持拖动排序 -->
45
44
<el-form-item label =" 活动优先级" >
46
- <el-tag
47
- v-for =" type in promotionTypes"
48
- :key =" type.value as number"
49
- :type =" type.colorType"
50
- class =" mr-[10px]"
51
- >
52
- {{ type.label }}
53
- </el-tag >
45
+ <ActivityOrdersSort
46
+ v-model:activity-orders =" formData.activityOrders"
47
+ :promotion-types =" promotionTypes"
48
+ />
54
49
</el-form-item >
55
50
</el-col >
56
51
<el-col :span =" 24" >
@@ -115,6 +110,7 @@ import { copyValueToTarget } from '@/utils'
115
110
import { otherSettingsSchema } from ' ./spu.data'
116
111
import { DICT_TYPE , DictDataType , getIntDictOptions } from ' @/utils/dict'
117
112
import CouponSelect from ' ./CouponSelect.vue'
113
+ import ActivityOrdersSort from ' ./ActivityOrdersSort.vue'
118
114
119
115
defineOptions ({ name: ' OtherSettingsForm' })
120
116
You can’t perform that action at this time.
0 commit comments