Compare commits
No commits in common. 'master' and 'V2.4.7' have entirely different histories.
@ -1,5 +1,5 @@ |
|||||||
{ |
{ |
||||||
"tabWidth": 2, |
"tabWidth": 4, |
||||||
"singleQuote": true, |
"singleQuote": true, |
||||||
"trailingComma": "none", |
"trailingComma": "none", |
||||||
"printWidth": 140 |
"printWidth": 140 |
||||||
|
@ -0,0 +1,28 @@ |
|||||||
|
.header{ |
||||||
|
background-color: #242f42; |
||||||
|
} |
||||||
|
.login-wrap{ |
||||||
|
background: #324157; |
||||||
|
} |
||||||
|
.plugins-tips{ |
||||||
|
background: #eef1f6; |
||||||
|
} |
||||||
|
.plugins-tips a{ |
||||||
|
color: #20a0ff; |
||||||
|
} |
||||||
|
.el-upload--text em { |
||||||
|
color: #20a0ff; |
||||||
|
} |
||||||
|
.pure-button{ |
||||||
|
background: #20a0ff; |
||||||
|
} |
||||||
|
.tags-li.active { |
||||||
|
border: 1px solid #409EFF; |
||||||
|
background-color: #409EFF; |
||||||
|
} |
||||||
|
.message-title{ |
||||||
|
color: #20a0ff; |
||||||
|
} |
||||||
|
.collapse-btn:hover{ |
||||||
|
background: rgb(40,52,70); |
||||||
|
} |
@ -1,7 +0,0 @@ |
|||||||
/* 改变主题色变量 */ |
|
||||||
|
|
||||||
$--color-primary: #062c87; |
|
||||||
|
|
||||||
/* 改变 icon 字体路径变量,必需 */ |
|
||||||
$--font-path: '~element-ui/lib/theme-chalk/fonts'; |
|
||||||
@import "~element-ui/packages/theme-chalk/src/index"; |
|
@ -1,189 +0,0 @@ |
|||||||
.msg { |
|
||||||
li { |
|
||||||
margin-bottom: 10px; |
|
||||||
border-top: 1px solid #f1f1f1; |
|
||||||
&:first-child { |
|
||||||
border-top: 0; |
|
||||||
} |
|
||||||
.li-wrap { |
|
||||||
position: relative; |
|
||||||
display: flex; |
|
||||||
justify-content: space-between; |
|
||||||
padding: 16px 0; |
|
||||||
.avatar { |
|
||||||
width: 48px; |
|
||||||
height: 48px; |
|
||||||
border-radius: 50%; |
|
||||||
} |
|
||||||
.texts { |
|
||||||
flex: 1; |
|
||||||
margin-left: 24px; |
|
||||||
.name { |
|
||||||
color: rgba(0, 0, 0, 0.85); |
|
||||||
font-size: 16px; |
|
||||||
} |
|
||||||
.date { |
|
||||||
color: rgba(0, 0, 0, 0.45); |
|
||||||
font-size: 14px; |
|
||||||
} |
|
||||||
/deep/img { |
|
||||||
max-width: 95%; |
|
||||||
} |
|
||||||
} |
|
||||||
.reply-name { |
|
||||||
color: #062c87; |
|
||||||
} |
|
||||||
.action { |
|
||||||
display: inline-flex; |
|
||||||
align-items: center; |
|
||||||
margin: 15px 10px 0 0; |
|
||||||
.icon { |
|
||||||
margin: 0 5px; |
|
||||||
color: #062c87; |
|
||||||
font-size: 18px; |
|
||||||
cursor: pointer; |
|
||||||
&:hover { |
|
||||||
opacity: 0.8; |
|
||||||
} |
|
||||||
&:first-child { |
|
||||||
margin-right: 5px; |
|
||||||
} |
|
||||||
&.del { |
|
||||||
color: rgba(0, 0, 0, 0.65); |
|
||||||
border: 1px solid rgba(0, 0, 0, 0.15); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
.like-wrap { |
|
||||||
display: inline-flex; |
|
||||||
align-items: center; |
|
||||||
cursor: pointer; |
|
||||||
} |
|
||||||
} |
|
||||||
.reply { |
|
||||||
margin-top: 20px; |
|
||||||
} |
|
||||||
} |
|
||||||
&.children { |
|
||||||
margin-left: 72px; |
|
||||||
padding-left: 24px; |
|
||||||
background-color: rgba(0, 0, 0, 0.02); |
|
||||||
border-radius: 8px; |
|
||||||
li { |
|
||||||
border-top-color: rgba(0, 0, 0, 0.06); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
.toggle { |
|
||||||
margin: 16px 0; |
|
||||||
text-align: center; |
|
||||||
color: #062c87; |
|
||||||
font-size: 14px; |
|
||||||
span { |
|
||||||
cursor: pointer; |
|
||||||
} |
|
||||||
} |
|
||||||
/deep/.quill { |
|
||||||
background-color: #fff; |
|
||||||
} |
|
||||||
|
|
||||||
/deep/.timeline { |
|
||||||
padding-left: 9%; |
|
||||||
overflow: hidden; |
|
||||||
.el-timeline-item { |
|
||||||
padding-bottom: 40px; |
|
||||||
} |
|
||||||
.el-timeline-item__node--normal { |
|
||||||
top: 30px; |
|
||||||
} |
|
||||||
.el-timeline-item__wrapper { |
|
||||||
top: 15px; |
|
||||||
padding-left: 40px; |
|
||||||
} |
|
||||||
.el-timeline-item__tail { |
|
||||||
height: 250%; |
|
||||||
border-left-width: 1px; |
|
||||||
} |
|
||||||
.sign { |
|
||||||
position: relative; |
|
||||||
display: inline-block; |
|
||||||
margin-left: -12.5%; |
|
||||||
font-size: 14px; |
|
||||||
color: #062c87; |
|
||||||
} |
|
||||||
.draft { |
|
||||||
.ver, |
|
||||||
.sign { |
|
||||||
color: #b1b1b1; |
|
||||||
} |
|
||||||
} |
|
||||||
.ver { |
|
||||||
display: flex; |
|
||||||
justify-content: space-between; |
|
||||||
align-items: center; |
|
||||||
padding-bottom: 10px; |
|
||||||
margin: -22px 0 20px; |
|
||||||
font-size: 15px; |
|
||||||
color: #062c87; |
|
||||||
border-bottom: 1px dashed #bfbfbf; |
|
||||||
} |
|
||||||
.des { |
|
||||||
p, |
|
||||||
span, |
|
||||||
em { |
|
||||||
font-size: 14px !important; |
|
||||||
} |
|
||||||
} |
|
||||||
.withdraw { |
|
||||||
margin-right: 10px; |
|
||||||
font-size: 13px; |
|
||||||
color: #979797; |
|
||||||
} |
|
||||||
.action { |
|
||||||
margin-left: 15px; |
|
||||||
i { |
|
||||||
margin-left: 8px; |
|
||||||
font-size: 14px; |
|
||||||
color: #062c87; |
|
||||||
cursor: pointer; |
|
||||||
&:hover { |
|
||||||
opacity: 0.9; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
.detail { |
|
||||||
li { |
|
||||||
margin-bottom: 20px; |
|
||||||
} |
|
||||||
.name { |
|
||||||
display: flex; |
|
||||||
align-items: center; |
|
||||||
margin-bottom: 5px; |
|
||||||
font-size: 15px; |
|
||||||
font-weight: 600; |
|
||||||
img { |
|
||||||
width: 20px; |
|
||||||
margin-right: 5px; |
|
||||||
} |
|
||||||
} |
|
||||||
.val { |
|
||||||
font-size: 14px; |
|
||||||
line-height: 1.8; |
|
||||||
white-space: pre-wrap; |
|
||||||
p { |
|
||||||
position: relative; |
|
||||||
color: #6a6a6a; |
|
||||||
&:before { |
|
||||||
content: ''; |
|
||||||
display: inline-block; |
|
||||||
width: 5px; |
|
||||||
height: 5px; |
|
||||||
margin: 0 10px 0 5px; |
|
||||||
vertical-align: middle; |
|
||||||
border-radius: 20px; |
|
||||||
background-color: #c5b8ff; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,29 @@ |
|||||||
|
.header{ |
||||||
|
background-color: #fff; |
||||||
|
} |
||||||
|
.login-wrap{ |
||||||
|
background: rgba(56, 157, 170, 0.82);; |
||||||
|
} |
||||||
|
.plugins-tips{ |
||||||
|
background: #f2f2f2; |
||||||
|
} |
||||||
|
.plugins-tips a{ |
||||||
|
color: #00d1b2; |
||||||
|
} |
||||||
|
.el-upload--text em { |
||||||
|
color: #00d1b2; |
||||||
|
} |
||||||
|
.pure-button{ |
||||||
|
background: #00d1b2; |
||||||
|
} |
||||||
|
.pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus { |
||||||
|
background-color: #00d1b2 !important; |
||||||
|
border-color: #00d1b2 !important; |
||||||
|
} |
||||||
|
.tags-li.active { |
||||||
|
border: 1px solid #9278FF; |
||||||
|
background-color: #9278FF; |
||||||
|
} |
||||||
|
.collapse-btn:hover{ |
||||||
|
background: #00d1b2; |
||||||
|
} |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 946 B |
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 371 B |
Before Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 341 B |
Before Width: | Height: | Size: 244 B |
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 583 B |
Before Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 768 B |
@ -1,149 +0,0 @@ |
|||||||
<template> |
|
||||||
<div class="menus"> |
|
||||||
<el-menu class="nav" :default-active="onRoutes" background-color="#062c87" text-color="#fff" |
|
||||||
active-text-color="#333" unique-opened mode="horizontal" router @select="handleSelect"> |
|
||||||
<template v-for="item in menus"> |
|
||||||
<template v-if="item.subs"> |
|
||||||
<el-submenu :index="item.index" :key="item.index"> |
|
||||||
<template slot="title"> |
|
||||||
<!-- <i :class="item.icon"></i> --> |
|
||||||
<span slot="title">{{ item.title }}</span> |
|
||||||
</template> |
|
||||||
<template v-for="subItem in item.subs"> |
|
||||||
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index"> |
|
||||||
<template slot="title">{{ subItem.title }}</template> |
|
||||||
<el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">{{ |
|
||||||
threeItem.title |
|
||||||
}}</el-menu-item> |
|
||||||
</el-submenu> |
|
||||||
<el-menu-item v-else :index="subItem.index" :key="subItem.index">{{ subItem.title }}</el-menu-item> |
|
||||||
</template> |
|
||||||
</el-submenu> |
|
||||||
</template> |
|
||||||
<template v-else> |
|
||||||
<el-menu-item :index="item.index" :key="item.index"> |
|
||||||
<!-- <i :class="item.icon"></i> --> |
|
||||||
<span slot="title">{{ item.title }}</span> |
|
||||||
</el-menu-item> |
|
||||||
</template> |
|
||||||
</template> |
|
||||||
</el-menu> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
import Setting from '@/setting' |
|
||||||
import addRoutes from '@/libs/route/addRoutes' |
|
||||||
export default { |
|
||||||
data () { |
|
||||||
return { |
|
||||||
menuList: [ |
|
||||||
{ |
|
||||||
icon: 'el-icon-school', |
|
||||||
index: '/workbench', |
|
||||||
title: '工作台' |
|
||||||
}, |
|
||||||
{ |
|
||||||
icon: 'el-icon-user', |
|
||||||
index: '/customer', |
|
||||||
title: '客户管理' |
|
||||||
}, |
|
||||||
{ |
|
||||||
icon: 'el-icon-shopping-bag-2', |
|
||||||
index: '/user', |
|
||||||
title: '用户管理' |
|
||||||
}, |
|
||||||
{ |
|
||||||
icon: 'el-icon-document-checked', |
|
||||||
index: '/order', |
|
||||||
title: '订单管理' |
|
||||||
}, |
|
||||||
{ |
|
||||||
icon: 'el-icon-office-building', |
|
||||||
index: '/system', |
|
||||||
title: '系统配置' |
|
||||||
}, |
|
||||||
], |
|
||||||
menus: [], |
|
||||||
onRoutes: this.$route.path |
|
||||||
}; |
|
||||||
}, |
|
||||||
watch: { |
|
||||||
"$route.path": function (val) { |
|
||||||
this.menuList.map(e => { |
|
||||||
if (val.replace('/', '') === e.index) { |
|
||||||
this.handleSelect(val.replace('/', '')) |
|
||||||
this.$forceUpdate(); |
|
||||||
} |
|
||||||
}) |
|
||||||
} |
|
||||||
}, |
|
||||||
mounted () { |
|
||||||
sessionStorage.getItem('token') && this.getPer() // 登录了才获取权限 |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
handleSelect (index) { |
|
||||||
this.onRoutes = index |
|
||||||
this.$store.commit('setInfoTab', '1') |
|
||||||
this.$store.commit('setColumnId', '') |
|
||||||
this.$store.commit('setCompetitionCache', null) |
|
||||||
}, |
|
||||||
initMenu () { |
|
||||||
if (Setting.dynamicRoute) { |
|
||||||
this.menus = this.menuList |
|
||||||
return false |
|
||||||
|
|
||||||
const routes = this.$store.state.routes |
|
||||||
const menus = [] |
|
||||||
this.menuList.map(e => { |
|
||||||
routes.find(n => n.path === e.index) && menus.push(e) |
|
||||||
}) |
|
||||||
this.menus = menus |
|
||||||
} else { |
|
||||||
this.menus = this.menuList |
|
||||||
} |
|
||||||
}, |
|
||||||
// 获取权限列表 |
|
||||||
getPer () { |
|
||||||
this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { |
|
||||||
const routes = res.permissionMenu[0].children |
|
||||||
addRoutes(routes) |
|
||||||
this.initMenu() |
|
||||||
this.$store.commit('setDataPer', res.dataPermissionList) |
|
||||||
}).catch(err => { |
|
||||||
if (err.status === 500) { |
|
||||||
localStorage.removeItem('ms_username'); |
|
||||||
sessionStorage.clear() |
|
||||||
location.reload() |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
|
|
||||||
<style lang="scss" scoped> |
|
||||||
.menus { |
|
||||||
z-index: 2000; |
|
||||||
position: sticky; |
|
||||||
top: 0; |
|
||||||
display: flex; |
|
||||||
justify-content: center; |
|
||||||
background-color: #062c87; |
|
||||||
|
|
||||||
/deep/.nav { |
|
||||||
border-bottom: 0; |
|
||||||
|
|
||||||
&>.el-menu-item { |
|
||||||
height: 56px; |
|
||||||
padding: 0 30px; |
|
||||||
line-height: 56px; |
|
||||||
} |
|
||||||
|
|
||||||
&>.el-menu-item.is-active { |
|
||||||
background-color: #fff !important; |
|
||||||
border-bottom: 0; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|
@ -1,32 +0,0 @@ |
|||||||
/** |
|
||||||
* 阿里云oss配置 |
|
||||||
* */ |
|
||||||
|
|
||||||
import router from '@/router/index' |
|
||||||
import { Message } from 'element-ui' |
|
||||||
export default async function () { |
|
||||||
try { |
|
||||||
let RE = localStorage.getItem('osc') |
|
||||||
if (RE) { |
|
||||||
RE = JSON.parse(RE) |
|
||||||
} else { |
|
||||||
sessionStorage.removeItem('token') |
|
||||||
Message.error('登录过期,请重新登录!') |
|
||||||
setTimeout(() => { |
|
||||||
router.replace('/login') |
|
||||||
}, 1500) |
|
||||||
return false |
|
||||||
} |
|
||||||
return { |
|
||||||
// oss账号信息
|
|
||||||
config: { |
|
||||||
region: 'oss-cn-shenzhen', |
|
||||||
accessKeyId: RE[0], |
|
||||||
accessKeySecret: RE[1], |
|
||||||
bucket: 'huoran' |
|
||||||
}, |
|
||||||
// 上传成功url前置部分(成功回调没有返回url)
|
|
||||||
preUrl: 'https://huoran.oss-cn-shenzhen.aliyuncs.com/' |
|
||||||
} |
|
||||||
} catch (e) { } |
|
||||||
} |
|
@ -1,140 +0,0 @@ |
|||||||
<template> |
|
||||||
<el-upload :disabled="uploading" :before-upload="beforeUpload" :on-remove="onRemove" :on-error="uploadError" |
|
||||||
:limit="limit" action="" :on-exceed="handleExceed" :show-file-list="showFiles" :file-list="fileList" |
|
||||||
:http-request="handleRequest" name="file"> |
|
||||||
<slot name="trigger"> |
|
||||||
<el-button size="small" :loading="uploading">{{ uploading ? '正在上传' : '上传文件' }}</el-button> |
|
||||||
</slot> |
|
||||||
<div slot="tip" class="el-upload__tip"> |
|
||||||
<el-progress v-if="uploading" class="upload-progress" :stroke-width="3" |
|
||||||
:percentage="uploadProgress"></el-progress> |
|
||||||
<slot name="tip"> |
|
||||||
<p>支持扩展名:.rar .zip .doc .docx .pdf .jpg...</p> |
|
||||||
</slot> |
|
||||||
</div> |
|
||||||
</el-upload> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
import OSS from 'ali-oss' |
|
||||||
import OssConfig from './config.js' |
|
||||||
import Util from '@/libs/util' |
|
||||||
export default { |
|
||||||
props: { |
|
||||||
// 最大允许上传个数 |
|
||||||
limit: { |
|
||||||
type: Number, |
|
||||||
default: 1 |
|
||||||
}, |
|
||||||
// 单个文件最大大小(单位: Mb) |
|
||||||
maxSize: { |
|
||||||
type: Number, |
|
||||||
default: 10 |
|
||||||
}, |
|
||||||
// 是否显示已上传文件列表 |
|
||||||
showFileList: { |
|
||||||
type: Boolean, |
|
||||||
default: true |
|
||||||
}, |
|
||||||
// 已上传文件列表 |
|
||||||
fileList: { |
|
||||||
type: Array, |
|
||||||
default: () => [] |
|
||||||
}, |
|
||||||
// 是否要更新fileList(如果要使用自己的fileList,则这个值传false,一般情况不用给这个值) |
|
||||||
changeFileList: { |
|
||||||
type: Boolean, |
|
||||||
default: true |
|
||||||
}, |
|
||||||
// 已上传文件列表 |
|
||||||
onRemove: { |
|
||||||
type: Function, |
|
||||||
default: new Function() |
|
||||||
}, |
|
||||||
}, |
|
||||||
data () { |
|
||||||
return { |
|
||||||
client: null, |
|
||||||
uploading: false, |
|
||||||
uploadProgress: 0, |
|
||||||
showFiles: this.showFileList, |
|
||||||
Oss: {}, |
|
||||||
}; |
|
||||||
}, |
|
||||||
mounted () { |
|
||||||
this.initOss() |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
// 初始化oss |
|
||||||
async initOss () { |
|
||||||
this.Oss = await OssConfig() |
|
||||||
this.client = new OSS(this.Oss.config) |
|
||||||
}, |
|
||||||
// 附件上传前 |
|
||||||
beforeUpload (file) { |
|
||||||
const oversize = file.size / 1024 / 1024 < this.maxSize |
|
||||||
if (!oversize) Util.warningMsg(`请上传小于${this.maxSize}MB的附件!`) |
|
||||||
if (oversize) { |
|
||||||
this.$emit('beforeUpload', file) |
|
||||||
return true |
|
||||||
} else { |
|
||||||
return false |
|
||||||
} |
|
||||||
}, |
|
||||||
// 自定义进度条 |
|
||||||
handleProgress (progress) { |
|
||||||
this.uploadProgress = Number((progress * 100).toFixed(2)) |
|
||||||
}, |
|
||||||
// 自定义上传 |
|
||||||
async handleRequest ({ file }) { |
|
||||||
try { |
|
||||||
this.uploadProgress = 0 |
|
||||||
this.uploading = true |
|
||||||
this.showFiles = false |
|
||||||
// 上传到阿里云oss |
|
||||||
const { name } = await this.client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file, { |
|
||||||
progress: this.handleProgress |
|
||||||
}); |
|
||||||
|
|
||||||
this.uploading = false |
|
||||||
const url = this.Oss.preUrl + name |
|
||||||
this.changeFileList && this.$emit('update:fileList', [ |
|
||||||
...this.fileList, |
|
||||||
{ |
|
||||||
name: name, |
|
||||||
url |
|
||||||
} |
|
||||||
]) |
|
||||||
|
|
||||||
this.showFiles = true |
|
||||||
this.$emit('onSuccess', { |
|
||||||
format: Util.getFileExt(file.name), |
|
||||||
name: file.name, |
|
||||||
url, |
|
||||||
size: file.size, |
|
||||||
}) |
|
||||||
} catch (error) { } |
|
||||||
}, |
|
||||||
uploadError (err, file, fileList) { |
|
||||||
this.$message({ |
|
||||||
message: "上传出错,请重试!", |
|
||||||
type: "error", |
|
||||||
center: true |
|
||||||
}) |
|
||||||
}, |
|
||||||
beforeRemove (file, fileList) { |
|
||||||
return this.$confirm(`确定移除 ${file.name}?`); |
|
||||||
}, |
|
||||||
handleExceed (files, fileList) { |
|
||||||
Util.warningMsg(`当前限制选择 ${this.limit} 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
||||||
}, |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
<style lang="scss" scoped> |
|
||||||
/deep/.upload-progress { |
|
||||||
max-width: 300px; |
|
||||||
margin: 10px 0; |
|
||||||
white-space: nowrap; |
|
||||||
} |
|
||||||
</style> |
|
@ -1,40 +0,0 @@ |
|||||||
// 阿里云oss上传
|
|
||||||
|
|
||||||
import OSS from 'ali-oss' |
|
||||||
import OssConfig from './config' |
|
||||||
import Util from '@/libs/util' |
|
||||||
|
|
||||||
let client = null |
|
||||||
let Oss |
|
||||||
// 初始化oss
|
|
||||||
const initOss = async () => { |
|
||||||
Oss = await OssConfig() |
|
||||||
if (!client) client = new OSS(Oss.config) |
|
||||||
} |
|
||||||
initOss() |
|
||||||
|
|
||||||
export default { |
|
||||||
// 上传文件
|
|
||||||
upload (file) { |
|
||||||
initOss() |
|
||||||
return new Promise(async (resolve, reject) => { |
|
||||||
try { |
|
||||||
// 上传到阿里云oss
|
|
||||||
const res = await client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file); |
|
||||||
resolve({ |
|
||||||
format: Util.getFileExt(file.name), |
|
||||||
name: file.name, |
|
||||||
url: Oss.preUrl + res.name, |
|
||||||
size: file.size, |
|
||||||
}) |
|
||||||
} catch (error) { |
|
||||||
reject() |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 删除文件(传完整url,不是没有https的name,因为很多接口没有存name,只存url,所以统一使用url)
|
|
||||||
async del (url) { |
|
||||||
initOss() |
|
||||||
await client.delete(url.replace(Oss.preUrl, '')); |
|
||||||
} |
|
||||||
} |
|
@ -1,50 +0,0 @@ |
|||||||
export default { |
|
||||||
difficults: [ |
|
||||||
{ |
|
||||||
id: 'basic', |
|
||||||
name: '基础', |
|
||||||
coefficient: 0.2, // 难度系数,试卷里计算试卷难度专用
|
|
||||||
theme: 'success', |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'easy', |
|
||||||
name: '普通', |
|
||||||
coefficient: 0.4, |
|
||||||
theme: '', |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'medium', |
|
||||||
name: '较难', |
|
||||||
coefficient: 0.6, |
|
||||||
theme: 'warning', |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'hard', |
|
||||||
name: '难', |
|
||||||
coefficient: 0.8, |
|
||||||
theme: 'danger', |
|
||||||
}, |
|
||||||
], |
|
||||||
questionTypes: [ |
|
||||||
{ |
|
||||||
id: 'single_choice', |
|
||||||
name: '单选题' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'multiple_choice', |
|
||||||
name: '多选题' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'judgement', |
|
||||||
name: '判断题' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'fill_blank', |
|
||||||
name: '填空题' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 'essay', |
|
||||||
name: '问答题' |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
@ -1,28 +0,0 @@ |
|||||||
export default { |
|
||||||
types: [ |
|
||||||
{ |
|
||||||
id: 1, |
|
||||||
name: '演示文稿类' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 2, |
|
||||||
name: '视频类' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 3, |
|
||||||
name: '图形类' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 4, |
|
||||||
name: '文本类' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 5, |
|
||||||
name: '音频类' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 6, |
|
||||||
name: '其他' |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
@ -1,34 +0,0 @@ |
|||||||
export default { |
|
||||||
difficults: [ |
|
||||||
{ |
|
||||||
id: 1, |
|
||||||
name: '简单' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 2, |
|
||||||
name: '普通' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 3, |
|
||||||
name: '较难' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 4, |
|
||||||
name: '难' |
|
||||||
}, |
|
||||||
], |
|
||||||
paperTypes: [ |
|
||||||
{ |
|
||||||
id: 0, |
|
||||||
name: '练习' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 1, |
|
||||||
name: '考核' |
|
||||||
}, |
|
||||||
{ |
|
||||||
id: 2, |
|
||||||
name: '竞赛' |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
@ -1,56 +0,0 @@ |
|||||||
// 导出压缩包
|
|
||||||
import JSZip from 'jszip' |
|
||||||
import FileSaver from 'file-saver' |
|
||||||
|
|
||||||
//文件以流的形式获取(参数url为文件链接地址)
|
|
||||||
const getImgArrayBuffer = url => { |
|
||||||
return new Promise((resolve, reject) => { |
|
||||||
//通过请求获取文件blob格式
|
|
||||||
let xmlhttp = new XMLHttpRequest(); |
|
||||||
xmlhttp.open('GET', url, true); |
|
||||||
xmlhttp.responseType = 'blob' |
|
||||||
xmlhttp.onload = function () { |
|
||||||
if (xmlhttp.status == 200) { |
|
||||||
resolve(xmlhttp.response); |
|
||||||
} else { |
|
||||||
reject(xmlhttp.response); |
|
||||||
} |
|
||||||
}; |
|
||||||
xmlhttp.send(); |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param {String} zipName 压缩包名字 |
|
||||||
* @param {Array} files 需要压缩的文件数组 |
|
||||||
* @param {Function | undefined} callback 回调 |
|
||||||
*/ |
|
||||||
export default function (zipName, files, callback) { |
|
||||||
var zip = new JSZip(); |
|
||||||
var promises = []; |
|
||||||
let cache = {}; |
|
||||||
for (let item of files) { |
|
||||||
// item.filePath为文件链接地址
|
|
||||||
// item.fileName为文件名称
|
|
||||||
if(item.filePath) { |
|
||||||
const promise = getImgArrayBuffer(item.filePath).then((data) => { |
|
||||||
// 下载文件, 并存成ArrayBuffer对象(blob)
|
|
||||||
zip.file(item.fileName, data, { binary: true }); // 逐个添加文件
|
|
||||||
cache[item.fileName] = data; |
|
||||||
}); |
|
||||||
promises.push(promise); |
|
||||||
} else { |
|
||||||
// 地址不存在时提示
|
|
||||||
console.log(`附件${item.fileName}地址错误,下载失败`); |
|
||||||
} |
|
||||||
} |
|
||||||
Promise.all(promises).then(() => { |
|
||||||
zip.generateAsync({ type: "blob" }).then((content) => { |
|
||||||
// 生成二进制流
|
|
||||||
FileSaver.saveAs(content, zipName); // 利用file-saver保存文件 zipName: 自定义文件名
|
|
||||||
callback && callback() |
|
||||||
}); |
|
||||||
}).catch((res) => { |
|
||||||
console.log("文件压缩失败"); |
|
||||||
}); |
|
||||||
} |
|
@ -0,0 +1,204 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col :span="24"> |
||||||
|
<el-card shadow="hover" class="mgb20"> |
||||||
|
<div class="flex-between"> |
||||||
|
<div class="per_title" @click="goback()"> |
||||||
|
<i class="el-icon-arrow-left"></i> |
||||||
|
<span class="per_back">返回</span> |
||||||
|
<span class="per_school">添加环节</span> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<el-button type="primary" round class="mag" @click="saveAdd('form')">确定 |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</el-card> |
||||||
|
|
||||||
|
<el-card shadow="hover" class="mgb20"> |
||||||
|
<div class="flex-between mgb20 user_header"> |
||||||
|
<div class="flex-center"> |
||||||
|
<p class="addhr_tag"></p> |
||||||
|
<span>环节1.1</span> |
||||||
|
</div> |
||||||
|
<el-button type="primary" round class="mag" @click="addcourse()">添加环节</el-button> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<el-form :model="form" ref="form" label-width="120px" class="courseware"> |
||||||
|
<ul class="mgb20"> |
||||||
|
<li v-for="(item,index) in form.courseList" :key="index" class="flex-between"> |
||||||
|
<div style="width: 50%;"> |
||||||
|
<el-form-item label="环节名称" :prop="'courseList.' + index + '.linkName'" |
||||||
|
:rules="{required: true, message: '请输入项目课件', trigger: 'blur'}"> |
||||||
|
<el-input placeholder="请输入项目课件" v-model="item.linkName"></el-input> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="资源添加" :prop="'courseList.' + index + '.fileLink'" |
||||||
|
:rules="{required: true, message: '请添加文件', trigger: 'blur'}"> |
||||||
|
<el-upload |
||||||
|
class="link_upload" |
||||||
|
:headers="{token}" |
||||||
|
:action="api.uploadFiles" |
||||||
|
:on-remove="(file, fileList)=>{return handleRemove(file, fileList, index)}" |
||||||
|
:on-error="uploadError" |
||||||
|
:on-success="(response, file, fileList)=>{return uploadSuccess(response, file, fileList, index)}" |
||||||
|
:before-remove="beforeRemove" |
||||||
|
:limit="1" |
||||||
|
:on-exceed="handleExceed" |
||||||
|
:file-list="item.uploadList"> |
||||||
|
<el-button size="medium" type="primary" icon="el-icon-upload" |
||||||
|
class="uploadTitle">点击上传 |
||||||
|
</el-button> |
||||||
|
</el-upload> |
||||||
|
</el-form-item> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<el-button size="medium" type="primary" @click="delCourse(index)">删除课件 |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</li> |
||||||
|
</ul> |
||||||
|
</el-form> |
||||||
|
</div> |
||||||
|
</el-card> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
token: this.$store.state.loginToken, |
||||||
|
form: { |
||||||
|
courseList: [{ |
||||||
|
projectId: this.$store.state.systemId, |
||||||
|
courseId: this.$store.state.courseId, |
||||||
|
linkName: "", |
||||||
|
fileLink: "", |
||||||
|
uploadList: [] |
||||||
|
}] |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
getData() { |
||||||
|
let data = { |
||||||
|
projectId: this.form.courseList[0].projectId, |
||||||
|
courseId: this.form.courseList[0].courseId |
||||||
|
}; |
||||||
|
this.$get(this.api.queryLinkDetails, data).then((res) => { |
||||||
|
res.message.map(e => { |
||||||
|
var arr = []; |
||||||
|
arr.push({ name: e.linkName, url: e.fileLink }); |
||||||
|
this.$set(e, "uploadList", arr); |
||||||
|
}); |
||||||
|
this.form.courseList = res.message; |
||||||
|
}).catch((res) => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
saveAdd(formName) { |
||||||
|
this.$refs[formName].validate((valid) => { |
||||||
|
if (valid) { |
||||||
|
var arr = this.form.courseList.map(v => { |
||||||
|
var obj = { |
||||||
|
...v |
||||||
|
}; |
||||||
|
delete obj.uploadList; |
||||||
|
return obj; |
||||||
|
}); |
||||||
|
let data = { |
||||||
|
courseLink: arr |
||||||
|
}; |
||||||
|
this.$post(this.api.addCourseLink, data).then((res) => { |
||||||
|
this.$message.success("添加成功!"); |
||||||
|
this.goback(); |
||||||
|
}).catch((res) => { |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
addcourse() { |
||||||
|
this.form.courseList = this.form.courseList.concat({ |
||||||
|
projectId: this.$store.state.systemId, |
||||||
|
courseId: this.$store.state.courseId, |
||||||
|
linkName: "", |
||||||
|
fileLink: "", |
||||||
|
uploadList: [] |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 上传文件 |
||||||
|
handleExceed(files, fileList) { |
||||||
|
this.$message.warning( |
||||||
|
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
||||||
|
); |
||||||
|
}, |
||||||
|
uploadSuccess(response, file, fileList, idx) { |
||||||
|
this.form.courseList[idx].uploadList.push({ name: file.name, url: response.message.fileUrl }); |
||||||
|
this.form.courseList[idx].fileLink = response.message.fileUrl; |
||||||
|
}, |
||||||
|
uploadError(err, file, fileList) { |
||||||
|
this.$message({ |
||||||
|
message: "上传出错,请重试!", |
||||||
|
type: "error", |
||||||
|
center: true |
||||||
|
}); |
||||||
|
}, |
||||||
|
beforeRemove(file, fileList) { |
||||||
|
return this.$confirm(`确定移除 ${file.name}?`); |
||||||
|
}, |
||||||
|
handleRemove(file, fileList, idx) { |
||||||
|
let uploadList = this.form.courseList[idx].uploadList; |
||||||
|
uploadList.forEach((item, index) => { |
||||||
|
if (file.name == item.name) { |
||||||
|
uploadList.splice(index, 1); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
delCourse(index) { |
||||||
|
this.$confirm("确定要删除该课件吗?", "提示", { |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
this.form.courseList.splice(index, 1); |
||||||
|
this.$message.success("删除成功"); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
goback() { |
||||||
|
this.$router.go(-1); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
/* .courseware ul .el-input{ |
||||||
|
width: 30%; |
||||||
|
} */ |
||||||
|
|
||||||
|
.courseware ul li { |
||||||
|
margin-top: 20px; |
||||||
|
padding: 0 0 10px 0; |
||||||
|
border-bottom: 1px dashed #eee; |
||||||
|
} |
||||||
|
|
||||||
|
.courseware ul li:first-child { |
||||||
|
margin-top: 0; |
||||||
|
} |
||||||
|
|
||||||
|
.courseware ul li:last-child { |
||||||
|
border-bottom: none; |
||||||
|
} |
||||||
|
|
||||||
|
.uploadTitle { |
||||||
|
height: 40px !important; |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,327 @@ |
|||||||
|
<template> |
||||||
|
<div> |
||||||
|
<el-card shadow="hover" class="mgb20"> |
||||||
|
<div> |
||||||
|
<div class="flex-center mgb20"> |
||||||
|
<p class="hr_tag"></p> |
||||||
|
<span>筛选</span> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<el-form label-width="80px"> |
||||||
|
<el-col :span="4"> |
||||||
|
<el-form-item label="学科类别"> |
||||||
|
<el-select v-model="form.categoryId" clearable |
||||||
|
@change="getProfessionalClass()" @clear="clearClass()"> |
||||||
|
<el-option v-for="(item,index) in subjectList" :key="index" |
||||||
|
:label="item.disciplineName" |
||||||
|
:value="item.disciplineId"></el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="4"> |
||||||
|
<el-form-item label="专业类"> |
||||||
|
<el-select v-model="form.professionalCategoryId" clearable |
||||||
|
:disabled="form.categoryId ? false : true" |
||||||
|
@change="getProfessional()" @clear="clearProfess()"> |
||||||
|
<el-option v-for="(item,index) in ProfessionalClassList" :key="index" |
||||||
|
:label="item.professionalClassName" |
||||||
|
:value="item.professionalClassId"></el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="4"> |
||||||
|
<el-form-item label="专业"> |
||||||
|
<el-select v-model="form.professionalId" clearable |
||||||
|
:disabled="form.professionalCategoryId ? false : true" |
||||||
|
@change="getData()"> |
||||||
|
<el-option v-for="(item,index) in ProfessionalList" :key="index" |
||||||
|
:label="item.professionalName" |
||||||
|
:value="item.professionalId"></el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="4"> |
||||||
|
<el-form-item label="课程类别"> |
||||||
|
<el-select v-model="form.curriculumType" clearable |
||||||
|
@change="getData()"> |
||||||
|
<el-option label="理论课程" :value="0"></el-option> |
||||||
|
<el-option label="实训课程" :value="1"></el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
<el-col :span="6"> |
||||||
|
<el-form-item> |
||||||
|
<el-input placeholder="请输入课程名称" prefix-icon="el-icon-search" |
||||||
|
v-model="form.curriculumName" clearable |
||||||
|
@keyup.enter.native="onSearch"></el-input> |
||||||
|
</el-form-item> |
||||||
|
</el-col> |
||||||
|
</el-form> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</el-card> |
||||||
|
|
||||||
|
<el-card shadow="hover" class="card"> |
||||||
|
<div class="flex-between mgb20"> |
||||||
|
<div class="flex-center"> |
||||||
|
<p class="hr_tag"></p> |
||||||
|
<span>课程列表</span> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<el-button type="primary" round @click="addcourse" v-auth>新增课程</el-button> |
||||||
|
<el-button type="primary" round @click="delAllSelection" v-auth>批量删除</el-button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<el-table v-loading="loading" :data="courseData" class="table" ref="table" stripe header-align="center" |
||||||
|
@selection-change="handleSelectionChange" :row-key="getRowKeys"> |
||||||
|
<el-table-column type="selection" width="55" align="center" |
||||||
|
:reserve-selection="true"></el-table-column> |
||||||
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
||||||
|
<el-table-column prop="curriculumName" label="课程名称" align="center"></el-table-column> |
||||||
|
<el-table-column prop="curriculumType" label="课程类型" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span class="ellipsis">{{ courseTypeStatus[scope.row.curriculumType] }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="userName" label="创建人" align="center"></el-table-column> |
||||||
|
<el-table-column label="配置的实训应用" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span class="ellipsis">{{ scope.row.sysName }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column prop="orderVolume" label="订单量" align="center"></el-table-column> |
||||||
|
<el-table-column prop="expectedCourse" label="预计课时" align="center"></el-table-column> |
||||||
|
<el-table-column label="上架/下架" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-switch |
||||||
|
v-model="scope.row.isShelves" |
||||||
|
:active-value="1" |
||||||
|
:inactive-value="0" |
||||||
|
@change="changeSwitch($event, scope.row)" |
||||||
|
v-auth="'/curriculum:上下架'"> |
||||||
|
</el-switch> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="操作" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-button type="text" @click="edit(scope.row)" v-auth>编辑</el-button> |
||||||
|
<el-button type="text" @click="config(scope.row)" v-auth>内容设置</el-button> |
||||||
|
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<div class="pagination"> |
||||||
|
<el-pagination background @current-change="handleCurrentChange" :current-page="pageNo" |
||||||
|
layout="total, prev, pager, next" :total="totals"></el-pagination> |
||||||
|
</div> |
||||||
|
</el-card> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
export default { |
||||||
|
name: "customer", |
||||||
|
data() { |
||||||
|
return { |
||||||
|
courseTypeStatus: { |
||||||
|
0: "理论课程", |
||||||
|
1: "实训课程" |
||||||
|
}, |
||||||
|
name: localStorage.getItem("ms_username"), |
||||||
|
courseData: [], |
||||||
|
form: { |
||||||
|
categoryId: "", |
||||||
|
professionalCategoryId: "", |
||||||
|
professionalId: "", |
||||||
|
curriculumType: "", |
||||||
|
curriculumName: "" |
||||||
|
}, |
||||||
|
pageNo: +this.$route.query.page || 1, |
||||||
|
pageSize: 10, |
||||||
|
totals: 0, |
||||||
|
subjectList: [], // 学科类别 |
||||||
|
ProfessionalClassList: [], // 专业类 |
||||||
|
ProfessionalList: [], // 专业 |
||||||
|
multipleSelection: [], |
||||||
|
loading: false, |
||||||
|
searchTimer: null |
||||||
|
}; |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
"form.curriculumName": function(val) { |
||||||
|
clearTimeout(this.searchTimer); |
||||||
|
this.searchTimer = setTimeout(() => { |
||||||
|
this.initData(); |
||||||
|
}, 500); |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.getSubject(); |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
getRowKeys(row) { |
||||||
|
return row.cid; |
||||||
|
}, |
||||||
|
// 获取列表数据 |
||||||
|
getData() { |
||||||
|
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
||||||
|
let data = { |
||||||
|
...this.form, |
||||||
|
pageNum: this.pageNo, |
||||||
|
pageSize: this.pageSize, |
||||||
|
supplierId: sid ? sid.supplierId : '' |
||||||
|
}; |
||||||
|
this.$post(this.api.curriculumList, data).then(res => { |
||||||
|
this.courseData = res.page.records; |
||||||
|
this.totals = res.page.total; |
||||||
|
this.loading = false; |
||||||
|
}).catch(err => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
initData() { |
||||||
|
this.pageNo = 1; |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
// 获取学科类别 |
||||||
|
getSubject() { |
||||||
|
this.$get(this.api.courseDiscipline).then(res => { |
||||||
|
this.subjectList = res.list; |
||||||
|
}).catch(err => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 清除学科类别 |
||||||
|
clearClass() { |
||||||
|
this.form.professionalCategoryId = ""; |
||||||
|
this.form.professionalId = ""; |
||||||
|
}, |
||||||
|
// 获取专业类 |
||||||
|
getProfessionalClass() { |
||||||
|
this.clearClass(); |
||||||
|
this.getProfessionalClassData(); |
||||||
|
this.pageNo = 1; |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
getProfessionalClassData() { |
||||||
|
let data = { |
||||||
|
disciplineId: this.form.categoryId |
||||||
|
}; |
||||||
|
this.$get(this.api.courseProfessionalClass, data).then(res => { |
||||||
|
this.ProfessionalClassList = res.list; |
||||||
|
}).catch(err => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 清除专业类 |
||||||
|
clearProfess() { |
||||||
|
this.form.professionalId = ""; |
||||||
|
}, |
||||||
|
// 获取专业 |
||||||
|
getProfessional() { |
||||||
|
this.clearProfess(); |
||||||
|
this.getProfessionalData(); |
||||||
|
this.pageNo = 1; |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
getProfessionalData() { |
||||||
|
let data = { |
||||||
|
professionalClassId: this.form.professionalCategoryId |
||||||
|
}; |
||||||
|
this.$get(this.api.courseProfessional, data).then(res => { |
||||||
|
this.ProfessionalList = res.list; |
||||||
|
}).catch(err => { |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 新建课程 |
||||||
|
addcourse() { |
||||||
|
this.$router.push("/addcurriculum"); |
||||||
|
}, |
||||||
|
// 编辑 |
||||||
|
edit(row) { |
||||||
|
this.$router.push(`/addcurriculum?cid=${row.cid}`); |
||||||
|
}, |
||||||
|
// 内容设置 |
||||||
|
config(row) { |
||||||
|
this.$router.push(`/contentSettings?cid=${row.cid}&name=${row.curriculumName}`); |
||||||
|
}, |
||||||
|
// 删除 |
||||||
|
handleDelete(row) { |
||||||
|
this.$post(`${this.api.deleteCoursePrompt}?cids=${row.cid}`).then(({ status }) => { |
||||||
|
if (status === 200) { |
||||||
|
this.$confirm("确定要删除吗?", "提示", { |
||||||
|
type: "warning" |
||||||
|
}).then(() => { |
||||||
|
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => { |
||||||
|
this.getData(); |
||||||
|
this.$message.success("删除成功"); |
||||||
|
}).catch(err => {}) |
||||||
|
}).catch(() => { |
||||||
|
}); |
||||||
|
} |
||||||
|
}).catch(err => {}) |
||||||
|
}, |
||||||
|
// 处理多选 |
||||||
|
handleSelectionChange(val) { |
||||||
|
this.multipleSelection = val; |
||||||
|
}, |
||||||
|
// 批量删除 |
||||||
|
delAllSelection() { |
||||||
|
if (this.multipleSelection.length) { |
||||||
|
let cids = [] |
||||||
|
this.multipleSelection.forEach(i => { |
||||||
|
cids.push('cids=' + i.cid) |
||||||
|
}); |
||||||
|
this.$post(`${this.api.deleteCoursePrompt}?${cids.join('&')}`).then(({ status }) => { |
||||||
|
if (status === 200) { |
||||||
|
this.$confirm("确定要删除吗?", "提示", { |
||||||
|
type: "warning" |
||||||
|
}).then(() => { |
||||||
|
let ids = this.multipleSelection.map(i => i.cid); |
||||||
|
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => { |
||||||
|
if(ids.length == this.courseData.length){ |
||||||
|
if(this.pageNo > 1){ |
||||||
|
this.pageNo = this.pageNo-1 |
||||||
|
} |
||||||
|
} |
||||||
|
this.getData(); |
||||||
|
this.$message.success("删除成功"); |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
}).catch(err => {}) |
||||||
|
}).catch(() => {}) |
||||||
|
} |
||||||
|
}).catch(err => {}) |
||||||
|
} else { |
||||||
|
this.$message.warning("请先选择课程 !"); |
||||||
|
} |
||||||
|
}, |
||||||
|
// 处理页码切换 |
||||||
|
handleCurrentChange(val) { |
||||||
|
this.pageNo = val; |
||||||
|
this.$router.push(`curriculum?page=${val}`) |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
// 课程名称条件搜索 |
||||||
|
onSearch() { |
||||||
|
this.pageNo = 1; |
||||||
|
this.getData(); |
||||||
|
}, |
||||||
|
// 上下架 |
||||||
|
changeSwitch(value, row) { |
||||||
|
this.$post(`${this.api.isShelves}?cid=${row.cid}&isShelves=${value}`).then((res) => { |
||||||
|
this.getData(); |
||||||
|
this.$message.success("修改上下架状态成功!"); |
||||||
|
}).catch((res) => { |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
.card { |
||||||
|
min-height: calc(100vh - 300px); |
||||||
|
} |
||||||
|
.mag { |
||||||
|
margin-right: 20px; |
||||||
|
} |
||||||
|
</style> |
||||||
|
|
@ -1,610 +0,0 @@ |
|||||||
<template> |
|
||||||
<el-drawer title="添加系统资源" :visible.sync="sourceVisible" size="1200px" :close-on-click-modal="false" |
|
||||||
custom-class="source-dia" @closed="closeDia"> |
|
||||||
<div class="overflow" v-loading="loading"> |
|
||||||
<div class="left"> |
|
||||||
<div class="tabs mgb20"> |
|
||||||
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: i == active }" @click="tabChange(i)">{{ |
|
||||||
item |
|
||||||
}}</a> |
|
||||||
</div> |
|
||||||
|
|
||||||
<template v-if="active !== 'tab3'"> |
|
||||||
<el-input class="mgb10" style="width: 300px" placeholder="请输入资源名称" prefix-icon="el-icon-search" |
|
||||||
v-model="keyword" clearable></el-input> |
|
||||||
|
|
||||||
<div class="course"> |
|
||||||
<div v-for="(course, i) in course" :key="i" class="item"> |
|
||||||
<div class="line"> |
|
||||||
<i :class="`el-icon-caret-right arrow ${course.shrink ? 'active' : ''}`" |
|
||||||
@click="course.shrink = !course.shrink"></i> |
|
||||||
<el-checkbox class="check" v-model="course.check" @change="checkCourse(course)"></el-checkbox> |
|
||||||
<img v-if="course.coverUrl" class="cover" :src="course.coverUrl" alt=""> |
|
||||||
<span class="course-name">{{ course.curriculumName || course.courseName }}</span> |
|
||||||
</div> |
|
||||||
<div v-if="course.shrink" class="chapters"> |
|
||||||
<!-- 章节 --> |
|
||||||
<div v-for="(chapter, j) in course.chapters" :key="j" class=""> |
|
||||||
<div class="line"> |
|
||||||
<i :class="`el-icon-caret-right arrow ${chapter.shrink ? 'active' : ''}`" |
|
||||||
@click="chapter.shrink = !chapter.shrink"></i> |
|
||||||
<el-checkbox class="check" v-model="chapter.check" @change="checkChapter(chapter, course)">{{ |
|
||||||
chapter.name |
|
||||||
}}</el-checkbox> |
|
||||||
</div> |
|
||||||
|
|
||||||
<!-- 小节 --> |
|
||||||
<div v-if="chapter.shrink" class="sections"> |
|
||||||
<div v-for="(section, k) in chapter.subsections" :key="k" class="line"> |
|
||||||
<el-checkbox class="check" v-model="section.check" @change="checkSection(section, chapter)"> |
|
||||||
<img v-if="section.fileType === 'pptx'" src="@/assets/img/exts/ppt.png" alt=""> |
|
||||||
<img v-else-if="section.fileType === 'mp4'" src="@/assets/img/exts/video.png" alt=""> |
|
||||||
<img v-else-if="section.fileType === 'doc' || section.fileType === 'docx'" |
|
||||||
src="@/assets/img/exts/word.png" alt=""> |
|
||||||
<img v-else-if="section.fileType === 'xlsx' || section.fileType === 'xls'" |
|
||||||
src="@/assets/img/exts/excel.png" alt=""> |
|
||||||
<img v-else-if="section.fileType === 'txt'" src="@/assets/img/exts/txt.png" alt=""> |
|
||||||
<img v-else-if="section.fileType === 'pdf'" src="@/assets/img/exts/pdf.png" alt=""> |
|
||||||
<img v-else src="@/assets/img/exts/pic.png" alt=""> |
|
||||||
{{ section.name }}</el-checkbox> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
|
|
||||||
<!-- 文件素材 --> |
|
||||||
<div v-else class="materials"> |
|
||||||
<div class="types"> |
|
||||||
<div class="flex-center m-b-10"> |
|
||||||
<p class="addhr_tag"></p> |
|
||||||
<span>资源类型</span> |
|
||||||
</div> |
|
||||||
<ul class="lines"> |
|
||||||
<li v-for="(item, i) in sourceType" :key="i" :class="['line', { active: curType === item.name }]" |
|
||||||
@click="checkType(item)">{{ item.name }}</li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="sources"> |
|
||||||
<div class="flex-center m-b-10"> |
|
||||||
<p class="addhr_tag"></p> |
|
||||||
<span>资源列表</span> |
|
||||||
</div> |
|
||||||
<el-input class="m-b-10" placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="keyword" |
|
||||||
clearable></el-input> |
|
||||||
<ul class="lines"> |
|
||||||
<el-checkbox v-if="sources.length" v-model="checkAll" label="全选" @change="checkAllChange"></el-checkbox> |
|
||||||
<li v-for="(item, i) in sources" :key="i" class="line"> |
|
||||||
<el-checkbox v-model="item.check" :label="item.resourceName" @change="sourceChange(item)"></el-checkbox> |
|
||||||
</li> |
|
||||||
</ul> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class="right"> |
|
||||||
<div v-if="$parent.curSection.id" class="m-b-20"> |
|
||||||
<p class="total m-b-10">原资源(共1个)</p> |
|
||||||
<div v-html="$parent.curSection.name"></div> |
|
||||||
</div> |
|
||||||
<template v-if="checked.length"> |
|
||||||
<div class="flex-between m-b-10"> |
|
||||||
<p class="total">已选资源(共{{ checked.length }}个)</p> |
|
||||||
<el-button type="text" @click="batchDelChecked">批量移除</el-button> |
|
||||||
</div> |
|
||||||
|
|
||||||
<el-input placeholder="请输入资源名称" prefix-icon="el-icon-search" v-model="checkedKeyword" clearable></el-input> |
|
||||||
|
|
||||||
<div class="lines"> |
|
||||||
<template v-for="(item, i) in checked"> |
|
||||||
<div v-if="!item.name || item.name.includes(checkedKeyword)" :key="i" class="line"> |
|
||||||
<div class="check-left"> |
|
||||||
<el-checkbox v-model="item.check"></el-checkbox> |
|
||||||
<span class="serial">{{ i + 1 }}</span> |
|
||||||
<el-tooltip effect="dark" :content="item.name" placement="top-start"> |
|
||||||
<p class="checked-name ellipsis">{{ item.name }}</p> |
|
||||||
</el-tooltip> |
|
||||||
</div> |
|
||||||
<i class="el-icon-delete action-icon" @click="delChecked(item)"></i> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
<div v-else class="empty"> |
|
||||||
<img class="icon" src="@/assets/img/empty.svg" alt=""> |
|
||||||
<p>暂无数据</p> |
|
||||||
</div> |
|
||||||
|
|
||||||
</div> |
|
||||||
</div> |
|
||||||
|
|
||||||
<div class="btns"> |
|
||||||
<el-button @click="sourceVisible = false">取消</el-button> |
|
||||||
<el-button type="primary" :loading="submiting" @click="submit">确定</el-button> |
|
||||||
</div> |
|
||||||
</el-drawer> |
|
||||||
</template> |
|
||||||
<script> |
|
||||||
import Setting from '@/setting' |
|
||||||
import Util from '@/libs/util' |
|
||||||
import _ from 'lodash' |
|
||||||
import SourceConst from '@/const/source' |
|
||||||
export default { |
|
||||||
props: ['visible'], |
|
||||||
data () { |
|
||||||
return { |
|
||||||
sourceVisible: false, |
|
||||||
active: 'tab1', |
|
||||||
tabs: { |
|
||||||
tab1: '教学课程', |
|
||||||
tab2: '精品课程', |
|
||||||
tab3: '文件素材', |
|
||||||
}, |
|
||||||
sourceType: [], |
|
||||||
curType: '全部', |
|
||||||
sources: [], |
|
||||||
checkAll: false, |
|
||||||
keyword: '', |
|
||||||
searchTimer: null, |
|
||||||
checkedKeyword: '', |
|
||||||
|
|
||||||
allSections: [], |
|
||||||
course: [], |
|
||||||
|
|
||||||
checked: [], |
|
||||||
submiting: false, |
|
||||||
loading: false, |
|
||||||
}; |
|
||||||
}, |
|
||||||
watch: { |
|
||||||
'keyword': function (val) { |
|
||||||
clearTimeout(this.searchTimer) |
|
||||||
this.searchTimer = setTimeout(this.getCourse, 500) |
|
||||||
}, |
|
||||||
visible () { |
|
||||||
this.sourceVisible = this.visible |
|
||||||
this.visible && this.init() |
|
||||||
} |
|
||||||
}, |
|
||||||
mounted () { |
|
||||||
|
|
||||||
}, |
|
||||||
methods: { |
|
||||||
// 初始化 |
|
||||||
init () { |
|
||||||
this.checked = [] |
|
||||||
this.curType = '全部' |
|
||||||
this.sourceType = [ |
|
||||||
{ |
|
||||||
id: '', |
|
||||||
name: '全部' |
|
||||||
}, |
|
||||||
...SourceConst.types |
|
||||||
] |
|
||||||
this.sourceType.forEach(e => { |
|
||||||
e.check = false |
|
||||||
}) |
|
||||||
this.getCourse() |
|
||||||
}, |
|
||||||
// 课程列表 |
|
||||||
async getCourse () { |
|
||||||
try { |
|
||||||
this.loading = true |
|
||||||
this.checkAll = false |
|
||||||
const { checked } = this |
|
||||||
if (this.active === 'tab3') { |
|
||||||
const { page } = await this.$post(this.api.resourceLibrary, { |
|
||||||
pageNum: 1, |
|
||||||
pageSize: 10000, |
|
||||||
platformId: Setting.platformId, |
|
||||||
type: 2, |
|
||||||
keyword: this.keyword, |
|
||||||
displayFileType: this.curType === '全部' ? [] : [this.curType], |
|
||||||
}) |
|
||||||
const list = page.records |
|
||||||
list.forEach(e => { |
|
||||||
const cur = checked.find(m => m.resourceName && m.id === e.id) |
|
||||||
e.name = e.resourceName |
|
||||||
e.check = !!cur |
|
||||||
}) |
|
||||||
this.sources = list |
|
||||||
} else { |
|
||||||
const { list } = await this.$post(`${this.api[this.active === 'tab1' ? 'curriculumTree' : 'boutiqueCurriculumTree']}?name=${this.keyword}`) |
|
||||||
if (list.length) { |
|
||||||
const all = [] |
|
||||||
list.forEach(e => { |
|
||||||
e.shrink = false |
|
||||||
e.check = false |
|
||||||
e.chapters.forEach(n => { |
|
||||||
n.shrink = false |
|
||||||
n.check = false |
|
||||||
all.push(...n.subsections) |
|
||||||
n.subsections.forEach(m => { |
|
||||||
const cur = checked.find(j => m.cid === j.cid && m.id === j.id) |
|
||||||
m.check = !!cur |
|
||||||
}) |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
list.forEach(e => { |
|
||||||
e.shrink = false |
|
||||||
e.check = false |
|
||||||
e.chapters.forEach(n => { |
|
||||||
n.shrink = false |
|
||||||
n.check = n.subsections.every(m => m.check) |
|
||||||
}) |
|
||||||
}) |
|
||||||
|
|
||||||
list.forEach(e => { |
|
||||||
e.shrink = false |
|
||||||
e.check = e.chapters.every(m => m.check) |
|
||||||
}) |
|
||||||
|
|
||||||
list[0].shrink = true |
|
||||||
list[0].chapters[0].shrink = true |
|
||||||
this.allSections = all |
|
||||||
} |
|
||||||
this.course = list |
|
||||||
} |
|
||||||
} finally { |
|
||||||
this.loading = false |
|
||||||
} |
|
||||||
}, |
|
||||||
initData () { |
|
||||||
this.page = 1; |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
tabChange (index) { |
|
||||||
this.keyword = '' |
|
||||||
this.active = index |
|
||||||
this.getCourse() |
|
||||||
}, |
|
||||||
// 课程多选回调 |
|
||||||
checkCourse (row) { |
|
||||||
const { check } = row |
|
||||||
const { checked } = this |
|
||||||
row.chapters.forEach(e => { |
|
||||||
e.check = check |
|
||||||
e.subsections.forEach(n => { |
|
||||||
n.check = check |
|
||||||
const cur = checked.findIndex(m => m.id === n.id) |
|
||||||
if (check) { |
|
||||||
if (cur === -1) { |
|
||||||
const section = _.cloneDeep(n) |
|
||||||
section.check = false |
|
||||||
checked.push(section) |
|
||||||
} |
|
||||||
} else { |
|
||||||
cur !== -1 && checked.splice(cur, 1) |
|
||||||
} |
|
||||||
}) |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 章节多选回调 |
|
||||||
checkChapter (row, course) { |
|
||||||
const { check } = row |
|
||||||
const { checked } = this |
|
||||||
row.subsections.forEach(n => { |
|
||||||
n.check = check |
|
||||||
const cur = checked.findIndex(m => m.id === n.id) |
|
||||||
if (check) { |
|
||||||
if (cur === -1) { |
|
||||||
const section = _.cloneDeep(n) |
|
||||||
section.check = false |
|
||||||
checked.push(section) |
|
||||||
} |
|
||||||
} else { |
|
||||||
cur !== -1 && checked.splice(cur, 1) |
|
||||||
} |
|
||||||
}) |
|
||||||
course.check = course.chapters.every(e => e.check) |
|
||||||
}, |
|
||||||
// 小节多选回调 |
|
||||||
async checkSection (row, chapter) { |
|
||||||
const { check } = row |
|
||||||
const { checked } = this |
|
||||||
const cur = checked.findIndex(m => m.id === row.id) |
|
||||||
if (check) { |
|
||||||
if (cur === -1) { |
|
||||||
const section = _.cloneDeep(row) |
|
||||||
section.check = false |
|
||||||
this.checked.push(section) |
|
||||||
} |
|
||||||
} else { |
|
||||||
cur !== -1 && this.checked.splice(cur, 1) |
|
||||||
} |
|
||||||
chapter.check = chapter.subsections.every(e => e.check) |
|
||||||
}, |
|
||||||
// 资源全选回调 |
|
||||||
checkAllChange (val) { |
|
||||||
this.sources.map(e => { |
|
||||||
e.check = val |
|
||||||
this.sourceChange(e) |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 资源类型选择回调 |
|
||||||
checkType ({ name }) { |
|
||||||
this.curType = name |
|
||||||
this.getCourse() |
|
||||||
}, |
|
||||||
// 资源列表选择回调 |
|
||||||
sourceChange (row) { |
|
||||||
const { check } = row |
|
||||||
const { checked } = this |
|
||||||
const cur = checked.findIndex(m => m.id === row.id) |
|
||||||
if (check) { |
|
||||||
if (cur === -1) { |
|
||||||
const section = _.cloneDeep(row) |
|
||||||
section.check = false |
|
||||||
this.checked.push(section) |
|
||||||
} |
|
||||||
} else { |
|
||||||
cur !== -1 && this.checked.splice(cur, 1) |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
// 批量移除 |
|
||||||
async batchDelChecked (val) { |
|
||||||
try { |
|
||||||
const checked = this.checked.filter(e => e.check) |
|
||||||
if (checked.length) { |
|
||||||
checked.map(e => { |
|
||||||
const cur = this.allSections.find(n => n.id === e.id) |
|
||||||
if (cur) { |
|
||||||
cur.check = false |
|
||||||
} |
|
||||||
}) |
|
||||||
this.checked = this.checked.filter(e => !e.check) |
|
||||||
} else { |
|
||||||
Util.warningMsg('请选择数据') |
|
||||||
} |
|
||||||
} catch (e) { } |
|
||||||
}, |
|
||||||
// 已选单个删除 |
|
||||||
async delChecked (item) { |
|
||||||
try { |
|
||||||
const cur = this.allSections.find(e => e.id === item.id) |
|
||||||
if (cur) cur.check = false |
|
||||||
this.checked.splice(this.checked.findIndex(e => e.id === item.id), 1) |
|
||||||
} catch (e) { } |
|
||||||
}, |
|
||||||
// 提交 |
|
||||||
async submit () { |
|
||||||
try { |
|
||||||
if (this.submiting) return false |
|
||||||
const { checked } = this |
|
||||||
if (checked.length) { |
|
||||||
this.submiting = true |
|
||||||
const { chapterId, id } = this.$parent |
|
||||||
const result = checked.map(e => { |
|
||||||
return { |
|
||||||
chapterId, |
|
||||||
cid: id, |
|
||||||
resourceId: e.id, |
|
||||||
type: e.cid ? 0 : e.resourceName ? 2 : 1, |
|
||||||
} |
|
||||||
}) |
|
||||||
|
|
||||||
const old = this.$parent.curSection // 需要更换的资源 |
|
||||||
if (old.id) { |
|
||||||
// 更换资源 |
|
||||||
await this.$post(this.api.replaceResource, { |
|
||||||
chapterId: old.chapterId, |
|
||||||
cid: +id, |
|
||||||
subsectionId: old.id, |
|
||||||
newResource: result |
|
||||||
}) |
|
||||||
|
|
||||||
} else { |
|
||||||
// 批量新增资源 |
|
||||||
await this.$post(this.api.combinationResource, result) |
|
||||||
} |
|
||||||
|
|
||||||
this.sourceVisible = false |
|
||||||
this.$parent.switchTypeVisible = false |
|
||||||
this.$parent.getData() |
|
||||||
this.submiting = false |
|
||||||
} else { |
|
||||||
Util.warningMsg('请选择资源') |
|
||||||
} |
|
||||||
} catch (e) { |
|
||||||
this.submiting = false |
|
||||||
} |
|
||||||
}, |
|
||||||
// 弹框关闭回调 |
|
||||||
closeDia () { |
|
||||||
this.$emit('update:visible', false) |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
|
|
||||||
<style lang="scss" scoped> |
|
||||||
/deep/.source-dia { |
|
||||||
.el-drawer__header { |
|
||||||
padding-bottom: 20px; |
|
||||||
margin-bottom: 0; |
|
||||||
border-bottom: 1px solid #eee; |
|
||||||
} |
|
||||||
|
|
||||||
.overflow { |
|
||||||
display: flex; |
|
||||||
} |
|
||||||
|
|
||||||
.btns { |
|
||||||
position: absolute; |
|
||||||
bottom: 0; |
|
||||||
left: 0; |
|
||||||
width: 100%; |
|
||||||
padding: 14px 0; |
|
||||||
text-align: center; |
|
||||||
background-color: #fff; |
|
||||||
box-shadow: 4px -2px 6px 0px rgba(198, 198, 198, 0.3500); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
.empty { |
|
||||||
display: flex; |
|
||||||
flex-direction: column; |
|
||||||
justify-content: center; |
|
||||||
align-items: center; |
|
||||||
height: 100%; |
|
||||||
font-size: 14px; |
|
||||||
text-align: center; |
|
||||||
color: #a3a3a3; |
|
||||||
} |
|
||||||
|
|
||||||
.left { |
|
||||||
width: 700px; |
|
||||||
padding: 0 15px; |
|
||||||
border-right: 1px solid #eee; |
|
||||||
box-sizing: border-box; |
|
||||||
|
|
||||||
.course { |
|
||||||
height: calc(100vh - 263px); |
|
||||||
overflow: auto; |
|
||||||
|
|
||||||
.item { |
|
||||||
padding: 10px; |
|
||||||
margin-bottom: 10px; |
|
||||||
background-color: #f9f9f9; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.line { |
|
||||||
display: flex; |
|
||||||
align-items: center; |
|
||||||
} |
|
||||||
|
|
||||||
.arrow { |
|
||||||
font-size: 16px; |
|
||||||
color: #9f9f9f; |
|
||||||
cursor: pointer; |
|
||||||
transition: .3s; |
|
||||||
|
|
||||||
&.active { |
|
||||||
transform: rotate(90deg); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.check { |
|
||||||
margin: 0 10px; |
|
||||||
|
|
||||||
img { |
|
||||||
vertical-align: middle; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.cover { |
|
||||||
width: 100px; |
|
||||||
max-height: 80px; |
|
||||||
margin-right: 15px; |
|
||||||
border-radius: 6px; |
|
||||||
} |
|
||||||
|
|
||||||
.course-name { |
|
||||||
font-size: 14px; |
|
||||||
color: #333; |
|
||||||
} |
|
||||||
|
|
||||||
.chapters { |
|
||||||
padding-left: 26px; |
|
||||||
margin-top: 10px; |
|
||||||
|
|
||||||
.line { |
|
||||||
margin-bottom: 10px; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.chapter-name { |
|
||||||
font-size: 13px; |
|
||||||
color: #ccc; |
|
||||||
} |
|
||||||
|
|
||||||
.sections { |
|
||||||
padding-left: 43px; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.right { |
|
||||||
flex: 1; |
|
||||||
padding: 15px; |
|
||||||
|
|
||||||
.total { |
|
||||||
font-size: 15px; |
|
||||||
color: #333; |
|
||||||
font-weight: 600; |
|
||||||
} |
|
||||||
|
|
||||||
.lines { |
|
||||||
height: calc(100vh - 228px); |
|
||||||
padding-right: 10px; |
|
||||||
margin-top: 10px; |
|
||||||
overflow: auto; |
|
||||||
} |
|
||||||
|
|
||||||
.line { |
|
||||||
display: flex; |
|
||||||
padding: 5px 0; |
|
||||||
color: #333; |
|
||||||
} |
|
||||||
|
|
||||||
.serial { |
|
||||||
width: 32px; |
|
||||||
margin: 0 12px; |
|
||||||
text-align: center; |
|
||||||
white-space: nowrap; |
|
||||||
} |
|
||||||
|
|
||||||
.check-left { |
|
||||||
display: inline-flex; |
|
||||||
align-items: center; |
|
||||||
} |
|
||||||
|
|
||||||
.checked-name { |
|
||||||
width: 360px; |
|
||||||
margin-right: 20px; |
|
||||||
} |
|
||||||
|
|
||||||
.action-icon { |
|
||||||
font-size: 14px; |
|
||||||
cursor: pointer; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.materials { |
|
||||||
display: flex; |
|
||||||
gap: 20px; |
|
||||||
} |
|
||||||
|
|
||||||
.types { |
|
||||||
width: 250px; |
|
||||||
height: calc(100vh - 223px); |
|
||||||
padding: 15px; |
|
||||||
background-color: #f9f9f9; |
|
||||||
box-sizing: border-box; |
|
||||||
overflow: auto; |
|
||||||
|
|
||||||
.line { |
|
||||||
margin-bottom: 10px; |
|
||||||
cursor: pointer; |
|
||||||
|
|
||||||
&.active { |
|
||||||
font-weight: 600; |
|
||||||
color: #062c87; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.sources { |
|
||||||
flex: 1; |
|
||||||
padding: 10px; |
|
||||||
|
|
||||||
.line { |
|
||||||
margin-top: 8px; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|
@ -1,332 +0,0 @@ |
|||||||
<template> |
|
||||||
<div> |
|
||||||
<el-card shadow="hover" class="mgb20"> |
|
||||||
<div> |
|
||||||
<div class="flex-center mgb20"> |
|
||||||
<p class="hr_tag"></p> |
|
||||||
<span>筛选</span> |
|
||||||
</div> |
|
||||||
<div> |
|
||||||
<el-form label-width="80px"> |
|
||||||
<el-col :span="4"> |
|
||||||
<el-form-item label="学科类别"> |
|
||||||
<el-select v-model="form.categoryId" clearable @change="getProfessionalClass()" @clear="clearClass()"> |
|
||||||
<el-option v-for="(item, index) in subjectList" :key="index" :label="item.disciplineName" |
|
||||||
:value="item.disciplineId"></el-option> |
|
||||||
</el-select> |
|
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
<el-col :span="4"> |
|
||||||
<el-form-item label="专业类"> |
|
||||||
<el-select v-model="form.professionalCategoryId" clearable :disabled="form.categoryId ? false : true" |
|
||||||
@change="getProfessional()" @clear="clearProfess()"> |
|
||||||
<el-option v-for="(item, index) in ProfessionalClassList" :key="index" |
|
||||||
:label="item.professionalClassName" :value="item.professionalClassId"></el-option> |
|
||||||
</el-select> |
|
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
<el-col :span="4"> |
|
||||||
<el-form-item label="专业"> |
|
||||||
<el-select v-model="form.professionalId" clearable |
|
||||||
:disabled="form.professionalCategoryId ? false : true" @change="getData()"> |
|
||||||
<el-option v-for="(item, index) in ProfessionalList" :key="index" :label="item.professionalName" |
|
||||||
:value="item.professionalId"></el-option> |
|
||||||
</el-select> |
|
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
<el-col :span="4"> |
|
||||||
<el-form-item label="课程类别"> |
|
||||||
<el-select v-model="form.curriculumType" clearable @change="getData()"> |
|
||||||
<el-option v-for="(item, i) in courseTypeStatus" :key="i" :label="item" :value="i"></el-option> |
|
||||||
</el-select> |
|
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
<el-col :span="6"> |
|
||||||
<el-form-item> |
|
||||||
<el-input placeholder="请输入课程名称" prefix-icon="el-icon-search" v-model="form.curriculumName" clearable |
|
||||||
@keyup.enter.native="onSearch"></el-input> |
|
||||||
</el-form-item> |
|
||||||
</el-col> |
|
||||||
</el-form> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</el-card> |
|
||||||
|
|
||||||
<el-card shadow="hover" class="card"> |
|
||||||
<div class="flex-between mgb20"> |
|
||||||
<div class="flex-center"> |
|
||||||
<p class="hr_tag"></p> |
|
||||||
<span>课程列表</span> |
|
||||||
</div> |
|
||||||
<div> |
|
||||||
<el-button type="primary" round @click="addcourse" v-auth="'/curriculum:新增课程'">新增课程</el-button> |
|
||||||
<el-button type="primary" round @click="delAllSelection" v-auth="'/curriculum:批量删除'">批量删除</el-button> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<el-table v-loading="loading" :data="courseData" class="table" ref="table" header-align="center" |
|
||||||
@selection-change="handleSelectionChange" row-key="cid"> |
|
||||||
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
||||||
<el-table-column type="index" width="70" label="序号" align="center"></el-table-column> |
|
||||||
<el-table-column prop="curriculumName" label="课程名称" align="center"></el-table-column> |
|
||||||
<el-table-column prop="curriculumType" label="课程类别" width="90" align="center"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<span class="ellipsis">{{ courseTypeStatus[scope.row.curriculumType] }}</span> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column label="配置的系统" align="center"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<span class="ellipsis">{{ scope.row.sysName }}</span> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column prop="expectedCourse" label="预计课时" width="90" align="center"></el-table-column> |
|
||||||
<el-table-column prop="orderVolume" label="订单量" width="90" align="center"></el-table-column> |
|
||||||
<el-table-column prop="userName" label="创建人" width="120" align="center"></el-table-column> |
|
||||||
<el-table-column label="上架/下架" width="90" align="center"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<el-switch v-model="scope.row.isShelves" :active-value="1" :inactive-value="0" |
|
||||||
@change="changeSwitch($event, scope.row)" v-auth="'/curriculum:上下架'"> |
|
||||||
</el-switch> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column label="操作" width="240" align="center"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<el-button type="text" @click="preview(scope.row)">预览课程</el-button> |
|
||||||
<el-button type="text" @click="edit(scope.row)" v-auth="'/curriculum:编辑'">编辑</el-button> |
|
||||||
<el-button type="text" @click="config(scope.row)" v-auth="'/curriculum:内容设置'">内容设置</el-button> |
|
||||||
<el-button type="text" @click="copy(scope.row)">复制</el-button> |
|
||||||
<el-button type="text" @click="handleDelete(scope.row)" v-auth="'/curriculum:删除'">删除</el-button> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
</el-table> |
|
||||||
<div class="pagination"> |
|
||||||
<el-pagination background @current-change="handleCurrentChange" :current-page="page" |
|
||||||
layout="total, prev, pager, next" :total="totals"></el-pagination> |
|
||||||
</div> |
|
||||||
</el-card> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
import Setting from '@/setting' |
|
||||||
import qs from 'qs' |
|
||||||
import Util from '@/libs/util' |
|
||||||
export default { |
|
||||||
data () { |
|
||||||
return { |
|
||||||
courseTypeStatus: { |
|
||||||
0: '理论课程', |
|
||||||
1: '实训课程', |
|
||||||
2: '理实课程', |
|
||||||
}, |
|
||||||
name: localStorage.getItem("ms_username"), |
|
||||||
courseData: [], |
|
||||||
form: { |
|
||||||
categoryId: +this.$route.query.categoryId || '', |
|
||||||
professionalCategoryId: +this.$route.query.professionalCategoryId || '', |
|
||||||
professionalId: +this.$route.query.professionalId || '', |
|
||||||
curriculumType: this.$route.query.curriculumType || '', |
|
||||||
curriculumName: this.$route.query.curriculumName || '' |
|
||||||
}, |
|
||||||
page: +this.$route.query.page || 1, |
|
||||||
pageSize: 10, |
|
||||||
totals: 0, |
|
||||||
subjectList: [], // 学科类别 |
|
||||||
ProfessionalClassList: [], // 专业类 |
|
||||||
ProfessionalList: [], // 专业 |
|
||||||
multipleSelection: [], |
|
||||||
loading: false, |
|
||||||
searchTimer: null |
|
||||||
}; |
|
||||||
}, |
|
||||||
watch: { |
|
||||||
"form.curriculumName": function (val) { |
|
||||||
clearTimeout(this.searchTimer); |
|
||||||
this.searchTimer = setTimeout(() => { |
|
||||||
this.initData(); |
|
||||||
}, 500); |
|
||||||
} |
|
||||||
}, |
|
||||||
mounted () { |
|
||||||
this.getSubject(); |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
async getData () { |
|
||||||
try { |
|
||||||
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理') |
|
||||||
this.loading = true |
|
||||||
const { page } = await this.$post(this.api.curriculumList, { |
|
||||||
...this.form, |
|
||||||
pageNum: this.page, |
|
||||||
pageSize: this.pageSize, |
|
||||||
supplierId: sid ? sid.supplierId : '', |
|
||||||
platformId: Setting.platformId |
|
||||||
}) |
|
||||||
this.courseData = page.records |
|
||||||
this.totals = page.total |
|
||||||
this.loading = false |
|
||||||
} finally { |
|
||||||
this.loading = false |
|
||||||
} |
|
||||||
}, |
|
||||||
initData () { |
|
||||||
this.page = 1; |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
// 获取学科类别 |
|
||||||
async getSubject () { |
|
||||||
const { list } = await this.$get(this.api.courseDiscipline) |
|
||||||
this.subjectList = list |
|
||||||
this.form.professionalCategoryId && this.getProfessionalClassData() |
|
||||||
}, |
|
||||||
// 清除学科类别 |
|
||||||
clearClass () { |
|
||||||
this.form.professionalCategoryId = '' |
|
||||||
this.form.professionalId = '' |
|
||||||
}, |
|
||||||
// 获取专业类 |
|
||||||
getProfessionalClass () { |
|
||||||
this.clearClass(); |
|
||||||
this.getProfessionalClassData(); |
|
||||||
this.page = 1; |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
async getProfessionalClassData () { |
|
||||||
const { list } = await this.$get(this.api.courseProfessionalClass, { |
|
||||||
disciplineId: this.form.categoryId |
|
||||||
}) |
|
||||||
this.ProfessionalClassList = list |
|
||||||
this.form.professionalId && this.getProfessionalData() |
|
||||||
}, |
|
||||||
// 清除专业类 |
|
||||||
clearProfess () { |
|
||||||
this.form.professionalId = '' |
|
||||||
}, |
|
||||||
// 获取专业 |
|
||||||
getProfessional () { |
|
||||||
this.clearProfess(); |
|
||||||
this.getProfessionalData(); |
|
||||||
this.page = 1; |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
async getProfessionalData () { |
|
||||||
const { list } = await this.$get(this.api.courseProfessional, { |
|
||||||
professionalClassId: this.form.professionalCategoryId |
|
||||||
}) |
|
||||||
this.ProfessionalList = list |
|
||||||
}, |
|
||||||
// 缓存当前页面和参数,详情页返回到列表的时候直接取该url |
|
||||||
setReferrer () { |
|
||||||
this.$store.commit('setReferrer', `${this.$route.path}?${qs.stringify(this.form)}&page=${this.page}`) |
|
||||||
}, |
|
||||||
// 新建课程 |
|
||||||
addcourse () { |
|
||||||
this.setReferrer() |
|
||||||
this.$router.push("/curriculum/detail"); |
|
||||||
}, |
|
||||||
// 编辑 |
|
||||||
edit (row) { |
|
||||||
this.setReferrer() |
|
||||||
this.$router.push(`/curriculum/detail?cid=${row.cid}`); |
|
||||||
}, |
|
||||||
// 预览 |
|
||||||
preview (row) { |
|
||||||
this.setReferrer() |
|
||||||
this.$router.push(`/station?courseId=${row.cid || ''}&curriculumName=${encodeURIComponent(row.curriculumName)}&mallId=${row.mallId || ''}`) |
|
||||||
}, |
|
||||||
// 内容设置 |
|
||||||
config (row) { |
|
||||||
this.setReferrer() |
|
||||||
this.$router.push(`/curriculum/content?cid=${row.cid}&name=${row.curriculumName}`); |
|
||||||
}, |
|
||||||
// 复制 |
|
||||||
async copy (row) { |
|
||||||
this.$confirm('确定要复制吗', "提示", { |
|
||||||
type: "warning" |
|
||||||
}).then(async () => { |
|
||||||
await this.$post(`${this.api.copySelfBuildCourse}?cid=${row.cid}`) |
|
||||||
Util.successMsg('复制成功') |
|
||||||
this.initData() |
|
||||||
}).catch(() => { }) |
|
||||||
|
|
||||||
return |
|
||||||
this.$router.push(`/curriculum/detail?cid=${row.cid}©=1`) |
|
||||||
}, |
|
||||||
// 删除 |
|
||||||
handleDelete (row) { |
|
||||||
this.$post(`${this.api.deleteCoursePrompt}?cids=${row.cid}`).then(({ status }) => { |
|
||||||
if (status === 200) { |
|
||||||
this.$confirm("确定要删除吗?", "提示", { |
|
||||||
type: "warning" |
|
||||||
}).then(() => { |
|
||||||
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => { |
|
||||||
this.getData(); |
|
||||||
this.$message.success("删除成功"); |
|
||||||
}).catch(err => { }) |
|
||||||
}).catch(() => { |
|
||||||
}); |
|
||||||
} |
|
||||||
}).catch(err => { }) |
|
||||||
}, |
|
||||||
// 处理多选 |
|
||||||
handleSelectionChange (val) { |
|
||||||
this.multipleSelection = val; |
|
||||||
}, |
|
||||||
// 批量删除 |
|
||||||
delAllSelection () { |
|
||||||
if (this.multipleSelection.length) { |
|
||||||
let cids = [] |
|
||||||
this.multipleSelection.forEach(i => { |
|
||||||
cids.push('cids=' + i.cid) |
|
||||||
}); |
|
||||||
this.$post(`${this.api.deleteCoursePrompt}?${cids.join('&')}`).then(({ status }) => { |
|
||||||
if (status === 200) { |
|
||||||
this.$confirm("确定要删除吗?", "提示", { |
|
||||||
type: "warning" |
|
||||||
}).then(() => { |
|
||||||
let ids = this.multipleSelection.map(i => i.cid); |
|
||||||
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => { |
|
||||||
if (ids.length == this.courseData.length) { |
|
||||||
if (this.page > 1) { |
|
||||||
this.page = this.page - 1 |
|
||||||
} |
|
||||||
} |
|
||||||
this.getData(); |
|
||||||
this.$message.success("删除成功"); |
|
||||||
this.$refs.table.clearSelection() |
|
||||||
}).catch(err => { }) |
|
||||||
}).catch(() => { }) |
|
||||||
} |
|
||||||
}).catch(err => { }) |
|
||||||
} else { |
|
||||||
this.$message.warning("请先选择课程 !"); |
|
||||||
} |
|
||||||
}, |
|
||||||
// 处理页码切换 |
|
||||||
handleCurrentChange (val) { |
|
||||||
this.page = val; |
|
||||||
this.$router.push(`/curriculum?page=${val}`) |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
// 课程名称条件搜索 |
|
||||||
onSearch () { |
|
||||||
this.page = 1; |
|
||||||
this.getData(); |
|
||||||
}, |
|
||||||
// 上下架 |
|
||||||
changeSwitch (value, row) { |
|
||||||
this.$post(`${this.api.isShelves}?cid=${row.cid}&isShelves=${value}`).then((res) => { |
|
||||||
this.getData(); |
|
||||||
this.$message.success("修改上下架状态成功!"); |
|
||||||
}).catch((res) => { |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
|
|
||||||
<style scoped> |
|
||||||
.card { |
|
||||||
min-height: calc(100vh - 300px); |
|
||||||
} |
|
||||||
</style> |
|
@ -1,251 +0,0 @@ |
|||||||
<template> |
|
||||||
<div class="page"> |
|
||||||
<div style="margin-bottom: 10px;text-align: right;"> |
|
||||||
<el-button v-auth="'/shop:营销推广管理:新增'" type="primary" round @click="add">新增</el-button> |
|
||||||
</div> |
|
||||||
<el-table :data="list" class="table" ref="table" header-align="center" row-key="id"> |
|
||||||
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
||||||
<el-table-column prop="courseName" label="图片" min-width="150" align="center"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<img width="100" :src="scope.row.banner" alt=""> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
<el-table-column prop="title" label="标题" min-width="150" align="center"></el-table-column> |
|
||||||
<el-table-column prop="subheading" label="副标题" min-width="150" align="center"></el-table-column> |
|
||||||
<el-table-column prop="url" label="链接" min-width="150" align="center"></el-table-column> |
|
||||||
<el-table-column label="操作" align="center" width="250"> |
|
||||||
<template slot-scope="scope"> |
|
||||||
<el-switch v-model="scope.row.isOpen" :active-value="0" :inactive-value="1" |
|
||||||
@change="switchOff($event, scope.row)" v-auth="'/shop:营销推广管理:禁用'"> |
|
||||||
</el-switch> |
|
||||||
<el-button style="margin-left: 10px;" v-auth="'/shop:营销推广管理:编辑'" type="text" |
|
||||||
@click="edit(scope.row)">编辑</el-button> |
|
||||||
<el-button v-auth="'/shop:营销推广管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
|
||||||
</template> |
|
||||||
</el-table-column> |
|
||||||
</el-table> |
|
||||||
|
|
||||||
<el-dialog :title="(form.id ? '编辑' : '新增') + 'banner'" :visible.sync="bannerVisible" width="500px" class="dialog" |
|
||||||
:close-on-click-modal="false"> |
|
||||||
<el-form ref="form" label-width="60px"> |
|
||||||
<el-form-item label="图片"> |
|
||||||
<el-upload class="avatar-uploader" accept=".jpg,.png,.jpeg,.gif" :on-change="changeFile" |
|
||||||
:show-file-list="false" action="" :auto-upload="false"> |
|
||||||
<img v-if="form.banner" :src="form.banner" class="avatar"> |
|
||||||
<div class="uploader-default" v-else> |
|
||||||
<i class="el-icon-plus"></i> |
|
||||||
<p>上传图片</p> |
|
||||||
</div> |
|
||||||
</el-upload> |
|
||||||
</el-form-item> |
|
||||||
<el-form-item label="标题"> |
|
||||||
<el-input v-model="form.title" placeholder="请输入标题" maxlength="100"></el-input> |
|
||||||
</el-form-item> |
|
||||||
<el-form-item label="副标题"> |
|
||||||
<el-input v-model="form.subheading" placeholder="请输入副标题" maxlength="100"></el-input> |
|
||||||
</el-form-item> |
|
||||||
<el-form-item label="链接"> |
|
||||||
<el-input v-model="form.url" placeholder="请输入链接" maxlength="100"></el-input> |
|
||||||
</el-form-item> |
|
||||||
</el-form> |
|
||||||
<span slot="footer" class="dialog-footer"> |
|
||||||
<el-button @click="bannerVisible = false">取消</el-button> |
|
||||||
<el-button type="primary" @click="submitBanner">确定</el-button> |
|
||||||
</span> |
|
||||||
</el-dialog> |
|
||||||
|
|
||||||
<!-- 剪裁组件弹窗 --> |
|
||||||
<el-dialog title="图片裁剪" append-to-body :visible.sync="cropperModel" width="1100px" :close-on-click-modal="false"> |
|
||||||
<Cropper ref="cropper" :img-file.sync="file" :is-upload="isUpload" :fixed="true" :fixedNumber.sync="fixedNumber" |
|
||||||
:autoCropWidth="500" :autoCropHeight="138.8" @upload="customUpload" /> |
|
||||||
</el-dialog> |
|
||||||
</div> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
|
||||||
import Util from "@/libs/util"; |
|
||||||
import Setting from '@/setting' |
|
||||||
import Cropper from '@/components/img-upload/Cropper' |
|
||||||
import Axios from 'axios' |
|
||||||
import Oss from '@/components/upload/upload.js' |
|
||||||
export default { |
|
||||||
data () { |
|
||||||
return { |
|
||||||
headers: { |
|
||||||
token: sessionStorage.getItem("token") |
|
||||||
}, |
|
||||||
list: [], |
|
||||||
bannerVisible: false, |
|
||||||
form: { |
|
||||||
id: '', |
|
||||||
banner: '', |
|
||||||
title: '', |
|
||||||
subheading: '', |
|
||||||
url: '', |
|
||||||
}, |
|
||||||
cropperModel: false, |
|
||||||
isUpload: false, |
|
||||||
fixedNumber: [5.4, 1], |
|
||||||
file: '' |
|
||||||
}; |
|
||||||
}, |
|
||||||
components: { |
|
||||||
Cropper |
|
||||||
}, |
|
||||||
mounted () { |
|
||||||
this.getList() |
|
||||||
}, |
|
||||||
methods: { |
|
||||||
getList () { |
|
||||||
this.$post(this.api.listMarketing, { |
|
||||||
pageNum: 1, |
|
||||||
pageSize: 1000 |
|
||||||
}).then(({ page }) => { |
|
||||||
this.list = page.records; |
|
||||||
this.total = page.total; |
|
||||||
}).catch(res => { |
|
||||||
}); |
|
||||||
}, |
|
||||||
// 图片裁剪上传事件 |
|
||||||
customUpload (data) { |
|
||||||
data.name = this.file.name |
|
||||||
this.imgUpload(data) |
|
||||||
}, |
|
||||||
// 图片上传到服务器 |
|
||||||
imgUpload (formData) { |
|
||||||
this.isUpload = true |
|
||||||
Oss.upload(formData).then(res => { |
|
||||||
this.form.banner && Oss.del(this.form.banner) |
|
||||||
this.form.banner = res.url |
|
||||||
}) |
|
||||||
this.$refs.cropper.isDisabled = false |
|
||||||
this.isUpload = false |
|
||||||
this.cropperModel = false |
|
||||||
}, |
|
||||||
// 图片改变钩子 |
|
||||||
changeFile (file) { |
|
||||||
const { size, name } = file |
|
||||||
const ext = name.substring(name.lastIndexOf('.') + 1) |
|
||||||
if (!Util.isImg(ext)) { |
|
||||||
this.$message.error('请上传图片!') |
|
||||||
return false |
|
||||||
} |
|
||||||
this.file = file |
|
||||||
this.cropperModel = true |
|
||||||
this.$nextTick(() => { |
|
||||||
this.$refs.cropper.updateImg({ |
|
||||||
url: window.URL.createObjectURL(file.raw), |
|
||||||
size: file.size |
|
||||||
}) |
|
||||||
}) |
|
||||||
}, |
|
||||||
add () { |
|
||||||
this.form = { |
|
||||||
id: '', |
|
||||||
banner: '', |
|
||||||
title: '', |
|
||||||
subheading: '', |
|
||||||
url: '', |
|
||||||
} |
|
||||||
this.bannerVisible = true |
|
||||||
}, |
|
||||||
edit (row) { |
|
||||||
this.form = JSON.parse(JSON.stringify(row)) |
|
||||||
this.bannerVisible = true |
|
||||||
}, |
|
||||||
// banner弹框提交 |
|
||||||
submitBanner () { |
|
||||||
const { form } = this |
|
||||||
if (!form.banner) return Util.errorMsg('请上传图片') |
|
||||||
this.$post(this.api[form.id ? 'updateMarketing' : 'saveMarketing'], form).then(res => { |
|
||||||
this.getList() |
|
||||||
this.bannerVisible = false |
|
||||||
}).catch(res => { }) |
|
||||||
}, |
|
||||||
handleDelete (row) { |
|
||||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
||||||
type: "warning" |
|
||||||
}) |
|
||||||
.then(() => { |
|
||||||
this.$post(`${this.api.delMarketing}?ids=${row.id}`).then(res => { |
|
||||||
Util.successMsg("删除成功"); |
|
||||||
this.getList(); |
|
||||||
}).catch(res => { |
|
||||||
}); |
|
||||||
}) |
|
||||||
.catch(() => { |
|
||||||
}); |
|
||||||
}, |
|
||||||
switchOff (val, row) { |
|
||||||
this.$post(`${this.api.bannerEnableOrDisable}?id=${row.id}&isDisable=${row.isOpen}`).then(res => { }).catch(err => { }) |
|
||||||
} |
|
||||||
} |
|
||||||
}; |
|
||||||
</script> |
|
||||||
|
|
||||||
<style lang="scss" scoped> |
|
||||||
.m-l-10 { |
|
||||||
margin-left: 10px; |
|
||||||
} |
|
||||||
|
|
||||||
$avatar-width: 104px; |
|
||||||
|
|
||||||
/deep/ .avatar-uploader { |
|
||||||
.el-upload { |
|
||||||
position: relative; |
|
||||||
width: $avatar-width; |
|
||||||
height: $avatar-width; |
|
||||||
border: 1px dashed #d9d9d9; |
|
||||||
border-radius: 2px; |
|
||||||
cursor: pointer; |
|
||||||
overflow: hidden; |
|
||||||
|
|
||||||
&:hover { |
|
||||||
border-color: #409eff; |
|
||||||
} |
|
||||||
|
|
||||||
.uploader-default { |
|
||||||
display: flex; |
|
||||||
flex-direction: column; |
|
||||||
justify-content: center; |
|
||||||
width: $avatar-width !important; |
|
||||||
height: $avatar-width; |
|
||||||
text-align: center; |
|
||||||
background: rgba(0, 0, 0, 0.04); |
|
||||||
|
|
||||||
i { |
|
||||||
font-size: 20px; |
|
||||||
font-weight: bold; |
|
||||||
color: #8c939d; |
|
||||||
} |
|
||||||
|
|
||||||
p { |
|
||||||
margin-top: 10px; |
|
||||||
font-size: 14px; |
|
||||||
color: rgba(0, 0, 0, 0.65); |
|
||||||
line-height: 1; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.avatar { |
|
||||||
width: $avatar-width; |
|
||||||
height: $avatar-width; |
|
||||||
display: block; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
.el-upload__tip { |
|
||||||
margin-top: 0; |
|
||||||
|
|
||||||
p { |
|
||||||
font-size: 14px; |
|
||||||
color: rgba(0, 0, 0, 0.45); |
|
||||||
line-height: 1; |
|
||||||
|
|
||||||
&:first-child { |
|
||||||
margin-bottom: 5px; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|