yuantianjiao hace 6 años
padre
commit
f052e959b4

+ 21
- 7
src/pages/system/cmsManager/bannerManager/add.vue Ver fichero

@@ -66,13 +66,27 @@
66 66
               class="avatar-uploader"
67 67
               :action='$api.file.image.url'
68 68
               :show-file-list="false"
69
-              :on-success="handleAvatarSuccess"
70
-              :before-upload="beforeAvatarUpload">
69
+              :on-success="handleAvatarSuccess">
71 70
               <img v-if="postData.ImageUrl" :src="postData.ImageUrl" class="avatar">
72 71
               <i v-else class="el-icon-plus avatar-uploader-icon"></i>
73 72
             </el-upload>
74 73
           </div>
75 74
         </li>
75
+        <li class="flex-h">
76
+          <span>对应案场:</span>
77
+          <div class="flex-item">
78
+            <div style="width:50%">
79
+              <el-select v-model="postData.CaseId" placeholder="请选择">
80
+                <el-option
81
+                  v-for="item in caseList"
82
+                  :key="item.CaseId"
83
+                  :label="item.CaseName"
84
+                  :value="item.CaseId">
85
+                </el-option>
86
+              </el-select>
87
+            </div>
88
+          </div>
89
+        </li>
76 90
         <li style="text-align:center">
77 91
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
78 92
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -105,18 +119,20 @@ export default {
105 119
   components: {},
106 120
   created () {
107 121
     this.updateLocationInfo()
122
+    this.postData.CaseId = this.defaultCaseId
108 123
   },
109 124
   computed: {
110 125
     ...mapState({
111 126
       positionList: x => x.cms.location,
112 127
       OrgId: x => x.app.user.OrgId,
113
-      CaseId: x => x.app.cases.default
128
+      defaultCaseId: x => x.app.cases.default,
129
+      caseList: x => x.app.cases.list
114 130
     })
115 131
   },
116 132
   methods: {
133
+    ...mapCmsActions(['updateLocationInfo']),
117 134
     submit () {
118 135
       this.postData.OrgId = this.OrgId
119
-      this.postData.CaseId = this.CaseId
120 136
       console.log(this.postData)
121 137
       this.$ajax(this.$api.cms.addImage.url, {
122 138
         method: this.$api.cms.addImage.method,
@@ -139,9 +155,7 @@ export default {
139 155
     },
140 156
     handleAvatarSuccess (res, file) {
141 157
       this.postData.ImageUrl = res.result.url
142
-    },
143
-    beforeAvatarUpload (file) { },
144
-    ...mapCmsActions(['updateLocationInfo']),
158
+    }
145 159
   }
146 160
 }
147 161
 </script>

+ 17
- 4
src/pages/system/cmsManager/bannerManager/edit.vue Ver fichero

@@ -66,13 +66,27 @@
66 66
               class="avatar-uploader"
67 67
               :action='$api.file.image.url'
68 68
               :show-file-list="false"
69
-              :on-success="handleAvatarSuccess"
70
-              :before-upload="beforeAvatarUpload">
69
+              :on-success="handleAvatarSuccess">
71 70
               <img v-if="postData.ImageUrl" :src="postData.ImageUrl" class="avatar">
72 71
               <i v-else class="el-icon-plus avatar-uploader-icon"></i>
73 72
             </el-upload>
74 73
           </div>
75 74
         </li>
75
+        <li class="flex-h">
76
+          <span>对应案场:</span>
77
+          <div class="flex-item">
78
+            <div style="width:50%">
79
+              <el-select v-model="postData.CaseId" placeholder="请选择">
80
+                <el-option
81
+                  v-for="item in caseList"
82
+                  :key="item.CaseId"
83
+                  :label="item.CaseName"
84
+                  :value="item.CaseId">
85
+                </el-option>
86
+              </el-select>
87
+            </div>
88
+          </div>
89
+        </li>
76 90
         <li style="text-align:center">
77 91
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
78 92
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -111,7 +125,7 @@ export default {
111 125
     ...mapState({
112 126
       positionList: x => x.cms.location,
113 127
       OrgId: x => x.app.user.OrgId,
114
-      CaseId: x => x.app.cases.default
128
+      caseList: x => x.app.cases.list
115 129
     })
116 130
   },
117 131
   methods: {
@@ -145,7 +159,6 @@ export default {
145 159
     handleAvatarSuccess (res, file) {
146 160
       this.postData.ImageUrl = res.result.url
147 161
     },
148
-    beforeAvatarUpload (file) { },
149 162
     getDetail () {
150 163
       this.$ajax(this.$api.cms.imageDetail.url, {
151 164
         method: this.$api.cms.imageDetail.method,

+ 2
- 2
src/pages/system/cmsManager/bannerManager/index.vue Ver fichero

@@ -47,7 +47,7 @@
47 47
     </div>
48 48
     <el-pagination
49 49
       @current-change="handleCurrentChange"
50
-      :current-page.sync="postData.currentPage+1"
50
+      :current-page.sync="postData.currentPage"
51 51
       :page-size="postData.pageSize"
52 52
       layout="prev, pager, next, jumper"
53 53
       :total="postData.total">
@@ -86,7 +86,7 @@ export default {
86 86
   methods: {
87 87
     ...mapCmsActions(['updateLocationInfo']),
88 88
     handleCurrentChange (val) {
89
-      this.postData.currentPage = val - 1
89
+      this.postData.currentPage = val
90 90
       this.getList()
91 91
     },
92 92
     handleEdit (index, row) { // 编辑

+ 68
- 4
src/pages/system/cmsManager/indexMsg/add.vue Ver fichero

@@ -8,7 +8,7 @@
8 8
             <div style="width:50%">
9 9
               <el-input
10 10
                 placeholder="请输入标题"
11
-                v-model="postData.title"
11
+                v-model="postData.InfoName"
12 12
                 clearable>
13 13
               </el-input>
14 14
             </div>
@@ -20,12 +20,42 @@
20 20
             <div style="width:50%">
21 21
               <el-input
22 22
                 placeholder="请输入链接"
23
-                v-model="postData.link"
23
+                v-model="postData.InfoUrl"
24 24
                 clearable>
25 25
               </el-input>
26 26
             </div>
27 27
           </div>
28 28
         </li>
29
+        <li class="flex-h">
30
+          <span>对应案场:</span>
31
+          <div class="flex-item">
32
+            <div style="width:50%">
33
+              <el-select v-model="postData.CaseId" placeholder="请选择">
34
+                <el-option
35
+                  v-for="item in caseList"
36
+                  :key="item.CaseId"
37
+                  :label="item.CaseName"
38
+                  :value="item.CaseId">
39
+                </el-option>
40
+              </el-select>
41
+            </div>
42
+          </div>
43
+        </li>
44
+        <li class="flex-h">
45
+          <span>位置:</span>
46
+          <div class="flex-item">
47
+            <div style="width:50%">
48
+              <el-select v-model="postData.LocationId" placeholder="请选择">
49
+                <el-option
50
+                  v-for="item in positionList"
51
+                  :key="item.LocationId"
52
+                  :label="item.LocationName"
53
+                  :value="item.LocationId">
54
+                </el-option>
55
+              </el-select>
56
+            </div>
57
+          </div>
58
+        </li>
29 59
         <li style="text-align:center">
30 60
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
31 61
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -36,20 +66,54 @@
36 66
 </template>
37 67
 
38 68
 <script>
69
+import { mapState, createNamespacedHelpers } from 'vuex'
70
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
39 71
 export default {
40 72
   name: '',
41 73
   data () {
42 74
     return {
43 75
       postData: {
44
-        title: '',
45
-        link: ''
76
+        InfoName: '',
77
+        InfoUrl: '',
78
+        OrgId: '',
79
+        CaseId: '',
80
+        LocationId: '1'
46 81
       }
47 82
     }
48 83
   },
49 84
   components: {},
85
+  created () {
86
+    this.updateLocationInfo()
87
+    this.postData.CaseId = this.defaultCaseId
88
+  },
89
+  computed: {
90
+    ...mapState({
91
+      positionList: x => x.cms.location,
92
+      OrgId: x => x.app.user.OrgId,
93
+      defaultCaseId: x => x.app.cases.default,
94
+      caseList: x => x.app.cases.list
95
+    })
96
+  },
50 97
   methods: {
98
+    ...mapCmsActions(['updateLocationInfo']),
51 99
     submit () {
52 100
       console.log(this.postData)
101
+      this.postData.OrgId = this.OrgId
102
+      this.$ajax(this.$api.cms.addInfo.url, {
103
+        method: this.$api.cms.addInfo.method,
104
+        data: this.postData
105
+      }).then(res => {
106
+        this.$message({
107
+          message: '添加成功',
108
+          type: 'success',
109
+          duration: 1000
110
+        })
111
+        setTimeout(() => {
112
+          this.$router.push({ name: 'indexMsg' })
113
+        }, 1000)
114
+      }).catch(msg => {
115
+
116
+      })
53 117
     },
54 118
     cancel () {
55 119
       this.$router.go(-1)

+ 87
- 6
src/pages/system/cmsManager/indexMsg/edit.vue Ver fichero

@@ -8,7 +8,7 @@
8 8
             <div style="width:50%">
9 9
               <el-input
10 10
                 placeholder="请输入标题"
11
-                v-model="postData.title"
11
+                v-model="postData.InfoName"
12 12
                 clearable>
13 13
               </el-input>
14 14
             </div>
@@ -20,12 +20,42 @@
20 20
             <div style="width:50%">
21 21
               <el-input
22 22
                 placeholder="请输入链接"
23
-                v-model="postData.link"
23
+                v-model="postData.InfoUrl"
24 24
                 clearable>
25 25
               </el-input>
26 26
             </div>
27 27
           </div>
28 28
         </li>
29
+        <li class="flex-h">
30
+          <span>对应案场:</span>
31
+          <div class="flex-item">
32
+            <div style="width:50%">
33
+              <el-select v-model="postData.CaseId" placeholder="请选择">
34
+                <el-option
35
+                  v-for="item in caseList"
36
+                  :key="item.CaseId"
37
+                  :label="item.CaseName"
38
+                  :value="item.CaseId">
39
+                </el-option>
40
+              </el-select>
41
+            </div>
42
+          </div>
43
+        </li>
44
+        <li class="flex-h">
45
+          <span>位置:</span>
46
+          <div class="flex-item">
47
+            <div style="width:50%">
48
+              <el-select v-model="postData.LocationId" placeholder="请选择">
49
+                <el-option
50
+                  v-for="item in positionList"
51
+                  :key="item.LocationId"
52
+                  :label="item.LocationName"
53
+                  :value="item.LocationId">
54
+                </el-option>
55
+              </el-select>
56
+            </div>
57
+          </div>
58
+        </li>
29 59
         <li style="text-align:center">
30 60
           <el-button type="primary" size="mini" @click="submit">保存</el-button>
31 61
           <el-button type="danger" size="mini" @click="cancel">取消</el-button>
@@ -36,26 +66,77 @@
36 66
 </template>
37 67
 
38 68
 <script>
69
+import { mapState, createNamespacedHelpers } from 'vuex'
70
+const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
39 71
 export default {
40 72
   name: '',
41 73
   data () {
42 74
     return {
43 75
       postData: {
44
-        title: '',
45
-        link: ''
76
+        InfoName: '',
77
+        InfoUrl: '',
78
+        OrgId: '',
79
+        CaseId: '',
80
+        LocationId: '1'
46 81
       }
47 82
     }
48 83
   },
49 84
   components: {},
85
+  created () {
86
+    this.updateLocationInfo()
87
+    this.getDetail()
88
+  },
89
+  computed: {
90
+    ...mapState({
91
+      positionList: x => x.cms.location,
92
+      OrgId: x => x.app.user.OrgId,
93
+      caseList: x => x.app.cases.list
94
+    })
95
+  },
50 96
   methods: {
97
+    ...mapCmsActions(['updateLocationInfo']),
51 98
     submit () {
52 99
       console.log(this.postData)
100
+      this.postData.OrgId = this.OrgId
101
+      this.$ajax(this.$api.cms.editInfo.url, {
102
+        method: this.$api.cms.editInfo.method,
103
+        urlData: {
104
+          id: this.$route.query.id
105
+        },
106
+        data: this.postData
107
+      }).then(res => {
108
+        this.$message({
109
+          message: '添加成功',
110
+          type: 'success',
111
+          duration: 1000
112
+        })
113
+        setTimeout(() => {
114
+          this.$router.push({ name: 'indexMsg' })
115
+        }, 1000)
116
+      }).catch(msg => {
117
+
118
+      })
53 119
     },
54 120
     cancel () {
55 121
       this.$router.go(-1)
122
+    },
123
+    getDetail () {
124
+      this.$ajax(this.$api.cms.infoDetail.url, {
125
+        method: this.$api.cms.infoDetail.method,
126
+        urlData: {
127
+          id: this.$route.query.id
128
+        }
129
+      }).then(res => {
130
+        console.log(res)
131
+        // this.postData.InfoName = res.InfoName
132
+        // this.postData.InfoUrl = res.InfoUrl
133
+        // this.postData.CaseId = res.CaseId
134
+        this.postData = res
135
+      }).catch(msg => {
136
+
137
+      })
56 138
     }
57
-  },
58
-  mounted () { }
139
+  }
59 140
 }
60 141
 </script>
61 142
 

+ 50
- 37
src/pages/system/cmsManager/indexMsg/index.vue Ver fichero

@@ -15,17 +15,13 @@
15 15
         stripe
16 16
         style="width: 100%">
17 17
         <el-table-column
18
-          prop="title"
18
+          prop="InfoName"
19 19
           label="消息标题">
20 20
         </el-table-column>
21 21
         <el-table-column
22
-          prop="url"
22
+          prop="InfoUrl"
23 23
           label="跳转链接">
24 24
         </el-table-column>
25
-        <el-table-column
26
-          prop="creatTime"
27
-          label="创建时间">
28
-        </el-table-column>
29 25
         <el-table-column label="操作">
30 26
           <template slot-scope="scope">
31 27
             <el-button
@@ -41,12 +37,11 @@
41 37
       </el-table>
42 38
     </div>
43 39
     <el-pagination
44
-      @size-change="handleSizeChange"
45 40
       @current-change="handleCurrentChange"
46
-      :current-page.sync="currentPage"
47
-      :page-size="10"
41
+      :current-page.sync="postData.currentPage"
42
+      :page-size="postData.pageSize"
48 43
       layout="prev, pager, next, jumper"
49
-      :total="100">
44
+      :total="postData.total">
50 45
     </el-pagination>
51 46
   </div>
52 47
 </template>
@@ -61,28 +56,16 @@ export default {
61 56
   name: '',
62 57
   data () {
63 58
     return {
64
-      currentPage: 0, // 当前页码
59
+      postData: {
60
+        currentPage: 1, // 当前页码
61
+        pageSize: 10,
62
+        total: 0,
63
+      },
65 64
       tableSearch: { // 表格搜索条件
66 65
         key: '', // 搜索关键字
67 66
         caseId: '', // 案场id
68 67
       },
69
-      tableData: [{
70
-        title: 'xxx',
71
-        url: 'xxx',
72
-        creatTime: 'xxx'
73
-      }, {
74
-        title: 'xxx',
75
-        url: 'xxx',
76
-        creatTime: 'xxx'
77
-      }, {
78
-        title: 'xxx',
79
-        url: 'xxx',
80
-        creatTime: 'xxx'
81
-      }, {
82
-        title: 'xxx',
83
-        url: 'xxx',
84
-        creatTime: 'xxx'
85
-      }]
68
+      tableData: []
86 69
     }
87 70
   },
88 71
   computed: {
@@ -90,19 +73,20 @@ export default {
90 73
       caseList: x => x.caseList,
91 74
     })
92 75
   },
76
+  created () {
77
+    this.getList()
78
+  },
93 79
   components: {
94 80
     tableSearch,
95 81
   },
96 82
   methods: {
97
-    handleSizeChange (val) {
98
-      console.log(`每页 ${val} 条`)
99
-    },
100 83
     handleCurrentChange (val) {
101
-      console.log(`当前页: ${val}`)
84
+      this.postData.currentPage = val
85
+      this.getList()
102 86
     },
103 87
     handleEdit (index, row) { // 编辑
104 88
       console.log(index, row)
105
-      this.$router.push({ name: 'editIndexMsg' })
89
+      this.$router.push({ name: 'editIndexMsg', query: { id: row.InfoId } })
106 90
     },
107 91
     handleDelete (index, row) { // 删除
108 92
       console.log(index, row)
@@ -111,10 +95,7 @@ export default {
111 95
         cancelButtonText: '取消',
112 96
         type: 'warning'
113 97
       }).then(() => {
114
-        this.$message({
115
-          type: 'success',
116
-          message: '删除成功!'
117
-        })
98
+        this.deleteInfo(row.InfoId)
118 99
       }).catch(() => {
119 100
         this.$message({
120 101
           type: 'info',
@@ -127,6 +108,38 @@ export default {
127 108
     },
128 109
     addIndexMsg () {
129 110
       this.$router.push({ name: 'addIndexMsg' })
111
+    },
112
+    getList () {
113
+      this.$ajax(this.$api.cms.info.url, {
114
+        method: this.$api.cms.info.method,
115
+        queryData: {
116
+          page: this.postData.currentPage,
117
+          pagesize: this.postData.pageSize
118
+        }
119
+      }).then(res => {
120
+        this.tableData = res.list
121
+        this.postData.total = res.pagenum
122
+        this.postData.currentPage = res.page
123
+      }).catch(msg => {
124
+
125
+      })
126
+    },
127
+    deleteInfo (id) {
128
+      this.$ajax(this.$api.cms.deleteInfo.url, {
129
+        method: this.$api.cms.deleteInfo.method,
130
+        urlData: {
131
+          id: id
132
+        }
133
+      }).then(res => {
134
+        console.log(res)
135
+        this.$message({
136
+          type: 'success',
137
+          message: '删除成功!'
138
+        })
139
+        this.getList()
140
+      }).catch(msg => {
141
+
142
+      })
130 143
     }
131 144
   }
132 145
 }

+ 105
- 40
src/pages/system/cmsManager/majorProjects/add.vue Ver fichero

@@ -6,12 +6,12 @@
6 6
           <span>对应案场:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9
-              <el-select v-model="postData.case" placeholder="请选择">
9
+              <el-select v-model="postData.CaseId" placeholder="请选择">
10 10
                 <el-option
11 11
                   v-for="item in caseList"
12
-                  :key="item.value"
13
-                  :label="item.label"
14
-                  :value="item.value">
12
+                  :key="item.CaseId"
13
+                  :label="item.CaseName"
14
+                  :value="item.CaseId">
15 15
                 </el-option>
16 16
               </el-select>
17 17
             </div>
@@ -23,7 +23,7 @@
23 23
             <div style="width:50%">
24 24
               <el-input
25 25
                 placeholder="请输入名称"
26
-                v-model="postData.name"
26
+                v-model="postData.Name"
27 27
                 clearable>
28 28
               </el-input>
29 29
             </div>
@@ -35,7 +35,7 @@
35 35
             <div style="width:50%">
36 36
               <el-input
37 37
                 placeholder="请输入标题"
38
-                v-model="postData.title"
38
+                v-model="postData.Title"
39 39
                 clearable>
40 40
               </el-input>
41 41
             </div>
@@ -44,25 +44,31 @@
44 44
         <li class="flex-h">
45 45
           <span>图片:</span>
46 46
           <div class="flex-item">
47
-            <div>
48
-              <a class="formImg">
49
-                <img src="" class="centerLabel contain" alt="">
50
-                <i class="iconfont icon-quxiao"></i>
51
-              </a>
52
-              <el-button type="success" size="mini">上传图片</el-button>
53
-            </div>
47
+            <el-upload
48
+              :action="$api.file.image.url"
49
+              list-type="picture-card"
50
+              :on-success="handlePictureCardPreview"
51
+              :on-remove="handleRemove">
52
+              <i class="el-icon-plus"></i>
53
+            </el-upload>
54
+            <el-dialog :visible.sync="dialogVisible">
55
+              <img width="100%" :src="imgs" alt="">
56
+            </el-dialog>
54 57
           </div>
55 58
         </li>
56 59
         <li class="flex-h">
57 60
           <span>详细图片:</span>
58 61
           <div class="flex-item">
59
-            <div>
60
-              <a class="formImg">
61
-                <img src="" class="centerLabel contain" alt="">
62
-                <i class="iconfont icon-quxiao"></i>
63
-              </a>
64
-              <el-button type="success" size="mini">上传图片</el-button>
65
-            </div>
62
+            <el-upload
63
+              :action='$api.file.image.url'
64
+              list-type="picture-card"
65
+              :on-success="handlePictureCardPreviewDetail"
66
+              :on-remove="handleRemoveDetail">
67
+              <i class="el-icon-plus"></i>
68
+            </el-upload>
69
+            <el-dialog :visible.sync="dialogVisibleDetail">
70
+              <img width="100%" :src="detailimgs" alt="">
71
+            </el-dialog>
66 72
           </div>
67 73
         </li>
68 74
         <li class="flex-h">
@@ -71,7 +77,7 @@
71 77
             <div style="width:50%">
72 78
               <el-input
73 79
                 placeholder="请输入专题简介"
74
-                v-model="postData.about"
80
+                v-model="postData.DetailContent"
75 81
                 type='textarea'
76 82
                 :autosize="{ minRows: 3, maxRows: 5}"
77 83
                 clearable>
@@ -83,8 +89,8 @@
83 89
           <span>是否前台展示:</span>
84 90
           <div class="flex-item">
85 91
             <div style="width:50%" class="radio">
86
-              <el-radio v-model="postData.show" label='0' >是</el-radio>
87
-                <el-radio v-model="postData.show" label='1' >否</el-radio>
92
+              <el-radio v-model="postData.IsAllCourse" label='1' >是</el-radio>
93
+              <el-radio v-model="postData.IsAllCourse" label='0' >否</el-radio>
88 94
             </div>
89 95
           </div>
90 96
         </li>
@@ -98,39 +104,98 @@
98 104
 </template>
99 105
 
100 106
 <script>
107
+import { mapState } from 'vuex'
101 108
 export default {
102 109
   name: '',
103 110
   data () {
104 111
     return {
105 112
       postData: {
106
-        case: '',
107
-        name: '',
108
-        title: '',
109
-        about: '',
110
-        show: '0'
113
+        CaseId: '',
114
+        Name: '',
115
+        Title: '',
116
+        DetailContent: '',
117
+        IsAllCourse: '1',
118
+        imgs: '',
119
+        detailimgs: '',
120
+        courseids: ''
111 121
       },
112
-      caseList: [{
113
-        value: '0',
114
-        label: '案场1'
115
-      }, {
116
-        value: '1',
117
-        label: '案场3'
118
-      }, {
119
-        value: '2',
120
-        label: '案场2'
121
-      }],
122
+      dialogVisible: false,
123
+      dialogVisibleDetail: false,
124
+      imgs: '',
125
+      detailimgs: '',
126
+      imgsArr: [],
127
+      detailimgsArr: []
122 128
     }
123 129
   },
124 130
   components: {},
131
+  computed: {
132
+    ...mapState({
133
+      caseList: x => x.app.cases.list,
134
+      defaultCaseId: x => x.app.cases.default,
135
+      OrgId: x => x.app.user.OrgId
136
+    })
137
+  },
125 138
   methods: {
126 139
     submit () {
127
-      console.log(this.postData)
140
+      this.postData.OrgId = this.OrgId
141
+      for (let i = 0; i < this.imgsArr.length; i++) {
142
+        this.postData.imgs += this.imgsArr[i].response.result.url + ','
143
+      }
144
+      this.postData.imgs = this.postData.imgs.substr(0, this.postData.imgs.length - 1)
145
+      for (let i = 0; i < this.detailimgsArr.length; i++) {
146
+        this.postData.detailimgs += this.detailimgsArr[i].response.result.url + ','
147
+      }
148
+      this.postData.detailimgs = this.postData.detailimgs.substr(0, this.postData.detailimgs.length - 1)
149
+      this.$ajax(this.$api.cms.addCase.url, {
150
+        method: this.$api.cms.addCase.method,
151
+        data: this.postData
152
+      }).then(res => {
153
+        this.$message({
154
+          message: '添加成功',
155
+          type: 'success',
156
+          duration: 1000
157
+        })
158
+        setTimeout(() => {
159
+          this.$router.push({ name: 'indexCase' })
160
+        }, 1000)
161
+      }).catch(msg => {
162
+
163
+      })
128 164
     },
129 165
     cancel () {
130 166
       this.$router.go(-1)
167
+    },
168
+    handlePictureCardPreview (res, file) {
169
+      this.imgs = res.result.url
170
+      this.dialogVisible = true
171
+      this.imgsArr.push(file)
172
+    },
173
+    handleRemove (file) {
174
+      for (let i = 0; i < this.imgsArr.length; i++) {
175
+        if (this.imgsArr[i].uid === file.uid) {
176
+          this.imgsArr.splice(i, 1)
177
+        }
178
+      }
179
+    },
180
+    handlePictureCardPreviewDetail (res, file) {
181
+      this.detailimgs = res.result.url
182
+      this.dialogVisibleDetail = true
183
+      this.detailimgsArr.push(file)
184
+    },
185
+    handleRemoveDetail (file) {
186
+      for (let i = 0; i < this.detailimgsArr.length; i++) {
187
+        if (this.detailimgsArr[i].uid === file.uid) {
188
+          this.detailimgsArr.splice(i, 1)
189
+        }
190
+      }
191
+    },
192
+    spli (arr) {
193
+      console.log(arr)
131 194
     }
132 195
   },
133
-  mounted () { }
196
+  created () {
197
+    this.postData.CaseId = this.defaultCaseId
198
+  }
134 199
 }
135 200
 </script>
136 201
 

+ 102
- 39
src/pages/system/cmsManager/majorProjects/edit.vue Ver fichero

@@ -6,12 +6,12 @@
6 6
           <span>对应案场:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9
-              <el-select v-model="postData.case" placeholder="请选择">
9
+              <el-select v-model="postData.CaseId" placeholder="请选择">
10 10
                 <el-option
11 11
                   v-for="item in caseList"
12
-                  :key="item.value"
13
-                  :label="item.label"
14
-                  :value="item.value">
12
+                  :key="item.CaseId"
13
+                  :label="item.CaseName"
14
+                  :value="item.CaseId">
15 15
                 </el-option>
16 16
               </el-select>
17 17
             </div>
@@ -23,7 +23,7 @@
23 23
             <div style="width:50%">
24 24
               <el-input
25 25
                 placeholder="请输入名称"
26
-                v-model="postData.name"
26
+                v-model="postData.Name"
27 27
                 clearable>
28 28
               </el-input>
29 29
             </div>
@@ -35,7 +35,7 @@
35 35
             <div style="width:50%">
36 36
               <el-input
37 37
                 placeholder="请输入标题"
38
-                v-model="postData.title"
38
+                v-model="postData.Title"
39 39
                 clearable>
40 40
               </el-input>
41 41
             </div>
@@ -44,25 +44,31 @@
44 44
         <li class="flex-h">
45 45
           <span>图片:</span>
46 46
           <div class="flex-item">
47
-            <div>
48
-              <a class="formImg">
49
-                <img src="" class="centerLabel contain" alt="">
50
-                <i class="iconfont icon-quxiao"></i>
51
-              </a>
52
-              <el-button type="success" size="mini">上传图片</el-button>
53
-            </div>
47
+            <el-upload
48
+              :action="$api.file.image.url"
49
+              list-type="picture-card"
50
+              :on-success="handlePictureCardPreview"
51
+              :on-remove="handleRemove">
52
+              <i class="el-icon-plus"></i>
53
+            </el-upload>
54
+            <el-dialog :visible.sync="dialogVisible">
55
+              <img width="100%" :src="imgs" alt="">
56
+            </el-dialog>
54 57
           </div>
55 58
         </li>
56 59
         <li class="flex-h">
57 60
           <span>详细图片:</span>
58 61
           <div class="flex-item">
59
-            <div>
60
-              <a class="formImg">
61
-                <img src="" class="centerLabel contain" alt="">
62
-                <i class="iconfont icon-quxiao"></i>
63
-              </a>
64
-              <el-button type="success" size="mini">上传图片</el-button>
65
-            </div>
62
+            <el-upload
63
+              :action='$api.file.image.url'
64
+              list-type="picture-card"
65
+              :on-success="handlePictureCardPreviewDetail"
66
+              :on-remove="handleRemoveDetail">
67
+              <i class="el-icon-plus"></i>
68
+            </el-upload>
69
+            <el-dialog :visible.sync="dialogVisibleDetail">
70
+              <img width="100%" :src="detailimgs" alt="">
71
+            </el-dialog>
66 72
           </div>
67 73
         </li>
68 74
         <li class="flex-h">
@@ -71,7 +77,7 @@
71 77
             <div style="width:50%">
72 78
               <el-input
73 79
                 placeholder="请输入专题简介"
74
-                v-model="postData.about"
80
+                v-model="postData.DetailContent"
75 81
                 type='textarea'
76 82
                 :autosize="{ minRows: 3, maxRows: 5}"
77 83
                 clearable>
@@ -83,8 +89,8 @@
83 89
           <span>是否前台展示:</span>
84 90
           <div class="flex-item">
85 91
             <div style="width:50%" class="radio">
86
-              <el-radio v-model="postData.show" label='0' >是</el-radio>
87
-                <el-radio v-model="postData.show" label='1' >否</el-radio>
92
+              <el-radio v-model="postData.IsAllCourse" label='1' >是</el-radio>
93
+              <el-radio v-model="postData.IsAllCourse" label='0' >否</el-radio>
88 94
             </div>
89 95
           </div>
90 96
         </li>
@@ -98,36 +104,93 @@
98 104
 </template>
99 105
 
100 106
 <script>
107
+import { mapState } from 'vuex'
101 108
 export default {
102 109
   name: '',
103 110
   data () {
104 111
     return {
105 112
       postData: {
106
-        case: '',
107
-        name: '',
108
-        title: '',
109
-        about: '',
110
-        show: '0'
113
+        CaseId: '',
114
+        Name: '',
115
+        Title: '',
116
+        DetailContent: '',
117
+        IsAllCourse: '1',
118
+        imgs: '',
119
+        detailimgs: '',
120
+        courseids: ''
111 121
       },
112
-      caseList: [{
113
-        value: '0',
114
-        label: '案场1'
115
-      }, {
116
-        value: '1',
117
-        label: '案场3'
118
-      }, {
119
-        value: '2',
120
-        label: '案场2'
121
-      }],
122
+      dialogVisible: false,
123
+      dialogVisibleDetail: false,
124
+      imgs: '',
125
+      detailimgs: '',
126
+      imgsArr: [],
127
+      detailimgsArr: []
122 128
     }
123 129
   },
124 130
   components: {},
131
+  computed: {
132
+    ...mapState({
133
+      caseList: x => x.app.cases.list,
134
+      defaultCaseId: x => x.app.cases.default,
135
+      OrgId: x => x.app.user.OrgId
136
+    })
137
+  },
125 138
   methods: {
126 139
     submit () {
127
-      console.log(this.postData)
140
+      this.postData.OrgId = this.OrgId
141
+      for (let i = 0; i < this.imgsArr.length; i++) {
142
+        this.postData.imgs += this.imgsArr[i].response.result.url + ','
143
+      }
144
+      this.postData.imgs = this.postData.imgs.substr(0, this.postData.imgs.length - 1)
145
+      for (let i = 0; i < this.detailimgsArr.length; i++) {
146
+        this.postData.detailimgs += this.detailimgsArr[i].response.result.url + ','
147
+      }
148
+      this.postData.detailimgs = this.postData.detailimgs.substr(0, this.postData.detailimgs.length - 1)
149
+      this.$ajax(this.$api.cms.addCase.url, {
150
+        method: this.$api.cms.addCase.method,
151
+        data: this.postData
152
+      }).then(res => {
153
+        this.$message({
154
+          message: '添加成功',
155
+          type: 'success',
156
+          duration: 1000
157
+        })
158
+        setTimeout(() => {
159
+          this.$router.push({ name: 'indexCase' })
160
+        }, 1000)
161
+      }).catch(msg => {
162
+
163
+      })
128 164
     },
129 165
     cancel () {
130 166
       this.$router.go(-1)
167
+    },
168
+    handlePictureCardPreview (res, file) {
169
+      this.imgs = res.result.url
170
+      this.dialogVisible = true
171
+      this.imgsArr.push(file)
172
+    },
173
+    handleRemove (file) {
174
+      for (let i = 0; i < this.imgsArr.length; i++) {
175
+        if (this.imgsArr[i].uid === file.uid) {
176
+          this.imgsArr.splice(i, 1)
177
+        }
178
+      }
179
+    },
180
+    handlePictureCardPreviewDetail (res, file) {
181
+      this.detailimgs = res.result.url
182
+      this.dialogVisibleDetail = true
183
+      this.detailimgsArr.push(file)
184
+    },
185
+    handleRemoveDetail (file) {
186
+      for (let i = 0; i < this.detailimgsArr.length; i++) {
187
+        if (this.detailimgsArr[i].uid === file.uid) {
188
+          this.detailimgsArr.splice(i, 1)
189
+        }
190
+      }
191
+    },
192
+    spli (arr) {
193
+      console.log(arr)
131 194
     }
132 195
   },
133 196
   mounted () { }

+ 5
- 20
src/pages/system/cmsManager/majorProjects/index.vue Ver fichero

@@ -3,7 +3,7 @@
3 3
     <div class="system-table-search">
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="success" @click='addMajorProjects'>新增项目专题</el-button>
6
+          <el-button size="mini" type="success" @click='addMajorProjects'>新增首页案场</el-button>
7 7
         </div>
8 8
         <ul>
9 9
           <li>
@@ -70,7 +70,7 @@
70 70
     </div>
71 71
     <el-pagination
72 72
       @current-change="handleCurrentChange"
73
-      :current-page.sync="postData.currentPage+1"
73
+      :current-page.sync="postData.currentPage"
74 74
       :page-size="postData.pageSize"
75 75
       layout="prev, pager, next, jumper"
76 76
       :total="postData.total">
@@ -87,7 +87,7 @@ export default {
87 87
   data () {
88 88
     return {
89 89
       postData: {
90
-        currentPage: 0, // 当前页码
90
+        currentPage: 1, // 当前页码
91 91
         pageSize: 10,
92 92
         total: 0,
93 93
       },
@@ -124,8 +124,9 @@ export default {
124 124
   },
125 125
   computed: {
126 126
     ...mapState({
127
+      OrgId: x => x.app.user.OrgId,
127 128
       caseList: x => x.app.cases.list,
128
-      defaultCaseId: x => x.app.cases.default,
129
+      defaultCaseId: x => x.app.cases.default
129 130
     })
130 131
   },
131 132
   components: {
@@ -186,22 +187,6 @@ export default {
186 187
         }
187 188
       }).then(res => {
188 189
         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 190
       }).catch(msg => {
206 191
 
207 192
       })

+ 37
- 1
src/util/api.js Ver fichero

@@ -91,9 +91,45 @@ const $api = {
91 91
       method: 'delete',
92 92
       url: `${baseUrl}/common/cms/image/:id`
93 93
     },
94
-    case: {
94
+    case: { // 首页案场列表
95 95
       method: 'get',
96 96
       url: `${baseUrl}/common/cms/case`
97
+    },
98
+    caseDetail: { // 首页案场详情
99
+      method: 'get',
100
+      url: `${baseUrl}/common/cms/case/:id`
101
+    },
102
+    addCase: { // 添加首页案场
103
+      method: 'post',
104
+      url: `${baseUrl}/common/cms/case`
105
+    },
106
+    editCase: { // 添加首页案场
107
+      method: 'put',
108
+      url: `${baseUrl}/common/cms/case/:id`
109
+    },
110
+    deleteCase: { // 添加首页案场
111
+      method: 'delete',
112
+      url: `${baseUrl}/common/cms/case/:id`
113
+    },
114
+    info: { // 首页消息列表
115
+      method: 'get',
116
+      url: `${baseUrl}/common/cms/info`
117
+    },
118
+    infoDetail: { // 首页消息详情
119
+      method: 'get',
120
+      url: `${baseUrl}/common/cms/info/:id`
121
+    },
122
+    addInfo: { // 新增首页消息
123
+      method: 'post',
124
+      url: `${baseUrl}/common/cms/info`
125
+    },
126
+    editInfo: { // 编辑首页消息
127
+      method: 'put',
128
+      url: `${baseUrl}/common/cms/info/:id`
129
+    },
130
+    deleteInfo: { // 编辑首页消息
131
+      method: 'delete',
132
+      url: `${baseUrl}/common/cms/info/:id`
97 133
     }
98 134
   },
99 135
   file: {