|
@@ -2,8 +2,10 @@
|
2
|
2
|
<div class="box">
|
3
|
3
|
<div class="form-item" v-if="menuConfig">
|
4
|
4
|
<label for="name">菜单名称</label>
|
5
|
|
- <Input placeholder="字数不超过4个汉字或8个字母" size="large" v-model="menuTitle" clearable @input="toolClass.CutStr(menuTitle, 8, '字数不超过4个汉字或8个字母')" name="name" style="width: 300px"/>
|
6
|
|
- <span class="error">{{toolClass.CutStr(menuTitle, 8, '字数不超过4个汉字或8个字母')}}</span>
|
|
5
|
+ <Input v-if="!isSub" placeholder="字数不超过4个汉字或8个字母" size="large" v-model="menuTitle" clearable @input="toolClass.CutStr(menuTitle, 8, '字数不超过4个汉字或8个字母')" name="name" style="width: 300px"/>
|
|
6
|
+ <span v-if="!isSub" class="error">{{toolClass.CutStr(menuTitle, 8, '字数不超过4个汉字或8个字母')}}</span>
|
|
7
|
+ <Input v-if="isSub" placeholder="字数不超过8个汉字或16个字母" size="large" v-model="menuTitle" clearable @input="toolClass.CutStr(menuTitle, 8, '字数不超过8个汉字或16个字母')" name="name" style="width: 300px"/>
|
|
8
|
+ <span v-if="isSub" class="error">{{toolClass.CutStr(menuTitle, 16, '字数不超过8个汉字或16个字母')}}</span>
|
7
|
9
|
</div>
|
8
|
10
|
<div class="form-item" v-if="hasContent" v-show="!noRadio">
|
9
|
11
|
<label for="name">菜单内容</label>
|
|
@@ -69,7 +71,7 @@
|
69
|
71
|
</Upload>
|
70
|
72
|
</div>
|
71
|
73
|
<Modal width='800' v-model="showMaterial" @on-ok="checkImg" @on-cancel="closeImg">
|
72
|
|
- <material v-if="showMaterial" :type='materialType' :model='model' @emit='setImg'></material>
|
|
74
|
+ <material v-if="showMaterial" :type='materialType' :model='model' @emit='setImg' @dbemit='dbsetImg'></material>
|
73
|
75
|
</Modal>
|
74
|
76
|
<div class="img-view">
|
75
|
77
|
<img v-if="img.url" :src="img.url">
|
|
@@ -113,7 +115,7 @@ import { createNamespacedHelpers } from 'vuex'
|
113
|
115
|
const { mapActions: mapMaterialActions } = createNamespacedHelpers('material')
|
114
|
116
|
const { mapActions: mapMenuConfigActions } = createNamespacedHelpers('menuConfig')
|
115
|
117
|
export default {
|
116
|
|
- props: ['data', 'menuConfig', 'hasContent', 'hasDelete', 'noRadio', 'hasCancel', 'needCheckDestroy'],
|
|
118
|
+ props: ['data', 'menuConfig', 'hasContent', 'hasDelete', 'noRadio', 'hasCancel', 'needCheckDestroy', 'isSub'],
|
117
|
119
|
data () {
|
118
|
120
|
return {
|
119
|
121
|
active: '文字',
|
|
@@ -173,7 +175,6 @@ export default {
|
173
|
175
|
...mapMaterialActions(['addImg']),
|
174
|
176
|
...mapMenuConfigActions(['Changed']),
|
175
|
177
|
checkLink () {
|
176
|
|
- console.log(111)
|
177
|
178
|
if (!this.linkText) {
|
178
|
179
|
this.$Message.warning('链接名称必填')
|
179
|
180
|
return false
|
|
@@ -214,6 +215,11 @@ export default {
|
214
|
215
|
this.imghc = img
|
215
|
216
|
this.imghc.url = this.imghc.Url
|
216
|
217
|
},
|
|
218
|
+ dbsetImg (img) {
|
|
219
|
+ this.imghc = img
|
|
220
|
+ this.imghc.url = this.imghc.Url
|
|
221
|
+ this.checkImg()
|
|
222
|
+ },
|
217
|
223
|
checkImg () {
|
218
|
224
|
this.img = this.imghc
|
219
|
225
|
this.closeImg()
|
|
@@ -255,6 +261,10 @@ export default {
|
255
|
261
|
setView (view) {
|
256
|
262
|
this.viewhc = view
|
257
|
263
|
},
|
|
264
|
+ dbsetView (view) {
|
|
265
|
+ this.viewhc = view
|
|
266
|
+ this.checkView()
|
|
267
|
+ },
|
258
|
268
|
checkView () {
|
259
|
269
|
this.view = this.viewhc
|
260
|
270
|
this.closeView()
|
|
@@ -274,9 +284,16 @@ export default {
|
274
|
284
|
if (!this.menuTitle) {
|
275
|
285
|
this.$Message.warning('菜单名称必填')
|
276
|
286
|
return false
|
277
|
|
- } else if (this.toolClass.CutStr(this.menuTitle, 8, '字数不超过4个汉字或8个字母')) {
|
278
|
|
- this.$Message.warning('菜单名称超过4个汉字或8个字母')
|
279
|
|
- return false
|
|
287
|
+ } else if (!this.isSub) {
|
|
288
|
+ if (this.toolClass.CutStr(this.menuTitle, 8, '字数不超过4个汉字或8个字母')) {
|
|
289
|
+ this.$Message.warning('一级菜单名称超过4个汉字或8个字母')
|
|
290
|
+ return false
|
|
291
|
+ }
|
|
292
|
+ } else if (this.isSub) {
|
|
293
|
+ if (this.toolClass.CutStr(this.menuTitle, 16, '字数不超过8个汉字或16个字母')) {
|
|
294
|
+ this.$Message.warning('二级菜单名称超过8个汉字或16个字母')
|
|
295
|
+ return false
|
|
296
|
+ }
|
280
|
297
|
}
|
281
|
298
|
this.emitData.name = this.menuTitle
|
282
|
299
|
}
|
|
@@ -289,7 +306,6 @@ export default {
|
289
|
306
|
this.emitData.type = 'text'
|
290
|
307
|
this.emitData.value = this.text
|
291
|
308
|
} else if (this.active === '图片') {
|
292
|
|
- console.log(this.img)
|
293
|
309
|
if (!this.img.media_id) {
|
294
|
310
|
this.$Message.warning('请选择素材')
|
295
|
311
|
return false
|
|
@@ -305,7 +321,6 @@ export default {
|
305
|
321
|
this.emitData.media_id = this.view.media_id
|
306
|
322
|
}
|
307
|
323
|
} else if (this.type === '跳转网页') {
|
308
|
|
- console.log(111)
|
309
|
324
|
if (this.errors.first('link')) {
|
310
|
325
|
this.$Message.warning('链接格式不正确')
|
311
|
326
|
return false
|
|
@@ -336,7 +351,6 @@ export default {
|
336
|
351
|
},
|
337
|
352
|
beforeUpdate () {
|
338
|
353
|
if (this.needCheckDestroy) {
|
339
|
|
- console.log('check')
|
340
|
354
|
if (this.data) {
|
341
|
355
|
if (this.menuConfig) {
|
342
|
356
|
if (this.menuTitle !== this.data.name) {
|