wangfei 6 年之前
父節點
當前提交
82337e33f9

+ 30
- 2
src/pages/system/cmsManager/bannerManager/add.vue 查看文件

@@ -11,7 +11,7 @@
11 11
             </div>
12 12
           </div>
13 13
         </li>
14
-        <li class="flex-h">
14
+        <li class="flex-h" v-if="postData.ForwardType==='1'">
15 15
           <span>链接:</span>
16 16
           <div class="flex-item">
17 17
             <div style="width:50%">
@@ -23,6 +23,21 @@
23 23
             </div>
24 24
           </div>
25 25
         </li>
26
+        <li class="flex-h" v-else>
27
+          <span>课程:</span>
28
+          <div class="flex-item">
29
+            <div style="width:50%">
30
+              <el-select v-model="postData.ForwardResourceId" placeholder="请选择课程">
31
+                <el-option
32
+                  v-for="item in courses.list"
33
+                  :key="item.CourseId"
34
+                  :label="item.CourseName"
35
+                  :value="item.CourseId">
36
+                </el-option>
37
+              </el-select>
38
+            </div>
39
+          </div>
40
+        </li>
26 41
         <li class="flex-h">
27 42
           <span>是否发布:</span>
28 43
           <div class="flex-item">
@@ -103,7 +118,10 @@
103 118
 
104 119
 <script>
105 120
 import { mapState, createNamespacedHelpers, mapActions } from 'vuex'
121
+
106 122
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
123
+const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
124
+
107 125
 export default {
108 126
   name: '',
109 127
   data () {
@@ -117,7 +135,7 @@ export default {
117 135
         ImageUrl: '',
118 136
         Title: '',
119 137
         OrgId: '',
120
-        CaseId: ''
138
+        CaseId: '',
121 139
       },
122 140
       dialogVisible: false,
123 141
       imgs: '',
@@ -127,6 +145,7 @@ export default {
127 145
   },
128 146
   components: {},
129 147
   created () {
148
+    this.GetCourseList({page: 1, pagesize: 100})
130 149
     this.updateLocationInfo()
131 150
     this.updateSystemInfo().then(() => {
132 151
       this.postData.CaseId = this.defaultCaseId
@@ -138,13 +157,20 @@ export default {
138 157
       OrgId: x => x.app.user.OrgId,
139 158
       defaultCaseId: x => x.app.cases.default,
140 159
       caseList: x => x.app.cases.list
160
+    }),
161
+    ...mapCourseState({
162
+      courses: x => x.courseList,
141 163
     })
142 164
   },
143 165
   methods: {
166
+    ...mapCourseActions([
167
+      'GetCourseList',
168
+    ]),
144 169
     ...mapCmsActions(['updateLocationInfo']),
145 170
     ...mapActions(['updateSystemInfo']),
146 171
     submit () {
147 172
       if (this.postData.ForwardType === '1') {
173
+        this.postData.ForwardResourceId = ''
148 174
         if (this.postData.ForwardUrl === '') {
149 175
           this.$message({
150 176
             message: '链接地址不能为空',
@@ -161,6 +187,8 @@ export default {
161 187
             return false
162 188
           }
163 189
         }
190
+      } else {
191
+        this.postData.ForwardUrl = ''
164 192
       }
165 193
       this.postData.OrgId = this.OrgId
166 194
       this.postData.ForwardType === '1' ? this.postData.ForwardType = 'url' : this.postData.ForwardType = 'course'

+ 29
- 3
src/pages/system/cmsManager/bannerManager/edit.vue 查看文件

@@ -11,7 +11,7 @@
11 11
             </div>
12 12
           </div>
13 13
         </li>
14
-        <li class="flex-h">
14
+        <li class="flex-h" v-if="postData.ForwardType==='1'">
15 15
           <span>链接:</span>
16 16
           <div class="flex-item">
17 17
             <div style="width:50%">
@@ -23,6 +23,21 @@
23 23
             </div>
24 24
           </div>
25 25
         </li>
26
+        <li class="flex-h" v-else>
27
+          <span>课程:</span>
28
+          <div class="flex-item">
29
+            <div style="width:50%">
30
+              <el-select v-model="postData.ForwardResourceId" placeholder="请选择课程">
31
+                <el-option
32
+                  v-for="item in courses.list"
33
+                  :key="item.CourseId"
34
+                  :label="item.CourseName"
35
+                  :value="item.CourseId">
36
+                </el-option>
37
+              </el-select>
38
+            </div>
39
+          </div>
40
+        </li>
26 41
         <li class="flex-h">
27 42
           <span>是否发布:</span>
28 43
           <div class="flex-item">
@@ -104,6 +119,8 @@
104 119
 <script>
105 120
 import { mapState, createNamespacedHelpers } from 'vuex'
106 121
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
122
+const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
123
+
107 124
 export default {
108 125
   name: '',
109 126
   data () {
@@ -117,7 +134,7 @@ export default {
117 134
         ImageUrl: '',
118 135
         Title: '',
119 136
         OrgId: '',
120
-        CaseId: ''
137
+        CaseId: '',
121 138
       },
122 139
       dialogVisible: false,
123 140
       imgs: '',
@@ -127,20 +144,27 @@ export default {
127 144
   },
128 145
   components: {},
129 146
   created () {
147
+    this.GetCourseList({page: 1, pagesize: 100, callback: this.getDetail})
130 148
     this.updateLocationInfo()
131
-    this.getDetail()
132 149
   },
133 150
   computed: {
134 151
     ...mapState({
135 152
       positionList: x => x.cms.location,
136 153
       OrgId: x => x.app.user.OrgId,
137 154
       caseList: x => x.app.cases.list
155
+    }),
156
+    ...mapCourseState({
157
+      courses: x => x.courseList,
138 158
     })
139 159
   },
140 160
   methods: {
161
+    ...mapCourseActions([
162
+      'GetCourseList',
163
+    ]),
141 164
     ...mapCmsActions(['updateLocationInfo']),
142 165
     submit () {
143 166
       if (this.postData.ForwardType === '1') {
167
+        this.postData.ForwardResourceId = ''
144 168
         if (this.postData.ForwardUrl === '') {
145 169
           this.$message({
146 170
             message: '链接地址不能为空',
@@ -157,6 +181,8 @@ export default {
157 181
             return false
158 182
           }
159 183
         }
184
+      } else {
185
+        this.postData.ForwardUrl = ''
160 186
       }
161 187
       this.postData.OrgId = this.OrgId
162 188
       this.postData.CaseId = this.CaseId

+ 0
- 212
src/pages/system/cmsManager/majorProjects/add.vue 查看文件

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

+ 215
- 108
src/pages/system/cmsManager/majorProjects/edit.vue 查看文件

@@ -6,7 +6,7 @@
6 6
           <span>对应案场:</span>
7 7
           <div class="flex-item">
8 8
             <div style="width:50%">
9
-              <el-select v-model="postData.CaseId" placeholder="请选择">
9
+              <el-select v-model="CaseId" placeholder="请选择">
10 10
                 <el-option
11 11
                   v-for="item in caseList"
12 12
                   :key="item.CaseId"
@@ -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="detail.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="detail.Title"
39 39
                 clearable>
40 40
               </el-input>
41 41
             </div>
@@ -54,9 +54,6 @@
54 54
               :on-exceed="exceed">
55 55
               <i class="el-icon-plus"></i>
56 56
             </el-upload>
57
-            <el-dialog :visible.sync="dialogVisible">
58
-              <img width="100%" :src="imgs" alt="">
59
-            </el-dialog>
60 57
           </div>
61 58
         </li>
62 59
         <li class="flex-h">
@@ -72,9 +69,6 @@
72 69
               :on-exceed="exceed">
73 70
               <i class="el-icon-plus"></i>
74 71
             </el-upload>
75
-            <el-dialog :visible.sync="dialogVisibleDetail">
76
-              <img width="100%" :src="detailimgs" alt="">
77
-            </el-dialog>
78 72
           </div>
79 73
         </li>
80 74
         <li class="flex-h">
@@ -83,7 +77,7 @@
83 77
             <div style="width:50%">
84 78
               <el-input
85 79
                 placeholder="请输入专题简介"
86
-                v-model="postData.DetailContent"
80
+                v-model="detail.DetailContent"
87 81
                 type='textarea'
88 82
                 :autosize="{ minRows: 3, maxRows: 5}"
89 83
                 clearable>
@@ -91,12 +85,55 @@
91 85
             </div>
92 86
           </div>
93 87
         </li>
88
+        <li class="flex-h">
89
+          <span>展示课程:</span>
90
+          <div class="flex-item">
91
+            <div style="width:50%" class="radio">
92
+              <el-radio v-model="detail.IsAllCourse" :label='1' >全部课程</el-radio>
93
+              <el-radio v-model="detail.IsAllCourse" :label='0' >指定课程</el-radio>
94
+            </div>
95
+          </div>
96
+        </li>
97
+        <li class="flex-h" v-if="detail.IsAllCourse === 0">
98
+          <el-table
99
+            :data="detail.Courses"
100
+            stripe
101
+            style="width: 100%">
102
+            <el-table-column
103
+              prop="CourseName"
104
+              label="课程名称">
105
+            </el-table-column>
106
+            <el-table-column
107
+              prop="BeginDate"
108
+              label="课程开始时间">
109
+              <template slot-scope="scope">
110
+                <label>{{toolClass.dateFormat(scope.row.BeginDate,'yyyy-MM-dd')}}</label>
111
+              </template>
112
+            </el-table-column>
113
+            <el-table-column
114
+              prop="EndDate"
115
+              label="课程结束时间">
116
+              <template slot-scope="scope">
117
+                <label>{{toolClass.dateFormat(scope.row.EndDate,'yyyy-MM-dd')}}</label>
118
+              </template>
119
+            </el-table-column>
120
+            <el-table-column label="操作" width="450">
121
+              <template slot-scope="scope">
122
+                <el-button
123
+                  size="mini"
124
+                  type="danger"
125
+                  @click="deleteItem(scope.row)">删除</el-button>
126
+              </template>
127
+            </el-table-column>
128
+          </el-table>
129
+            <el-button type="primary" size="mini" @click="addCourse">新增</el-button>
130
+        </li>
94 131
         <li class="flex-h">
95 132
           <span>是否前台展示:</span>
96 133
           <div class="flex-item">
97 134
             <div style="width:50%" class="radio">
98
-              <el-radio v-model="postData.Status" label='1' >是</el-radio>
99
-              <el-radio v-model="postData.Status" label='0' >否</el-radio>
135
+              <el-radio v-model="detail.Status" :label='1' >是</el-radio>
136
+              <el-radio v-model="detail.Status" :label='0' >否</el-radio>
100 137
             </div>
101 138
           </div>
102 139
         </li>
@@ -106,32 +143,66 @@
106 143
         </li>
107 144
       </ul>
108 145
     </form>
146
+    <el-dialog
147
+      title="选择课程"
148
+      :visible.sync="selCourseVisible"
149
+      width="500px"
150
+      center>
151
+      <div>
152
+        <el-table
153
+          ref="courseTable"
154
+          :data="courses.list"
155
+          tooltip-effect="dark"
156
+          stripe
157
+          @selection-change="handleSelectionChange"
158
+          style="width: 100%">
159
+          <el-table-column
160
+            type="selection"
161
+            width="55">
162
+          </el-table-column>
163
+          <el-table-column
164
+            prop="CourseName"
165
+            label="课程名称">
166
+          </el-table-column>
167
+          <el-table-column
168
+            prop="BeginDate"
169
+            label="课程开始时间">
170
+            <template slot-scope="scope">
171
+              <label>{{toolClass.dateFormat(scope.row.BeginDate,'yyyy-MM-dd')}}</label>
172
+            </template>
173
+          </el-table-column>
174
+          <el-table-column
175
+            prop="EndDate"
176
+            label="课程结束时间">
177
+            <template slot-scope="scope">
178
+              <label>{{toolClass.dateFormat(scope.row.EndDate,'yyyy-MM-dd')}}</label>
179
+            </template>
180
+          </el-table-column>
181
+        </el-table>
182
+      </div>
183
+      <span slot="footer" class="dialog-footer">
184
+        <el-button @click="selCourseVisible = false">取 消</el-button>
185
+        <el-button type="primary" @click="addCourseOk">确 定</el-button>
186
+      </span>
187
+    </el-dialog>
109 188
   </div>
110 189
 </template>
111 190
 
112 191
 <script>
113
-import { mapState } from 'vuex'
192
+import { createNamespacedHelpers, mapState } from 'vuex'
193
+
194
+const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('cmscase')
195
+const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
196
+
114 197
 export default {
115 198
   name: '',
116 199
   data () {
117 200
     return {
118
-      postData: {
119
-        CaseId: '',
120
-        Name: '',
121
-        Title: '',
122
-        DetailContent: '',
123
-        Status: '1',
124
-        imgs: '',
125
-        detailimgs: '',
126
-        courseids: ''
127
-      },
201
+      id: '',
128 202
       limit: 1,
129
-      dialogVisible: false,
130
-      dialogVisibleDetail: false,
131
-      imgs: '',
132
-      detailimgs: '',
133
-      imgsArr: [],
134
-      detailimgsArr: []
203
+      imgs: null,
204
+      detailimgs: null,
205
+      selCourseVisible: false,
135 206
     }
136 207
   },
137 208
   components: {},
@@ -140,105 +211,117 @@ export default {
140 211
       caseList: x => x.app.cases.list,
141 212
       defaultCaseId: x => x.app.cases.default,
142 213
       OrgId: x => x.app.user.OrgId
143
-    })
144
-  },
145
-  methods: {
146
-    submit () {
147
-      this.postData.OrgId = this.OrgId
148
-      this.postData.imgs = ''
149
-      this.postData.detailimgs = ''
150
-      for (let i = 0; i < this.imgsArr.length; i++) {
151
-        this.postData.imgs += this.imgsArr[i].response.result.url + ','
152
-      }
153
-      if (this.postData.imgs) {
154
-        this.postData.imgs = this.postData.imgs.substr(0, this.postData.imgs.length - 1)
214
+    }),
215
+    ...mapCaseState({
216
+      detail: x => x.caseInfo,
217
+    }),
218
+    ...mapCourseState({
219
+      courses: x => x.courseList,
220
+    }),
221
+    CaseId: {
222
+      get () {
223
+        return this.detail.CaseId || this.caseid
224
+      },
225
+      set (val) {
226
+        this.UpdateInfo({...this.detail, CaseId: val})
155 227
       }
156
-      for (let i = 0; i < this.detailimgsArr.length; i++) {
157
-        this.postData.detailimgs += this.detailimgsArr[i].response.result.url + ','
228
+    },
229
+    imgsArr: {
230
+      get () {
231
+        return this.imgs || (this.detail.CmsCaseImgs || []).filter(x => x.ImageType === 'cover').map(x => {
232
+          return {
233
+            url: x.CaseImageUrl,
234
+            response: {
235
+              result: {
236
+                url: x.CaseImageUrl
237
+              }
238
+            }
239
+          }
240
+        })
241
+      },
242
+      set (val) {
243
+        this.imgs = val
158 244
       }
159
-      if (this.postData.detailimgs) {
160
-        this.postData.detailimgs = this.postData.detailimgs.substr(0, this.postData.detailimgs.length - 1)
245
+    },
246
+    detailimgsArr: {
247
+      get () {
248
+        return this.detailimgs || (this.detail.CmsCaseImgs || []).filter(x => x.ImageType === 'detail').map(x => {
249
+          return {
250
+            url: x.CaseImageUrl,
251
+            response: {
252
+              result: {
253
+                url: x.CaseImageUrl
254
+              }
255
+            }
256
+          }
257
+        })
258
+      },
259
+      set (val) {
260
+        this.detailimgs = val
161 261
       }
162
-      console.log(this.postData)
163
-      this.$ajax(this.$api.cms.editCase.url, {
164
-        method: this.$api.cms.editCase.method,
165
-        urlData: {
166
-          id: this.$route.query.id
167
-        },
168
-        data: this.postData
169
-      }).then(res => {
170
-        this.$message({
171
-          message: '编辑成功',
172
-          type: 'success',
173
-          duration: 1000
262
+    },
263
+  },
264
+  methods: {
265
+    ...mapCaseActions([
266
+      'GetCaseInfo',
267
+      'AddCaseInfo',
268
+      'SetNull',
269
+      'UpdateInfo',
270
+    ]),
271
+    ...mapCourseActions([
272
+      'GetCourseList',
273
+    ]),
274
+    submit () {
275
+      const imgs = this.imgsArr.map(x => x.response.result.url).join(',')
276
+      const detailimgs = this.detailimgsArr.map(x => x.response.result.url).join(',')
277
+      const courseids = this.detail.Courses.map(x => x.CourseId).join(',')
278
+      if (this.id === '') {
279
+        this.detail.OrgId = this.OrgId
280
+        this.AddCaseInfo({...this.detail, imgs, detailimgs, courseids}).then(res => {
281
+          this.afterSave()
174 282
         })
175
-        setTimeout(() => {
176
-          this.$router.push({ name: 'indexCase' })
177
-        }, 1000)
178
-      }).catch(msg => {
179
-
283
+      } else {
284
+        this.AddCaseInfo({...this.detail, imgs, detailimgs, courseids}).then(res => {
285
+          this.afterSave()
286
+        })
287
+      }
288
+    },
289
+    afterSave () {
290
+      this.$message({
291
+        message: '保存成功',
292
+        type: 'success',
293
+        duration: 1000
180 294
       })
295
+      setTimeout(() => {
296
+        this.$router.push({ name: 'indexCase' })
297
+      }, 1000)
181 298
     },
182 299
     cancel () {
183 300
       this.$router.go(-1)
184 301
     },
185 302
     handlePictureCardPreview (res, file, fileList) {
186
-      this.imgs = res.result.url
187
-      this.dialogVisible = false
188 303
       this.imgsArr = fileList
189
-      console.log(this.imgsArr)
190 304
     },
191 305
     handleRemove (file, fileList) {
192 306
       this.imgsArr = fileList
193 307
     },
194 308
     handlePictureCardPreviewDetail (res, file, fileList) {
195
-      this.detailimgs = res.result.url
196
-      this.dialogVisibleDetail = false
197 309
       this.detailimgsArr = fileList
198 310
     },
199 311
     handleRemoveDetail (file, fileList) {
200 312
       this.detailimgsArr = fileList
201 313
     },
202 314
     getDetail () {
203
-      this.$ajax(this.$api.cms.caseDetail.url, {
204
-        method: this.$api.cms.caseDetail.method,
205
-        urlData: {
206
-          id: this.$route.query.id
207
-        }
208
-      }).then(res => {
209
-        console.log(res)
210
-        res.Status += ''
211
-        let imgsArr = []
212
-        let detailimgsArr = []
213
-        for (let i = 0; i < res.CmsCaseImgs.length; i++) {
214
-          if (res.CmsCaseImgs[i].ImageType === 'cover') {
215
-            let item = {
216
-              url: res.CmsCaseImgs[i].CaseImageUrl,
217
-              response: {
218
-                result: {
219
-                  url: res.CmsCaseImgs[i].CaseImageUrl
220
-                }
221
-              }
222
-            }
223
-            imgsArr.push(item)
224
-          } else if (res.CmsCaseImgs[i].ImageType === 'detail') {
225
-            let item = {
226
-              url: res.CmsCaseImgs[i].CaseImageUrl,
227
-              response: {
228
-                result: {
229
-                  url: res.CmsCaseImgs[i].CaseImageUrl
230
-                }
231
-              }
232
-            }
233
-            detailimgsArr.push(item)
234
-          }
235
-        }
236
-        this.imgsArr = imgsArr
237
-        this.detailimgsArr = detailimgsArr
238
-        this.postData = res
239
-      }).catch(msg => {
240
-
241
-      })
315
+      this.GetCaseInfo({id: this.id})
316
+    },
317
+    toggleSelection (rows) {
318
+      if (rows) {
319
+        rows.map(row => {
320
+          this.$refs.courseTable.toggleRowSelection(row)
321
+        })
322
+      } else {
323
+        this.$refs.courseTable.clearSelection()
324
+      }
242 325
     },
243 326
     exceed () {
244 327
       this.$message({
@@ -246,10 +329,34 @@ export default {
246 329
         type: 'info',
247 330
         duration: 1000
248 331
       })
332
+    },
333
+    addCourse () {
334
+      this.GetCourseList({caseid: this.CaseId, page: 1, pagesize: 100, callback: this.coursesShow})
335
+    },
336
+    coursesShow () {
337
+      this.selCourseVisible = true
338
+      setTimeout(() => {
339
+        this.toggleSelection(this.detail.Courses)
340
+      }, 30)
341
+    },
342
+    handleSelectionChange (val) {
343
+      this.UpdateInfo({...this.detail, Courses: val})
344
+    },
345
+    addCourseOk () {
346
+      this.selCourseVisible = false
347
+    },
348
+    deleteItem (row) {
349
+      this.UpdateInfo({...this.detail, Courses: this.detail.Courses.filter(x => x.CourseId !== row.CourseId)})
249 350
     }
250 351
   },
251
-  created () {
252
-    this.getDetail()
352
+  mounted () {
353
+    const { id } = this.$route.query
354
+    this.id = id
355
+    if (id && id !== '') {
356
+      this.getDetail()
357
+    } else {
358
+      this.SetNull()
359
+    }
253 360
   }
254 361
 }
255 362
 </script>

+ 17
- 21
src/pages/system/cmsManager/majorProjects/index.vue 查看文件

@@ -122,8 +122,23 @@ export default {
122 122
       this.postData.currentPage = val
123 123
       this.getList()
124 124
     },
125
-    showItem (index, row) { // 前台显示
126
-      this.editIsAllCourse(row)
125
+    showItem (index, data) { // 前台显示
126
+      let api = data.Status === 1 ? this.$api.cms.caseHide : this.$api.cms.caseShow
127
+      this.$ajax(api.url, {
128
+        method: api.method,
129
+        urlData: {
130
+          id: data.CmsCaseId
131
+        }
132
+      }).then(res => {
133
+        this.$message({
134
+          message: '编辑成功',
135
+          type: 'success',
136
+          duration: 1000
137
+        })
138
+        this.getList()
139
+      }).catch(msg => {
140
+
141
+      })
127 142
     },
128 143
     editItem (index, row) { // 编辑
129 144
       console.log(index, row)
@@ -190,25 +205,6 @@ export default {
190 205
         this.getList()
191 206
       }).catch(msg => {
192 207
 
193
-      })
194
-    },
195
-    editIsAllCourse (data) {
196
-      console.log(data)
197
-      let api = data.Status === 1 ? this.$api.cms.caseHide : this.$api.cms.caseShow
198
-      this.$ajax(api.url, {
199
-        method: api.method,
200
-        urlData: {
201
-          id: data.CmsCaseId
202
-        }
203
-      }).then(res => {
204
-        this.$message({
205
-          message: '编辑成功',
206
-          type: 'success',
207
-          duration: 1000
208
-        })
209
-        this.getList()
210
-      }).catch(msg => {
211
-
212 208
       })
213 209
     },
214 210
   }

+ 16
- 1
src/pages/system/newOrder/newOrderList/index.vue 查看文件

@@ -76,7 +76,12 @@
76 76
 </template>
77 77
 
78 78
 <script>
79
+import { createNamespacedHelpers, mapState } from 'vuex'
80
+
79 81
 import { getLodop } from '@/util/LodopFuncs'
82
+
83
+const { mapState: mapOrderState, mapActions: mapOrderActions } = createNamespacedHelpers('goodsorder')
84
+
80 85
 const baseUrl = process.env.NODE_ENV === 'development' ? 'ws://192.168.0.148:8078/admin' : 'ws://cdkj.ycjcjy.com/admin' // 'ws://cdkj.ycjcjy.com/admin'
81 86
 var LODOP
82 87
 export default {
@@ -94,11 +99,21 @@ export default {
94 99
     }
95 100
   },
96 101
   components: {
102
+    ...mapOrderState({
103
+      orders: x => x.ordersList
104
+    }),
105
+    ...mapState({
106
+      cases: x => x.app.cases.list,
107
+      defaultCaseId: x => x.app.cases.default
108
+    })
97 109
   },
98 110
   mounted () {
99
-
111
+    this.GetOrdersList()
100 112
   },
101 113
   methods: {
114
+    ...mapOrderActions([
115
+      'GetOrdersList',
116
+    ]),
102 117
     submit (cl) {
103 118
       this.printPdf(cl)
104 119
     },

+ 1
- 7
src/pages/system/page.js 查看文件

@@ -45,7 +45,6 @@ import bannerManager from './cmsManager/bannerManager/index' // 轮播图管理
45 45
 import addBanner from './cmsManager/bannerManager/add' // 添加轮播图
46 46
 import editBanner from './cmsManager/bannerManager/edit' // 编辑轮播图
47 47
 import indexCase from './cmsManager/majorProjects/index' // 售楼处项目专题
48
-import addIndexCase from './cmsManager/majorProjects/add' // 新增售楼处项目专题
49 48
 import editIndexCase from './cmsManager/majorProjects/edit' // 编辑售楼处项目专题
50 49
 import indexMsg from './cmsManager/indexMsg/index' // 首页消息
51 50
 import addIndexMsg from './cmsManager/indexMsg/add' // 新增首页消息
@@ -285,12 +284,7 @@ export default {
285 284
           path: 'indexCase',
286 285
           name: 'indexCase',
287 286
           component: indexCase,
288
-          children: [{ // 新增售楼处项目专题
289
-            path: 'addIndexCase',
290
-            name: 'addIndexCase',
291
-            component: addIndexCase,
292
-            children: []
293
-          }, { // 编辑售楼处项目专题
287
+          children: [{ // 编辑售楼处项目专题
294 288
             path: 'editIndexCase',
295 289
             name: 'editIndexCase',
296 290
             component: editIndexCase,

+ 56
- 0
src/store/cms/case.js 查看文件

@@ -0,0 +1,56 @@
1
+
2
+export default {
3
+  namespaced: true,
4
+  state: {
5
+    caseInfo: {},
6
+  },
7
+  mutations: {
8
+    init (state, data) {
9
+      state.caseInfo = data
10
+    }
11
+  },
12
+  actions: {
13
+    GetCaseInfo ({ commit }, payload) {
14
+      return new Promise((resolve) => {
15
+        this.$ajax(this.$api.cms.caseDetail.url, {
16
+          method: this.$api.cms.caseDetail.method,
17
+          urlData: {
18
+            id: payload.id
19
+          }
20
+        }).then(res => {
21
+          commit('init', res)
22
+          resolve()
23
+        })
24
+      })
25
+    },
26
+    AddCaseInfo ({ commit }, payload) {
27
+      return new Promise((resolve) => {
28
+        this.$ajax(this.$api.cms.addCase.url, {
29
+          method: this.$api.cms.addCase.method,
30
+          data: payload
31
+        }).then(res => {
32
+          resolve()
33
+        })
34
+      })
35
+    },
36
+    UpdateCaseInfo ({ commit }, payload) {
37
+      return new Promise((resolve) => {
38
+        this.$ajax(this.$api.cms.editCase.url, {
39
+          method: this.$api.cms.editCase.method,
40
+          urlData: {
41
+            id: payload.id
42
+          },
43
+          data: payload
44
+        }).then(res => {
45
+          resolve()
46
+        })
47
+      })
48
+    },
49
+    SetNull ({ commit }) {
50
+      commit('init', {})
51
+    },
52
+    UpdateInfo ({ commit }, payload) {
53
+      commit('init', payload)
54
+    }
55
+  }
56
+}

+ 3
- 0
src/store/course/course.js 查看文件

@@ -28,6 +28,9 @@ export default {
28 28
         }
29 29
       }).then(res => {
30 30
         commit('updateList', res)
31
+        if (payload.callback) {
32
+          payload.callback()
33
+        }
31 34
       })
32 35
     },
33 36
     GetCourseByID ({ commit }, { id }) {

+ 26
- 0
src/store/goods/order.js 查看文件

@@ -0,0 +1,26 @@
1
+import ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    ordersList: [],
8
+  },
9
+  mutations: {
10
+    updateList (state, payload) {
11
+      state.ordersList = payload || []
12
+    },
13
+  },
14
+  actions: {
15
+    GetOrdersList ({ commit }, payload) {
16
+      ajax(api.goodsOrder.getOnlineOrder.url, {
17
+        method: api.goodsOrder.getOnlineOrder.method,
18
+        queryData: {
19
+          ...payload,
20
+        }
21
+      }).then(res => {
22
+        commit('updateList', res)
23
+      })
24
+    },
25
+  }
26
+}

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

@@ -22,6 +22,8 @@ export const modules = {
22 22
   coursetag: () => require('./course/tag').default,
23 23
   schedule: () => require('./course/schedule').default,
24 24
   verification: () => require('./verification/verification').default,
25
+  goodsorder: () => require('./goods/order').default,
26
+  cmscase: () => require('./cms/case').default,
25 27
 }
26 28
 
27 29
 Object.keys(modules).forEach((modKey) => {

+ 6
- 0
src/util/api.js 查看文件

@@ -525,5 +525,11 @@ const $api = {
525 525
       url: `${baseUrl}${common}/verify/course/:id`
526 526
     },
527 527
   },
528
+  goodsOrder: {
529
+    getOnlineOrder: {
530
+      method: 'get',
531
+      url: `${baseUrl}${common}/order/online/goods`
532
+    },
533
+  },
528 534
 }
529 535
 export default $api