yuantianjiao 6 vuotta sitten
vanhempi
commit
a88d1d772b

+ 14
- 7
src/pages/system/cmsManager/bannerManager/add.vue Näytä tiedosto

@@ -27,8 +27,8 @@
27 27
           <span>是否发布:</span>
28 28
           <div class="flex-item">
29 29
             <div style="width:50%" class="radio">
30
-              <el-radio v-model="postData.status" label='1' >是</el-radio>
31
-              <el-radio v-model="postData.status" label='0' >否</el-radio>
30
+              <el-radio v-model="postData.Status" label='1' >是</el-radio>
31
+              <el-radio v-model="postData.Status" label='0' >否</el-radio>
32 32
             </div>
33 33
           </div>
34 34
         </li>
@@ -39,9 +39,9 @@
39 39
               <el-select v-model="postData.LocationId" placeholder="请选择">
40 40
                 <el-option
41 41
                   v-for="item in positionList"
42
-                  :key="item.value"
43
-                  :label="item.label"
44
-                  :value="item.value">
42
+                  :key="item.LocationId"
43
+                  :label="item.LocationName"
44
+                  :value="item.LocationId">
45 45
                 </el-option>
46 46
               </el-select>
47 47
             </div>
@@ -92,7 +92,7 @@ export default {
92 92
       postData: {
93 93
         ForwardType: '1',
94 94
         ForwardUrl: '',
95
-        ForwardResource: '',
95
+        ForwardResourceId: '',
96 96
         Status: '1',
97 97
         LocationId: '',
98 98
         ImageUrl: '',
@@ -122,7 +122,14 @@ export default {
122 122
         method: this.$api.cms.addImage.method,
123 123
         data: this.postData
124 124
       }).then(res => {
125
-        this.$router.push({ name: 'bannerManager' })
125
+        this.$message({
126
+          message: '添加成功',
127
+          type: 'success',
128
+          duration: 1000
129
+        })
130
+        setTimeout(() => {
131
+          this.$router.push({ name: 'bannerManager' })
132
+        }, 1000)
126 133
       }).catch(msg => {
127 134
 
128 135
       })

+ 82
- 46
src/pages/system/cmsManager/bannerManager/edit.vue Näytä tiedosto

@@ -6,8 +6,8 @@
6 6
           <span>跳转类型:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%" class="radio">
9
-                <el-radio v-model="postData.jumpType" label='0' >连接</el-radio>
10
-                <el-radio v-model="postData.jumpType" label='1' >课程</el-radio>
9
+                <el-radio v-model="postData.ForwardType" label='1' >链接</el-radio>
10
+                <el-radio v-model="postData.ForwardType" label='0' >课程</el-radio>
11 11
             </div>
12 12
           </div>
13 13
         </li>
@@ -17,7 +17,7 @@
17 17
             <div style="width:50%">
18 18
               <el-input
19 19
                 placeholder="请输入链接"
20
-                v-model="postData.link"
20
+                v-model="postData.ForwardUrl"
21 21
                 clearable>
22 22
               </el-input>
23 23
             </div>
@@ -27,8 +27,8 @@
27 27
           <span>是否发布:</span>
28 28
           <div class="flex-item">
29 29
             <div style="width:50%" class="radio">
30
-              <el-radio v-model="postData.release" label='0' >是</el-radio>
31
-                <el-radio v-model="postData.release" label='1' >否</el-radio>
30
+              <el-radio v-model="postData.Status" label='1' >是</el-radio>
31
+              <el-radio v-model="postData.Status" label='0' >否</el-radio>
32 32
             </div>
33 33
           </div>
34 34
         </li>
@@ -36,12 +36,12 @@
36 36
           <span>图片位置:</span>
37 37
           <div class="flex-item">
38 38
             <div style="width:50%">
39
-              <el-select v-model="postData.position" placeholder="请选择">
39
+              <el-select v-model="postData.LocationId" placeholder="请选择">
40 40
                 <el-option
41 41
                   v-for="item in positionList"
42
-                  :key="item.value"
43
-                  :label="item.label"
44
-                  :value="item.value">
42
+                  :key="item.LocationId"
43
+                  :label="item.LocationName"
44
+                  :value="item.LocationId">
45 45
                 </el-option>
46 46
               </el-select>
47 47
             </div>
@@ -53,7 +53,7 @@
53 53
             <div style="width:50%">
54 54
               <el-input
55 55
                 placeholder="请输入标题"
56
-                v-model="postData.realName"
56
+                v-model="postData.Title"
57 57
                 clearable>
58 58
               </el-input>
59 59
             </div>
@@ -62,13 +62,15 @@
62 62
         <li class="flex-h">
63 63
           <span>图片:</span>
64 64
           <div class="flex-item">
65
-            <div>
66
-              <a class="formImg">
67
-                <img src="" class="centerLabel contain" alt="">
68
-                <i class="iconfont icon-quxiao"></i>
69
-              </a>
70
-              <el-button type="success" size="mini">上传图片</el-button>
71
-            </div>
65
+            <el-upload
66
+              class="avatar-uploader"
67
+              :action='$api.file.image.url'
68
+              :show-file-list="false"
69
+              :on-success="handleAvatarSuccess"
70
+              :before-upload="beforeAvatarUpload">
71
+              <img v-if="postData.ImageUrl" :src="postData.ImageUrl" class="avatar">
72
+              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
73
+            </el-upload>
72 74
           </div>
73 75
         </li>
74 76
         <li style="text-align:center">
@@ -81,50 +83,84 @@
81 83
 </template>
82 84
 
83 85
 <script>
86
+import { mapState, createNamespacedHelpers } from 'vuex'
87
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
84 88
 export default {
85 89
   name: '',
86 90
   data () {
87 91
     return {
88 92
       postData: {
89
-        jumpType: '0',
90
-        link: '',
91
-        release: '0',
92
-        position: ''
93
-      },
94
-      positionList: [{
95
-        value: '0',
96
-        label: '首页'
97
-      }, {
98
-        value: '1',
99
-        label: '精选'
100
-      }, {
101
-        value: '2',
102
-        label: '健康'
103
-      }, {
104
-        value: '3',
105
-        label: '社交'
106
-      }, {
107
-        value: '4',
108
-        label: '教育'
109
-      }, {
110
-        value: '5',
111
-        label: '健身'
112
-      }, {
113
-        value: '6',
114
-        label: '艺术'
115
-      }],
93
+        ForwardType: '1',
94
+        ForwardUrl: '',
95
+        ForwardResourceId: '',
96
+        Status: '1',
97
+        LocationId: '',
98
+        ImageUrl: '',
99
+        Title: '',
100
+        OrgId: '',
101
+        CaseId: ''
102
+      }
116 103
     }
117 104
   },
118 105
   components: {},
106
+  created () {
107
+    this.updateLocationInfo()
108
+    this.getDetail()
109
+  },
110
+  computed: {
111
+    ...mapState({
112
+      positionList: x => x.cms.location,
113
+      OrgId: x => x.app.user.OrgId,
114
+      CaseId: x => x.app.cases.default
115
+    })
116
+  },
119 117
   methods: {
118
+    ...mapCmsActions(['updateLocationInfo']),
120 119
     submit () {
120
+      this.postData.OrgId = this.OrgId
121
+      this.postData.CaseId = this.CaseId
121 122
       console.log(this.postData)
123
+      this.$ajax(this.$api.cms.editImage.url, {
124
+        method: this.$api.cms.editImage.method,
125
+        data: this.postData,
126
+        urlData: {
127
+          id: this.$route.query.id
128
+        }
129
+      }).then(res => {
130
+        this.$message({
131
+          message: '编辑成功',
132
+          type: 'success',
133
+          duration: 1000
134
+        })
135
+        setTimeout(() => {
136
+          this.$router.push({ name: 'bannerManager' })
137
+        }, 1000)
138
+      }).catch(msg => {
139
+
140
+      })
122 141
     },
123 142
     cancel () {
124 143
       this.$router.go(-1)
144
+    },
145
+    handleAvatarSuccess (res, file) {
146
+      this.postData.ImageUrl = res.result.url
147
+    },
148
+    beforeAvatarUpload (file) { },
149
+    getDetail () {
150
+      this.$ajax(this.$api.cms.imageDetail.url, {
151
+        method: this.$api.cms.imageDetail.method,
152
+        urlData: {
153
+          id: this.$route.query.id
154
+        }
155
+      }).then(res => {
156
+        console.log(res)
157
+        res.Status = res.Status + ''
158
+        this.postData = res
159
+      }).catch(msg => {
160
+
161
+      })
125 162
     }
126
-  },
127
-  mounted () { }
163
+  }
128 164
 }
129 165
 </script>
130 166
 

+ 66
- 54
src/pages/system/cmsManager/bannerManager/index.vue Näytä tiedosto

@@ -5,7 +5,7 @@
5 5
         <div class="flex-item flex-h">
6 6
           <el-button size="mini" type="success" @click="addBanner">新增轮播图</el-button>
7 7
         </div>
8
-        <tableSearch @exportSearchKey="searchList"></tableSearch>
8
+        <!-- <tableSearch @exportSearchKey="searchList"></tableSearch> -->
9 9
       </div>
10 10
       <div class="moreFilter"></div>
11 11
     </div>
@@ -19,16 +19,16 @@
19 19
           label="图片">
20 20
           <template slot-scope="scope">
21 21
             <a class="tableImg">
22
-              <img :src="scope.row.img" class="centerLabel contain" alt="">
22
+              <img :src="scope.row.ImageUrl" class="centerLabel contain" alt="">
23 23
             </a>
24 24
           </template>
25 25
         </el-table-column>
26 26
         <el-table-column
27
-          prop="position"
27
+          prop="LocationShow"
28 28
           label="位置">
29 29
         </el-table-column>
30 30
         <el-table-column
31
-          prop="isShow"
31
+          prop="StatusShow"
32 32
           label="是否显示">
33 33
         </el-table-column>
34 34
         <el-table-column label="操作">
@@ -46,102 +46,114 @@
46 46
       </el-table>
47 47
     </div>
48 48
     <el-pagination
49
-      @size-change="handleSizeChange"
50 49
       @current-change="handleCurrentChange"
51
-      :current-page.sync="currentPage"
52
-      :page-size="10"
50
+      :current-page.sync="postData.currentPage+1"
51
+      :page-size="postData.pageSize"
53 52
       layout="prev, pager, next, jumper"
54
-      :total="100">
53
+      :total="postData.total">
55 54
     </el-pagination>
56 55
   </div>
57 56
 </template>
58 57
 
59 58
 <script>
60 59
 import tableSearch from '@/components/tableSearch/index'
61
-import { mapState } from 'vuex'
60
+import { mapState, createNamespacedHelpers } from 'vuex'
61
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
62 62
 export default {
63 63
   name: '',
64 64
   data () {
65 65
     return {
66
-      currentPage: 0, // 当前页码
67
-      tableSearch: { // 表格搜索条件
68
-        key: '', // 搜索关键字
69
-        caseId: '', // 案场id
66
+      postData: {
67
+        currentPage: 0, // 当前页码
68
+        pageSize: 10,
69
+        total: 0,
70 70
       },
71
-      tableData: [{
72
-        img: 'xxx',
73
-        position: 'xxx',
74
-        isShow: 'xxx'
75
-      }, {
76
-        img: 'xxx',
77
-        position: 'xxx',
78
-        isShow: 'xxx'
79
-      }, {
80
-        img: 'xxx',
81
-        position: 'xxx',
82
-        isShow: 'xxx'
83
-      }, {
84
-        img: 'xxx',
85
-        position: 'xxx',
86
-        isShow: 'xxx'
87
-      }]
71
+      tableData: []
88 72
     }
89 73
   },
90 74
   computed: {
91 75
     ...mapState({
92
-      case: x => x.user.cases.list,
76
+      positionList: x => x.cms.location
93 77
     })
94 78
   },
95 79
   components: {
96 80
     tableSearch,
97 81
   },
98
-  mounted () {
99
-    this.initList()
82
+  created () {
83
+    this.updateLocationInfo()
84
+    this.getList()
100 85
   },
101 86
   methods: {
102
-    handleSizeChange (val) {
103
-      console.log(`每页 ${val} 条`)
104
-    },
87
+    ...mapCmsActions(['updateLocationInfo']),
105 88
     handleCurrentChange (val) {
106
-      console.log(`当前页: ${val}`)
89
+      this.postData.currentPage = val - 1
90
+      this.getList()
107 91
     },
108 92
     handleEdit (index, row) { // 编辑
109
-      this.$router.push({ name: 'editBanner', query: { id: row.position } })
110
-      console.log(index, row)
93
+      this.$router.push({ name: 'editBanner', query: { id: row.ImageId } })
111 94
     },
112 95
     handleDelete (index, row) { // 删除
113
-      console.log(index, row)
114
-      this.$confirm('确认删除此渠道?', '提示', {
96
+      this.$confirm('确认删除此消息?', '提示', {
115 97
         confirmButtonText: '确定',
116 98
         cancelButtonText: '取消',
117 99
         type: 'warning'
118
-      }).then(() => {
119
-        this.$message({
120
-          type: 'success',
121
-          message: '删除成功!'
122
-        })
123
-      }).catch(() => {
100
+      }).then((res) => {
101
+        this.deleteImage(row.ImageId)
102
+      }).catch((res) => {
124 103
         this.$message({
125 104
           type: 'info',
126 105
           message: '已取消删除'
127 106
         })
128 107
       })
129 108
     },
130
-    searchList (key) { // 搜索列表
131
-      console.log(key)
132
-    },
109
+    // searchList (key) { // 搜索列表
110
+    //   console.log(key)
111
+    // },
133 112
     addBanner () {
134 113
       this.$router.push({ name: 'addBanner' })
135 114
     },
136
-    initList () {
115
+    getList () {
137 116
       this.$ajax(this.$api.cms.imageList.url, {
138 117
         method: this.$api.cms.imageList.method,
139
-        data: {
140
-          pagenum: '1'
118
+        queryData: {
119
+          page: this.postData.currentPage,
120
+          pagesize: this.postData.pageSize
141 121
         }
142
-      }, { a: 1 }).then(res => {
122
+      }).then(res => {
143 123
         console.log(res)
124
+        let length = res.list.length
125
+        for (let i = 0; i < length; i++) {
126
+          if (res.list[i].Status === 1) {
127
+            res.list[i].StatusShow = '是'
128
+          } else {
129
+            res.list[i].StatusShow = '否'
130
+          }
131
+          for (let j = 0; j < this.positionList.length; j++) {
132
+            if (res.list[i].LocationId === this.positionList[j].LocationId) {
133
+              res.list[i].LocationShow = this.positionList[j].LocationName
134
+            }
135
+          }
136
+        }
144 137
         this.tableData = res.list
138
+        this.postData.total = res.pagenum
139
+        this.postData.currentPage = res.page
140
+      }).catch(msg => {
141
+
142
+      })
143
+    },
144
+    deleteImage (id) {
145
+      this.$ajax(this.$api.cms.deleteDetail.url, {
146
+        method: this.$api.cms.deleteDetail.method,
147
+        urlData: {
148
+          id: id
149
+        }
150
+      }).then(res => {
151
+        console.log(res)
152
+        this.$message({
153
+          type: 'success',
154
+          message: '删除成功!'
155
+        })
156
+        this.getList()
145 157
       }).catch(msg => {
146 158
 
147 159
       })

+ 52
- 19
src/pages/system/cmsManager/majorProjects/index.vue Näytä tiedosto

@@ -11,9 +11,9 @@
11 11
             <el-select v-model="tableSearch.caseId" placeholder="请选择">
12 12
               <el-option
13 13
                 v-for="item in caseList"
14
-                :key="item.value"
15
-                :label="item.label"
16
-                :value="item.value">
14
+                :key="item.CaseId"
15
+                :label="item.CaseName"
16
+                :value="item.CaseId">
17 17
               </el-option>
18 18
             </el-select>
19 19
           </li>
@@ -69,27 +69,28 @@
69 69
       </el-table>
70 70
     </div>
71 71
     <el-pagination
72
-      @size-change="handleSizeChange"
73 72
       @current-change="handleCurrentChange"
74
-      :current-page.sync="currentPage"
75
-      :page-size="10"
73
+      :current-page.sync="postData.currentPage+1"
74
+      :page-size="postData.pageSize"
76 75
       layout="prev, pager, next, jumper"
77
-      :total="100">
76
+      :total="postData.total">
78 77
     </el-pagination>
79 78
   </div>
80 79
 </template>
81 80
 
82 81
 <script>
83 82
 import tableSearch from '@/components/tableSearch/index'
84
-import { createNamespacedHelpers } from 'vuex'
85
-
86
-const { mapState: mapCaseState } = createNamespacedHelpers('case')
83
+import { mapState } from 'vuex'
87 84
 
88 85
 export default {
89 86
   name: '',
90 87
   data () {
91 88
     return {
92
-      currentPage: 0, // 当前页码
89
+      postData: {
90
+        currentPage: 0, // 当前页码
91
+        pageSize: 10,
92
+        total: 0,
93
+      },
93 94
       tableSearch: { // 表格搜索条件
94 95
         key: '', // 搜索关键字
95 96
         caseId: '', // 案场id
@@ -122,19 +123,22 @@ export default {
122 123
     }
123 124
   },
124 125
   computed: {
125
-    ...mapCaseState({
126
-      caseList: x => x.caseList,
126
+    ...mapState({
127
+      caseList: x => x.app.cases.list,
128
+      defaultCaseId: x => x.app.cases.default,
127 129
     })
128 130
   },
129 131
   components: {
130 132
     tableSearch,
131 133
   },
134
+  created () {
135
+    this.getList()
136
+    this.tableSearch.caseId = this.defaultCaseId
137
+  },
132 138
   methods: {
133
-    handleSizeChange (val) {
134
-      console.log(`每页 ${val} 条`)
135
-    },
136 139
     handleCurrentChange (val) {
137
-      console.log(`当前页: ${val}`)
140
+      this.postData.currentPage = val - 1
141
+      this.getList()
138 142
     },
139 143
     showItem (index, row) { // 前台显示
140 144
       console.log(index, row)
@@ -144,7 +148,7 @@ export default {
144 148
     },
145 149
     editItem (index, row) { // 编辑
146 150
       console.log(index, row)
147
-      this.$router.push({ name: 'editMajorProjects', query: { id: row.id } })
151
+      this.$router.push({ name: 'editIndexCase', query: { id: row.id } })
148 152
     },
149 153
     copyItemUrl (index, row) { // 复制专题链接
150 154
       console.log(index, row)
@@ -171,7 +175,36 @@ export default {
171 175
       console.log(key)
172 176
     },
173 177
     addMajorProjects () {
174
-      this.$router.push({ name: 'addMajorProjects' })
178
+      this.$router.push({ name: 'addIndexCase' })
179
+    },
180
+    getList () {
181
+      this.$ajax(this.$api.cms.case.url, {
182
+        method: this.$api.cms.case.method,
183
+        queryData: {
184
+          page: this.postData.currentPage,
185
+          pagesize: this.postData.pageSize
186
+        }
187
+      }).then(res => {
188
+        console.log(res)
189
+        // let length = res.list.length
190
+        // for (let i = 0; i < length; i++) {
191
+        //   if (res.list[i].Status === 1) {
192
+        //     res.list[i].StatusShow = '是'
193
+        //   } else {
194
+        //     res.list[i].StatusShow = '否'
195
+        //   }
196
+        //   for (let j = 0; j < this.positionList.length; j++) {
197
+        //     if (res.list[i].LocationId === this.positionList[j].LocationId) {
198
+        //       res.list[i].LocationShow = this.positionList[j].LocationName
199
+        //     }
200
+        //   }
201
+        // }
202
+        // this.tableData = res.list
203
+        // this.postData.total = res.pagenum
204
+        // this.postData.currentPage = res.page
205
+      }).catch(msg => {
206
+
207
+      })
175 208
     }
176 209
   }
177 210
 }

+ 14
- 2
src/util/api.js Näytä tiedosto

@@ -39,13 +39,25 @@ const $api = {
39 39
       method: 'get',
40 40
       url: `${baseUrl}/common/cms/image`
41 41
     },
42
+    imageDetail: { // 轮播图详情
43
+      method: 'get',
44
+      url: `${baseUrl}/common/cms/image/:id`
45
+    },
42 46
     addImage: { // 添加轮播图
43 47
       method: 'post',
44 48
       url: `${baseUrl}/common/cms/image`
45 49
     },
46 50
     editImage: { // 编辑轮播图
47
-      method: 'post',
48
-      url: `${baseUrl}/common/cms/image`
51
+      method: 'put',
52
+      url: `${baseUrl}/common/cms/image/:id`
53
+    },
54
+    deleteDetail: { // 删除轮播图
55
+      method: 'delete',
56
+      url: `${baseUrl}/common/cms/image/:id`
57
+    },
58
+    case: {
59
+      method: 'get',
60
+      url: `${baseUrl}/common/cms/case`
49 61
     }
50 62
   },
51 63
   file: {