Merge branch 'master' of 120.27.44.69:dev/trimble-admin-pro
Showing
12 changed files
with
1829 additions
and
3 deletions
... | @@ -19,7 +19,7 @@ let requestDomain = "https://ow.go.qudone.com"; | ... | @@ -19,7 +19,7 @@ let requestDomain = "https://ow.go.qudone.com"; |
19 | if (location.href.indexOf("://k.wxpai.cn") > 0 || location.href.indexOf("://h5.k.wxpai.cn") > 0) { | 19 | if (location.href.indexOf("://k.wxpai.cn") > 0 || location.href.indexOf("://h5.k.wxpai.cn") > 0) { |
20 | requestDomain = "https://api.k.wxpai.cn/bizproxy"; | 20 | requestDomain = "https://api.k.wxpai.cn/bizproxy"; |
21 | } | 21 | } |
22 | 22 | //requestDomain = 'http://localhost:6400' | |
23 | /** | 23 | /** |
24 | * header不加session的白名单 | 24 | * header不加session的白名单 |
25 | */ | 25 | */ |
... | @@ -99,7 +99,7 @@ export const formdata = (url, data) => { | ... | @@ -99,7 +99,7 @@ export const formdata = (url, data) => { |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | export const request = { | 102 | /*export const request = { |
103 | post(url, data) { | 103 | post(url, data) { |
104 | return axios.post(`${requestDomain}${url}`, data); | 104 | return axios.post(`${requestDomain}${url}`, data); |
105 | }, | 105 | }, |
... | @@ -127,5 +127,106 @@ export const request = { | ... | @@ -127,5 +127,106 @@ export const request = { |
127 | } | 127 | } |
128 | return fullUrl; | 128 | return fullUrl; |
129 | }, | 129 | }, |
130 | /!*test*!/ | ||
131 | };*/ | ||
132 | |||
133 | export const request = { | ||
134 | |||
135 | post(url, data) { | ||
136 | //return axios.post(`${requestDomain}${url}`, data); | ||
137 | let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}` | ||
138 | return axios.post(requestUrl, data) | ||
139 | }, | ||
140 | get(url, data) { | ||
141 | //return axios.get(`${requestDomain}${url}`, { params: data }); | ||
142 | let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}` | ||
143 | return axios.get(requestUrl, { | ||
144 | params: data | ||
145 | }) | ||
146 | }, | ||
147 | form(url, params) { | ||
148 | let formData = new FormData() //使用formData对象 | ||
149 | for (let key in params) { | ||
150 | formData.append(key, params[key]) | ||
151 | } | ||
152 | let requestUrl = url.indexOf('://') >= 0 ? `${url}` : `${requestDomain}${url}` | ||
153 | return axios.post(requestUrl, formData, formDataHeaders) | ||
154 | }, | ||
155 | build(url, params) { | ||
156 | let fullUrl = `${requestDomain}${url}` | ||
157 | let split = '' | ||
158 | for (let key in params) { | ||
159 | if (split) { | ||
160 | split = '&' | ||
161 | } else { | ||
162 | split = '?' | ||
163 | } | ||
164 | fullUrl += split + key + '=' + params[key] | ||
165 | } | ||
166 | return fullUrl | ||
167 | }, | ||
130 | /*test*/ | 168 | /*test*/ |
131 | }; | 169 | postTest(url, data) { |
170 | axios({ // 用axios发送post请求 | ||
171 | method: 'post', | ||
172 | url: `${requestDomain}${url}`, // 请求地址 | ||
173 | data: data, // 参数 | ||
174 | responseType: 'blob' // 表明返回服务器返回的数据类型 | ||
175 | }).then(res => { // 处理返回的文件流 | ||
176 | console.log('请求头:', res.headers) | ||
177 | console.log('res的数据:', res) | ||
178 | const filename = res.headers['content-disposition'].split('=')[1] | ||
179 | console.log('文件名:', filename) | ||
180 | const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })//new Blob([res])中不加data就会返回下图中[objece objece]内容(少取一层) | ||
181 | const elink = document.createElement('a') | ||
182 | elink.download = filename | ||
183 | elink.style.display = 'none' | ||
184 | elink.href = URL.createObjectURL(blob) | ||
185 | document.body.appendChild(elink) | ||
186 | elink.click() | ||
187 | document.body.removeChild(elink) | ||
188 | URL.revokeObjectURL(elink.href) // 释放URL 对象 | ||
189 | |||
190 | }) | ||
191 | |||
192 | var xhr = new XMLHttpRequest() | ||
193 | //xhr.open("POST", "https://ow.go.qudone.com/zlzmapi/admin/member/export/test", true); | ||
194 | xhr.open('POST', 'http://127.0.0.1:8011/zlzmapi/admin/member/export/test', true) | ||
195 | xhr.setRequestHeader('adminSessionId', 'a91986990ed049bebd0b4ab67d346229') | ||
196 | xhr.responseType = 'blob' | ||
197 | xhr.onload = function() { | ||
198 | if (this.status === 200) { | ||
199 | //var blob = new Blob([this.response], {type: 'application/vnd.ms-excel;charset=ISO8859-1'}); | ||
200 | var blob = new Blob([this.response], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) | ||
201 | console.log('打印response:', this) | ||
202 | var a = document.createElement('a') | ||
203 | var url = window.URL.createObjectURL(blob) | ||
204 | a.href = url | ||
205 | document.body.appendChild(a) | ||
206 | a.click() | ||
207 | } | ||
208 | } | ||
209 | xhr.send() | ||
210 | |||
211 | /* return axios.post(`${requestDomain}${url}`, data, formDataHeaders).then(res => { | ||
212 | let fileName = res.headers['Content-Disposition'] | ||
213 | console.log('文件名:', fileName) | ||
214 | console.log('res的数据:', res) | ||
215 | console.log('res的data的数据:', res.data) | ||
216 | console.log('测试导出2') | ||
217 | //将文件流转成blob形式 | ||
218 | const blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' }) | ||
219 | console.log('blob的值:', blob) | ||
220 | const elink = document.createElement('a') | ||
221 | elink.style.display = 'none' | ||
222 | elink.href = URL.createObjectURL(blob) | ||
223 | document.body.appendChild(elink) | ||
224 | elink.click() | ||
225 | URL.revokeObjectURL(elink.href) // 释放URL 对象 | ||
226 | document.body.removeChild(elink) | ||
227 | /!* let objectUrl = URL.createObjectURL(blob) | ||
228 | window.location.href = objectUrl | ||
229 | *!/ | ||
230 | })*/ | ||
231 | } | ||
232 | } | ... | ... |
src/components/UploadItem.vue
0 → 100644
1 | <template> | ||
2 | <el-upload | ||
3 | class="avatar-uploader" | ||
4 | :action="uploadUrl" | ||
5 | :http-request="uploadSumit" | ||
6 | :show-file-list="false" | ||
7 | :on-success="handleAvatarSuccess" | ||
8 | :before-upload="beforeAvatarUpload" | ||
9 | > | ||
10 | <img v-if="currentValue" :src="currentValue" class="avatar"> | ||
11 | <i v-else class="el-icon-plus avatar-uploader-icon"></i> | ||
12 | <div class="el-upload__tip" slot="tip" :class="{error:tipsError}">{{tips}}</div> | ||
13 | </el-upload> | ||
14 | </template> | ||
15 | |||
16 | <script> | ||
17 | import { request } from "@/api/fetch-api.js"; | ||
18 | |||
19 | /** | ||
20 | * 外层插件可通过监听:v-on:before-upload;v-on:after-upload两个事件监听上传结果 | ||
21 | * after-upload(success, src) | ||
22 | */ | ||
23 | |||
24 | export default { | ||
25 | props: ["value"], | ||
26 | data() { | ||
27 | return { | ||
28 | imageUrl: this.value, | ||
29 | uploadUrl: "https://api.k.wxpai.cn/bizproxy/kdapi/file/upload", | ||
30 | tips: "只能上传jpg/png文件,且不超过500kb", | ||
31 | tipsError: false, | ||
32 | uploadInterval: 0 | ||
33 | }; | ||
34 | }, | ||
35 | methods: { | ||
36 | handleAvatarSuccess(res, file) { | ||
37 | this.imageUrl = URL.createObjectURL(file.raw); | ||
38 | }, | ||
39 | beforeAvatarUpload(file) { | ||
40 | const isJPG = file.type === "image/jpeg" || file.type === "image/png"; | ||
41 | const isLt2M = file.size / 1024 < 500; | ||
42 | |||
43 | if (!isJPG) { | ||
44 | this.tipsError = true; | ||
45 | this.tips = "上传图片只能是 JPG|PNG 格式!"; | ||
46 | // this.$message.error(""); | ||
47 | } | ||
48 | if (!isLt2M) { | ||
49 | this.tipsError = true; | ||
50 | this.tips = "上传图片大小不能超过 500kb!"; | ||
51 | } | ||
52 | |||
53 | return isJPG && isLt2M; | ||
54 | }, | ||
55 | uploadSumit(params) { | ||
56 | this.tipsError = false; | ||
57 | this.uploadStart(); | ||
58 | this.$emit("before-upload"); | ||
59 | |||
60 | let data = { | ||
61 | path: "/pro/tianbao", | ||
62 | file: params.file | ||
63 | }; | ||
64 | request | ||
65 | .form(this.uploadUrl, data) | ||
66 | .then(result => { | ||
67 | this.uploadEnd(); | ||
68 | this.imageUrl = result.content; | ||
69 | this.$emit("input", this.imageUrl); | ||
70 | this.$emit("after-upload", { success: true, src: this.imageUrl }); | ||
71 | }) | ||
72 | .catch(res => { | ||
73 | this.uploadEnd(); | ||
74 | this.$emit("after-upload", { success: false, src: this.imageUrl }); | ||
75 | }); | ||
76 | }, | ||
77 | uploadStart() { | ||
78 | let that = this; | ||
79 | let times = 0; | ||
80 | this.uploadInterval = setInterval(function() { | ||
81 | times++; | ||
82 | let t = times % 4; | ||
83 | let s = ""; | ||
84 | for (let i = 0; i < t; i++) { | ||
85 | s += "."; | ||
86 | } | ||
87 | that.tips = "上传中" + s; | ||
88 | }, 500); | ||
89 | }, | ||
90 | uploadEnd() { | ||
91 | clearInterval(this.uploadInterval); | ||
92 | this.tips = "只能上传jpg/png文件,且不超过500kb"; | ||
93 | } | ||
94 | }, | ||
95 | computed: { | ||
96 | currentValue: function() { | ||
97 | return this.value; | ||
98 | } | ||
99 | } | ||
100 | }; | ||
101 | </script> | ||
102 | |||
103 | <style> | ||
104 | .avatar-uploader .el-upload { | ||
105 | border: 1px dashed #d9d9d9; | ||
106 | border-radius: 6px; | ||
107 | cursor: pointer; | ||
108 | position: relative; | ||
109 | overflow: hidden; | ||
110 | padding: 10px; | ||
111 | } | ||
112 | .avatar-uploader .el-upload:hover { | ||
113 | border-color: #409eff; | ||
114 | } | ||
115 | .avatar-uploader-icon { | ||
116 | font-size: 28px; | ||
117 | color: #8c939d; | ||
118 | width: 120px; | ||
119 | height: 120px; | ||
120 | line-height: 120px; | ||
121 | text-align: center; | ||
122 | } | ||
123 | .avatar { | ||
124 | max-width: 120px; | ||
125 | max-height: 120px; | ||
126 | display: block; | ||
127 | } | ||
128 | .error { | ||
129 | color: red; | ||
130 | } | ||
131 | </style> |
... | @@ -150,6 +150,98 @@ export const constantRouterMap = [{ | ... | @@ -150,6 +150,98 @@ export const constantRouterMap = [{ |
150 | }] | 150 | }] |
151 | }, | 151 | }, |
152 | 152 | ||
153 | { | ||
154 | path: '/edu', | ||
155 | component: Layout, | ||
156 | redirect: '/edu/live', | ||
157 | name: 'live', | ||
158 | meta: { | ||
159 | title: '教育教学', | ||
160 | icon: 'nested' | ||
161 | }, | ||
162 | children: [ | ||
163 | { | ||
164 | path: '/edu/live', | ||
165 | name: 'live', | ||
166 | component: () => import('@/views/live/index'), | ||
167 | meta: { | ||
168 | title: '直播课程', | ||
169 | icon: '' | ||
170 | } | ||
171 | }, | ||
172 | { | ||
173 | path: '/edu/public', | ||
174 | name: 'public', | ||
175 | component: () => import('@/views/public/index'), | ||
176 | meta: { | ||
177 | title: '公开课', | ||
178 | icon: '' | ||
179 | } | ||
180 | }, | ||
181 | { | ||
182 | path: '/edu/playback', | ||
183 | name: 'playback', | ||
184 | component: () => import('@/views/playback/index'), | ||
185 | meta: { | ||
186 | title: '回放视频', | ||
187 | icon: '' | ||
188 | } | ||
189 | }, | ||
190 | { | ||
191 | path: '/edu/playbackType', | ||
192 | name: 'playbackType', | ||
193 | component: () => import('@/views/playbackType/index'), | ||
194 | meta: { | ||
195 | title: '回放视频类型', | ||
196 | icon: '' | ||
197 | } | ||
198 | }, | ||
199 | { | ||
200 | path: '/edu/video', | ||
201 | name: 'video', | ||
202 | component: () => import('@/views/video/index'), | ||
203 | meta: { | ||
204 | title: '视频演示', | ||
205 | icon: '' | ||
206 | } | ||
207 | }, | ||
208 | { | ||
209 | path: '/edu/videoType', | ||
210 | name: 'video', | ||
211 | component: () => import('@/views/videoType/index'), | ||
212 | meta: { | ||
213 | title: '视频演示类型', | ||
214 | icon: '' | ||
215 | } | ||
216 | }, | ||
217 | ] | ||
218 | }, | ||
219 | |||
220 | // { | ||
221 | // path: '/live', | ||
222 | // component: Layout, | ||
223 | // children: [ | ||
224 | // { | ||
225 | // path: 'index', | ||
226 | // name: 'Live', | ||
227 | // component: () => import('@/views/live/index'), | ||
228 | // meta: { title: '直播课程', icon: 'form' } | ||
229 | // } | ||
230 | // ] | ||
231 | // }, | ||
232 | // { | ||
233 | // path: '/public', | ||
234 | // component: Layout, | ||
235 | // children: [ | ||
236 | // { | ||
237 | // path: 'index', | ||
238 | // name: 'public', | ||
239 | // component: () => import('@/views/public/index'), | ||
240 | // meta: { title: '公开课', icon: 'form' } | ||
241 | // } | ||
242 | // ] | ||
243 | // }, | ||
244 | |||
153 | 245 | ||
154 | // { | 246 | // { |
155 | // path: '/example', | 247 | // path: '/example', | ... | ... |
src/views/live/components/liveSaveDialog.vue
0 → 100644
1 | <template> | ||
2 | <div> | ||
3 | <el-dialog | ||
4 | :title="title" | ||
5 | :visible.sync="dialogVisible" | ||
6 | :before-close="handleCloseDialog"> | ||
7 | <el-form :model="liveForm" ref="liveForm" :rules="liveRules" label-width="130px"> | ||
8 | <el-form-item label="时间:" prop="liveTime"> | ||
9 | <el-date-picker | ||
10 | v-model="liveForm.liveTime" | ||
11 | type="datetime" | ||
12 | value-format="timestamp" | ||
13 | placeholder="选择日期时间"> | ||
14 | </el-date-picker> | ||
15 | </el-form-item> | ||
16 | <el-form-item label="内容:" prop="liveContent"> | ||
17 | <el-input type="textarea" v-model="liveForm.liveContent" maxlength="500" show-word-limit></el-input> | ||
18 | </el-form-item> | ||
19 | </el-form> | ||
20 | <span slot="footer" class="dialog-footer"> | ||
21 | <el-button type="primary" @click="submitForm('liveForm')">提交</el-button> | ||
22 | <el-button @click="handleCloseDialog">取消</el-button> | ||
23 | </span> | ||
24 | </el-dialog> | ||
25 | </div> | ||
26 | </template> | ||
27 | |||
28 | <script> | ||
29 | import { request } from '@/api/fetch-api' | ||
30 | |||
31 | |||
32 | let urls = { | ||
33 | liveSaveUrl: '/tianbao_edu_api/admin/live/save', | ||
34 | } | ||
35 | export default { | ||
36 | props: ['dialogVisible', 'title', 'liveTemp'], | ||
37 | data() { | ||
38 | return { | ||
39 | title: '', | ||
40 | liveForm:{}, | ||
41 | liveRules:{ | ||
42 | liveTime: [ | ||
43 | {required: true, message: '请选择时间', trigger: 'blur'} | ||
44 | ], | ||
45 | liveContent: [ | ||
46 | {required: true, message: '请输入内容', trigger: 'blur'} | ||
47 | ], | ||
48 | } | ||
49 | |||
50 | } | ||
51 | }, | ||
52 | methods: { | ||
53 | handleCloseDialog() { | ||
54 | this.$emit('closedialog', false) | ||
55 | }, | ||
56 | init(){ | ||
57 | if (JSON.parse(JSON.stringify(this.liveTemp)) == null) { | ||
58 | this.title='创建' | ||
59 | } else { | ||
60 | this.title="修改" | ||
61 | this.liveForm = JSON.parse(JSON.stringify(this.liveTemp)) | ||
62 | } | ||
63 | }, | ||
64 | submitForm(formName){ | ||
65 | this.$refs[formName].validate((valid) => { | ||
66 | if (valid) { | ||
67 | request.post(urls.liveSaveUrl, this.liveForm).then(response => { | ||
68 | this.$emit('initLive') | ||
69 | this.$emit('closedialog', false) | ||
70 | this.$message.success("保存成功") | ||
71 | }).catch(() => { | ||
72 | |||
73 | }) | ||
74 | } else { | ||
75 | console.log('error submit!!') | ||
76 | return false | ||
77 | } | ||
78 | }) | ||
79 | |||
80 | } | ||
81 | |||
82 | }, | ||
83 | created() { | ||
84 | this.init() | ||
85 | } | ||
86 | } | ||
87 | </script> | ||
88 | |||
89 | <style scoped> | ||
90 | |||
91 | </style> |
src/views/live/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-button type="primary" @click="createLive">创建</el-button> | ||
5 | </el-header> | ||
6 | <el-main> | ||
7 | <el-table | ||
8 | :data="liveList" | ||
9 | style="width: 100%" | ||
10 | stripe | ||
11 | highlight-current-row | ||
12 | v-loading="loading" | ||
13 | > | ||
14 | <el-table-column label="时间" prop="liveTime"> | ||
15 | <template slot-scope="scope"> | ||
16 | {{timestampToTime(scope.row.liveTime)}} | ||
17 | </template> | ||
18 | </el-table-column> | ||
19 | <el-table-column label="直播内容" prop="liveContent"></el-table-column> | ||
20 | <el-table-column label="操作"> | ||
21 | <template slot-scope="scope"> | ||
22 | <el-link type="primary" @click="editLive(scope.row)">编辑 </el-link> | ||
23 | <el-link type="primary" @click="deleteLive(scope.row.liveCode)">删除</el-link> | ||
24 | </template> | ||
25 | </el-table-column> | ||
26 | </el-table> | ||
27 | </el-main> | ||
28 | <el-footer height> | ||
29 | <div style="text-align:right;"> | ||
30 | <el-pagination | ||
31 | @size-change="handleSizeChange" | ||
32 | @current-change="handleCurrentChange" | ||
33 | :current-page="queryForm.page" | ||
34 | :page-size="queryForm.size" | ||
35 | layout="total, prev, pager, next" | ||
36 | :total="total"> | ||
37 | </el-pagination> | ||
38 | </div> | ||
39 | </el-footer> | ||
40 | |||
41 | <live-save-dialog | ||
42 | v-if="dialogVisible" | ||
43 | :dialog-visible="dialogVisible" | ||
44 | :live-temp="liveTemp" | ||
45 | @closedialog="closedialog" | ||
46 | @initLive="initLive"> | ||
47 | </live-save-dialog> | ||
48 | </div> | ||
49 | </template> | ||
50 | |||
51 | <script> | ||
52 | import {request} from '@/api/fetch-api' | ||
53 | import liveSaveDialog from './components/liveSaveDialog' | ||
54 | |||
55 | let urls = { | ||
56 | liveListUrl: '/tianbao_edu_api/admin/live/list', | ||
57 | liveSaveUrl: '/tianbao_edu_api/admin/live/save', | ||
58 | liveDelUrl:'/tianbao_edu_api/admin/live/delete' | ||
59 | } | ||
60 | export default { | ||
61 | components: {liveSaveDialog}, | ||
62 | data() { | ||
63 | return { | ||
64 | liveList: [], | ||
65 | total: 0, | ||
66 | loading: false, | ||
67 | queryForm: { | ||
68 | page: 1, | ||
69 | size: 10 | ||
70 | }, | ||
71 | dialogVisible:false, | ||
72 | liveTemp:{}, | ||
73 | } | ||
74 | }, | ||
75 | methods: { | ||
76 | initLive() { | ||
77 | this.loading = true | ||
78 | request.get(urls.liveListUrl, this.queryForm).then(data => { | ||
79 | this.loading = false | ||
80 | this.liveList = data.content.list | ||
81 | this.total = data.content.total | ||
82 | }).catch(() => { | ||
83 | |||
84 | }) | ||
85 | }, | ||
86 | editLive(row){ | ||
87 | this.liveTemp=row | ||
88 | this.dialogVisible=true | ||
89 | }, | ||
90 | createLive(){ | ||
91 | this.liveTemp=null | ||
92 | this.dialogVisible=true | ||
93 | }, | ||
94 | closedialog() { | ||
95 | this.dialogVisible = false | ||
96 | }, | ||
97 | deleteLive(code){ | ||
98 | |||
99 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
100 | confirmButtonText: '确定', | ||
101 | cancelButtonText: '取消', | ||
102 | type: 'warning' | ||
103 | }).then(() => { | ||
104 | request.post(urls.liveDelUrl, {liveCode: code}).then(data => { | ||
105 | this.$message.success("删除成") | ||
106 | this.initLive() | ||
107 | }).catch(() => { | ||
108 | |||
109 | }) | ||
110 | }).catch(() => { | ||
111 | |||
112 | }) | ||
113 | }, | ||
114 | timestampToTime(row) { | ||
115 | if (row === 0) { | ||
116 | return '' | ||
117 | } | ||
118 | var date = new Date(row) | ||
119 | var Y = date.getFullYear() + '-' | ||
120 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' | ||
121 | var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ' | ||
122 | var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':' | ||
123 | var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':' | ||
124 | var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() | ||
125 | return Y + M + D + h + m + s | ||
126 | }, | ||
127 | /*分页*/ | ||
128 | handleSizeChange(val) { | ||
129 | console.log(`每页 ${val} 条`) | ||
130 | this.queryForm.size = val | ||
131 | this.queryForm.page = 1 | ||
132 | this.initLive() | ||
133 | }, | ||
134 | handleCurrentChange(val) { | ||
135 | console.log(`当前页: ${val}`) | ||
136 | this.queryForm.page = val | ||
137 | this.initLive() | ||
138 | }, | ||
139 | }, | ||
140 | created() { | ||
141 | this.initLive() | ||
142 | } | ||
143 | } | ||
144 | </script> | ||
145 | |||
146 | <style scoped> | ||
147 | |||
148 | </style> |
src/views/playback/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-input v-model="queryForm.title" style="width: 200px" placeholder="视频名称" clearable></el-input> | ||
5 | <el-select v-model="queryForm.playbackTypeCode" placeholder="请选择" clearable @change="searchPlayback"> | ||
6 | <el-option | ||
7 | v-for="item in playbackTypeList" | ||
8 | :key="item.playbackTypeCode" | ||
9 | :label="item.typeName" | ||
10 | :value="item.playbackTypeCode"> | ||
11 | </el-option> | ||
12 | </el-select> | ||
13 | <el-button @click="searchPlayback" type="primary">搜索</el-button> | ||
14 | <el-button type="primary" @click="playbackCreate">创建</el-button> | ||
15 | </el-header> | ||
16 | <el-main> | ||
17 | <el-table | ||
18 | :data="playbackList" | ||
19 | style="width: 100%" | ||
20 | stripe | ||
21 | highlight-current-row | ||
22 | v-loading="loading" | ||
23 | > | ||
24 | <el-table-column label="名称" prop="title"></el-table-column> | ||
25 | <el-table-column label="视频链接" prop="videoUrl"></el-table-column> | ||
26 | <el-table-column label="类型" prop="typeName"></el-table-column> | ||
27 | <el-table-column label="操作"> | ||
28 | <template slot-scope="scope"> | ||
29 | <el-link type="primary" @click="playbackEdit(scope.row)">编辑 </el-link> | ||
30 | <el-link type="primary" @click="playbackDelete(scope.row.playbackCode)">删除 </el-link> | ||
31 | </template> | ||
32 | </el-table-column> | ||
33 | </el-table> | ||
34 | </el-main> | ||
35 | <el-footer> | ||
36 | <div style="text-align:right;"> | ||
37 | <el-pagination | ||
38 | @size-change="handleSizeChange" | ||
39 | @current-change="handleCurrentChange" | ||
40 | :current-page="queryForm.page" | ||
41 | :page-size="queryForm.size" | ||
42 | layout="total, prev, pager, next" | ||
43 | :total="total"> | ||
44 | </el-pagination> | ||
45 | </div> | ||
46 | </el-footer> | ||
47 | |||
48 | <el-dialog | ||
49 | width="60%" | ||
50 | :title="title" | ||
51 | :visible.sync="dialogVisible"> | ||
52 | <el-form :model="playbackForm" ref="playbackForm" :rules="playbackRules" label-width="180px"> | ||
53 | <el-form-item label="名称:" prop="title"> | ||
54 | <el-input v-model="playbackForm.title" maxlength="100" show-word-limit></el-input> | ||
55 | </el-form-item> | ||
56 | <el-form-item label="视频链接:" prop="videoUrl"> | ||
57 | <el-input v-model="playbackForm.videoUrl" maxlength="100" show-word-limit></el-input> | ||
58 | <div>视频链接提取方法: | ||
59 | <div>1.电脑打开qq视频链接 | ||
60 | 2.鼠标移动至视频左下角分享按钮 | ||
61 | 3.点击复制通用代码 | ||
62 | 4.取复制内容中src的值 | ||
63 | </div> | ||
64 | </div> | ||
65 | </el-form-item> | ||
66 | <el-form-item label="类型:" prop="playbackTypeCode"> | ||
67 | <el-select v-model="playbackForm.playbackTypeCode" placeholder="请选择"> | ||
68 | <el-option | ||
69 | v-for="item in playbackTypeList" | ||
70 | :key="item.playbackTypeCode" | ||
71 | :label="item.typeName" | ||
72 | :value="item.playbackTypeCode"> | ||
73 | </el-option> | ||
74 | </el-select> | ||
75 | </el-form-item> | ||
76 | </el-form> | ||
77 | <span slot="footer" class="dialog-footer"> | ||
78 | <el-button type="primary" @click="submitForm('playbackForm')">提交</el-button> | ||
79 | <el-button @click="cancelCreate">取消</el-button> | ||
80 | </span> | ||
81 | </el-dialog> | ||
82 | |||
83 | </div> | ||
84 | </template> | ||
85 | |||
86 | <script> | ||
87 | import {request} from '@/api/fetch-api' | ||
88 | import UploadItem from '@/components/UploadItem' | ||
89 | |||
90 | let urls = { | ||
91 | playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list', | ||
92 | playbackListUrl: '/tianbao_edu_api/admin/playback/list', | ||
93 | playbackSaveUrl: '/tianbao_edu_api/admin/playback/save', | ||
94 | playbackDelUrl: '/tianbao_edu_api/admin/playback/delete', | ||
95 | } | ||
96 | |||
97 | export default { | ||
98 | components: {UploadItem}, | ||
99 | data() { | ||
100 | return { | ||
101 | playbackList: [], | ||
102 | total: 0, | ||
103 | loading: false, | ||
104 | queryForm: { | ||
105 | page: 1, | ||
106 | size: 10, | ||
107 | playbackTypeCode: '', | ||
108 | title: '' | ||
109 | }, | ||
110 | dialogVisible: false, | ||
111 | title: '', | ||
112 | playbackForm: {}, | ||
113 | playbackRules: { | ||
114 | title: [{required: true, message: '请输入名称', trigger: 'blur'}], | ||
115 | videoUrl: [{required: true, message: '请输入视频链接', trigger: 'blur'}], | ||
116 | playbackTypeCode: [{required: true, message: '请选择', trigger: 'blur'}] | ||
117 | }, | ||
118 | playbackTypeList: [] | ||
119 | } | ||
120 | }, | ||
121 | methods: { | ||
122 | searchPlayback() { | ||
123 | this.queryForm.page = 1 | ||
124 | this.initPlayBack() | ||
125 | }, | ||
126 | initPlayBack() { | ||
127 | this.loading = true | ||
128 | request.get(urls.playbackListUrl, this.queryForm).then(data => { | ||
129 | this.loading = false | ||
130 | this.playbackList = data.content.list | ||
131 | this.total = data.content.total | ||
132 | }).catch(() => { | ||
133 | |||
134 | }) | ||
135 | }, | ||
136 | initPlayBackType() { | ||
137 | let form = { | ||
138 | page: 1, | ||
139 | size: 1000, | ||
140 | } | ||
141 | request.get(urls.playbackTypeListUrl, form).then(data => { | ||
142 | this.playbackTypeList = data.content.list | ||
143 | }).catch(() => { | ||
144 | |||
145 | }) | ||
146 | }, | ||
147 | playbackEdit(row) { | ||
148 | this.title = '编辑' | ||
149 | this.dialogVisible = true | ||
150 | this.playbackForm = JSON.parse(JSON.stringify(row)) | ||
151 | }, | ||
152 | playbackDelete(code) { | ||
153 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
154 | confirmButtonText: '确定', | ||
155 | cancelButtonText: '取消', | ||
156 | type: 'warning' | ||
157 | }).then(() => { | ||
158 | let form = { | ||
159 | playbackCode: code | ||
160 | } | ||
161 | request.post(urls.playbackDelUrl, form).then(data => { | ||
162 | this.initPlayBack() | ||
163 | this.$message.success("删除成功") | ||
164 | }).catch(() => { | ||
165 | |||
166 | }) | ||
167 | }).catch(() => { | ||
168 | |||
169 | }) | ||
170 | |||
171 | }, | ||
172 | cancelCreate() { | ||
173 | this.dialogVisible = false | ||
174 | this.playbackForm = {} | ||
175 | }, | ||
176 | playbackCreate() { | ||
177 | this.playbackForm = {} | ||
178 | this.dialogVisible = true | ||
179 | this.title = '创建' | ||
180 | }, | ||
181 | submitForm(formName) { | ||
182 | this.$refs[formName].validate((valid) => { | ||
183 | if (valid) { | ||
184 | request.post(urls.playbackSaveUrl, this.playbackForm).then(response => { | ||
185 | this.dialogVisible = false | ||
186 | this.$message.success("保存成功") | ||
187 | this.initPlayBack() | ||
188 | }).catch(() => { | ||
189 | |||
190 | }) | ||
191 | } else { | ||
192 | console.log('error submit!!') | ||
193 | return false | ||
194 | } | ||
195 | }) | ||
196 | |||
197 | }, | ||
198 | /*分页*/ | ||
199 | handleSizeChange(val) { | ||
200 | console.log(`每页 ${val} 条`) | ||
201 | this.queryForm.size = val | ||
202 | this.queryForm.page = 1 | ||
203 | this.initPlayBack() | ||
204 | }, | ||
205 | handleCurrentChange(val) { | ||
206 | console.log(`当前页: ${val}`) | ||
207 | this.queryForm.page = val | ||
208 | this.initPlayBack() | ||
209 | }, | ||
210 | |||
211 | }, | ||
212 | created() { | ||
213 | this.initPlayBack() | ||
214 | this.initPlayBackType() | ||
215 | } | ||
216 | } | ||
217 | </script> | ||
218 | |||
219 | <style scoped> | ||
220 | |||
221 | </style> |
src/views/playbackType/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-button type="primary" @click="playbackTypeCreate">创建</el-button> | ||
5 | </el-header> | ||
6 | <el-main> | ||
7 | <el-table | ||
8 | :data="playbackTypeList" | ||
9 | style="width: 100%" | ||
10 | stripe | ||
11 | highlight-current-row | ||
12 | v-loading="loading" | ||
13 | > | ||
14 | <el-table-column label="名称" prop="typeName"></el-table-column> | ||
15 | <el-table-column label="图片" prop="typeImage"> | ||
16 | <template slot-scope="scope"> | ||
17 | <a :href="scope.row.typeImage" target="_blank"> | ||
18 | <div style="width: 100px;"> | ||
19 | <el-image :src="scope.row.typeImage"></el-image> | ||
20 | </div> | ||
21 | </a> | ||
22 | </template> | ||
23 | </el-table-column> | ||
24 | <el-table-column label="操作"> | ||
25 | <template slot-scope="scope"> | ||
26 | <el-link type="primary" @click="playbackTypeEdit(scope.row)">编辑 </el-link> | ||
27 | <el-link type="primary" @click="playbackTypeDelete(scope.row.playbackTypeCode)">删除 </el-link> | ||
28 | </template> | ||
29 | </el-table-column> | ||
30 | </el-table> | ||
31 | </el-main> | ||
32 | <el-footer> | ||
33 | <div style="text-align:right;"> | ||
34 | <el-pagination | ||
35 | @size-change="handleSizeChange" | ||
36 | @current-change="handleCurrentChange" | ||
37 | :current-page="queryForm.page" | ||
38 | :page-size="queryForm.size" | ||
39 | layout="total, prev, pager, next" | ||
40 | :total="total"> | ||
41 | </el-pagination> | ||
42 | </div> | ||
43 | </el-footer> | ||
44 | |||
45 | <el-dialog | ||
46 | width="60%" | ||
47 | :title="title" | ||
48 | :visible.sync="dialogVisible"> | ||
49 | <el-form :model="playbackTypeForm" ref="playbakcForm" :rules="playbackTypeRules" label-width="180px"> | ||
50 | <el-form-item label="名称:" prop="typeName"> | ||
51 | <el-input v-model="playbackTypeForm.typeName" maxlength="100" show-word-limit></el-input> | ||
52 | </el-form-item> | ||
53 | <el-form-item label="图片:" prop="typeImage"> | ||
54 | <upload-item | ||
55 | v-model="playbackTypeForm.typeImage" | ||
56 | v-on:before-upload="loading=true" | ||
57 | v-on:after-upload="loading=false" | ||
58 | ></upload-item> | ||
59 | </el-form-item> | ||
60 | </el-form> | ||
61 | <span slot="footer" class="dialog-footer"> | ||
62 | <el-button type="primary" @click="submitForm('playbakcForm')">提交</el-button> | ||
63 | <el-button @click="cancelCreate">取消</el-button> | ||
64 | </span> | ||
65 | </el-dialog> | ||
66 | |||
67 | </div> | ||
68 | </template> | ||
69 | |||
70 | <script> | ||
71 | import {request} from '@/api/fetch-api' | ||
72 | import UploadItem from '@/components/UploadItem' | ||
73 | |||
74 | let urls = { | ||
75 | playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list', | ||
76 | playbackTypeSaveUrl: '/tianbao_edu_api/admin/playbackType/save', | ||
77 | playbackTypeDelUrl: '/tianbao_edu_api/admin/playbackType/delete', | ||
78 | } | ||
79 | |||
80 | export default { | ||
81 | components: {UploadItem}, | ||
82 | data() { | ||
83 | return { | ||
84 | playbackTypeList: [], | ||
85 | total: 0, | ||
86 | loading: false, | ||
87 | queryForm: { | ||
88 | page: 1, | ||
89 | size: 10 | ||
90 | }, | ||
91 | dialogVisible: false, | ||
92 | title: '', | ||
93 | playbackTypeForm: {}, | ||
94 | playbackTypeRules: { | ||
95 | typeName: [{required: true, message: '请输入名称', trigger: 'blur'}], | ||
96 | typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}] | ||
97 | } | ||
98 | } | ||
99 | }, | ||
100 | methods: { | ||
101 | initPlayBackType() { | ||
102 | this.loading = true | ||
103 | request.get(urls.playbackTypeListUrl, this.queryForm).then(data => { | ||
104 | this.loading = false | ||
105 | this.playbackTypeList = data.content.list | ||
106 | this.total = data.content.total | ||
107 | }).catch(() => { | ||
108 | |||
109 | }) | ||
110 | }, | ||
111 | playbackTypeEdit(row) { | ||
112 | this.title = '编辑' | ||
113 | this.dialogVisible = true | ||
114 | this.playbackTypeForm = JSON.parse(JSON.stringify(row)) | ||
115 | }, | ||
116 | playbackTypeDelete(code) { | ||
117 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
118 | confirmButtonText: '确定', | ||
119 | cancelButtonText: '取消', | ||
120 | type: 'warning' | ||
121 | }).then(() => { | ||
122 | let form = { | ||
123 | playbackTypeCode: code | ||
124 | } | ||
125 | request.post(urls.playbackTypeDelUrl, form).then(data => { | ||
126 | this.initPlayBackType() | ||
127 | this.$message.success("删除成功") | ||
128 | }).catch(() => { | ||
129 | |||
130 | }) | ||
131 | }).catch(() => { | ||
132 | |||
133 | }) | ||
134 | |||
135 | }, | ||
136 | cancelCreate() { | ||
137 | this.dialogVisible = false | ||
138 | this.playbackTypeForm = {} | ||
139 | }, | ||
140 | playbackTypeCreate() { | ||
141 | this.playbackTypeForm = {} | ||
142 | this.dialogVisible = true | ||
143 | this.title = '创建' | ||
144 | }, | ||
145 | submitForm(formName) { | ||
146 | this.$refs[formName].validate((valid) => { | ||
147 | if (valid) { | ||
148 | request.post(urls.playbackTypeSaveUrl, this.playbackTypeForm).then(response => { | ||
149 | this.dialogVisible = false | ||
150 | this.$message.success("保存成功") | ||
151 | this.initPlayBackType() | ||
152 | }).catch(() => { | ||
153 | |||
154 | }) | ||
155 | } else { | ||
156 | console.log('error submit!!') | ||
157 | return false | ||
158 | } | ||
159 | }) | ||
160 | |||
161 | }, | ||
162 | /*分页*/ | ||
163 | handleSizeChange(val) { | ||
164 | console.log(`每页 ${val} 条`) | ||
165 | this.queryForm.size = val | ||
166 | this.queryForm.page = 1 | ||
167 | this.initPlayBackType() | ||
168 | }, | ||
169 | handleCurrentChange(val) { | ||
170 | console.log(`当前页: ${val}`) | ||
171 | this.queryForm.page = val | ||
172 | this.initPlayBackType() | ||
173 | }, | ||
174 | |||
175 | }, | ||
176 | created() { | ||
177 | this.initPlayBackType() | ||
178 | } | ||
179 | } | ||
180 | </script> | ||
181 | |||
182 | <style scoped> | ||
183 | |||
184 | </style> |
1 | <template> | ||
2 | <div> | ||
3 | <el-dialog | ||
4 | :title="title2" | ||
5 | :visible.sync="dialogVisible" | ||
6 | :before-close="handleCloseDialog"> | ||
7 | <el-form :model="publicForm" ref="publicForm" :rules="publicRules" label-width="130px"> | ||
8 | <el-form-item label="标题:" prop="title"> | ||
9 | <el-input v-model="publicForm.title" maxlength="50" show-word-limit></el-input> | ||
10 | </el-form-item> | ||
11 | <el-form-item label="开始时间:" prop="startT"> | ||
12 | <el-date-picker | ||
13 | v-model="publicForm.startT" | ||
14 | type="datetime" | ||
15 | value-format="timestamp" | ||
16 | placeholder="选择日期时间"> | ||
17 | </el-date-picker> | ||
18 | <!-- <el-date-picker | ||
19 | v-model="publicForm.startDate" | ||
20 | type="date" | ||
21 | placeholder="选择日期(必填)" | ||
22 | format="yyyy年MM月dd日" | ||
23 | value-format="yyyy年MM月dd日" | ||
24 | :picker-options="pickerOptionsStart"> | ||
25 | </el-date-picker> | ||
26 | <el-time-picker | ||
27 | v-model="publicForm.startTime" | ||
28 | format="HH:mm:ss" | ||
29 | value-format="HH:mm:ss" | ||
30 | placeholder="选择时间"> | ||
31 | </el-time-picker>--> | ||
32 | </el-form-item> | ||
33 | <el-form-item label="结束时间:" prop="endT"> | ||
34 | <el-date-picker | ||
35 | v-model="publicForm.endT" | ||
36 | type="datetime" | ||
37 | value-format="timestamp" | ||
38 | placeholder="选择日期时间"> | ||
39 | </el-date-picker> | ||
40 | <!-- <el-date-picker | ||
41 | v-model="publicForm.endDate" | ||
42 | type="date" | ||
43 | placeholder="选择日期(必填)" | ||
44 | format="yyyy年MM月dd日" | ||
45 | value-format="yyyy年MM月dd日" | ||
46 | :picker-options="pickerOptionsEnd" | ||
47 | > | ||
48 | </el-date-picker> | ||
49 | <el-time-picker | ||
50 | v-model="publicForm.endTime" | ||
51 | format="HH:mm:ss" | ||
52 | value-format="HH:mm:ss" | ||
53 | placeholder="选择时间"> | ||
54 | </el-time-picker>--> | ||
55 | </el-form-item> | ||
56 | <el-form-item label="地点:" prop="city"> | ||
57 | <el-input v-model="publicForm.city" maxlength="100" | ||
58 | show-word-limit></el-input> | ||
59 | <!-- <el-row :gutter="5"> | ||
60 | <el-col :span="7"> | ||
61 | <el-select | ||
62 | v-model="publicForm.province" | ||
63 | filterable | ||
64 | placeholder="省" | ||
65 | @change="provinceSelectChangeHandler" | ||
66 | > | ||
67 | <el-option | ||
68 | v-for="(item,index) in provinceList" | ||
69 | :key="index" | ||
70 | :label="item.areaName" | ||
71 | :value="item.areaName" | ||
72 | ></el-option> | ||
73 | </el-select> | ||
74 | </el-col> | ||
75 | <el-col :span="7"> | ||
76 | <el-select | ||
77 | v-model="publicForm.city" | ||
78 | filterable | ||
79 | placeholder="市" | ||
80 | > | ||
81 | <el-option | ||
82 | v-for="(item,index) in cityList" | ||
83 | :key="index" | ||
84 | :label="item.areaName" | ||
85 | :value="item.areaName" | ||
86 | ></el-option> | ||
87 | </el-select> | ||
88 | </el-col> | ||
89 | </el-row>--> | ||
90 | </el-form-item> | ||
91 | <el-form-item label="注册/回放:" prop="enroll"> | ||
92 | <el-input v-model="publicForm.enroll" maxlength="200" | ||
93 | show-word-limit></el-input> | ||
94 | </el-form-item> | ||
95 | <el-form-item label="团队:" prop="team"> | ||
96 | <el-input v-model="publicForm.team" maxlength="100" | ||
97 | show-word-limit></el-input> | ||
98 | </el-form-item> | ||
99 | <el-form-item label="内容:" prop="content"> | ||
100 | <el-input v-model="publicForm.content" type="textarea" maxlength="500" | ||
101 | show-word-limit></el-input> | ||
102 | </el-form-item> | ||
103 | </el-form> | ||
104 | <span slot="footer" class="dialog-footer"> | ||
105 | <el-button type="primary" @click="submitForm('publicForm')">提交</el-button> | ||
106 | <el-button @click="handleCloseDialog">取消</el-button> | ||
107 | </span> | ||
108 | </el-dialog> | ||
109 | </div> | ||
110 | </template> | ||
111 | |||
112 | <script> | ||
113 | import {request} from '@/api/fetch-api' | ||
114 | |||
115 | |||
116 | let urls = { | ||
117 | publicSaveUrl: '/tianbao_edu_api/admin/public/save', | ||
118 | areaUrl: 'https://api.k.wxpai.cn/bizproxy/kdapi/area', | ||
119 | } | ||
120 | export default { | ||
121 | props: ['dialogVisible', 'publicTemp'], | ||
122 | data() { | ||
123 | return { | ||
124 | title2: '', | ||
125 | publicForm: {}, | ||
126 | publicRules: { | ||
127 | title: [{required: true, message: '请输入标题', trigger: 'blur'}], | ||
128 | startT: [{required: true, message: '请选择开始时间', trigger: 'blur'}], | ||
129 | endT: [{required: true, message: '请选择结束时间', trigger: 'blur'}], | ||
130 | enroll: [{required: true, message: '请填写报名', trigger: 'blur'}], | ||
131 | city: [{required: true, message: '请选择省市', trigger: 'blur'}], | ||
132 | content: [{required: true, message: '请输入内容', trigger: 'blur'}], | ||
133 | team: [{required: true, message: '请输入团队', trigger: 'blur'}], | ||
134 | }, | ||
135 | provinceList: [], | ||
136 | cityList: [], | ||
137 | pickerOptionsStart: { | ||
138 | disabledDate: time => { | ||
139 | let endDateVal = this.publicForm.endDate; | ||
140 | if (endDateVal) { | ||
141 | return time.getTime() >= new Date(endDateVal).getTime(); | ||
142 | } | ||
143 | } | ||
144 | }, | ||
145 | pickerOptionsEnd: { | ||
146 | disabledDate: time => { | ||
147 | let beginDateVal = this.publicForm.startDate; | ||
148 | if (beginDateVal) { | ||
149 | return ( | ||
150 | time.getTime() < new Date(beginDateVal).getTime()-24*60*60*1000 | ||
151 | ); | ||
152 | } | ||
153 | }, | ||
154 | }, | ||
155 | } | ||
156 | }, | ||
157 | methods: { | ||
158 | handleCloseDialog() { | ||
159 | this.$emit('closedialog', false) | ||
160 | }, | ||
161 | init() { | ||
162 | if (JSON.parse(JSON.stringify(this.publicTemp)) == null) { | ||
163 | this.title2 = '创建' | ||
164 | } else { | ||
165 | this.title2 = "修改" | ||
166 | this.publicForm = JSON.parse(JSON.stringify(this.publicTemp)) | ||
167 | } | ||
168 | }, | ||
169 | submitForm(formName) { | ||
170 | this.$refs[formName].validate((valid) => { | ||
171 | if (valid) { | ||
172 | request.post(urls.publicSaveUrl, this.publicForm).then(response => { | ||
173 | this.$emit('initPublic') | ||
174 | this.$emit('closedialog', false) | ||
175 | this.$message.success("保存成功") | ||
176 | }).catch(() => { | ||
177 | |||
178 | }) | ||
179 | } else { | ||
180 | console.log('error submit!!') | ||
181 | return false | ||
182 | } | ||
183 | }) | ||
184 | }, | ||
185 | getProvince() { | ||
186 | request.post(urls.areaUrl, {}).then(res => { | ||
187 | this.provinceList = res.content | ||
188 | }) | ||
189 | }, | ||
190 | provinceSelectChangeHandler(province) { | ||
191 | this.cityList = null | ||
192 | let areaId = this.findAreaId( | ||
193 | this.provinceList, | ||
194 | province | ||
195 | ) | ||
196 | request.post(urls.areaUrl, {parentId: areaId}).then(res => { | ||
197 | this.cityList = res.content | ||
198 | }) | ||
199 | }, | ||
200 | findAreaId(areaList, name) { | ||
201 | let areaId = '' | ||
202 | areaList.forEach(element => { | ||
203 | if (element.areaName == name) { | ||
204 | areaId = element.areaId | ||
205 | } | ||
206 | }) | ||
207 | return areaId | ||
208 | }, | ||
209 | changeStart() { | ||
210 | this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, { | ||
211 | // 可通过箭头函数的方式访问到this | ||
212 | disabledDate: (time) => { | ||
213 | var times = ''; | ||
214 | times = this.publicForm.endDate < time.getTime() || time.getTime() < new Date(new Date().toLocaleDateString()) | ||
215 | .getTime(); | ||
216 | return times | ||
217 | } | ||
218 | }) | ||
219 | |||
220 | }, | ||
221 | //开始时间 控制结束时间 | ||
222 | changeEnd() { | ||
223 | this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, { | ||
224 | disabledDate: (time) => { | ||
225 | return time.getTime() > this.publicForm.startDate | ||
226 | } | ||
227 | }) | ||
228 | }, | ||
229 | }, | ||
230 | created() { | ||
231 | this.init() | ||
232 | this.getProvince() | ||
233 | } | ||
234 | } | ||
235 | </script> | ||
236 | |||
237 | <style scoped> | ||
238 | |||
239 | </style> |
src/views/public/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-button type="primary" @click="createPublic">创建</el-button> | ||
5 | </el-header> | ||
6 | <el-main> | ||
7 | <el-table | ||
8 | :data="publicList" | ||
9 | style="width: 100%" | ||
10 | stripe | ||
11 | highlight-current-row | ||
12 | v-loading="loading" | ||
13 | > | ||
14 | <el-table-column label="活动标题" prop="title"></el-table-column> | ||
15 | <el-table-column label="地点" prop="city"> | ||
16 | </el-table-column> | ||
17 | <el-table-column label="注册/回放" prop="enroll"></el-table-column> | ||
18 | <el-table-column label="团队" prop="team"></el-table-column> | ||
19 | <el-table-column label="开始时间"> | ||
20 | <template slot-scope="scope"> | ||
21 | <!--{{scope.row.startDate}} {{scope.row.startTime}}--> | ||
22 | {{timestampToTime(scope.row.startT)}} | ||
23 | </template> | ||
24 | </el-table-column> | ||
25 | <el-table-column label="结束时间"> | ||
26 | <template slot-scope="scope"> | ||
27 | <!--{{scope.row.endDate}} {{scope.row.endTime}}--> | ||
28 | {{timestampToTime(scope.row.endT)}} | ||
29 | </template> | ||
30 | </el-table-column> | ||
31 | <el-table-column label="直播内容" prop="content"></el-table-column> | ||
32 | <el-table-column label="操作"> | ||
33 | <template slot-scope="scope"> | ||
34 | <el-link type="primary" @click="editPublic(scope.row)">编辑 </el-link> | ||
35 | <el-link type="primary" @click="deletePublic(scope.row.publicCode)">删除</el-link> | ||
36 | </template> | ||
37 | </el-table-column> | ||
38 | </el-table> | ||
39 | </el-main> | ||
40 | <el-footer height> | ||
41 | <div style="text-align:right;"> | ||
42 | <el-pagination | ||
43 | @size-change="handleSizeChange" | ||
44 | @current-change="handleCurrentChange" | ||
45 | :current-page="queryForm.page" | ||
46 | :page-size="queryForm.size" | ||
47 | layout="total, prev, pager, next" | ||
48 | :total="total"> | ||
49 | </el-pagination> | ||
50 | </div> | ||
51 | </el-footer> | ||
52 | |||
53 | <public-save-dialog | ||
54 | v-if="dialogVisible" | ||
55 | :dialog-visible="dialogVisible" | ||
56 | :public-temp="publicTemp" | ||
57 | @closedialog="closedialog" | ||
58 | @initPublic="initPublic"> | ||
59 | </public-save-dialog> | ||
60 | </div> | ||
61 | </template> | ||
62 | |||
63 | <script> | ||
64 | import {request} from '@/api/fetch-api' | ||
65 | import publicSaveDialog from './components/publicSaveDialog' | ||
66 | |||
67 | let urls = { | ||
68 | publicListUrl: '/tianbao_edu_api/admin/public/list', | ||
69 | publicSaveUrl: '/tianbao_edu_api/admin/public/save', | ||
70 | publicDelUrl: '/tianbao_edu_api/admin/public/delete' | ||
71 | } | ||
72 | export default { | ||
73 | components: {publicSaveDialog}, | ||
74 | data() { | ||
75 | return { | ||
76 | publicList: [], | ||
77 | total: 0, | ||
78 | loading: false, | ||
79 | queryForm: { | ||
80 | page: 1, | ||
81 | size: 10 | ||
82 | }, | ||
83 | dialogVisible: false, | ||
84 | publicTemp: {}, | ||
85 | } | ||
86 | }, | ||
87 | methods: { | ||
88 | initPublic() { | ||
89 | this.loading = true | ||
90 | request.get(urls.publicListUrl, this.queryForm).then(data => { | ||
91 | this.loading = false | ||
92 | this.publicList = data.content.list | ||
93 | this.total = data.content.total | ||
94 | }).catch(() => { | ||
95 | |||
96 | }) | ||
97 | }, | ||
98 | editPublic(row) { | ||
99 | this.publicTemp = row | ||
100 | this.dialogVisible = true | ||
101 | }, | ||
102 | createPublic() { | ||
103 | this.publicTemp = null | ||
104 | this.dialogVisible = true | ||
105 | }, | ||
106 | closedialog() { | ||
107 | this.dialogVisible = false | ||
108 | }, | ||
109 | deletePublic(code) { | ||
110 | |||
111 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
112 | confirmButtonText: '确定', | ||
113 | cancelButtonText: '取消', | ||
114 | type: 'warning' | ||
115 | }).then(() => { | ||
116 | request.post(urls.publicDelUrl, {publicCode: code}).then(data => { | ||
117 | this.$message.success("删除成") | ||
118 | this.initPublic() | ||
119 | }).catch(() => { | ||
120 | |||
121 | }) | ||
122 | }).catch(() => { | ||
123 | |||
124 | }) | ||
125 | }, | ||
126 | timestampToTime(row) { | ||
127 | if (row === 0) { | ||
128 | return '' | ||
129 | } | ||
130 | var date = new Date(row) | ||
131 | var Y = date.getFullYear() + '-' | ||
132 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' | ||
133 | var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ' | ||
134 | var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':' | ||
135 | var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':' | ||
136 | var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() | ||
137 | return Y + M + D + h + m + s | ||
138 | }, | ||
139 | /*分页*/ | ||
140 | handleSizeChange(val) { | ||
141 | console.log(`每页 ${val} 条`) | ||
142 | this.queryForm.size = val | ||
143 | this.queryForm.page = 1 | ||
144 | this.initPublic() | ||
145 | }, | ||
146 | handleCurrentChange(val) { | ||
147 | console.log(`当前页: ${val}`) | ||
148 | this.queryForm.page = val | ||
149 | this.initPublic() | ||
150 | }, | ||
151 | timestampToTime(row) { | ||
152 | if (row === 0) { | ||
153 | return '' | ||
154 | } | ||
155 | var date = new Date(row) | ||
156 | var Y = date.getFullYear() + '-' | ||
157 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-' | ||
158 | var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ' | ||
159 | var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':' | ||
160 | var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':' | ||
161 | var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() | ||
162 | return Y + M + D + h + m + s | ||
163 | }, | ||
164 | }, | ||
165 | created() { | ||
166 | this.initPublic() | ||
167 | } | ||
168 | } | ||
169 | </script> | ||
170 | |||
171 | <style scoped> | ||
172 | |||
173 | </style> |
src/views/video/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-input type="primary" v-model="queryForm.videoName" placeholder="视频名" style="width: 200px" clearable></el-input> | ||
5 | <el-select v-model="queryForm.videoTypeCode" placeholder="请选择" clearable @change="searchVideo"> | ||
6 | <el-option | ||
7 | v-for="item in videoTypeList" | ||
8 | :key="item.videoTypeCode" | ||
9 | :label="item.typeName" | ||
10 | :value="item.videoTypeCode"> | ||
11 | <span style="float: left">{{ item.typeName }}</span> | ||
12 | <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span> | ||
13 | <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span> | ||
14 | </el-option> | ||
15 | </el-select> | ||
16 | <el-button type="primary" @click="searchVideo">搜索</el-button> | ||
17 | <el-button type="primary" @click="videoCreate">创建</el-button> | ||
18 | </el-header> | ||
19 | <el-main> | ||
20 | <el-table | ||
21 | :data="videoList" | ||
22 | style="width: 100%" | ||
23 | stripe | ||
24 | highlight-current-row | ||
25 | v-loading="loading" | ||
26 | > | ||
27 | <el-table-column label="名称" prop="videoName"></el-table-column> | ||
28 | <el-table-column label="视频链接" prop="videoUrl"> | ||
29 | <!--<template slot-scope="scope">--> | ||
30 | <!--<video :src="scope.row.videoUrl" controls="controls"></video>--> | ||
31 | <!--</template>--> | ||
32 | </el-table-column> | ||
33 | <el-table-column label="类型" prop="typeName"> | ||
34 | </el-table-column> | ||
35 | <el-table-column label="操作"> | ||
36 | <template slot-scope="scope"> | ||
37 | <el-link type="primary" @click="videoEdit(scope.row)">编辑 </el-link> | ||
38 | <el-link type="primary" @click="videoDelete(scope.row.videoCode)">删除 </el-link> | ||
39 | </template> | ||
40 | </el-table-column> | ||
41 | </el-table> | ||
42 | </el-main> | ||
43 | <el-footer> | ||
44 | <div style="text-align:right;"> | ||
45 | <el-pagination | ||
46 | @size-change="handleSizeChange" | ||
47 | @current-change="handleCurrentChange" | ||
48 | :current-page="queryForm.page" | ||
49 | :page-size="queryForm.size" | ||
50 | layout="total, prev, pager, next" | ||
51 | :total="total"> | ||
52 | </el-pagination> | ||
53 | </div> | ||
54 | </el-footer> | ||
55 | |||
56 | <el-dialog | ||
57 | width="60%" | ||
58 | :title="title" | ||
59 | :visible.sync="dialogVisible"> | ||
60 | <el-form :model="videoForm" ref="videoForm" :rules="videoRules" label-width="180px"> | ||
61 | <el-form-item label="名称:" prop="videoName"> | ||
62 | <el-input v-model="videoForm.videoName" maxlength="100" show-word-limit></el-input> | ||
63 | </el-form-item> | ||
64 | <el-form-item label="视频链接:" prop="videoUrl"> | ||
65 | <el-input v-model="videoForm.videoUrl" maxlength="255" show-word-limit></el-input> | ||
66 | </el-form-item> | ||
67 | <el-form-item label="类型:" prop="videoTypeCode"> | ||
68 | <el-select v-model="videoForm.videoTypeCode" placeholder="请选择"> | ||
69 | <el-option | ||
70 | v-for="item in videoTypeList" | ||
71 | :key="item.videoTypeCode" | ||
72 | :label="item.typeName" | ||
73 | :value="item.videoTypeCode"> | ||
74 | <span style="float: left">{{ item.typeName }}</span> | ||
75 | <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span> | ||
76 | <span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span> | ||
77 | </el-option> | ||
78 | |||
79 | </el-select> | ||
80 | </el-form-item> | ||
81 | </el-form> | ||
82 | <span slot="footer" class="dialog-footer"> | ||
83 | <el-button type="primary" @click="submitForm('videoForm')">提交</el-button> | ||
84 | <el-button @click="cancelCreate">取消</el-button> | ||
85 | </span> | ||
86 | </el-dialog> | ||
87 | |||
88 | </div> | ||
89 | </template> | ||
90 | |||
91 | <script> | ||
92 | import {request} from '@/api/fetch-api' | ||
93 | import UploadItem from '@/components/UploadItem' | ||
94 | |||
95 | let urls = { | ||
96 | videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list', | ||
97 | videoListUrl: '/tianbao_edu_api/admin/video/list', | ||
98 | videoSaveUrl: '/tianbao_edu_api/admin/video/save', | ||
99 | videoDelUrl: '/tianbao_edu_api/admin/video/delete', | ||
100 | } | ||
101 | |||
102 | export default { | ||
103 | components: {UploadItem}, | ||
104 | data() { | ||
105 | return { | ||
106 | videoList: [], | ||
107 | total: 0, | ||
108 | loading: false, | ||
109 | queryForm: { | ||
110 | page: 1, | ||
111 | size: 10, | ||
112 | videoName: '', | ||
113 | videoTypeCode:'' | ||
114 | }, | ||
115 | dialogVisible: false, | ||
116 | title: '', | ||
117 | videoForm: {}, | ||
118 | videoRules: { | ||
119 | videoName: [{required: true, message: '请输入名称', trigger: 'blur'}], | ||
120 | videoUrl: [{required: true, message: '上传缩略图', trigger: 'blur'}], | ||
121 | videoTypeCode: [{required: true, message: '请选择', trigger: 'blur'}] | ||
122 | }, | ||
123 | videoTypeList: [] | ||
124 | } | ||
125 | }, | ||
126 | methods: { | ||
127 | initVideo() { | ||
128 | this.loading = true | ||
129 | request.get(urls.videoListUrl, this.queryForm).then(data => { | ||
130 | this.loading = false | ||
131 | this.videoList = data.content.list | ||
132 | this.total = data.content.total | ||
133 | }).catch(() => { | ||
134 | |||
135 | }) | ||
136 | }, | ||
137 | initVideoType() { | ||
138 | let form = { | ||
139 | page: 1, | ||
140 | size: 1000 | ||
141 | } | ||
142 | request.get(urls.videoTypeListUrl, this.form).then(data => { | ||
143 | this.videoTypeList = data.content.list | ||
144 | }).catch(() => { | ||
145 | |||
146 | }) | ||
147 | }, | ||
148 | searchVideo(){ | ||
149 | this.queryForm.page=1 | ||
150 | this.initVideo() | ||
151 | }, | ||
152 | videoEdit(row) { | ||
153 | this.title = '编辑' | ||
154 | this.dialogVisible = true | ||
155 | this.videoForm = JSON.parse(JSON.stringify(row)) | ||
156 | }, | ||
157 | videoDelete(code) { | ||
158 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
159 | confirmButtonText: '确定', | ||
160 | cancelButtonText: '取消', | ||
161 | type: 'warning' | ||
162 | }).then(() => { | ||
163 | let form = { | ||
164 | videoCode: code | ||
165 | } | ||
166 | request.post(urls.videoDelUrl, form).then(data => { | ||
167 | this.initVideo() | ||
168 | this.$message.success("删除成功") | ||
169 | }).catch(() => { | ||
170 | |||
171 | }) | ||
172 | }).catch(() => { | ||
173 | |||
174 | }) | ||
175 | |||
176 | }, | ||
177 | cancelCreate() { | ||
178 | this.dialogVisible = false | ||
179 | this.videoForm = {} | ||
180 | }, | ||
181 | videoCreate() { | ||
182 | this.videoForm = {} | ||
183 | this.dialogVisible = true | ||
184 | this.title = '创建' | ||
185 | }, | ||
186 | submitForm(formName) { | ||
187 | this.$refs[formName].validate((valid) => { | ||
188 | if (valid) { | ||
189 | request.post(urls.videoSaveUrl, this.videoForm).then(response => { | ||
190 | this.dialogVisible = false | ||
191 | this.$message.success("保存成功") | ||
192 | this.initVideo() | ||
193 | }).catch(() => { | ||
194 | |||
195 | }) | ||
196 | } else { | ||
197 | console.log('error submit!!') | ||
198 | return false | ||
199 | } | ||
200 | }) | ||
201 | |||
202 | }, | ||
203 | /*分页*/ | ||
204 | handleSizeChange(val) { | ||
205 | console.log(`每页 ${val} 条`) | ||
206 | this.queryForm.size = val | ||
207 | this.queryForm.page = 1 | ||
208 | this.initVideo() | ||
209 | }, | ||
210 | handleCurrentChange(val) { | ||
211 | console.log(`当前页: ${val}`) | ||
212 | this.queryForm.page = val | ||
213 | this.initVideo() | ||
214 | }, | ||
215 | |||
216 | }, | ||
217 | created() { | ||
218 | this.initVideo(); | ||
219 | this.initVideoType(); | ||
220 | } | ||
221 | } | ||
222 | </script> | ||
223 | |||
224 | <style scoped> | ||
225 | |||
226 | </style> |
src/views/videoType/index.vue
0 → 100644
1 | <template> | ||
2 | <div class="app-container"> | ||
3 | <el-header height> | ||
4 | <el-button type="primary" @click="videoTypeCreate">创建</el-button> | ||
5 | </el-header> | ||
6 | <el-main> | ||
7 | <el-table | ||
8 | :data="videoTypeList" | ||
9 | style="width: 100%" | ||
10 | stripe | ||
11 | highlight-current-row | ||
12 | v-loading="loading" | ||
13 | > | ||
14 | <el-table-column label="名称" prop="typeName"></el-table-column> | ||
15 | <el-table-column label="图片" prop="typeImage"> | ||
16 | <template slot-scope="scope"> | ||
17 | <a :href="scope.row.typeImage" target="_blank"> | ||
18 | <div style="width: 100px;"> | ||
19 | <el-image :src="scope.row.typeImage"></el-image> | ||
20 | </div> | ||
21 | </a> | ||
22 | </template> | ||
23 | </el-table-column> | ||
24 | <el-table-column label="软/硬件" prop="machine"> | ||
25 | <template slot-scope="scope"> | ||
26 | <span v-if="scope.row.machine===1">软件</span> | ||
27 | <span v-if="scope.row.machine===0">硬件</span> | ||
28 | </template> | ||
29 | </el-table-column> | ||
30 | <el-table-column label="操作"> | ||
31 | <template slot-scope="scope"> | ||
32 | <el-link type="primary" @click="videoTypeEdit(scope.row)">编辑 </el-link> | ||
33 | <el-link type="primary" @click="videoTypeDelete(scope.row.videoTypeCode)">删除 </el-link> | ||
34 | </template> | ||
35 | </el-table-column> | ||
36 | </el-table> | ||
37 | </el-main> | ||
38 | <el-footer> | ||
39 | <div style="text-align:right;"> | ||
40 | <el-pagination | ||
41 | @size-change="handleSizeChange" | ||
42 | @current-change="handleCurrentChange" | ||
43 | :current-page="queryForm.page" | ||
44 | :page-size="queryForm.size" | ||
45 | layout="total, prev, pager, next" | ||
46 | :total="total"> | ||
47 | </el-pagination> | ||
48 | </div> | ||
49 | </el-footer> | ||
50 | |||
51 | <el-dialog | ||
52 | width="60%" | ||
53 | :title="title" | ||
54 | :visible.sync="dialogVisible"> | ||
55 | <el-form :model="videoTypeForm" ref="videoTypeForm" :rules="videoTypeRules" label-width="180px"> | ||
56 | <el-form-item label="名称:" prop="typeName"> | ||
57 | <el-input v-model="videoTypeForm.typeName" maxlength="100" show-word-limit></el-input> | ||
58 | </el-form-item> | ||
59 | <el-form-item label="图片:" prop="typeImage"> | ||
60 | <upload-item | ||
61 | v-model="videoTypeForm.typeImage" | ||
62 | v-on:before-upload="loading=true" | ||
63 | v-on:after-upload="loading=false" | ||
64 | ></upload-item> | ||
65 | </el-form-item> | ||
66 | <el-form-item label="软/硬件:" prop="machine"> | ||
67 | <el-select v-model="videoTypeForm.machine" placeholder="请选择"> | ||
68 | <el-option | ||
69 | v-for="item in machineOption" | ||
70 | :key="item.value" | ||
71 | :label="item.label" | ||
72 | :value="item.value"> | ||
73 | </el-option> | ||
74 | </el-select> | ||
75 | </el-form-item> | ||
76 | </el-form> | ||
77 | <span slot="footer" class="dialog-footer"> | ||
78 | <el-button type="primary" @click="submitForm('videoTypeForm')">提交</el-button> | ||
79 | <el-button @click="cancelCreate">取消</el-button> | ||
80 | </span> | ||
81 | </el-dialog> | ||
82 | |||
83 | </div> | ||
84 | </template> | ||
85 | |||
86 | <script> | ||
87 | import {request} from '@/api/fetch-api' | ||
88 | import UploadItem from '@/components/UploadItem' | ||
89 | |||
90 | let urls = { | ||
91 | videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list', | ||
92 | videoTypeSaveUrl: '/tianbao_edu_api/admin/videoType/save', | ||
93 | videoTypeDelUrl: '/tianbao_edu_api/admin/videoType/delete', | ||
94 | } | ||
95 | |||
96 | export default { | ||
97 | components: {UploadItem}, | ||
98 | data() { | ||
99 | return { | ||
100 | videoTypeList: [], | ||
101 | total: 0, | ||
102 | loading: false, | ||
103 | queryForm: { | ||
104 | page: 1, | ||
105 | size: 10 | ||
106 | }, | ||
107 | dialogVisible: false, | ||
108 | title: '', | ||
109 | videoTypeForm: {}, | ||
110 | videoTypeRules: { | ||
111 | typeName: [{required: true, message: '请输入名称', trigger: 'blur'}], | ||
112 | typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}], | ||
113 | machine: [{required: true, message: '请选择', trigger: 'blur'}] | ||
114 | }, | ||
115 | machineOption: [ | ||
116 | {label: '软件', value: 1}, | ||
117 | {label: '硬件', value: 0}, | ||
118 | ] | ||
119 | |||
120 | } | ||
121 | }, | ||
122 | methods: { | ||
123 | initVideoType() { | ||
124 | this.loading = true | ||
125 | request.get(urls.videoTypeListUrl, this.queryForm).then(data => { | ||
126 | this.loading = false | ||
127 | this.videoTypeList = data.content.list | ||
128 | this.total = data.content.total | ||
129 | }).catch(() => { | ||
130 | |||
131 | }) | ||
132 | }, | ||
133 | videoTypeEdit(row) { | ||
134 | this.title = '编辑' | ||
135 | this.dialogVisible = true | ||
136 | this.videoTypeForm = JSON.parse(JSON.stringify(row)) | ||
137 | }, | ||
138 | videoTypeDelete(code) { | ||
139 | this.$confirm('是否永远删除, 是否继续?', '提示', { | ||
140 | confirmButtonText: '确定', | ||
141 | cancelButtonText: '取消', | ||
142 | type: 'warning' | ||
143 | }).then(() => { | ||
144 | let form = { | ||
145 | videoTypeCode: code | ||
146 | } | ||
147 | request.post(urls.videoTypeDelUrl, form).then(data => { | ||
148 | this.initVideoType() | ||
149 | this.$message.success("删除成功") | ||
150 | }).catch(() => { | ||
151 | |||
152 | }) | ||
153 | }).catch(() => { | ||
154 | |||
155 | }) | ||
156 | |||
157 | }, | ||
158 | cancelCreate() { | ||
159 | this.dialogVisible = false | ||
160 | this.videoTypeForm = {} | ||
161 | }, | ||
162 | videoTypeCreate() { | ||
163 | this.videoTypeForm = {} | ||
164 | this.dialogVisible = true | ||
165 | this.title = '创建' | ||
166 | }, | ||
167 | submitForm(formName) { | ||
168 | this.$refs[formName].validate((valid) => { | ||
169 | if (valid) { | ||
170 | request.post(urls.videoTypeSaveUrl, this.videoTypeForm).then(response => { | ||
171 | this.dialogVisible = false | ||
172 | this.$message.success("保存成功") | ||
173 | this.initVideoType() | ||
174 | }).catch(() => { | ||
175 | |||
176 | }) | ||
177 | } else { | ||
178 | console.log('error submit!!') | ||
179 | return false | ||
180 | } | ||
181 | }) | ||
182 | |||
183 | }, | ||
184 | /*分页*/ | ||
185 | handleSizeChange(val) { | ||
186 | console.log(`每页 ${val} 条`) | ||
187 | this.queryForm.size = val | ||
188 | this.queryForm.page = 1 | ||
189 | this.initVideoType() | ||
190 | }, | ||
191 | handleCurrentChange(val) { | ||
192 | console.log(`当前页: ${val}`) | ||
193 | this.queryForm.page = val | ||
194 | this.initVideoType() | ||
195 | }, | ||
196 | |||
197 | }, | ||
198 | created() { | ||
199 | this.initVideoType() | ||
200 | } | ||
201 | } | ||
202 | </script> | ||
203 | |||
204 | <style scoped> | ||
205 | |||
206 | </style> |
-
Please register or sign in to post a comment