许成详 6 years ago
parent
commit
80dd8301d4

+ 261
- 0
src/pages/system/courseManager/courseList/add.vue View File

@@ -0,0 +1,261 @@
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>
9
+              <el-upload
10
+                class="avatar-uploader"
11
+                :action='$api.file.image.url'
12
+                :show-file-list="false"
13
+                :on-success="handleAvatarSuccess">
14
+                <img v-if="postData.CourseImg" :src="postData.CourseImg" class="avatar">
15
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
16
+              </el-upload>
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.CourseName"
27
+                clearable
28
+                >
29
+              </el-input>
30
+            </div>
31
+          </div>
32
+        </li>
33
+        <li class="flex-h">
34
+          <span>课程类型:</span>
35
+          <div class="flex-item">
36
+            <div style="width: 50%;">
37
+              <el-select v-model="postData.LocationId" placeholder="请选择">
38
+                <el-option
39
+                  v-for="item in courseTypeList"
40
+                  :key="item.id"
41
+                  :label="item.name"
42
+                  :value="item.id">
43
+                </el-option>
44
+              </el-select>
45
+            </div>
46
+          </div>
47
+        </li>
48
+        <li class="flex-h">
49
+          <span>课程价格:</span>
50
+          <div class="flex-item">
51
+            <div style="width: 200px;">
52
+              <el-input
53
+                placeholder="请输入课程价格"
54
+                v-model="postData.Price"
55
+                clearable
56
+                >
57
+              </el-input>
58
+            </div>
59
+          </div>
60
+        </li>
61
+        <li class="flex-h">
62
+          <span>案场:</span>
63
+          <div class="flex-item">
64
+            <div style="width: 50%;">
65
+              <el-select v-model="postData.CaseId" placeholder="请选择">
66
+                <el-option
67
+                  v-for="item in cases"
68
+                  :key="item.CaseId"
69
+                  :label="item.CaseName"
70
+                  :value="item.CaseId">
71
+                </el-option>
72
+              </el-select>
73
+            </div>
74
+          </div>
75
+        </li>
76
+        <li class="flex-h">
77
+          <span>开课人数:</span>
78
+          <div class="flex-item">
79
+            <div style="width: 200px;">
80
+              <el-input
81
+                placeholder="请输入开课人数"
82
+                v-model="postData.MaxNum"
83
+                clearable
84
+                >
85
+              </el-input>
86
+            </div>
87
+          </div>
88
+        </li>
89
+        <li class="flex-h">
90
+          <span>最小开课人数:</span>
91
+          <div class="flex-item">
92
+            <div style="width: 200px;">
93
+              <el-input
94
+                placeholder="请输入开课人数"
95
+                v-model="postData.MinNum"
96
+                clearable
97
+                >
98
+              </el-input>
99
+            </div>
100
+          </div>
101
+        </li>
102
+        <li class="flex-h">
103
+          <span>课时数:</span>
104
+          <div class="flex-item">
105
+            <div style="width: 200px;">
106
+              <el-input
107
+                placeholder="请输入课时数"
108
+                v-model="postData.CourseNum"
109
+                clearable
110
+                >
111
+              </el-input>
112
+            </div>
113
+          </div>
114
+        </li>
115
+        <li class="flex-h">
116
+          <span>课程时间:</span>
117
+          <div class="flex-item">
118
+            <div>
119
+              <el-date-picker
120
+                v-model="postData.BeginDate"
121
+                type="date"
122
+                placeholder="选择开始日期">
123
+              </el-date-picker>
124
+              <span style="line-height:40px;display:inline-block;">-</span>
125
+              <el-date-picker
126
+                v-model="postData.EndDate"
127
+                type="date"
128
+                placeholder="选择结束日期">
129
+              </el-date-picker>
130
+            </div>
131
+          </div>
132
+        </li>
133
+        <li class="flex-h">
134
+          <span>课程计划备注:</span>
135
+          <div class="flex-item">
136
+            <div style="width: 50%;">
137
+              <el-input
138
+                type="textarea"
139
+                autosize
140
+                placeholder="请输入备注"
141
+                v-model="postData.Remark"
142
+                clearable
143
+                >
144
+              </el-input>
145
+            </div>
146
+          </div>
147
+        </li>
148
+        <li class="flex-h">
149
+          <span>课程标签:</span>
150
+          <div class="flex-item">
151
+            <div style="width: 50%;">
152
+              <el-select
153
+                v-model="postData.tagids"
154
+                multiple
155
+                filterable
156
+                allow-create
157
+                default-first-option
158
+                placeholder="请选择课程标签">
159
+                <el-option
160
+                  v-for="item in tagList"
161
+                  :key="item.value"
162
+                  :label="item.id"
163
+                  :value="item.value">
164
+                </el-option>
165
+              </el-select>
166
+            </div>
167
+          </div>
168
+        </li>
169
+        <li class="flex-h">
170
+          <span>课程简介:</span>
171
+          <div class="flex-item">
172
+            <div style="width: 50%;">
173
+              <el-input
174
+                type="textarea"
175
+                autosize
176
+                placeholder="请输入课程简介"
177
+                v-model="postData.CourseDesc"
178
+                clearable
179
+                >
180
+              </el-input>
181
+            </div>
182
+          </div>
183
+        </li>
184
+        <li class="flex-h">
185
+          <span>是否精选课程:</span>
186
+          <div class="flex-item">
187
+            <div>
188
+              <el-radio v-model="postData.IsSelect" label="1">是</el-radio>
189
+              <el-radio v-model="postData.IsSelect" label="0">否</el-radio>
190
+            </div>
191
+          </div>
192
+        </li>
193
+        <li style="text-align:center">
194
+          <el-button type="primary" size="mini" @click="submit">保存</el-button>
195
+          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
196
+        </li>
197
+      </ul>
198
+    </form>
199
+  </div>
200
+</template>
201
+
202
+<script>
203
+import { mapState } from 'vuex'
204
+export default {
205
+  name: '',
206
+  data () {
207
+    return {
208
+      postData: {
209
+        CourseImg: '', // 课程主图
210
+        CourseName: '', // 课程名称
211
+        LocationId: '', // 课程类型
212
+        Price: '', // 课程价格
213
+        CaseId: '', // 案场id
214
+        MaxNum: '', // 上课人数
215
+        MinNum: '', // 最小开课人数
216
+        CourseNum: '', // 课时数
217
+        BeginDate: '', // 课程开始时间
218
+        EndDate: '', // 课程结束时间
219
+        Remark: '', // 课程计划备注
220
+        tagids: [], // 课程标签(已有标签数据存入此字段)
221
+        tagnames: [], // 课程标签(新增标签数据存入此字段)
222
+        CourseDesc: '', // 课程描述
223
+        IsSelect: '0', // 是否精选课程
224
+      },
225
+      courseTypeList: [], // 课程类型列表
226
+      tagList: [], // 标签列表
227
+    }
228
+  },
229
+  computed: {
230
+    ...mapState({
231
+      cases: x => x.app.cases.list,
232
+      defaultCaseId: x => x.app.cases.default,
233
+      OrgId: x => x.app.user.OrgId,
234
+    }),
235
+    CaseId: {
236
+      get () {
237
+        return this.postData.CaseId === '' ? this.defaultCaseId || '' : this.postData.CaseId
238
+      },
239
+      set (val) {
240
+        this.postData.CaseId = val
241
+      }
242
+    }
243
+  },
244
+  components: {},
245
+  methods: {
246
+    handleAvatarSuccess (res, file) {
247
+      this.postData.CourseImg = res.result.url
248
+    },
249
+    submit () { // 提交数据
250
+    },
251
+    cancel () {
252
+      this.$router.push({ name: 'courseList' })
253
+    }
254
+  },
255
+  mounted () { }
256
+}
257
+</script>
258
+
259
+<!-- Add "scoped" attribute to limit CSS to this component only -->
260
+<style lang="scss" scoped>
261
+</style>

+ 114
- 0
src/pages/system/courseManager/courseList/edit.vue View File

@@ -0,0 +1,114 @@
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="CaseId" placeholder="请选择">
10
+                <el-option
11
+                  v-for="item in cases"
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.ChannelName"
27
+                clearable>
28
+              </el-input>
29
+            </div>
30
+          </div>
31
+        </li>
32
+        <li style="text-align:center">
33
+          <el-button type="primary" size="mini" @click="submit">保存</el-button>
34
+          <el-button type="danger" size="mini" @click="cancel">取消</el-button>
35
+        </li>
36
+      </ul>
37
+    </form>
38
+  </div>
39
+</template>
40
+
41
+<script>
42
+import { mapState } from 'vuex'
43
+export default {
44
+  name: '',
45
+  data () {
46
+    return {
47
+      postData: {
48
+        ChannelId: '', // 渠道id
49
+        ChannelName: '', // 渠道名称
50
+        CaseId: '', // 案场id
51
+        OrgId: '', // 机构id
52
+      }
53
+    }
54
+  },
55
+  computed: {
56
+    ...mapState({
57
+      cases: x => x.app.cases.list,
58
+      defaultCaseId: x => x.app.cases.default,
59
+      OrgId: x => x.app.user.OrgId,
60
+    }),
61
+    CaseId: {
62
+      get () {
63
+        return this.postData.CaseId === '' ? this.defaultCaseId || '' : this.postData.CaseId
64
+      },
65
+      set (val) {
66
+        this.postData.CaseId = val
67
+      }
68
+    }
69
+  },
70
+  created () {
71
+    this.getChannelInfo()
72
+  },
73
+  components: {},
74
+  methods: {
75
+    getChannelInfo () {
76
+      this.$ajax(this.$api.channelManager.getChannelInfo.url, {
77
+        method: this.$api.channelManager.getChannelInfo.method,
78
+        urlData: { channelId: this.$route.query.id }
79
+      }).then(res => {
80
+        this.postData = res
81
+      })
82
+    },
83
+    submit () { // 提交数据
84
+      if (this.postData.ChannelName === '') {
85
+        this.$message({
86
+          type: 'error',
87
+          message: '渠道名称不能为空'
88
+        })
89
+        return false
90
+      }
91
+      this.postData.OrgId = this.OrgId
92
+      if (this.postData.CaseId === '') this.postData.CaseId = this.CaseId
93
+      this.$ajax(this.$api.channelManager.editChannel.url, {
94
+        method: this.$api.channelManager.editChannel.method,
95
+        data: this.postData
96
+      }).then(res => {
97
+        this.$message({
98
+          type: 'success',
99
+          message: '操作成功'
100
+        })
101
+        this.$router.push({ name: 'channelList' })
102
+      })
103
+    },
104
+    cancel () {
105
+      this.$router.push({ name: 'channelList' })
106
+    }
107
+  },
108
+  mounted () { }
109
+}
110
+</script>
111
+
112
+<!-- Add "scoped" attribute to limit CSS to this component only -->
113
+<style lang="scss" scoped>
114
+</style>

+ 199
- 0
src/pages/system/courseManager/courseList/index.vue View File

@@ -0,0 +1,199 @@
1
+<template>
2
+  <div class="subPage">
3
+    <div class="system-table-search">
4
+      <div class="flex-h">
5
+        <div class="flex-item flex-h">
6
+          <el-button size="mini" type="success" @click="addCourse">新增课程</el-button>
7
+        </div>
8
+        <ul>
9
+          <li>
10
+            <!-- <span>选择案场:</span> -->
11
+            <el-select v-model="postData.caseid" placeholder="请选择">
12
+              <el-option
13
+                v-for="item in cases"
14
+                :key="item.CaseId"
15
+                :label="item.CaseName"
16
+                :value="item.CaseId">
17
+              </el-option>
18
+            </el-select>
19
+          </li>
20
+          <li>
21
+            <el-select v-model="postData.typeid" placeholder="课程分类">
22
+              <el-option
23
+                key=""
24
+                label=""
25
+                value=""
26
+              >
27
+              </el-option>
28
+              <el-option
29
+                v-for="item in courseTypeList"
30
+                :key="item.typeId"
31
+                :label="item.typeName"
32
+                :value="item.typeId">
33
+              </el-option>
34
+            </el-select>
35
+          </li>
36
+          <li>
37
+            <el-input
38
+              placeholder="请输入课程名称"
39
+              v-model="postData.name"
40
+            >
41
+            </el-input>
42
+          </li>
43
+        </ul>
44
+        <el-button
45
+          size="mini"
46
+          type="primary" @click="search">搜索</el-button>
47
+      </div>
48
+      <div class="moreFilter"></div>
49
+    </div>
50
+    <div class="system-table-box">
51
+      <el-table
52
+        :data="currentList"
53
+        stripe
54
+        style="width: 100%">
55
+        <el-table-column
56
+          prop="CourseName"
57
+          label="课程名称"
58
+          width="150">
59
+        </el-table-column>
60
+        <el-table-column
61
+          prop="Price"
62
+          label="课程价格"
63
+          width="150">
64
+        </el-table-column>
65
+        <el-table-column
66
+          prop="LocationId"
67
+          label="课程类别"
68
+          width="150">
69
+        </el-table-column>
70
+        <el-table-column
71
+          prop="CaseId"
72
+          label="所在案场"
73
+          width="150">
74
+        </el-table-column>
75
+        <el-table-column
76
+          prop="BeginDate"
77
+          label="课程开始时间"
78
+          width="150">
79
+        </el-table-column>
80
+        <el-table-column
81
+          prop="EndDate"
82
+          label="课程结束时间"
83
+          width="150">
84
+        </el-table-column>
85
+        <el-table-column
86
+          fixed="right"
87
+          label="操作"
88
+          width="600">
89
+          <template slot-scope="scope">
90
+            <el-button
91
+              size="mini"
92
+              type="success">添加课程详情</el-button>
93
+            <el-button
94
+              size="mini"
95
+              type="warning">排课</el-button>
96
+            <el-button
97
+              size="mini"
98
+              type="primary">复制课程</el-button>
99
+            <el-button
100
+              size="mini"
101
+              type="warning">发布</el-button>
102
+            <el-button
103
+              size="mini"
104
+              type="danger">取消发布</el-button>
105
+            <el-button
106
+              size="mini"
107
+              type="warning"
108
+              @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
109
+            <el-button
110
+              size="mini"
111
+              type="danger"
112
+              @click="handleDelete(scope.$index, scope.row)">删除</el-button>
113
+          </template>
114
+        </el-table-column>
115
+      </el-table>
116
+    </div>
117
+    <el-pagination
118
+      @current-change="handleCurrentChange"
119
+      :current-page.sync="postData.page"
120
+      :page-size="postData.pagesize"
121
+      layout="prev, pager, next, jumper"
122
+      :total="total">
123
+    </el-pagination>
124
+  </div>
125
+</template>
126
+
127
+<script>
128
+import { mapState } from 'vuex'
129
+
130
+export default {
131
+  name: '',
132
+  data () {
133
+    return {
134
+      total: 0,
135
+      postData: { // 表格搜索条件
136
+        caseid: '', // 案场id
137
+        page: 1, // 当前页码
138
+        pagesize: 10, // 请求数据量
139
+        typeid: '', // 课程类型
140
+        name: '', // 课程名称
141
+      },
142
+      currentList: [{
143
+        CourseName: 'xxx',
144
+        Price: 'xxx',
145
+        LocationId: 'xxx',
146
+        CaseId: 'xxx',
147
+        BeginDate: 'xxx',
148
+        EndDate: 'xxx',
149
+        CourseId: 'xxx',
150
+      }],
151
+      courseTypeList: [],
152
+    }
153
+  },
154
+  mounted () {
155
+    this.$nextTick(function () {
156
+      this.getList()
157
+    })
158
+  },
159
+  computed: {
160
+    ...mapState({
161
+      cases: x => x.app.cases.list,
162
+      defaultCaseId: x => x.app.cases.default
163
+    }),
164
+    CaseId: {
165
+      get () {
166
+        return this.postData.caseid || this.defaultCaseId
167
+      },
168
+      set (val) {
169
+        this.postData.caseid = val
170
+      }
171
+    }
172
+  },
173
+  methods: {
174
+    search () { // 搜索
175
+      this.postData.page = 1
176
+      this.currentList = []
177
+      this.getList()
178
+    },
179
+    getList () { // 获取列表
180
+    },
181
+    handleCurrentChange (val) { // 跳转到分页
182
+      this.getList()
183
+    },
184
+    handleEdit (index, row) { // 编辑
185
+      this.$router.push({ name: 'addCourse', query: { id: row.CourseId } })
186
+    },
187
+    handleDelete (index, row) { // 删除
188
+    },
189
+    addCourse () {
190
+      this.$router.push({ name: 'addCourse' })
191
+    }
192
+  }
193
+}
194
+</script>
195
+
196
+<!-- Add "scoped" attribute to limit CSS to this component only -->
197
+<style lang="scss" scoped>
198
+@import "page.scss";
199
+</style>

+ 36
- 0
src/pages/system/courseManager/courseList/page.scss View File

@@ -0,0 +1,36 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+

+ 12
- 0
src/pages/system/page.js View File

@@ -61,6 +61,8 @@ import courseManager from './courseManager/index' // 课程管理
61 61
 import fiveA from './courseManager/fiveA/index' // 全龄生活5A
62 62
 import addFiveA from './courseManager/fiveA/add' // 全龄生活5A添加
63 63
 import editFiveA from './courseManager/fiveA/edit' // 全龄生活5A编辑
64
+import courseList from './courseManager/courseList/index' // 课程列表
65
+import addCourse from './courseManager/courseList/add' // 新增课程
64 66
 import courseTag from './courseManager/courseTag/index' // 课程标签
65 67
 
66 68
 import dataStatistics from './dataStatistics/index' // 数据统计
@@ -346,6 +348,16 @@ export default {
346 348
             component: editFiveA,
347 349
             children: []
348 350
           }]
351
+        }, { // 课程列表
352
+          path: 'courseList',
353
+          name: 'courseList',
354
+          component: courseList,
355
+          children: [{ // 新增课程
356
+            path: 'addCourse',
357
+            name: 'addCourse',
358
+            component: addCourse,
359
+            children: []
360
+          }]
349 361
         }, { // 课程标签
350 362
           path: 'courseTag',
351 363
           name: 'courseTag',

+ 16
- 0
src/style/main.css View File

@@ -352,6 +352,22 @@ select:focus {
352 352
   margin-bottom: 10px;
353 353
 }
354 354
 
355
+.el-textarea__inner{
356
+  line-height: 20px;
357
+  padding: 10px 15px;
358
+}
359
+
360
+.el-radio{
361
+  font-size: 0;
362
+  white-space: nowrap;
363
+}
364
+
365
+.el-radio>*{
366
+  display: inline-block;
367
+  line-height: 40px;
368
+  vertical-align: middle;
369
+}
370
+
355 371
 
356 372
 
357 373