yuantianjiao 6 년 전
부모
커밋
a88d1d772b

+ 14
- 7
src/pages/system/cmsManager/bannerManager/add.vue 파일 보기

27
           <span>是否发布:</span>
27
           <span>是否发布:</span>
28
           <div class="flex-item">
28
           <div class="flex-item">
29
             <div style="width:50%" class="radio">
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
             </div>
32
             </div>
33
           </div>
33
           </div>
34
         </li>
34
         </li>
39
               <el-select v-model="postData.LocationId" placeholder="请选择">
39
               <el-select v-model="postData.LocationId" placeholder="请选择">
40
                 <el-option
40
                 <el-option
41
                   v-for="item in positionList"
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
                 </el-option>
45
                 </el-option>
46
               </el-select>
46
               </el-select>
47
             </div>
47
             </div>
92
       postData: {
92
       postData: {
93
         ForwardType: '1',
93
         ForwardType: '1',
94
         ForwardUrl: '',
94
         ForwardUrl: '',
95
-        ForwardResource: '',
95
+        ForwardResourceId: '',
96
         Status: '1',
96
         Status: '1',
97
         LocationId: '',
97
         LocationId: '',
98
         ImageUrl: '',
98
         ImageUrl: '',
122
         method: this.$api.cms.addImage.method,
122
         method: this.$api.cms.addImage.method,
123
         data: this.postData
123
         data: this.postData
124
       }).then(res => {
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
       }).catch(msg => {
133
       }).catch(msg => {
127
 
134
 
128
       })
135
       })

+ 82
- 46
src/pages/system/cmsManager/bannerManager/edit.vue 파일 보기

6
           <span>跳转类型:</span>
6
           <span>跳转类型:</span>
7
           <div class="flex-item">
7
           <div class="flex-item">
8
             <div style="width:50%" class="radio">
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
             </div>
11
             </div>
12
           </div>
12
           </div>
13
         </li>
13
         </li>
17
             <div style="width:50%">
17
             <div style="width:50%">
18
               <el-input
18
               <el-input
19
                 placeholder="请输入链接"
19
                 placeholder="请输入链接"
20
-                v-model="postData.link"
20
+                v-model="postData.ForwardUrl"
21
                 clearable>
21
                 clearable>
22
               </el-input>
22
               </el-input>
23
             </div>
23
             </div>
27
           <span>是否发布:</span>
27
           <span>是否发布:</span>
28
           <div class="flex-item">
28
           <div class="flex-item">
29
             <div style="width:50%" class="radio">
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
             </div>
32
             </div>
33
           </div>
33
           </div>
34
         </li>
34
         </li>
36
           <span>图片位置:</span>
36
           <span>图片位置:</span>
37
           <div class="flex-item">
37
           <div class="flex-item">
38
             <div style="width:50%">
38
             <div style="width:50%">
39
-              <el-select v-model="postData.position" placeholder="请选择">
39
+              <el-select v-model="postData.LocationId" placeholder="请选择">
40
                 <el-option
40
                 <el-option
41
                   v-for="item in positionList"
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
                 </el-option>
45
                 </el-option>
46
               </el-select>
46
               </el-select>
47
             </div>
47
             </div>
53
             <div style="width:50%">
53
             <div style="width:50%">
54
               <el-input
54
               <el-input
55
                 placeholder="请输入标题"
55
                 placeholder="请输入标题"
56
-                v-model="postData.realName"
56
+                v-model="postData.Title"
57
                 clearable>
57
                 clearable>
58
               </el-input>
58
               </el-input>
59
             </div>
59
             </div>
62
         <li class="flex-h">
62
         <li class="flex-h">
63
           <span>图片:</span>
63
           <span>图片:</span>
64
           <div class="flex-item">
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
           </div>
74
           </div>
73
         </li>
75
         </li>
74
         <li style="text-align:center">
76
         <li style="text-align:center">
81
 </template>
83
 </template>
82
 
84
 
83
 <script>
85
 <script>
86
+import { mapState, createNamespacedHelpers } from 'vuex'
87
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
84
 export default {
88
 export default {
85
   name: '',
89
   name: '',
86
   data () {
90
   data () {
87
     return {
91
     return {
88
       postData: {
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
   components: {},
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
   methods: {
117
   methods: {
118
+    ...mapCmsActions(['updateLocationInfo']),
120
     submit () {
119
     submit () {
120
+      this.postData.OrgId = this.OrgId
121
+      this.postData.CaseId = this.CaseId
121
       console.log(this.postData)
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
     cancel () {
142
     cancel () {
124
       this.$router.go(-1)
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
 </script>
165
 </script>
130
 
166
 

+ 66
- 54
src/pages/system/cmsManager/bannerManager/index.vue 파일 보기

5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
           <el-button size="mini" type="success" @click="addBanner">新增轮播图</el-button>
6
           <el-button size="mini" type="success" @click="addBanner">新增轮播图</el-button>
7
         </div>
7
         </div>
8
-        <tableSearch @exportSearchKey="searchList"></tableSearch>
8
+        <!-- <tableSearch @exportSearchKey="searchList"></tableSearch> -->
9
       </div>
9
       </div>
10
       <div class="moreFilter"></div>
10
       <div class="moreFilter"></div>
11
     </div>
11
     </div>
19
           label="图片">
19
           label="图片">
20
           <template slot-scope="scope">
20
           <template slot-scope="scope">
21
             <a class="tableImg">
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
             </a>
23
             </a>
24
           </template>
24
           </template>
25
         </el-table-column>
25
         </el-table-column>
26
         <el-table-column
26
         <el-table-column
27
-          prop="position"
27
+          prop="LocationShow"
28
           label="位置">
28
           label="位置">
29
         </el-table-column>
29
         </el-table-column>
30
         <el-table-column
30
         <el-table-column
31
-          prop="isShow"
31
+          prop="StatusShow"
32
           label="是否显示">
32
           label="是否显示">
33
         </el-table-column>
33
         </el-table-column>
34
         <el-table-column label="操作">
34
         <el-table-column label="操作">
46
       </el-table>
46
       </el-table>
47
     </div>
47
     </div>
48
     <el-pagination
48
     <el-pagination
49
-      @size-change="handleSizeChange"
50
       @current-change="handleCurrentChange"
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
       layout="prev, pager, next, jumper"
52
       layout="prev, pager, next, jumper"
54
-      :total="100">
53
+      :total="postData.total">
55
     </el-pagination>
54
     </el-pagination>
56
   </div>
55
   </div>
57
 </template>
56
 </template>
58
 
57
 
59
 <script>
58
 <script>
60
 import tableSearch from '@/components/tableSearch/index'
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
 export default {
62
 export default {
63
   name: '',
63
   name: '',
64
   data () {
64
   data () {
65
     return {
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
   computed: {
74
   computed: {
91
     ...mapState({
75
     ...mapState({
92
-      case: x => x.user.cases.list,
76
+      positionList: x => x.cms.location
93
     })
77
     })
94
   },
78
   },
95
   components: {
79
   components: {
96
     tableSearch,
80
     tableSearch,
97
   },
81
   },
98
-  mounted () {
99
-    this.initList()
82
+  created () {
83
+    this.updateLocationInfo()
84
+    this.getList()
100
   },
85
   },
101
   methods: {
86
   methods: {
102
-    handleSizeChange (val) {
103
-      console.log(`每页 ${val} 条`)
104
-    },
87
+    ...mapCmsActions(['updateLocationInfo']),
105
     handleCurrentChange (val) {
88
     handleCurrentChange (val) {
106
-      console.log(`当前页: ${val}`)
89
+      this.postData.currentPage = val - 1
90
+      this.getList()
107
     },
91
     },
108
     handleEdit (index, row) { // 编辑
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
     handleDelete (index, row) { // 删除
95
     handleDelete (index, row) { // 删除
113
-      console.log(index, row)
114
-      this.$confirm('确认删除此渠道?', '提示', {
96
+      this.$confirm('确认删除此消息?', '提示', {
115
         confirmButtonText: '确定',
97
         confirmButtonText: '确定',
116
         cancelButtonText: '取消',
98
         cancelButtonText: '取消',
117
         type: 'warning'
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
         this.$message({
103
         this.$message({
125
           type: 'info',
104
           type: 'info',
126
           message: '已取消删除'
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
     addBanner () {
112
     addBanner () {
134
       this.$router.push({ name: 'addBanner' })
113
       this.$router.push({ name: 'addBanner' })
135
     },
114
     },
136
-    initList () {
115
+    getList () {
137
       this.$ajax(this.$api.cms.imageList.url, {
116
       this.$ajax(this.$api.cms.imageList.url, {
138
         method: this.$api.cms.imageList.method,
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
         console.log(res)
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
         this.tableData = res.list
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
       }).catch(msg => {
157
       }).catch(msg => {
146
 
158
 
147
       })
159
       })

+ 52
- 19
src/pages/system/cmsManager/majorProjects/index.vue 파일 보기

11
             <el-select v-model="tableSearch.caseId" placeholder="请选择">
11
             <el-select v-model="tableSearch.caseId" placeholder="请选择">
12
               <el-option
12
               <el-option
13
                 v-for="item in caseList"
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
               </el-option>
17
               </el-option>
18
             </el-select>
18
             </el-select>
19
           </li>
19
           </li>
69
       </el-table>
69
       </el-table>
70
     </div>
70
     </div>
71
     <el-pagination
71
     <el-pagination
72
-      @size-change="handleSizeChange"
73
       @current-change="handleCurrentChange"
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
       layout="prev, pager, next, jumper"
75
       layout="prev, pager, next, jumper"
77
-      :total="100">
76
+      :total="postData.total">
78
     </el-pagination>
77
     </el-pagination>
79
   </div>
78
   </div>
80
 </template>
79
 </template>
81
 
80
 
82
 <script>
81
 <script>
83
 import tableSearch from '@/components/tableSearch/index'
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
 export default {
85
 export default {
89
   name: '',
86
   name: '',
90
   data () {
87
   data () {
91
     return {
88
     return {
92
-      currentPage: 0, // 当前页码
89
+      postData: {
90
+        currentPage: 0, // 当前页码
91
+        pageSize: 10,
92
+        total: 0,
93
+      },
93
       tableSearch: { // 表格搜索条件
94
       tableSearch: { // 表格搜索条件
94
         key: '', // 搜索关键字
95
         key: '', // 搜索关键字
95
         caseId: '', // 案场id
96
         caseId: '', // 案场id
122
     }
123
     }
123
   },
124
   },
124
   computed: {
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
   components: {
131
   components: {
130
     tableSearch,
132
     tableSearch,
131
   },
133
   },
134
+  created () {
135
+    this.getList()
136
+    this.tableSearch.caseId = this.defaultCaseId
137
+  },
132
   methods: {
138
   methods: {
133
-    handleSizeChange (val) {
134
-      console.log(`每页 ${val} 条`)
135
-    },
136
     handleCurrentChange (val) {
139
     handleCurrentChange (val) {
137
-      console.log(`当前页: ${val}`)
140
+      this.postData.currentPage = val - 1
141
+      this.getList()
138
     },
142
     },
139
     showItem (index, row) { // 前台显示
143
     showItem (index, row) { // 前台显示
140
       console.log(index, row)
144
       console.log(index, row)
144
     },
148
     },
145
     editItem (index, row) { // 编辑
149
     editItem (index, row) { // 编辑
146
       console.log(index, row)
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
     copyItemUrl (index, row) { // 复制专题链接
153
     copyItemUrl (index, row) { // 复制专题链接
150
       console.log(index, row)
154
       console.log(index, row)
171
       console.log(key)
175
       console.log(key)
172
     },
176
     },
173
     addMajorProjects () {
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 파일 보기

39
       method: 'get',
39
       method: 'get',
40
       url: `${baseUrl}/common/cms/image`
40
       url: `${baseUrl}/common/cms/image`
41
     },
41
     },
42
+    imageDetail: { // 轮播图详情
43
+      method: 'get',
44
+      url: `${baseUrl}/common/cms/image/:id`
45
+    },
42
     addImage: { // 添加轮播图
46
     addImage: { // 添加轮播图
43
       method: 'post',
47
       method: 'post',
44
       url: `${baseUrl}/common/cms/image`
48
       url: `${baseUrl}/common/cms/image`
45
     },
49
     },
46
     editImage: { // 编辑轮播图
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
   file: {
63
   file: {