yuantianjiao 6 年之前
父節點
當前提交
b11e8af857

+ 20
- 16
public/index.html 查看文件

@@ -1,18 +1,22 @@
1 1
 <!DOCTYPE html>
2 2
 <html lang="en">
3
-  <head>
4
-    <meta charset="utf-8">
5
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
-    <link rel="stylesheet" href="//at.alicdn.com/t/font_681879_u55mh75ray8.css">
9
-    <title>千锦荟第三方平台</title>
10
-  </head>
11
-  <body>
12
-    <noscript>
13
-      <strong>We're sorry but menu doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
14
-    </noscript>
15
-    <div id="app"></div>
16
-    <!-- built files will be auto injected -->
17
-  </body>
18
-</html>
3
+
4
+<head>
5
+  <meta charset="utf-8">
6
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+  <meta name="viewport" content="width=device-width,initial-scale=1.0">
8
+  <meta name="referrer" content="never">
9
+  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
10
+  <link rel="stylesheet" href="//at.alicdn.com/t/font_681879_u55mh75ray8.css">
11
+  <title>千锦荟第三方平台</title>
12
+</head>
13
+
14
+<body>
15
+  <noscript>
16
+    <strong>您的浏览器不支持JavaScript脚本,请更换浏览器</strong>
17
+  </noscript>
18
+  <div id="app"></div>
19
+  <!-- built files will be auto injected -->
20
+</body>
21
+
22
+</html>

+ 1
- 4
src/App.vue 查看文件

@@ -7,10 +7,7 @@
7 7
 <script>
8 8
 import './assets/main.css'
9 9
 export default {
10
-  name: 'app',
11
-  created () {
12
-    console.log(this)
13
-  }
10
+  name: 'app'
14 11
 }
15 12
 </script>
16 13
 

二進制
src/assets/loading.gif 查看文件


+ 1
- 1
src/components/Emotion/index.vue 查看文件

@@ -38,7 +38,7 @@ export default {
38 38
   },
39 39
   methods: {
40 40
     clickHandler (i) {
41
-      let emotion = `#${i};`
41
+      let emotion = `/${i}`
42 42
       this.$emit('emotion', emotion)
43 43
     }
44 44
   },

+ 0
- 1
src/components/bottomMenu.vue 查看文件

@@ -16,7 +16,6 @@ export default {
16 16
   components: { subMenu },
17 17
   methods: {
18 18
     addMenu () {
19
-      console.log(this.menuArr)
20 19
       this.$emit('addMainMenu')
21 20
     },
22 21
     modify (item, index) {

+ 25
- 4
src/components/material.vue 查看文件

@@ -1,24 +1,27 @@
1 1
 <template>
2 2
   <div>
3
+    <div class="loading" v-if="isLoading">
4
+      <img width='80px' :src="loading" alt="">
5
+    </div>
3 6
     <Button type="error" @click="reflsh">同步素材库</Button>
4 7
     <div class="box" v-if="model === 'get'">
5 8
       <div v-if="type === 'img'">
6 9
         <div  v-for="(item,index) in img" :key="index" @click="emit(item,index)" :class="{checked:item.checked}">
7
-          <img :src="item.Url" alt="">
10
+          <img :src="item.url" alt="">
8 11
         </div>
9 12
       </div>
10 13
       <div v-if="type === 'view'">
11 14
         <div v-for="(item,index) in view" :key="index" @click="emit(item,index)" :class="{checked:item.checked}">
12
-          <img :src="item.Url" alt="">
15
+          <img :src="item.url" alt="">
13 16
           <p>{{item.text}}</p>
14 17
         </div>
15 18
       </div>
16 19
     </div>
17 20
     <div v-if="model === 'set'" class="box-set">
18 21
       <div class="upload-list" v-for="(item,index) in uploadList" :key='index'>
19
-        <img :src="item.Url">
22
+        <img :src="item.url">
20 23
         <div class="upload-list-cover">
21
-          <Icon type="ios-eye-outline" @click.native="handleView(item.Url)"></Icon>
24
+          <Icon type="ios-eye-outline" @click.native="handleView(item.url)"></Icon>
22 25
           <Icon type="ios-trash-outline" @click.native="handleRemove(item)"></Icon>
23 26
         </div>
24 27
       </div>
@@ -49,12 +52,15 @@
49 52
 </template>
50 53
 
51 54
 <script>
55
+import loading from '@/assets/loading.gif'
52 56
 import { createNamespacedHelpers } from 'vuex'
53 57
 const { mapState: mapMaterialState, mapActions: mapMaterialActions } = createNamespacedHelpers('material')
54 58
 export default {
55 59
   props: ['type', 'model'],
56 60
   data () {
57 61
     return {
62
+      loading,
63
+      isLoading: false,
58 64
       defaultList: [],
59 65
       imgName: '',
60 66
       visible: false,
@@ -150,8 +156,10 @@ export default {
150 156
       return check
151 157
     },
152 158
     reflsh () {
159
+      this.isLoading = true
153 160
       this.reflshImg({ type: 'image' }).then(() => {
154 161
         this.$Message.success('同步成功')
162
+        this.isLoading = false
155 163
         this.getImg({ type: 'image' }).then(() => {
156 164
           if (this.model === 'set') {
157 165
             this.$nextTick(() => {
@@ -166,6 +174,18 @@ export default {
166 174
 </script>
167 175
 
168 176
 <style lang="scss" scoped>
177
+.loading {
178
+  width: 100%;
179
+  height: 100%;
180
+  position: absolute;
181
+  top: 0;
182
+  left: 0;
183
+  display: flex;
184
+  justify-content: center;
185
+  align-items: center;
186
+  z-index: 2;
187
+  background: rgba(0, 0, 0, 0.2);
188
+}
169 189
 .box {
170 190
   width: 100%;
171 191
   padding: 20px;
@@ -232,6 +252,7 @@ export default {
232 252
     width: 100%;
233 253
     height: 100%;
234 254
     position: absolute;
255
+    object-fit: cover;
235 256
     top: 0;
236 257
     left: 0;
237 258
   }

+ 9
- 3
src/components/menu.vue 查看文件

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <div>
3
-    <Menu style="width:200px;" active-name="20">
3
+    <Menu style="width:200px;" :active-name="activeName">
4 4
       <div v-for="(item,index) in packChildren(menuData)" :key="index">
5 5
         <Submenu v-if="item.children" :name='item.id'>
6 6
           <template slot="title">
@@ -33,6 +33,11 @@
33 33
 <script>
34 34
 export default {
35 35
   props: ['menuData'],
36
+  data () {
37
+    return {
38
+      activeName: '20',
39
+    }
40
+  },
36 41
   methods: {
37 42
     packChildren (data) {
38 43
       let cp = data.slice()
@@ -55,12 +60,13 @@ export default {
55 60
             break
56 61
           }
57 62
         }
58
-
63
+        if (cp[inx].Url === this.$router.history.current.name) {
64
+          this.activeName = cp[inx].id
65
+        }
59 66
         if (!found && cp[inx].IsShow === 1) {
60 67
           res.push(cp[inx])
61 68
         }
62 69
       })
63
-      console.log(res)
64 70
       return res
65 71
     }
66 72
   }

+ 98
- 4
src/components/menuForm.vue 查看文件

@@ -98,7 +98,7 @@
98 98
       </div>
99 99
     </div>
100 100
     <div class="btn-group">
101
-      <Button type="primary" @click="emit">确认</Button>
101
+      <Button type="primary" @click="emit">保存</Button>
102 102
       <Button v-if="hasDelete" @click="delMenu">删除当前菜单</Button>
103 103
       <Button v-if="hasCancel" type="warning" @click="cancel">取消</Button>
104 104
     </div>
@@ -111,8 +111,9 @@ import Emotion from '@/components/Emotion/index'
111 111
 import material from '@/components/material'
112 112
 import { createNamespacedHelpers } from 'vuex'
113 113
 const { mapActions: mapMaterialActions } = createNamespacedHelpers('material')
114
+const { mapActions: mapMenuConfigActions } = createNamespacedHelpers('menuConfig')
114 115
 export default {
115
-  props: ['data', 'menuConfig', 'hasContent', 'hasDelete', 'noRadio', 'hasCancel'],
116
+  props: ['data', 'menuConfig', 'hasContent', 'hasDelete', 'noRadio', 'hasCancel', 'needCheckDestroy'],
116 117
   data () {
117 118
     return {
118 119
       active: '文字',
@@ -170,6 +171,7 @@ export default {
170 171
   },
171 172
   methods: {
172 173
     ...mapMaterialActions(['addImg']),
174
+    ...mapMenuConfigActions(['Changed']),
173 175
     checkLink () {
174 176
       console.log(111)
175 177
       if (!this.linkText) {
@@ -192,8 +194,8 @@ export default {
192 194
       this.closeLink()
193 195
     },
194 196
     closeLink () {
195
-      this.linkText = ''
196
-      this.linkHref = ''
197
+      // this.linkText = ''
198
+      // this.linkHref = ''
197 199
       this.showLink = false
198 200
     },
199 201
     handleEmotion (i) {
@@ -210,6 +212,7 @@ export default {
210 212
     },
211 213
     setImg (img) {
212 214
       this.imghc = img
215
+      this.imghc.url = this.imghc.Url
213 216
     },
214 217
     checkImg () {
215 218
       this.img = this.imghc
@@ -286,6 +289,7 @@ export default {
286 289
           this.emitData.type = 'text'
287 290
           this.emitData.value = this.text
288 291
         } else if (this.active === '图片') {
292
+          console.log(this.img)
289 293
           if (!this.img.media_id) {
290 294
             this.$Message.warning('请选择素材')
291 295
             return false
@@ -304,14 +308,19 @@ export default {
304 308
         console.log(111)
305 309
         if (this.errors.first('link')) {
306 310
           this.$Message.warning('url格式不正确')
311
+          return false
307 312
         } else if (!this.linkHref) {
308 313
           this.$Message.warning('url必填')
314
+          return false
309 315
         } else if (this.linkHref.indexOf('http') <= -1) {
310 316
           this.$Message.warning('链接必须附带http协议头')
311 317
           return false
312 318
         }
313 319
         this.emitData.type = 'view'
314 320
         this.emitData.url = this.linkHref
321
+      } else {
322
+        // this.emitData.type = this.data
323
+        // type为null
315 324
       }
316 325
       if (this.data.sub_button) {
317 326
         this.emitData.sub_button = this.data.sub_button
@@ -325,6 +334,91 @@ export default {
325 334
       this.$emit('cancel')
326 335
     }
327 336
   },
337
+  beforeUpdate () {
338
+    if (this.needCheckDestroy) {
339
+      console.log('check')
340
+      if (this.data) {
341
+        if (this.menuConfig) {
342
+          if (this.menuTitle !== this.data.name) {
343
+            this.Changed(true)
344
+            return
345
+          }
346
+        } else {
347
+          if (this.menuTitle) {
348
+            this.Changed(true)
349
+            return
350
+          }
351
+        }
352
+        if (this.data.type === 'text') {
353
+          if (this.type !== '发送消息') {
354
+            this.Changed(true)
355
+            return
356
+          }
357
+          if (this.active !== '文字') {
358
+            this.Changed(true)
359
+            return
360
+          }
361
+          if (this.text !== this.data.value) {
362
+            this.Changed(true)
363
+            return
364
+          }
365
+        } else if (this.data.type === 'media_id') {
366
+          if (this.type !== '发送消息') {
367
+            this.Changed(true)
368
+            return
369
+          }
370
+          if (this.active !== '图片') {
371
+            this.Changed(true)
372
+            return
373
+          }
374
+          if (this.img.media_id !== this.data.media_id) {
375
+            this.Changed(true)
376
+            return
377
+          }
378
+        } else if (this.data.type === 'view_limited') {
379
+          if (this.type !== '发送消息') {
380
+            this.Changed(true)
381
+            return
382
+          }
383
+          if (this.active !== '图文') {
384
+            this.Changed(true)
385
+            return
386
+          }
387
+          if (this.view.media_id !== this.data.media_id) {
388
+            this.Changed(true)
389
+            return
390
+          }
391
+        } else if (this.data.type === 'view') {
392
+          if (this.type !== '跳转网页') {
393
+            this.Changed(true)
394
+            return
395
+          }
396
+          if (this.linkHref !== this.data.url) {
397
+            this.Changed(true)
398
+            return
399
+          }
400
+        }
401
+      } else {
402
+        if (this.text) {
403
+          this.Changed(true)
404
+          return
405
+        }
406
+        if (this.img.media_id) {
407
+          this.Changed(true)
408
+          return
409
+        }
410
+        if (this.view.media_id) {
411
+          this.Changed(true)
412
+          return
413
+        }
414
+        if (this.linkHref) {
415
+          this.Changed(true)
416
+          return
417
+        }
418
+      }
419
+      this.Changed(false)
420
+    }
421
+  },
328 422
   components: {
329 423
     Emotion,
330 424
     material

+ 1
- 1
src/pages/login/login.vue 查看文件

@@ -15,7 +15,7 @@
15 15
         <span>记住用户名密码</span>
16 16
         <input type="checkbox" v-model="Remember">
17 17
       </div>
18
-      <Button type="success" class="submit" @click="submit()">登</Button>
18
+      <Button type="success" class="submit" @click="submit()">登</Button>
19 19
     </div>
20 20
   </div>
21 21
 </template>

+ 17
- 4
src/pages/main/main.vue 查看文件

@@ -19,11 +19,11 @@
19 19
           <Modal v-model="showPass" title="修改密码">
20 20
             <div style="padding-bottom:15px;">
21 21
               <label for="passWordOld" style="padding-right:20px;">旧密码</label>
22
-              <Input placeholder="请输入项目名称" size="large" v-model="passWordOld" clearable name="passWordOld" type='password' style="width: 300px"/>
22
+              <Input placeholder="请输入旧密码" size="large" v-model="passWordOld" clearable name="passWordOld" type='password' style="width: 300px"/>
23 23
             </div>
24 24
             <div>
25 25
               <label for="passWord" style="padding-right:20px;">新密码</label>
26
-              <Input placeholder="请输入项目名称" size="large" v-model="passWord" clearable name="passWord" type='password' style="width: 300px"/>
26
+              <Input placeholder="请输入新密码" size="large" v-model="passWord" clearable name="passWord" type='password' style="width: 300px"/>
27 27
             </div>
28 28
             <div slot="footer">
29 29
               <Button type="primary" @click="submit">确认</Button>
@@ -33,7 +33,7 @@
33 33
       </Header>
34 34
       <Layout>
35 35
         <Sider hide-trigger :style="{background: '#fff',borderRight:'1px solid #dcdee2'}">
36
-          <menuLeft v-if="menuData.length>0" :menuData='menuData'></menuLeft>
36
+          <menuLeft v-if="showMenu" :menuData='menuData'></menuLeft>
37 37
         </Sider>
38 38
         <Layout :style="{padding: '24px'}">
39 39
           <Content :style="{padding: '24px', height: '85vh',background: '#fff', position:'relative',overflowY: 'scroll'}">
@@ -61,7 +61,8 @@ export default {
61 61
       showPass: false,
62 62
       defultHead,
63 63
       logo,
64
-      showPage: false
64
+      showPage: false,
65
+      showMenu: false
65 66
     }
66 67
   },
67 68
   created () {
@@ -113,6 +114,18 @@ export default {
113 114
         console.log(this.userInfo)
114 115
       })
115 116
     }
117
+  },
118
+  watch: {
119
+    menuData: {
120
+      handler () {
121
+        this.showMenu = false
122
+        setTimeout(() => {
123
+          this.showMenu = true
124
+        }, 200)
125
+      },
126
+      immediate: false,
127
+      deep: false
128
+    }
116 129
   }
117 130
 }
118 131
 </script>

+ 4
- 0
src/pages/main/management/management.vue 查看文件

@@ -130,6 +130,10 @@ export default {
130 130
         this.$Message.warning('请输入项目名称')
131 131
         this.showAdd = true
132 132
         return
133
+      } else if (this.name.length > 15) {
134
+        this.$Message.warning('项目名称不能超过15字')
135
+        this.showAdd = true
136
+        return
133 137
       }
134 138
       this.addManagement({ OrgName: this.name }).then(() => {
135 139
         this.$Message.success('新增成功')

+ 121
- 39
src/pages/main/menuConfig/menuConfig.vue 查看文件

@@ -14,21 +14,24 @@
14 14
         </div>
15 15
         <div class='phone-body'>
16 16
           <bottomMenu
17
-          :menuArr='menuJson'
18
-          @addMainMenu='addMainMenuClick'
19
-          @setMainMenu='setMainMenuClick'
20
-          @addSubMenu='addSubMenuClick'
21
-          @setSubMenu='setSubMenuClick'></bottomMenu>
17
+            :menuArr='menuJson'
18
+            @addMainMenu='addMainMenuClick'
19
+            @setMainMenu='setMainMenuClick'
20
+            @addSubMenu='addSubMenuClick'
21
+            @setSubMenu='setSubMenuClick'>
22
+          </bottomMenu>
22 23
         </div>
23 24
       </div>
24 25
       <div class="content-item">
25 26
         <transition name="fade">
26
-          <menuForm v-if="formActive" :data='chooseItem' :menuConfig='true' :hasContent='hasContent' :hasDelete='hasDelete' @emit='checkForm' @delMenu='delMenu'></menuForm>
27
+          <div v-if="formActive" class="boxshadow">
28
+            <menuForm :data='chooseItem' :menuConfig='true' :hasContent='hasContent' :hasDelete='hasDelete' :needCheckDestroy='true' @emit='checkForm' @delMenu='delMenu'></menuForm>
29
+          </div>
27 30
         </transition>
28 31
       </div>
29 32
     </div>
30 33
     <div class="btn-group">
31
-      <Button type="primary" @click="submit">发布</Button>
34
+      <Button type="primary" style="width:200px;" @click="submit">发布</Button>
32 35
     </div>
33 36
   </div>
34 37
 </template>
@@ -59,7 +62,8 @@ export default {
59 62
   },
60 63
   computed: {
61 64
     ...mapMenuConfigState({
62
-      menuJson: item => item.menuJson
65
+      menuJson: item => item.menuJson,
66
+      changed: item => item.changed
63 67
     })
64 68
   },
65 69
   components: {
@@ -67,18 +71,45 @@ export default {
67 71
     menuForm
68 72
   },
69 73
   methods: {
70
-    ...mapMenuConfigActions(['getWechatMenu', 'AddMainMenu', 'SetMainMenu', 'AddSubMenu', 'SetSubMenu', 'mainActive', 'subActive', 'mainPlusActive', 'subPlusActive', 'clear', 'setWechatMenu']),
74
+    ...mapMenuConfigActions(['getWechatMenu', 'AddMainMenu', 'SetMainMenu', 'AddSubMenu', 'SetSubMenu', 'mainActive', 'subActive', 'mainPlusActive', 'subPlusActive', 'clear', 'setWechatMenu', 'Changed']),
71 75
     init () {
72 76
       this.getWechatMenu()
73 77
     },
74 78
     chengeForm (hasContent, hasDelete) {
75 79
       this.formActive = false
76
-      this.hasContent = hasContent
77
-      this.hasDelete = hasDelete
78
-      this.$nextTick(() => {
79
-        setTimeout(() => {
80
+      return new Promise((resolve, reject) => {
81
+        if (!this.changed) {
82
+          this.hasContent = hasContent
83
+          this.hasDelete = hasDelete
84
+          this.$nextTick(() => {
85
+            setTimeout(() => {
86
+              this.formActive = true
87
+            }, 500)
88
+          })
89
+          resolve()
90
+        } else {
80 91
           this.formActive = true
81
-        }, 500)
92
+          console.log('检查修改')
93
+          this.$Modal.confirm({
94
+            title: '警告',
95
+            content: `<p style='font-size:18px;'>您已编辑过此菜单,确认放弃编辑?<p>`,
96
+            onOk: () => {
97
+              this.formActive = false
98
+              this.hasContent = hasContent
99
+              this.hasDelete = hasDelete
100
+              this.$nextTick(() => {
101
+                setTimeout(() => {
102
+                  this.formActive = true
103
+                }, 500)
104
+              })
105
+              this.Changed(false)
106
+              resolve()
107
+            },
108
+            onCancel: () => {
109
+              reject()
110
+            }
111
+          })
112
+        }
82 113
       })
83 114
     },
84 115
     checkForm (data) {
@@ -91,37 +122,66 @@ export default {
91 122
       } else if (this.chooseTag.type === 3) {
92 123
         this.setSubMenu(data, this.chooseTag.index, this.chooseTag.parentIndex)
93 124
       }
125
+      this.Changed(false)
94 126
       this.$Message.success('设置成功')
95 127
       this.clear()
96
-      this.formActive = false
128
+      // this.formActive = false
97 129
     },
98 130
     addMainMenuClick () {
99
-      this.chooseItem = {}
100
-      this.chooseTag.type = 0
101
-      this.chengeForm(true, false)
102
-      this.mainPlusActive()
131
+      this.chengeForm(true, false).then(() => {
132
+        this.chooseItem = {}
133
+        this.chooseTag.type = 0
134
+        this.mainPlusActive()
135
+      }).catch((err) => {
136
+        console.log(err)
137
+      })
103 138
     },
104 139
     setMainMenuClick (item, index) {
105
-      this.chooseItem = item
106
-      this.chooseTag.type = 1
107
-      this.chooseTag.index = index
108
-      this.chengeForm(false, true)
109
-      this.mainActive({ index })
140
+      this.chengeForm(item.sub_button.length > 0 ? false : true, true).then(() => {
141
+        this.chooseItem = item
142
+        this.chooseTag.type = 1
143
+        this.chooseTag.index = index
144
+        this.mainActive({ index })
145
+      }).catch((err) => {
146
+        console.log(err)
147
+      })
148
+      // this.chooseItem = item
149
+      // this.chooseTag.type = 1
150
+      // this.chooseTag.index = index
151
+      // this.chengeForm(item.sub_button.length > 0 ? false : true, true)
152
+      // this.mainActive({ index })
110 153
     },
111 154
     addSubMenuClick (index) {
112
-      this.chooseItem = {}
113
-      this.chooseTag.type = 2
114
-      this.chooseTag.parentIndex = index
115
-      this.chengeForm(true, false)
116
-      this.subPlusActive({ index })
155
+      this.chengeForm(true, false).then(() => {
156
+        this.chooseItem = {}
157
+        this.chooseTag.type = 2
158
+        this.chooseTag.parentIndex = index
159
+        this.subPlusActive({ index })
160
+      }).catch((err) => {
161
+        console.log(err)
162
+      })
163
+      // this.chooseItem = {}
164
+      // this.chooseTag.type = 2
165
+      // this.chooseTag.parentIndex = index
166
+      // this.chengeForm(true, false)
167
+      // this.subPlusActive({ index })
117 168
     },
118 169
     setSubMenuClick (item, index, parentIndex) {
119
-      this.chooseItem = item
120
-      this.chooseTag.type = 3
121
-      this.chooseTag.index = index
122
-      this.chooseTag.parentIndex = parentIndex
123
-      this.chengeForm(true, true)
124
-      this.subActive({ index, parentIndex })
170
+      this.chengeForm(true, true).then(() => {
171
+        this.chooseItem = item
172
+        this.chooseTag.type = 3
173
+        this.chooseTag.index = index
174
+        this.chooseTag.parentIndex = parentIndex
175
+        this.subActive({ index, parentIndex })
176
+      }).catch((err) => {
177
+        console.log(err)
178
+      })
179
+      // this.chooseItem = item
180
+      // this.chooseTag.type = 3
181
+      // this.chooseTag.index = index
182
+      // this.chooseTag.parentIndex = parentIndex
183
+      // this.chengeForm(true, true)
184
+      // this.subActive({ index, parentIndex })
125 185
     },
126 186
     delMenu () {
127 187
       if (this.chooseTag.type === 1) {
@@ -159,10 +219,26 @@ export default {
159 219
       this.SetSubMenu(data)
160 220
     },
161 221
     submit () {
162
-      this.setWechatMenu().then(() => {
163
-        this.$Message.success('发布成功')
164
-        this.init()
165
-      })
222
+      if (this.changed) {
223
+        this.$Modal.confirm({
224
+          title: '警告',
225
+          content: `<p style='font-size:18px;'>当前编辑的菜单未保存,若确认发布,当前未保存菜单不会生效,是否确认发布?<p>`,
226
+          onOk: () => {
227
+            this.setWechatMenu().then(() => {
228
+              this.$Message.success('发布成功')
229
+              this.init()
230
+            })
231
+          },
232
+          onCancel: () => {
233
+
234
+          }
235
+        })
236
+      } else {
237
+        this.setWechatMenu().then(() => {
238
+          this.$Message.success('发布成功')
239
+          this.init()
240
+        })
241
+      }
166 242
     }
167 243
   }
168 244
 }
@@ -173,6 +249,12 @@ export default {
173 249
   display: flex;
174 250
   .content-item {
175 251
     flex: 1;
252
+    .boxshadow {
253
+      box-shadow: 1px 1px 5px 1px #ccc;
254
+      margin: 0px 0px 0px 20px;
255
+      border-radius: 5px;
256
+      height: 667px;
257
+    }
176 258
   }
177 259
   .phone {
178 260
     width: 375px;

+ 13
- 4
src/pages/main/reply/editReply.vue 查看文件

@@ -54,8 +54,8 @@ export default {
54 54
           this.menuData.value = this.MessageParagraph
55 55
         } else if (this.MessageType === 'img') {
56 56
           this.menuData.type = 'media_id'
57
-          this.img.media_id = ''
58
-          this.img.url = this.MessageImg
57
+          this.menuData.media_id = ''
58
+          this.menuData.url = this.MessageImg
59 59
         } else if (this.MessageType === 'content') {
60 60
           this.menuData.type = 'view'
61 61
           this.menuData.media_id = ''
@@ -104,6 +104,15 @@ export default {
104 104
       this.$router.push({ name: 'reply' })
105 105
     },
106 106
     checkForm (data) {
107
+      console.log(data)
108
+      if (!this.name) {
109
+        this.$Message.warning('规则名必填')
110
+        return
111
+      }
112
+      if (this.tagList.length <= 0) {
113
+        this.$Message.warning('关键词不得少于1个')
114
+        return
115
+      }
107 116
       let formData = {}
108 117
       formData.RuleName = this.name
109 118
       formData.IsUse = this.$route.query.state ? 'on' : 'off'
@@ -117,14 +126,14 @@ export default {
117 126
         formData.MessageContent = ''
118 127
       } else if (data.type === 'media_id') {
119 128
         formData.MessageType = 'img'
120
-        formData.MessageImg = ''
129
+        formData.MessageImg = data.media_id
121 130
         formData.MessageParagraph = ''
122 131
         formData.MessageContent = ''
123 132
       } else if (data.type === 'view') {
124 133
         formData.MessageType = 'content'
125 134
         formData.MessageImg = ''
126 135
         formData.MessageParagraph = ''
127
-        formData.MessageContent = ''
136
+        formData.MessageContent = data.media_id
128 137
       }
129 138
       if (this.$route.query.id) {
130 139
         formData.AutoReplyId = this.$route.query.id

+ 5
- 5
src/pages/main/reply/reply.vue 查看文件

@@ -71,7 +71,7 @@ export default {
71 71
                   'margin-right': '20px'
72 72
                 },
73 73
                 on: {
74
-                  click: () => { this.$router.push({ name: 'editReply', query: { id: params.row.AutoReplyId,state: this.keywordSwitch } }) }
74
+                  click: () => { this.$router.push({ name: 'editReply', query: { id: params.row.AutoReplyId, state: this.keywordSwitch } }) }
75 75
                 },
76 76
               }, '编辑'),
77 77
               h('Button', {
@@ -104,8 +104,8 @@ export default {
104 104
         this.menuData.value = this.Subscribe.MessageParagraph
105 105
       } else if (this.Subscribe.MessageType === 'img') {
106 106
         this.menuData.type = 'media_id'
107
-        this.img.media_id = ''
108
-        this.img.url = this.Subscribe.MessageImg
107
+        this.menuData.media_id = ''
108
+        this.menuData.url = this.Subscribe.MessageImg
109 109
       } else if (this.Subscribe.MessageType === 'content') {
110 110
         this.menuData.type = 'view'
111 111
         this.menuData.media_id = ''
@@ -148,14 +148,14 @@ export default {
148 148
         formData.MessageContent = ''
149 149
       } else if (data.type === 'media_id') {
150 150
         formData.MessageType = 'img'
151
-        formData.MessageImg = ''
151
+        formData.MessageImg = data.media_id
152 152
         formData.MessageParagraph = ''
153 153
         formData.MessageContent = ''
154 154
       } else if (data.type === 'view') {
155 155
         formData.MessageType = 'content'
156 156
         formData.MessageImg = ''
157 157
         formData.MessageParagraph = ''
158
-        formData.MessageContent = ''
158
+        formData.MessageContent = data.media_id
159 159
       }
160 160
       if (this.Subscribe.AutoReplyId) {
161 161
         formData.AutoReplyId = this.Subscribe.AutoReplyId

+ 2
- 2
src/pages/main/user/editUser.vue 查看文件

@@ -206,7 +206,7 @@ export default {
206 206
           Phone: this.mobile,
207 207
           Email: this.email,
208 208
           UserId: this.$route.query.id,
209
-          Headimgurl: this.uploadList[0].url,
209
+          Headimgurl: this.uploadList.length > 0 ? this.uploadList[0].url : '',
210 210
           Pwd: this.passWord,
211 211
           UserType: 'operator'
212 212
         }
@@ -220,7 +220,7 @@ export default {
220 220
           RealName: this.realName,
221 221
           Phone: this.mobile,
222 222
           Email: this.email,
223
-          Headimgurl: this.uploadList[0].url,
223
+          Headimgurl: this.uploadList.length > 0 ? this.uploadList[0].url : '',
224 224
           Pwd: this.passWord,
225 225
           UserType: 'operator'
226 226
         }

+ 3
- 1
src/pages/main/user/user.vue 查看文件

@@ -15,6 +15,7 @@
15 15
 </template>
16 16
 
17 17
 <script>
18
+import defultHead from '@/assets/defultHead.png'
18 19
 import { createNamespacedHelpers } from 'vuex'
19 20
 const { mapState: mapUserState, mapActions: mapUserActions } = createNamespacedHelpers('user')
20 21
 export default {
@@ -24,6 +25,7 @@ export default {
24 25
       showAdd: false,
25 26
       name: '',
26 27
       chooseUser: '',
28
+      defultHead,
27 29
       userColumns: [
28 30
         {
29 31
           title: '头像',
@@ -32,7 +34,7 @@ export default {
32 34
           render: (h, params) => {
33 35
             return h('img', {
34 36
               attrs: {
35
-                src: params.row.Headimgurl
37
+                src: params.row.Headimgurl ? params.row.Headimgurl : this.defultHead
36 38
               },
37 39
               style: {
38 40
                 'width': '40px',

+ 3
- 3
src/router/index.js 查看文件

@@ -36,9 +36,9 @@ const router = new Router({
36 36
 })
37 37
 
38 38
 router.beforeEach((to, from, next) => {
39
-  console.log(store.state.main.isBind)
40
-  console.log(to)
41
-  console.log(from)
39
+  // console.log(store.state.main.isBind)
40
+  // console.log(to)
41
+  // console.log(from)
42 42
   if (to.name !== 'login' && !store.state.main.isBind) {
43 43
     // Message.warning('请先通知管理员绑定项目,再进行微信配置')
44 44
   }

+ 2
- 0
src/store/material.js 查看文件

@@ -30,6 +30,8 @@ export default {
30 30
         }).then(res => {
31 31
           res.list.forEach((curr) => {
32 32
             curr.checked = false
33
+            curr.media_id = curr.MediaId
34
+            curr.url = curr.Url
33 35
           })
34 36
           context.commit('updateImg', res)
35 37
           resolve(res)

+ 22
- 3
src/store/menuConfig.js 查看文件

@@ -56,6 +56,7 @@ export default {
56 56
       'button': [],
57 57
       mainPlusActive: false
58 58
     },
59
+    changed: false
59 60
   },
60 61
   mutations: {
61 62
     updateMenu (state, data) {
@@ -107,7 +108,10 @@ export default {
107 108
     },
108 109
     clearMenu (state) {
109 110
       state.menuJson = loop(state.menuJson)
110
-    }
111
+    },
112
+    updateChanged (state, data) {
113
+      state.changed = data
114
+    },
111 115
   },
112 116
   actions: {
113 117
     getWechatMenu (context) {
@@ -118,12 +122,21 @@ export default {
118 122
           let button = []
119 123
           if (res) {
120 124
             button = res.menu.menu.button
125
+            res.imgList = res.imgList || []
126
+            res.imgList.forEach((c, i) => {
127
+              if (!c) {
128
+                res.imgList.splice(i, 1)
129
+              }
130
+            })
121 131
             button.forEach((current) => {
122 132
               if (current.type === 'click') {
123 133
                 current.type = 'text'
124 134
                 current.value = res.keyList.filter(item => item.KeyId === current.key)[0].Value
125 135
               } else if (current.type === 'media_id') {
126
-                current.url = res.imgList.filter(item => item.MediaId === current.media_id)[0].Url
136
+                let filter = res.imgList.filter(item => item.MediaId === current.media_id)
137
+                if (filter.length > 0) {
138
+                  current.url = filter[0].Url ? filter[0].Url : ''
139
+                }
127 140
               }
128 141
               if (current.sub_button) {
129 142
                 current.sub_button.forEach((curr) => {
@@ -131,7 +144,10 @@ export default {
131 144
                     curr.type = 'text'
132 145
                     curr.value = res.keyList.filter(item => item.KeyId === curr.key)[0].Value
133 146
                   } else if (curr.type === 'media_id') {
134
-                    curr.url = res.imgList.filter(item => item.MediaId === curr.media_id)[0].Url
147
+                    let filter = res.imgList.filter(item => item.MediaId === curr.media_id)
148
+                    if (filter.length > 0) {
149
+                      curr.url = filter[0].Url ? filter[0].Url : ''
150
+                    }
135 151
                   }
136 152
                 })
137 153
               }
@@ -238,6 +254,9 @@ export default {
238 254
           resolve()
239 255
         }).catch(reject)
240 256
       })
257
+    },
258
+    Changed (context, data) {
259
+      context.commit('updateChanged', data)
241 260
     }
242 261
   }
243 262
 }

+ 2
- 2
vue.config.js 查看文件

@@ -6,8 +6,8 @@ module.exports = {
6 6
   devServer: {
7 7
     proxy: {
8 8
       '/api': {
9
-        // target: 'http://wechatconfig.ycjcjy.com',
10
-        target: 'http://192.168.0.62:8080', // wf
9
+        target: 'http://wechatconfig.ycjcjy.com',
10
+        // target: 'http://192.168.0.62:8080', // wf
11 11
         // target: 'http://192.168.0.102:8080', // hyq
12 12
         // target: 'http://192.168.0.11', // ys
13 13
         // target: 'http://dev.ycjcjy.com', // frp