Bladeren bron

商学院改为总后台

xialei 1 jaar geleden
bovenliggende
commit
a593216d92

+ 67 - 0
src/api/sharephotos.js

@@ -44,3 +44,70 @@ export function classifydel(data) {
44 44
 export function shareDelete(data) {
45 45
   return request.post('share/del', data)
46 46
 }
47
+
48
+
49
+/**
50
+ * 商学院
51
+ * @param data
52
+ * @returns {*}
53
+ */
54
+/**
55
+ * @description  课程列表
56
+ */
57
+export function business_school_lst(data) {
58
+  return request.post('business_school/list', data)
59
+}
60
+/**
61
+* @description  课程详情
62
+*/
63
+export function business_school_detail(data) {
64
+  return request.post('business_school/detail', data)
65
+}
66
+/**
67
+* @description  添加课程
68
+*/
69
+export function business_school_save(data) {
70
+  return request.post('business_school/save', data)
71
+}
72
+/**
73
+* @description  删除课程
74
+*/
75
+export function business_school_del(data) {
76
+  return request.post('business_school/del', data)
77
+}
78
+/**
79
+* @description  上下架课程
80
+*/
81
+export function business_school_save_state(data) {
82
+  return request.post('business_school/save_state', data)
83
+}
84
+/**
85
+* @description  课程分类
86
+*/
87
+export function business_school_classify_list(data) {
88
+  return request.post('business_school/classify_list', data)
89
+}
90
+/**
91
+* @description  课程分类表单
92
+*/
93
+export function business_school_classify_add_form(data) {
94
+  return request.post('business_school/classify_add_form', data)
95
+}
96
+/**
97
+* @description  添加课程分类
98
+*/
99
+export function business_school_classify_save_form(data) {
100
+return request.post('business_school/classify_save_form', data)
101
+}
102
+/**
103
+* @description  删除课程分类
104
+*/
105
+export function business_school_classify_del(data) {
106
+  return request.post('business_school/classify_del', data)
107
+}
108
+/**
109
+* @description  获取最高排序
110
+*/
111
+export function business_school_sort() {
112
+  return request.post('business_school/sort')
113
+}

+ 24 - 0
src/router/modules/setting.js

@@ -42,6 +42,30 @@ const settingRouter =
42 42
             title: '操作日志'
43 43
           },
44 44
           component: () => import('@/views/setting/systemLog/index')
45
+        },
46
+        {
47
+            path: 'business_school',
48
+            name: 'business_school',
49
+            meta: {
50
+                title: '课程列表'
51
+            },
52
+            component: () => import('@/views/setting/business_school')
53
+        },
54
+        {
55
+            path: 'business_school_classify',
56
+            name: 'business_school_classify',
57
+            meta: {
58
+                title: '课程分类'
59
+            },
60
+            component: () => import('@/views/setting/business_school_classify')
61
+        },
62
+        {
63
+            path: 'addCourse',
64
+            name: 'addCourse',
65
+            meta: {
66
+                title: '添加课程'
67
+            },
68
+            component: () => import('@/views/setting/addCourse')
45 69
         }
46 70
       ]
47 71
     }

+ 316 - 0
src/views/setting/addCourse.vue

@@ -0,0 +1,316 @@
1
+<template>
2
+  <div class="divBox">
3
+
4
+    <el-card class="box-card">
5
+      <el-form
6
+        ref="formValidate"
7
+        class="form"
8
+        :model="formValidate"
9
+        label-width="120px"
10
+        :rules="ruleValidate"
11
+        @submit.native.prevent
12
+      >
13
+        <div class="dividerTitle">
14
+          <span class="title mr10">添加课程</span>
15
+          <el-divider />
16
+        </div>
17
+        <el-row :gutter="10">
18
+          <el-col v-bind="grid">
19
+
20
+
21
+            <el-form-item label="*课程分类" class="selected-kuang">
22
+              <el-select
23
+                v-model="formValidate.classify"
24
+                placeholder="全部"
25
+                class="filter-item"
26
+              >
27
+              <el-option
28
+                v-for="item in merSelect"
29
+                :key="item.id"
30
+                :label="item.name"
31
+                :value="item.id"
32
+              />
33
+
34
+              </el-select>
35
+            </el-form-item>
36
+
37
+            <el-form-item label="*课程名称" style="margin-top: 25px" prop="name" label-for="name">
38
+              <el-input v-model="formValidate.name" placeholder="请输入" element-id="name" style="width: 80%" />
39
+            </el-form-item>
40
+
41
+            <el-form-item label="*封面" prop="image">
42
+              <div class="upLoadPicBox" @click="modalPicTap('1')">
43
+                <div v-if="formValidate.image" class="pictrue">
44
+                  <img :src="formValidate.image" />
45
+                </div>
46
+                <div v-else class="upLoad">
47
+                  <i class="el-icon-camera cameraIconfont" />
48
+                </div>
49
+              </div>
50
+            </el-form-item>
51
+            <el-form-item label="*类型" class="selected-kuang">
52
+              <el-select
53
+                v-model="formValidate.type"
54
+                placeholder="视频"
55
+                class="filter-item"
56
+              >
57
+                <el-option label="视频" value="0" />
58
+                <el-option label="图文" value="1" />
59
+              </el-select>
60
+            </el-form-item>
61
+            <el-form-item label="*上传视频" class="selected-kuang" v-if="formValidate.type == 0">
62
+
63
+              <el-upload
64
+                class="upload-demo mr10 mb15"
65
+                :action="fileUrl"
66
+                :on-success="handleSuccess"
67
+                :headers="myHeaders"
68
+                :show-file-list="false"
69
+                :on-progress="handleProcess"
70
+                multiple
71
+              >
72
+                <el-button size="small" type="primary">{{ uploadBtnTitle }}</el-button>
73
+              </el-upload>
74
+              <span v-if="formValidate.mp4">{{ formValidate.mp4 }}</span>
75
+            </el-form-item>
76
+
77
+
78
+            <el-form-item label="*视频封面" prop="cover" v-if="formValidate.type == 0" >
79
+              <div class="upLoadPicBox" @click="modalPicTap1('1')">
80
+                <div v-if="formValidate.cover" class="pictrue">
81
+                  <img :src="formValidate.cover" />
82
+                </div>
83
+                <div v-else class="upLoad">
84
+                  <i class="el-icon-camera cameraIconfont" />
85
+                </div>
86
+              </div>
87
+            </el-form-item>
88
+
89
+            <el-form-item label="*文章内容" class="article_edit_box" v-if="formValidate.type == 1">
90
+              <ueditor-from v-model="formValidate.content" :content="formValidate.content"/>
91
+            </el-form-item>
92
+
93
+            <el-form-item
94
+              label="排序"
95
+              prop="sort"
96
+              label-for="sort"
97
+            >
98
+              <el-input-number v-model="formValidate.sort" />
99
+            </el-form-item>
100
+
101
+            <el-form-item label="是否显示">
102
+              <el-switch
103
+                  v-model="formValidate.state"
104
+                  active-value="1"
105
+                  inactive-value="0"
106
+                  active-text="开启   "
107
+                  inactive-text="关闭   "
108
+                  @change="switchAction"
109
+              />
110
+            </el-form-item>
111
+
112
+          </el-col>
113
+        </el-row>
114
+
115
+
116
+        <el-button
117
+          type="primary"
118
+          class="submission"
119
+          @click="onsubmit"
120
+          >提交</el-button
121
+        >
122
+      </el-form>
123
+
124
+
125
+
126
+    </el-card>
127
+  </div>
128
+</template>
129
+
130
+<script>
131
+import { business_school_save, business_school_classify_list, business_school_detail, business_school_sort} from "@/api/sharephotos";
132
+import ueditorFrom from "@/components/ueditorFrom";
133
+import { roterPre } from "@/settings";
134
+import SettingMer from '@/libs/settingMer'
135
+import { getToken } from '@/utils/auth'
136
+export default {
137
+  name: "EditArticle",
138
+  components: { ueditorFrom },
139
+  data() {
140
+    return {
141
+      myHeaders: { 'X-Token': getToken() },
142
+      roterPre: roterPre,
143
+      list: [],
144
+      treeData: [],
145
+      grid: {
146
+        xl: 10,
147
+        lg: 10,
148
+        md: 10,
149
+        sm: 24,
150
+        xs: 24,
151
+      },
152
+      ruleValidate: {
153
+
154
+      },
155
+      value: false,
156
+      merSelect: [],
157
+      formValidate: {
158
+        classify: "",
159
+        name: "",
160
+        image: "",
161
+        type: "0",
162
+        state: "1",
163
+        sort: 0,
164
+        mp4: "",
165
+        content: "",
166
+        cover: "",
167
+        id: "",
168
+      },
169
+      videoUrl: '',
170
+      show: false,
171
+      uploadBtnTitle: '上传'
172
+    };
173
+  },
174
+
175
+  created() {
176
+    this.tempRoute = Object.assign({}, this.$route);
177
+
178
+    console.log(this.tempRoute.query)
179
+
180
+    if (this.tempRoute.query.id) {
181
+      this.formValidate.id = this.tempRoute.query.id;
182
+      this.detail(this.formValidate.id)
183
+    } else {
184
+      this.getBestSort()
185
+    }
186
+  },
187
+
188
+  computed: {
189
+    fileUrl() {
190
+      return SettingMer.https + `/upload/video/0/file`
191
+    }
192
+  },
193
+
194
+  mounted() {
195
+    this.classifylist();
196
+
197
+
198
+  },
199
+  methods: {
200
+
201
+    switchAction() {
202
+
203
+    },
204
+
205
+    getBestSort() {
206
+      business_school_sort().then(res => {
207
+        this.formValidate.sort = res.data.sort
208
+      })
209
+    },
210
+
211
+    // 上传中
212
+    handleProcess(){
213
+      // this.show = true
214
+      this.uploadBtnTitle = '上传中...'
215
+    },
216
+    // 上传成功
217
+    handleSuccess(res) {
218
+      if (res.status === 200) {
219
+        this.$message.success('上传成功')
220
+        this.formValidate.mp4 = res.data.src
221
+        this.uploadBtnTitle = '上传'
222
+      } else {
223
+        this.$message.error(res.message)
224
+        this.uploadBtnTitle = '上传'
225
+      }
226
+    },
227
+
228
+    //   分类列表
229
+    classifylist() {
230
+      business_school_classify_list()
231
+        .then((res) => {
232
+          if (res.status == 200) {
233
+            this.merSelect = res.data;
234
+          } else {
235
+            this.$message.error(res.message);
236
+          }
237
+        })
238
+        .catch((res) => {
239
+          this.$message.error(res.message);
240
+        });
241
+    },
242
+
243
+    modalPicTap(tit) {
244
+      const _this = this;
245
+      this.$modalUpload(function (img) {
246
+        _this.formValidate.image = img[0];
247
+      }, tit);
248
+    },
249
+
250
+    modalPicTap1(tit) {
251
+      const _this = this;
252
+      this.$modalUpload(function (img) {
253
+        _this.formValidate.cover = img[0];
254
+      }, tit);
255
+    },
256
+
257
+    //回显数据
258
+    detail(e) {
259
+
260
+      let params = {id : e}
261
+
262
+      business_school_detail(params).then(
263
+        (res) => {
264
+          if (res.status == 200) {
265
+            // this.formValidate.classify = res.data.classify;
266
+            // this.formValidate.name = res.data.name;
267
+            // this.formValidate.image = res.data.image;
268
+            // this.formValidate.head_size = res.data.head_size;
269
+            // this.formValidate.image = res.data.image;
270
+            // this.formValidate.image_fake = res.data.image_fake;
271
+            // this.formValidate.nickname_coordinate = res.data.nickname_coordinate;
272
+            // this.formValidate.nickname_size = res.data.nickname_size;
273
+            // this.formValidate.qr_coordinate = res.data.qr_coordinate;
274
+            // this.formValidate.qr_size = res.data.qr_size;
275
+            // this.formValidate.status = res.data.status;
276
+            // this.formValidate.type = res.data.type;
277
+            // this.formValidate.sort = res.data.sort;
278
+            this.formValidate = res.data
279
+          }
280
+        },
281
+        (fail) => {
282
+          console.log(fail);
283
+        }
284
+      );
285
+    },
286
+    // 提交数据
287
+    onsubmit(name) {
288
+      business_school_save(this.formValidate).then(
289
+        (res) => {
290
+          if (res.status == 200) {
291
+            this.$message.success(res.message);
292
+            this.$router.go(-1);
293
+          }
294
+        },
295
+        (fail) => {
296
+          this.$message.error(fail);
297
+        }
298
+      );
299
+    },
300
+  },
301
+};
302
+</script>
303
+
304
+<style scoped lang="scss">
305
+.sd {
306
+  display: flex;
307
+  position: relative;
308
+  position: absolute;
309
+  justify-content: center;
310
+  align-items: center;
311
+}
312
+
313
+.article_edit_box {
314
+  width: 1000px;
315
+}
316
+</style>

+ 481 - 0
src/views/setting/business_school.vue

@@ -0,0 +1,481 @@
1
+<template>
2
+  <div class="divBox">
3
+    <el-card class="box-card">
4
+      <div slot="header" class="clearfix">
5
+          <div class="container">
6
+              <el-form size="small" label-width="100px">
7
+                  <el-form-item label="时间选择:" class="width100">
8
+                      <el-radio-group v-model="tableFrom.date" type="button" class="mr20" size="small" @change="selectChange(tableFrom.date)">
9
+                          <el-radio-button v-for="(item,i) in fromList.fromTxt" :key="i" :label="item.val">{{ item.text }}</el-radio-button>
10
+                      </el-radio-group>
11
+                      <el-date-picker v-model="timeVal" value-format="yyyy/MM/dd" format="yyyy/MM/dd" size="small" type="daterange" placement="bottom-end" placeholder="自定义时间" style="width: 250px;" @change="onchangeTime" />
12
+                  </el-form-item>
13
+                  <el-form-item label="课程名称:" class="width100">
14
+                      <el-input v-model="tableFrom.name" placeholder="请输入" class="selWidth" size="small">
15
+                      </el-input>
16
+                  </el-form-item>
17
+                  <el-form-item label="课程分类:" class="selected-kuang">
18
+                    <el-select
19
+                      v-model="tableFrom.classify"
20
+                      placeholder="全部"
21
+                      class="filter-item"
22
+                      @change="getList(1)"
23
+                    >
24
+                    <el-option
25
+                      v-for="item in merSelect"
26
+                      :key="item.id"
27
+                      :label="item.name"
28
+                      :value="item.id"
29
+                    />
30
+                    </el-select>
31
+                  </el-form-item>
32
+                  <el-form-item label="状态:" class="selected-kuang">
33
+                    <el-select
34
+                      v-model="tableFrom.state"
35
+                      placeholder="全部"
36
+                      class="filter-item"
37
+                      @change="getList(1)"
38
+                    >
39
+                      <el-option label="全部" value="" />
40
+                      <el-option label="上架" value="1" />
41
+                      <el-option label="下架" value="0" />
42
+                    </el-select>
43
+                  </el-form-item>
44
+                  <el-form-item label="课程类型:" class="selected-kuang">
45
+                    <el-select
46
+                      v-model="tableFrom.type"
47
+                      placeholder="全部"
48
+                      class="filter-item"
49
+                      @change="getList(1)"
50
+                    >
51
+                      <el-option label="全部" value="" />
52
+                      <el-option label="视频" value="0"></el-option>
53
+                      <el-option label="图文" value="1"></el-option>
54
+
55
+                    </el-select>
56
+                  </el-form-item>
57
+
58
+                  <div class="bottom-button">
59
+                    <el-button size="small" @click="reset" style="width: 100px; margin-top: 20px; border: 1px solid; " >重置</el-button>
60
+                    <!-- <el-button type="primary" size="small" @click="exportSearchResult" style="width: 100px; margin-top: 20px;">导出</el-button> -->
61
+                    <el-button type="primary" size="small" @click="getList(1)" style="width: 100px; margin-top: 20px;">查询</el-button>
62
+                  </div>
63
+              </el-form>
64
+          </div>
65
+      </div>
66
+
67
+      <div class="mid_button_box">
68
+        <el-button @click="onAddAction" size="small" type="primary">添加课程</el-button>
69
+        <el-button @click="upSaleAction" size="small" type="success" >批量上架</el-button>
70
+        <el-button @click="downSaleAction" size="small" type="warning">批量下架</el-button>
71
+        <el-button @click="deleteAction" size="small" type="danger">批量删除</el-button>
72
+      </div>
73
+
74
+      <el-table
75
+        v-loading="listLoading"
76
+        :data="tableData.data"
77
+        style="width: 100%"
78
+        size="small"
79
+        @selection-change="handleSelectionChange"
80
+      >
81
+
82
+        <el-table-column type="selection" width="55"> </el-table-column>
83
+
84
+        <el-table-column prop="id" label="ID" min-width="60" />
85
+        <el-table-column prop="create_time" label="添加时间" min-width="130" />
86
+        <el-table-column label="课程名称" min-width="130">
87
+          <template slot-scope="scope">
88
+            <span class="courseName">{{ scope.row.name }}</span>
89
+          </template>
90
+        </el-table-column>
91
+        <el-table-column prop="classify_name" label="课程分类" min-width="80" />
92
+        <el-table-column prop="sort" label="排序" min-width="60" />
93
+
94
+
95
+        <el-table-column prop="type" label="课程类型" min-width="80">
96
+          <template slot-scope="scope">
97
+            <span v-if="scope.row.type == 1" >图文</span>
98
+            <span v-else >视频</span>
99
+          </template>
100
+        </el-table-column>
101
+
102
+        <el-table-column prop="state" label="状态" min-width="80" >
103
+          <template slot-scope="scope">
104
+
105
+            <el-button v-if="scope.row.state != 1" type="text" size="small" class="mr10" @click="onchangeIsShow(scope.row)" >上架</el-button>
106
+            <el-button v-else type="text" size="small" class="mr10" @click="onchangeIsShow(scope.row)" >下架</el-button>
107
+            <!-- <el-button type="text" size="small" class="mr10" @click="handleDelete(scope.row.id)" >删除</el-button> -->
108
+            <!-- <el-switch
109
+              v-model="scope.row.state"
110
+              active-value="1"
111
+              inactive-value="0"
112
+              active-text="上架"
113
+              inactive-text="下架"
114
+              @change="onchangeIsShow(scope.row)"
115
+            /> -->
116
+          </template>
117
+        </el-table-column>
118
+        <el-table-column label="操作" min-width="100" fixed="right">
119
+          <template slot-scope="scope">
120
+            <el-button
121
+              type="text"
122
+              size="small"
123
+              class="mr10"
124
+              @click="onEdit(scope.row.id)"
125
+              >编辑</el-button>
126
+            <el-button type="text" size="small" class="mr10" @click="handleDelete(scope.row.id)" >删除</el-button>
127
+
128
+            <!-- </router-link> -->
129
+          </template>
130
+        </el-table-column>
131
+      </el-table>
132
+      <div class="block">
133
+
134
+      </div>
135
+    </el-card>
136
+
137
+    <div class="block">
138
+        <el-pagination :current-page="tableFrom.page" :page-size="tableFrom.limit"
139
+                       :page-sizes="[20, 40, 60, 80]"
140
+                       :total="tableData.total" layout="total, sizes, prev, pager, next, jumper"
141
+                       @size-change="handleSizeChange"
142
+                       @current-change="pageChange"/>
143
+    </div>
144
+  </div>
145
+</template>
146
+
147
+<script>
148
+import {business_school_lst, business_school_add,business_school_save,business_school_del, business_school_classify_list,business_school_save_state} from "@/api/sharephotos";
149
+import { roterPre } from "@/settings";
150
+export default {
151
+  name: "Article",
152
+  data() {
153
+    return {
154
+      roterPre: roterPre,
155
+      tableData: {
156
+        data: [],
157
+      },
158
+
159
+      listLoading: true,
160
+      tableFrom: {
161
+          type: "",
162
+          state: "",
163
+          classify: "",
164
+          name: "",
165
+          date: "",
166
+          page: 1,
167
+          limit: 20,
168
+
169
+      },
170
+      is_show: false,
171
+      fromList: {
172
+          title: "选择时间",
173
+          custom: true,
174
+          fromTxt: [{
175
+                  text: "全部",
176
+                  val: ""
177
+              },
178
+              {
179
+                  text: "今天",
180
+                  val: "today"
181
+              },
182
+              {
183
+                  text: "昨天",
184
+                  val: "yesterday"
185
+              },
186
+              {
187
+                  text: "最近7天",
188
+                  val: "lately7"
189
+              },
190
+              {
191
+                  text: "最近30天",
192
+                  val: "lately30"
193
+              },
194
+              {
195
+                  text: "本月",
196
+                  val: "month"
197
+              },
198
+              {
199
+                  text: "本年",
200
+                  val: "year"
201
+              },
202
+          ],
203
+      },
204
+      merSelect: [],
205
+      ids: [],
206
+      timeVal: [],
207
+    };
208
+  },
209
+
210
+  created() {
211
+
212
+  },
213
+
214
+  mounted() {
215
+    this.getList();
216
+    this.classifylist();
217
+  },
218
+  methods: {
219
+    //   分类列表
220
+    classifylist() {
221
+      business_school_classify_list()
222
+        .then((res) => {
223
+          if (res.status == 200) {
224
+            this.merSelect = res.data;
225
+          } else {
226
+            this.$message.error(res.message);
227
+          }
228
+        })
229
+        .catch((res) => {
230
+          this.$message.error(res.message);
231
+        });
232
+    },
233
+
234
+    handleSelectionChange(val) {
235
+        this.selectionList = val;
236
+        const data = [];
237
+        this.selectionList.map((item) => {
238
+            data.push(item.id);
239
+        });
240
+        this.ids = data.join(",");
241
+    },
242
+
243
+      // 添加
244
+    onAddAction() {
245
+      this.$router.push({
246
+          path: roterPre + "/setting/addCourse/",
247
+      });
248
+    },
249
+
250
+    // 编辑
251
+    onEdit(id) {
252
+
253
+      console.log('id')
254
+      console.log(id)
255
+      this.$router.push({
256
+          path: roterPre + "/setting/addCourse/",
257
+          query: {id: id}
258
+      });
259
+    },
260
+
261
+    // 重置
262
+    reset() {
263
+      this.tableFrom = {
264
+          type: "",
265
+          state: "",
266
+          classify: "",
267
+          name: "",
268
+          date: "",
269
+          page: 1,
270
+          limit: 20,
271
+      }
272
+
273
+      this.getList(1)
274
+    },
275
+
276
+    // 选择时间
277
+    selectChange(tab) {
278
+        this.timeVal = [];
279
+        this.tableFrom.date = tab;
280
+        this.getList(1);
281
+    },
282
+    // 具体日期
283
+    onchangeTime(e) {
284
+        this.timeVal = e;
285
+        this.tableFrom.date = e ? this.timeVal.join("-") : "";
286
+        this.getList(1);
287
+    },
288
+
289
+    // 列表
290
+    getList(num) {
291
+      this.listLoading = true;
292
+
293
+      this.tableFrom.page = num ? num : this.tableFrom.page;
294
+
295
+      business_school_lst(this.tableFrom)
296
+        .then((res) => {
297
+
298
+          this.tableData.data = res.data.list
299
+          this.tableData.total = res.data.count
300
+          this.listLoading = false;
301
+        })
302
+        .catch((res) => {
303
+          this.listLoading = false;
304
+          this.$message.error(res.message);
305
+        });
306
+    },
307
+    
308
+    // 单个上架下架
309
+    onchangeIsShow(row) {
310
+      let courseStatus = {
311
+        id: row.id,
312
+        state: row.state
313
+      }
314
+      console.log(courseStatus)
315
+      business_school_save_state(courseStatus)
316
+        .then(({ message }) => {
317
+          this.$message.success(message);
318
+          this.getList()
319
+        })
320
+        .catch(({ message }) => {
321
+          this.$message.error(message);
322
+        });
323
+    },
324
+
325
+    // 批量上架
326
+    upSaleAction() {
327
+
328
+      let courseStatus = {
329
+        id: this.ids,
330
+        state: '1'
331
+      }
332
+
333
+      business_school_save_state(courseStatus)
334
+        .then(({ message }) => {
335
+          this.$message.success(message);
336
+          this.getList()
337
+        })
338
+        .catch(({ message }) => {
339
+          this.$message.error(message);
340
+        });
341
+    },
342
+
343
+    // 批量下架
344
+    downSaleAction() {
345
+
346
+      let courseStatus = {
347
+        id: this.ids,
348
+        state: '0'
349
+      }
350
+
351
+      business_school_save_state(courseStatus)
352
+        .then(({ message }) => {
353
+          this.$message.success(message);
354
+          this.getList()
355
+        })
356
+        .catch(({ message }) => {
357
+          this.$message.error(message);
358
+        });
359
+    },
360
+
361
+    // 删除
362
+    handleDelete(id) {
363
+      this.$modalSure().then(() => {
364
+        let courseStatus = {
365
+          id: id,
366
+        }
367
+        business_school_del(courseStatus)
368
+          .then(({ message }) => {
369
+            this.$message.success(message);
370
+            this.getList()
371
+          })
372
+          .catch(({ message }) => {
373
+            this.$message.error(message);
374
+          });
375
+      });
376
+      
377
+      
378
+    },
379
+
380
+    // 批量删除
381
+    deleteAction() {
382
+      this.$modalSure().then(() => {
383
+        let courseStatus = {
384
+          id: this.ids,
385
+        }
386
+        business_school_del(courseStatus)
387
+          .then(({ message }) => {
388
+            this.$message.success(message);
389
+            this.getList()
390
+          })
391
+          .catch(({ message }) => {
392
+            this.$message.error(message);
393
+          });
394
+      });
395
+      
396
+    },
397
+
398
+
399
+
400
+    pageChange(page) {
401
+        this.tableFrom.page = page;
402
+        this.getList('');
403
+    },
404
+    handleSizeChange(val) {
405
+        this.tableFrom.limit = val;
406
+        this.getList('');
407
+    },
408
+
409
+    getDateDiff(dateTime) {
410
+      var str = dateTime;
411
+      let result = "";
412
+      //将字符串转换成时间格式
413
+      var timePublish = new Date(str);
414
+      var timeNow = new Date();
415
+      var minute = 1000 * 60;
416
+      var hour = minute * 60;
417
+      var day = hour * 24;
418
+      var month = day * 30;
419
+      var year = month * 12;
420
+      var diffValue = timeNow - timePublish;
421
+      var diffMonth = diffValue / month;
422
+      var diffWeek = diffValue / (7 * day);
423
+      var diffDay = diffValue / day;
424
+      var diffHour = diffValue / hour;
425
+      var diffMinute = diffValue / minute;
426
+      var diffYear = diffValue / year;
427
+      if (diffValue < 0) {
428
+        result = "刚刚发表";
429
+      } else if (diffYear > 1) {
430
+        result = parseInt(diffYear) + "年前";
431
+      } else if (diffMonth > 1) {
432
+        result = parseInt(diffMonth) + "月前";
433
+      } else if (diffWeek > 1) {
434
+        result = parseInt(diffWeek) + "周前";
435
+      } else if (diffDay > 1) {
436
+        result = parseInt(diffDay) + "天前";
437
+      } else if (diffHour > 1) {
438
+        result = parseInt(diffHour) + "小时前";
439
+      } else if (diffMinute > 1) {
440
+        result = parseInt(diffMinute) + "分钟前";
441
+      } else {
442
+        result = "刚刚发表";
443
+      }
444
+      return result;
445
+    },
446
+  },
447
+};
448
+</script>
449
+
450
+<style scoped lang="scss">
451
+.selWidth {
452
+  width: 300px;
453
+}
454
+.description {
455
+  width: 80%;
456
+  margin: 0 auto;
457
+  height: 50px;
458
+  line-height: 50px;
459
+  display: flex;
460
+  justify-content: space-between;
461
+  align-items: center;
462
+  text-align: center;
463
+}
464
+
465
+.bottom-button {
466
+    margin-top: 30px;
467
+    margin-left: 300px;
468
+    width: 250px;
469
+    display: flex;
470
+    justify-content: space-between;
471
+}
472
+
473
+.courseName {
474
+  overflow:hidden;
475
+  text-overflow: ellipsis;
476
+  -webkit-line-clamp: 2;
477
+  display: -webkit-box;
478
+  -webkit-box-orient: vertical;
479
+}
480
+
481
+</style>

+ 162 - 0
src/views/setting/business_school_classify.vue

@@ -0,0 +1,162 @@
1
+<template>
2
+  <div class="divBox">
3
+    <el-card class="box-card">
4
+      <div slot="header" class="clearfix">
5
+        <el-button @click="onAdd" size="small" type="primary">添加分类</el-button>
6
+      </div>
7
+      <el-table
8
+        v-loading="listLoading"
9
+        :data="tableData.data"
10
+        style="width: 100%"
11
+        size="small"
12
+      >
13
+        <el-table-column prop="name" label="名称" min-width="60" />
14
+        <el-table-column prop="sort" label="排序" min-width="60" />
15
+        <el-table-column label="操作" min-width="100" fixed="right">
16
+          <template slot-scope="scope">
17
+            <el-button
18
+              type="text"
19
+              size="small"
20
+              class="mr10"
21
+              @click="onEdit(scope.row.id)"
22
+              >编辑</el-button
23
+            >
24
+            <el-button type="text" size="small" class="mr10" @click="handleDelete(scope.row.id)" >删除</el-button>
25
+
26
+            <!-- </router-link> -->
27
+          </template>
28
+        </el-table-column>
29
+      </el-table>
30
+      <div class="block">
31
+
32
+      </div>
33
+    </el-card>
34
+  </div>
35
+</template>
36
+
37
+<script>
38
+import {business_school_classify_list, business_school_classify_add_form,business_school_classify_save_form,business_school_classify_del} from "@/api/sharephotos";
39
+import { roterPre } from "@/settings";
40
+export default {
41
+  name: "Article",
42
+  data() {
43
+    return {
44
+      roterPre: roterPre,
45
+      tableData: {
46
+        data: [],
47
+      },
48
+      listLoading: true,
49
+      merSelect: [],
50
+    };
51
+  },
52
+  mounted() {
53
+    this.getList();
54
+  },
55
+  methods: {
56
+      // 添加
57
+    onAdd() {
58
+      this.$modalForm(business_school_classify_add_form()).then(() => this.getList())
59
+    },
60
+    // 编辑
61
+    onEdit(id) {
62
+      this.$modalForm(business_school_classify_save_form({id:id})).then(() => this.getList())
63
+    },
64
+
65
+    // 列表
66
+    getList() {
67
+      this.listLoading = true;
68
+        business_school_classify_list()
69
+        .then((res) => {
70
+          this.tableData.data = res.data;
71
+          this.listLoading = false;
72
+        })
73
+        .catch((res) => {
74
+          this.listLoading = false;
75
+          this.$message.error(res.message);
76
+        });
77
+    },
78
+    share(e) {
79
+      saveshareclassify({}).catch((res) => {
80
+        if(res.message=='没有权限访问'){
81
+            this.$message.error(res.message);
82
+        }else{
83
+            this.$router.push({ name: "classifyadd", query: { id: e.id,name:e.name,sort:e.sort} });
84
+        }
85
+      });
86
+    },
87
+    handleDelete(id) {
88
+      this.$modalSure().then(() => {
89
+        business_school_classify_del({id:id}).then(({ message }) => {
90
+          this.$message.success(message)
91
+          this.getList()
92
+        }).catch(({ message }) => {
93
+          this.$message.error(message)
94
+        })
95
+      })
96
+    },
97
+    //上架下架
98
+    // onchangeIsShow(row) {
99
+    //   Getstatus(row.id)
100
+    //     .then(({ message }) => {
101
+    //       this.$message.success(message);
102
+    //     })
103
+    //     .catch(({ message }) => {
104
+    //       this.$message.error(message);
105
+    //     });
106
+    // },
107
+    getDateDiff(dateTime) {
108
+      var str = dateTime;
109
+      let result = "";
110
+      //将字符串转换成时间格式
111
+      var timePublish = new Date(str);
112
+      var timeNow = new Date();
113
+      var minute = 1000 * 60;
114
+      var hour = minute * 60;
115
+      var day = hour * 24;
116
+      var month = day * 30;
117
+      var year = month * 12;
118
+      var diffValue = timeNow - timePublish;
119
+      var diffMonth = diffValue / month;
120
+      var diffWeek = diffValue / (7 * day);
121
+      var diffDay = diffValue / day;
122
+      var diffHour = diffValue / hour;
123
+      var diffMinute = diffValue / minute;
124
+      var diffYear = diffValue / year;
125
+      if (diffValue < 0) {
126
+        result = "刚刚发表";
127
+      } else if (diffYear > 1) {
128
+        result = parseInt(diffYear) + "年前";
129
+      } else if (diffMonth > 1) {
130
+        result = parseInt(diffMonth) + "月前";
131
+      } else if (diffWeek > 1) {
132
+        result = parseInt(diffWeek) + "周前";
133
+      } else if (diffDay > 1) {
134
+        result = parseInt(diffDay) + "天前";
135
+      } else if (diffHour > 1) {
136
+        result = parseInt(diffHour) + "小时前";
137
+      } else if (diffMinute > 1) {
138
+        result = parseInt(diffMinute) + "分钟前";
139
+      } else {
140
+        result = "刚刚发表";
141
+      }
142
+      return result;
143
+    },
144
+  },
145
+};
146
+</script>
147
+
148
+<style scoped lang="scss">
149
+.selWidth {
150
+  width: 300px;
151
+}
152
+.description {
153
+  width: 80%;
154
+  margin: 0 auto;
155
+  height: 50px;
156
+  line-height: 50px;
157
+  display: flex;
158
+  justify-content: space-between;
159
+  align-items: center;
160
+  text-align: center;
161
+}
162
+</style>