master
yujialong 2 years ago
parent caf1587264
commit 982ec52326
  1. 29559
      public/UEditor/ueditor.all.js
  2. 29564
      public/UEditor/ueditor.all.min.js
  3. 18
      public/UEditor/ueditor.all.min1.js
  4. 2
      public/UEditor/ueditor.config.js
  5. 7
      src/api/index.js
  6. 4
      src/layouts/header/index.vue
  7. 60
      src/layouts/navbar/index.vue
  8. 4
      src/libs/auth/generateBtnPermission.js
  9. 12
      src/libs/route/addRoutes.js
  10. 12
      src/pages/account/login/index.vue
  11. 45
      src/pages/annex/list/index.vue
  12. 113
      src/pages/article/add/index.vue
  13. 63
      src/pages/article/list/index.vue
  14. 63
      src/pages/column/add/index.vue
  15. 17
      src/pages/column/list/index.vue
  16. 263
      src/pages/course/add/index.vue
  17. 888
      src/pages/course/contentSettings/index.vue
  18. 222
      src/pages/course/list/courseManagement/index.vue
  19. 63
      src/pages/course/list/index.vue
  20. 166
      src/pages/course/list/sortManagement/index.vue
  21. 502
      src/pages/course/preview/index.vue
  22. 15
      src/pages/page/list/index.vue
  23. 36
      src/pages/role/list/index.vue
  24. 17
      src/pages/setting/list/index.vue
  25. 812
      src/pages/setting/list/info.vue
  26. 70
      src/pages/site/list/index.vue
  27. 54
      src/pages/user/list/index.vue
  28. 10
      src/pages/userGroup/list/index.vue
  29. 2
      src/plugins/requests/index.js
  30. 8
      src/setting.js
  31. 15
      src/store/modules/auth.js
  32. 6
      src/store/modules/content.js
  33. 16
      src/store/modules/user.js
  34. 5
      src/styles/common.scss

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -30,7 +30,7 @@
UEDITOR_HOME_URL: URL UEDITOR_HOME_URL: URL
// 服务器统一请求接口路径 // 服务器统一请求接口路径
, serverUrl: URL + "jsp/controller.jsp" , serverUrl: URL + "iasf/sysFiles/upload"
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
, toolbars: [[ , toolbars: [[

@ -1,6 +1,6 @@
import Setting from "@/setting"; import Setting from '@/setting'
const host = Setting.apiBaseURL const host = Setting.apiBaseURL
const host1 = 'http://192.168.31.151:10000/' const host1 = 'http://192.168.31.136:10000/'
export default { export default {
logins: `iasf/sys/user/login`, logins: `iasf/sys/user/login`,
@ -13,6 +13,7 @@ export default {
depts: `iasf/sys/dept/tree`, depts: `iasf/sys/dept/tree`,
users: `iasf/sys/users`, users: `iasf/sys/users`,
user: `iasf/sys/user`, user: `iasf/sys/user`,
staffTemplate: `http://192.168.31.137:10000/iasf/sysFiles/preview/1559385019981807617`,
checkJobNumber: `iasf/sys/checkJobNumber`, checkJobNumber: `iasf/sys/checkJobNumber`,
checkUsername: `iasf/sys/checkUsername`, checkUsername: `iasf/sys/checkUsername`,
resetPwd: `iasf/sys/resetPwd`, resetPwd: `iasf/sys/resetPwd`,
@ -25,6 +26,8 @@ export default {
groupDel: `iasf/sys/userGroup/delete`, groupDel: `iasf/sys/userGroup/delete`,
groupList: `iasf/sys/userGroup/list`, groupList: `iasf/sys/userGroup/list`,
groupUpdate: `iasf/sys/userGroup/update`, groupUpdate: `iasf/sys/userGroup/update`,
site: `iasf/sys/site/list`,
updateSite: `iasf/sys/site/update`,
listWithTree: `${host1}iasf/sysColumn/listWithTree`, listWithTree: `${host1}iasf/sysColumn/listWithTree`,
saveColumn: `${host1}iasf/sysColumn/save`, saveColumn: `${host1}iasf/sysColumn/save`,
updateColumn: `${host1}iasf/sysColumn/update`, updateColumn: `${host1}iasf/sysColumn/update`,

@ -19,7 +19,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
<img class="cp" src="@/assets/img/notice.png"> <!-- <img class="cp" src="@/assets/img/notice.png"> -->
<el-dropdown class="user-wrap" @command="userCommand"> <el-dropdown class="user-wrap" @command="userCommand">
<div class="user"> <div class="user">
<el-avatar :size="24" :src="avatar"></el-avatar> <el-avatar :size="24" :src="avatar"></el-avatar>
@ -67,7 +67,6 @@ export default {
}, },
mounted() { mounted() {
this.setContent() this.setContent()
// this.getUserDetail()
}, },
methods: { methods: {
...mapActions("user", [ ...mapActions("user", [
@ -84,6 +83,7 @@ export default {
// //
siteCommand(e) { siteCommand(e) {
this.setSite(e) this.setSite(e)
this.$route.path === '/page/list' || this.$router.push('/page')
location.reload() location.reload()
}, },
// //

@ -3,7 +3,7 @@
<div v-show="!collapse" class="flex-1"> <div v-show="!collapse" class="flex-1">
<div class="logo"> <div class="logo">
<img src="@/assets/img/logo.png" alt=""> <img src="@/assets/img/logo.png" alt="">
<span>粒子研究院中文站点</span> <span>网站管理后台</span>
</div> </div>
<el-menu <el-menu
:default-active="active" :default-active="active"
@ -49,7 +49,7 @@
</ul> </ul>
</div> </div>
<div class="col-menu"> <div class="col-menu">
<div class="name">{{ this.$store.state.content.site.name }}</div> <div class="name">{{ site.siteName }}</div>
<el-menu <el-menu
v-if="colRefresh" v-if="colRefresh"
:default-active="siteActive" :default-active="siteActive"
@ -89,17 +89,17 @@
</template> </template>
<script> <script>
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from 'vuex'
import Setting from '@/setting' import Setting from '@/setting'
import addRoutes from '@/libs/route/addRoutes'
export default { export default {
data() { data() {
return { return {
site: this.$store.state.content.site,
collapse: false, collapse: false,
active: this.$route.path, active: this.$route.path,
siteActive: '/page', siteActive: '/page',
reloadSite: true, menus: [],
menus: [ defaultMenus: [
{ {
icon: 'site', icon: 'site',
index: '/site/list', index: '/site/list',
@ -165,26 +165,17 @@ export default {
] ]
} }
], ],
colRefresh: true, colRefresh: true
actives: {
dashboard: ["add"],
}
}; };
}, },
computed: { computed: {
...mapState('auth', [ ...mapState('auth', [
'routes' 'btns'
]) ])
}, },
watch: { watch: {
"$route"(to, from) { "$route"(to, from) {
let actives = this.actives; this.active = `/${this.$route.path.split('/')[1]}/list`
for (let i in this.actives) {
if (actives[i].includes(this.$route.name)) this.active = `/${i}/list`;
}
let arr=this.$route.path.split("/");
let name = `/${arr[1]}/list`
this.active = name
const { path } = this.$route const { path } = this.$route
const ori = this.collapse const ori = this.collapse
this.collapse = !!this.sites[0].subs.find(e => path.includes(e.index)) this.collapse = !!this.sites[0].subs.find(e => path.includes(e.index))
@ -196,13 +187,14 @@ export default {
this.colRefresh = true this.colRefresh = true
}) })
} }
this.site = this.$store.state.content.site
} }
}, },
created() { created() {
const { path } = this.$route const { path } = this.$route
this.collapse = !!this.sites[0].subs.find(e => path.includes(e.index)) this.collapse = !!this.sites[0].subs.find(e => path.includes(e.index))
if (this.collapse) this.siteActive = '/' + path.split('/')[1] if (this.collapse) this.siteActive = '/' + path.split('/')[1]
// this.getPer() this.initMenu()
}, },
methods: { methods: {
...mapActions('user', [ ...mapActions('user', [
@ -213,26 +205,30 @@ export default {
this.collapse = false this.collapse = false
if (index.includes('/')) { if (index.includes('/')) {
this.$router.push(index) this.$router.push(index)
} else {
this.active = '/user/list'
this.$router.push('/user/list')
} }
}, },
// //
getPer() {
this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => {
const routes = res.permissionMenu[0].children
addRoutes(routes)
this.initMenu()
}).catch(({ status }) => {
status === 500 && this.logout()
})
},
initMenu() { initMenu() {
// store // store
if (Setting.dynamicRoute) { if (Setting.dynamicRoute) {
const { routes } = this const { btns } = this
const menus = [] const menus = []
this.defaultMenus.map(e => { this.defaultMenus.map(e => {
routes.find(n => n.path === e.index) && menus.push(e) if (btns.find(n => n.includes(e.index) || n === e.title)) {
}); //
if (e.subs && e.subs.length) {
const children = []
e.subs.map((j, i) => {
btns.find(n => n.includes(j.index)) && children.push(j)
})
e.subs = children
}
menus.push(e)
}
})
this.menus = menus this.menus = menus
} else { } else {
this.menus = this.defaultMenus this.menus = this.defaultMenus

@ -8,7 +8,7 @@ const result = []
// 递归组合权限 // 递归组合权限
function createAuth(data, auth) { function createAuth(data, auth) {
data.map(e => { data.map(e => {
const text = (auth ? auth + ':' : '') + (auth ? e.name : e.path) // 第一级是路由,取path,子级取name const text = (auth ? auth + ':' : '') + (auth ? e.name : e.url) // 第一级是路由,取path,子级取name
result.push(text) result.push(text)
e.children && e.children.length && createAuth(e.children, text) e.children && e.children.length && createAuth(e.children, text)
}) })
@ -16,5 +16,5 @@ function createAuth(data, auth) {
export default function(data) { export default function(data) {
createAuth(data) createAuth(data)
store.dispatch('auth/addBtnAuth', result) store.commit('auth/addBtnAuth', result)
} }

@ -10,10 +10,10 @@ function createMeta(item) {
function createRoute(data) { function createRoute(data) {
data.map(e => { data.map(e => {
const { path } = e const { url } = e
// 有path则添加到路由里 // 有path则添加到路由里
path && newRoutes.push({ url && newRoutes.push({
path, path: url,
meta: createMeta(e) meta: createMeta(e)
}) })
// 递归生成路由集合 // 递归生成路由集合
@ -22,7 +22,7 @@ function createRoute(data) {
} }
export default function(data, path) { export default function(data, path) {
generateBtnPermission(data); generateBtnPermission(data)
createRoute(data); // createRoute(data)
store.dispatch("auth/addRoutes", newRoutes); // store.commit('auth/addRoutes', newRoutes)
} }

@ -62,10 +62,11 @@
</template> </template>
<script> <script>
import { mapActions, mapMutations } from 'vuex' import { mapMutations } from 'vuex'
import vFooter from '@/layouts/footer' import vFooter from '@/layouts/footer'
import util from '@/libs/util' import util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
import addRoutes from '@/libs/route/addRoutes'
export default { export default {
data: function() { data: function() {
return { return {
@ -103,8 +104,8 @@ export default {
}); });
}, },
methods: { methods: {
...mapMutations("user", [ ...mapMutations('user', [
'SET_USERID', 'SET_USERNAME' 'setUserId', 'setUserName'
]), ]),
getVerImg() { // getVerImg() { //
this.loginForm.random = Math.floor(Math.random() * 999999999); this.loginForm.random = Math.floor(Math.random() * 999999999);
@ -120,9 +121,10 @@ export default {
if (valid) { if (valid) {
this.$post(this.api.logins, this.loginForm).then(({ data }) => { this.$post(this.api.logins, this.loginForm).then(({ data }) => {
util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires) util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires)
addRoutes(data.permissionList[0].children)
util.successMsg('登录成功') util.successMsg('登录成功')
this.SET_USERID(data.id) this.setUserId(data.id)
this.SET_USERNAME(data.username) this.setUserName(data.username)
this.$router.push('/site') this.$router.push('/site')
}).catch(res => { }).catch(res => {
this.getVerImg() this.getVerImg()

@ -9,8 +9,8 @@
<el-option <el-option
v-for="item in sites" v-for="item in sites"
:key="item.id" :key="item.id"
:label="item.name" :label="item.siteName"
:value="item.id"> :value="item.siteName">
</el-option> </el-option>
</el-select> </el-select>
</li> </li>
@ -37,7 +37,7 @@
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<el-input class="keyword" placeholder="请输入文章名称" v-model.trim="keyword" clearable></el-input> <el-input class="keyword" :placeholder="'请输入' + keywords.find(e => e.id === field).name" v-model.trim="keyword" clearable></el-input>
</div> </div>
<div class="actions"> <div class="actions">
<el-button @click="batchDel">删除</el-button> <el-button @click="batchDel">删除</el-button>
@ -47,12 +47,13 @@
<el-table ref="table" :data="list" class="table" header-align="center" @selection-change="handleSelectionChange" row-key="id"> <el-table ref="table" :data="list" class="table" header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true" :selectable="row => !row.quote"></el-table-column> <el-table-column type="selection" width="50" align="center" :reserve-selection="true" :selectable="row => !row.quote"></el-table-column>
<el-table-column type="index" width="60" label="ID"></el-table-column> <el-table-column type="index" width="60" label="ID"></el-table-column>
<el-table-column prop="site" label="站点名称" min-width="180"></el-table-column> <el-table-column prop="site" label="站点" min-width="180"></el-table-column>
<el-table-column prop="type" label="文件类型" min-width="100"></el-table-column> <el-table-column prop="fileName" label="名称" min-width="180"></el-table-column>
<el-table-column prop="format" label="格式" min-width="100"></el-table-column> <el-table-column prop="type" label="文件类型" min-width="80"></el-table-column>
<el-table-column prop="fileSize" label="大小" min-width="100"> <el-table-column prop="format" label="格式" min-width="80"></el-table-column>
<el-table-column prop="fileSize" label="大小" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.fileSize }}kb {{ (scope.row.fileSize / 1000).toFixed(2) }}kb
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createDate" label="上传时间" min-width="150"></el-table-column> <el-table-column prop="createDate" label="上传时间" min-width="150"></el-table-column>
@ -63,10 +64,11 @@
{{ scope.row.quote ? '是' : '否' }} {{ scope.row.quote ? '是' : '否' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="170"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" :disabled="scope.row.quote !== ''" @click="del(scope.row)">删除</el-button> <el-button type="text" @click="show(scope.row, 'edit')">查看</el-button>
<el-button type="text" @click="download(scope.row, 'edit')">下载</el-button> <el-button v-auth type="text" :disabled="scope.row.quote !== ''" @click="del(scope.row)">删除</el-button>
<el-button v-auth type="text" @click="download(scope.row)">下载</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -78,11 +80,10 @@
<script> <script>
import util from '@/libs/util' import util from '@/libs/util'
import ColumnConst from '@/const/column'
export default { export default {
data() { data() {
return { return {
sites: ColumnConst.sites, sites: [],
types: [ types: [
{ {
name: '不限' name: '不限'
@ -133,12 +134,13 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '附件管理' name: '附件管理'
} }
]) ])
this.getData() this.getData()
this.getSite()
}, },
methods: { methods: {
getData() { getData() {
@ -156,11 +158,26 @@ export default {
this.total = +data.total this.total = +data.total
}).catch(err => {}) }).catch(err => {})
}, },
//
getSite() {
this.$post(this.api.site, {
page: 1,
limit: 1000,
siteName: ''
}).then(({ data }) => {
this.sites = data.records
}).catch(e => {})
},
initData() { initData() {
this.$refs.table.clearSelection() this.$refs.table.clearSelection()
this.page = 1 this.page = 1
this.getData() this.getData()
}, },
//
show(row) {
const format = row.format
window.open((util.isDoc(format) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + row.url)
},
// //
download(row) { download(row) {
util.downloadFile(row.fileName, row.url) util.downloadFile(row.fileName, row.url)

@ -1,6 +1,6 @@
<template> <template>
<div class="page"> <div class="page">
<p class="page-name mb">新增栏目</p> <p class="page-name mb">{{ }}栏目</p>
<el-form :model="form" :rules="rules" class="input-form model" label-width="140px"> <el-form :model="form" :rules="rules" class="input-form model" label-width="140px">
<el-form-item prop="title" label="标题"> <el-form-item prop="title" label="标题">
<el-input <el-input
@ -73,7 +73,7 @@
:action="this.api.upload" :action="this.api.upload"
:data="{ :data="{
quote: form.title, quote: form.title,
site: '粒子研究院中文站点', site: site.siteName,
uploader: userName uploader: userName
}" }"
> >
@ -97,22 +97,30 @@
:action="this.api.upload" :action="this.api.upload"
:data="{ :data="{
quote: form.title, quote: form.title,
site: '粒子研究院中文站点', site: site.siteName,
uploader: userName uploader: userName
}" }"
> >
<img v-if="form.bannerImg" :src="form.bannerImg" class="avatar"> <img v-if="form.bannerImg" :src="form.bannerImg" class="avatar-lg">
<div class="uploader-default" v-else> <div class="uploader-default" v-else>
<img class="plus" src="@/assets/img/plus.png" alt=""> <img class="plus" src="@/assets/img/plus.png" alt="">
<p>点击上传</p> <p>点击上传</p>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item class="lg" prop="articleTemplate" label="独立文章模板"> <el-form-item class="lg" prop="articleTemplate" label="文章模板">
<el-tooltip effect="dark" content="支持导入其它数据用于实验,总上传的文件大小不可以超过10M" placement="bottom"> <el-popover
<img class="info" src="@/assets/img/ques.png" alt=""> placement="top-start"
</el-tooltip> trigger="hover"
<ul class="styles"> content="默认使用栏目中设置的文章样式,如果需要为该篇文章指定专门的模板样式,可以设置此项">
<img slot="reference" class="info" src="@/assets/img/ques.png" alt="">
</el-popover>
<el-switch
v-model="form.useArticleTemplate"
:active-value="1"
:inactive-value="0">
</el-switch>
<ul v-if="form.useArticleTemplate" class="styles">
<li> <li>
<div class="review"> <div class="review">
<img src="@/assets/img/article2.png" alt=""> <img src="@/assets/img/article2.png" alt="">
@ -139,17 +147,16 @@
</el-form-item> </el-form-item>
<el-form-item prop="file" label="文件上传"> <el-form-item prop="file" label="文件上传">
<el-upload <el-upload
accept=".jpg,.png,.jpeg,.gif"
:on-remove="handleRemove" :on-remove="handleRemove"
:on-error="uploadError" :on-error="uploadError"
:on-success="uploadSuccessFile" :on-success="uploadSuccessFile"
:limit="1" :limit="1"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:show-file-list="false"
:action="this.api.upload" :action="this.api.upload"
:file-list="fileList"
:data="{ :data="{
quote: form.columnName, quote: form.title,
site: '粒子研究院中文站点', site: site.siteName,
uploader: userName uploader: userName
}" }"
> >
@ -210,7 +217,7 @@
<div class="btns"> <div class="btns">
<el-button type="primary" @click="submit(1)">发布</el-button> <el-button type="primary" @click="submit(1)">发布</el-button>
<el-button @click="preview">预览</el-button> <el-button @click="preview">预览</el-button>
<el-button v-if="!form.id" @click="submit(0)">保存草稿</el-button> <el-button @click="submit(0)">保存草稿</el-button>
<el-button @click="$router.back()">取消</el-button> <el-button @click="$router.back()">取消</el-button>
</div> </div>
</div> </div>
@ -223,7 +230,7 @@ import VueUeditorWrap from 'vue-ueditor-wrap'
export default { export default {
data() { data() {
return { return {
siteId: this.$store.state.content.site.id, site: this.$store.state.content.site,
headers: {}, headers: {},
nameRepeat: false, nameRepeat: false,
types: ColumnConst.types, types: ColumnConst.types,
@ -241,7 +248,8 @@ export default {
id: this.$route.query.id || '', id: this.$route.query.id || '',
founderId: +this.$store.state.user.userId, founderId: +this.$store.state.user.userId,
editorId: +this.$store.state.user.userId, editorId: +this.$store.state.user.userId,
articleTemplate: '', useArticleTemplate: 0,
articleTemplate: this.$route.query.columnId ? this.$store.state.content.column.detailStyle : '',
author: '', author: '',
bannerImg: '', bannerImg: '',
columnId: +this.$route.query.columnId, columnId: +this.$route.query.columnId,
@ -270,11 +278,14 @@ export default {
mainBody: [ mainBody: [
{ required: true, message: '请输入正文', trigger: 'blur' } { required: true, message: '请输入正文', trigger: 'blur' }
], ],
connectionType: [
{ required: true, message: '请选择连接类型', trigger: 'blur' }
],
}, },
editorConfig: { editorConfig: {
UEDITOR_HOME_URL: '/UEditor/', UEDITOR_HOME_URL: '/UEditor/',
initialFrameHeight: 200, initialFrameHeight: 200,
serverUrl: 'http://192.168.31.137:10000/iasf/sysFiles/upload/' // serverUrl: 'http://192.168.31.137:10000/iasf/sysFiles/upload' //
}, },
submiting: false, // submiting: false, //
updateTime: 0 updateTime: 0
@ -289,7 +300,7 @@ export default {
VueUeditorWrap VueUeditorWrap
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', name: '站点管理',
route: '/site' route: '/site'
@ -315,30 +326,56 @@ export default {
this.updateTime++ this.updateTime++
}, },
deep:true deep:true
}, }
}, },
methods: { methods: {
// //
getList() { getList() {
this.$post(this.api.listWithTree, { this.$post(this.api.listWithTree, {
siteId: this.siteId, siteId: this.site.id,
columnName: '', columnName: '',
templateId: '', templateId: '',
typeId : '', typeId : '',
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
this.$nextTick(() => { let { columnId } = this.$route.query
// this.$refs.column.setCheckedKeys(data[0].id) // idid
console.log("🚀 ~ file: index.vue ~ line 309 ~ this.$nextTick ~ his.$refs.column", this.$refs.column.setCheckedKeys) if (columnId && data.length) {
}) columnId = +columnId
let ids = []
// id
const getId = (list, parentId) => {
for (const i in list) {
const e = list[i]
if (e.id === columnId) {
ids = [...parentId, list[i].id]
break
} else {
getId(e.children, [...parentId, e.id])
}
}
}
getId(data, [])
if (!ids.length) ids = [data[0].id] // id
this.form.columnId = ids
}
}).catch(err => {}) }).catch(err => {})
}, },
// id
getId(list, ids) {
list.forEach(e => {
e.ids = ids ? [...ids, e.id] : [e.id]
e.children.length ? this.getId(e.children, e.ids) : delete e.children
})
},
// //
getData() { getData() {
this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => { this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => {
this.form = data this.form = data
if (data.articleTemplate === 3 && data.connectionType !== 2 && data.linkAddress) this.links = data.linkAddress.split(',').map(e => +e) if (data.articleTemplate === 3 && data.connectionType !== 2 && data.linkAddress) this.links = data.linkAddress.split(',').map(e => +e)
this.originalName = data.title this.originalName = data.title
const { file } = data
if (file) this.fileList = [{name: file, url: file}]
}).catch(err => {}) }).catch(err => {})
}, },
// //
@ -346,7 +383,7 @@ export default {
const { title, level, id } = this.form const { title, level, id } = this.form
if(title && title !== this.originalName){ if(title && title !== this.originalName){
this.$post(this.api.checkIfTheTitleIsRepeat, { this.$post(this.api.checkIfTheTitleIsRepeat, {
siteId: this.siteId, siteId: this.site.id,
title, title,
id: id || '' id: id || ''
}).then(res => { }).then(res => {
@ -357,10 +394,6 @@ export default {
}else{ }else{
this.nameRepeat = false this.nameRepeat = false
} }
},
//
typeChange(val) {
}, },
// //
beforeUpload(file) { beforeUpload(file) {
@ -389,16 +422,16 @@ export default {
util.errorMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); util.errorMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`);
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
this.form.columnBanner = '' this.form.file = ''
}, },
uploadSuccess(res) { uploadSuccess(res) {
this.form.titleImg = res.data.url this.form.titleImg = res.url
}, },
uploadSuccessBanner(res) { uploadSuccessBanner(res) {
this.form.bannerImg = res.data.url this.form.bannerImg = res.url
}, },
uploadSuccessFile(res) { uploadSuccessFile(res) {
this.form.file = res.data.url this.form.file = res.url
}, },
// //
preview() { preview() {
@ -414,24 +447,27 @@ export default {
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1]
if (form.articleTemplate === 3 && form.connectionType !== 2) { if (form.articleTemplate === 3 && form.connectionType !== 2) {
const { links } = this const { links } = this
if (!links.length && form.connectionType === 1) return util.errorMsg('请选择站内链接') if (!links.length && form.connectionType === 1 && isRelease) return util.errorMsg('请选择站内链接')
if (!links.length && form.connectionType === 3) return util.errorMsg('请选择栏目') if (!links.length && form.connectionType === 3 && isRelease) return util.errorMsg('请选择栏目')
form.linkAddress = links.join() form.linkAddress = links.join()
} }
if (form.articleTemplate !== 3 && !form.mainBody && isRelease) return util.errorMsg('请输入正文')
const { columnId } = form
if (typeof columnId === 'object') form.columnId = columnId[columnId.length - 1]
form.isRelease = isRelease form.isRelease = isRelease
this.submiting = true this.submiting = true
if (form.id) { if (form.id) {
delete form.children delete form.children
form.editorId = +this.$store.state.user.userId form.editorId = +this.$store.state.user.userId
this.$post(this.api.updateArticle, form).then(res => { this.$post(this.api.updateArticle, form).then(res => {
util.successMsg("修改成功") util.successMsg('修改成功')
this.$router.back() this.$router.back()
}).catch(err => { }).catch(err => {
this.submiting = false this.submiting = false
}) })
} else { } else {
this.$post(this.api.saveArticle, form).then(res => { this.$post(this.api.saveArticle, form).then(res => {
util.successMsg("创建成功") util.successMsg('创建成功')
this.$router.back() this.$router.back()
}).catch(err => { }).catch(err => {
this.submiting = false this.submiting = false
@ -528,7 +564,8 @@ $upload-lg-height: 102px;
} }
} }
.styles { .styles {
display: inline-flex; display: flex;
margin-top: 20px;
li { li {
margin-right: 20px; margin-right: 20px;
text-align: center; text-align: center;

@ -33,30 +33,35 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button type="primary" @click="add" >新增</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:新增'" type="primary" @click="add" >新增</el-button>
<el-button @click="batchDel">删除</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" @click="batchDel">删除</el-button>
</div> </div>
</div> </div>
<el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id"> <el-table :data="list" class="table" ref="table" header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column v-if="settings[0].show" type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <el-table-column v-if="settings[0].show" type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> <el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column v-if="settings[1].show" prop="title" label="标题" align="center" min-width="100"></el-table-column> <el-table-column v-if="settings[1].show" prop="title" label="标题" align="center" min-width="150"></el-table-column>
<el-table-column v-if="settings[2].show" prop="columnName" label="栏目" align="center" min-width="100"></el-table-column> <el-table-column v-if="settings[2].show" prop="columnName" label="栏目" align="center" min-width="120"></el-table-column>
<el-table-column v-if="settings[3].show" prop="founderName" label="录入人" align="center" min-width="80"></el-table-column> <el-table-column v-if="settings[3].show" prop="typeId" label="栏目类型" align="center" min-width="100">
<el-table-column v-if="settings[4].show" prop="editorName" label="修改人" align="center" min-width="80"></el-table-column> <template slot-scope="scope">
<el-table-column v-if="settings[5].show" prop="updateTime" label="修改日期" align="center" min-width="110"></el-table-column> {{ types.find(e => e.id === scope.row.typeId).name }}
<el-table-column v-if="settings[6].show" prop="releaseTime" label="发布日期" align="center" min-width="110"></el-table-column> </template>
<el-table-column v-if="settings[7].show" prop="totalBrowsing" label="总浏览" align="center" min-width="80"></el-table-column> </el-table-column>
<el-table-column v-if="settings[8].show" prop="workNumber" label="状态" align="center" min-width="100"> <el-table-column v-if="settings[4].show" prop="founderName" label="录入人" align="center" min-width="80"></el-table-column>
<el-table-column v-if="settings[5].show" prop="editorName" label="修改人" align="center" min-width="80"></el-table-column>
<el-table-column v-if="settings[6].show" prop="updateTime" label="修改日期" align="center" min-width="120"></el-table-column>
<el-table-column v-if="settings[7].show" prop="releaseTime" label="发布日期" align="center" min-width="120"></el-table-column>
<el-table-column v-if="settings[8].show" prop="totalBrowsing" label="总浏览" align="center" min-width="80"></el-table-column>
<el-table-column v-if="settings[9].show" prop="workNumber" label="状态" align="center" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isRelease ? '已发布' : '草稿' }} {{ scope.row.isRelease ? '已发布' : '草稿' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="settings[9].show" label="操作" align="center" width="300"> <el-table-column v-if="settings[10].show" label="操作" align="center" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-auth type="text" @click="resetPassword(scope.row)">预览</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:预览'" type="text" @click="resetPassword(scope.row)">预览</el-button>
<el-button v-auth type="text" @click="edit(scope.row)">编辑</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:编辑'" type="text" @click="edit(scope.row)">编辑</el-button>
<el-button v-auth type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:文章管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -69,9 +74,13 @@
<script> <script>
import util from '@/libs/util' import util from '@/libs/util'
import { mapMutations } from 'vuex'
import ColumnConst from '@/const/column'
export default { export default {
data() { data() {
return { return {
types: ColumnConst.types,
siteName: this.$store.state.content.site.siteName,
columns: [], columns: [],
defaultProps: { defaultProps: {
value: 'id', value: 'id',
@ -116,17 +125,21 @@ export default {
name: '栏目', name: '栏目',
show: true show: true
}, },
{
name: '栏目类型',
show: true
},
{ {
name: '录入人', name: '录入人',
show: false show: true
}, },
{ {
name: '修改人', name: '修改人',
show: false show: true
}, },
{ {
name: '修改日期', name: '修改日期',
show: false show: true
}, },
{ {
name: '发布日期', name: '发布日期',
@ -134,7 +147,7 @@ export default {
}, },
{ {
name: '总浏览', name: '总浏览',
show: false show: true
}, },
{ {
name: '状态', name: '状态',
@ -156,7 +169,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', name: '站点管理',
route: '/site' route: '/site'
@ -172,6 +185,9 @@ export default {
this.getColumn() this.getColumn()
}, },
methods: { methods: {
...mapMutations('content', [
'setColumn'
]),
// //
getColumn() { getColumn() {
this.$post(this.api.listWithTree, { this.$post(this.api.listWithTree, {
@ -182,16 +198,18 @@ export default {
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.column.setCurrentKey(data[0].id) this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id)
this.getData() this.getData()
}) })
}).catch(e => {}) }).catch(e => {})
}, },
// //
getData() { getData() {
const id = this.$refs.column.getCurrentKey()
this.$router.push(`/article?columnId=${id}`).catch(e => {})
this.$post(this.api.queryArticle, { this.$post(this.api.queryArticle, {
siteId: this.$store.state.content.site.id, siteId: this.$store.state.content.site.id,
columnIds: [this.$refs.column.getCurrentKey()], columnIds: [id],
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
title: this.keyword title: this.keyword
@ -257,6 +275,9 @@ export default {
}, },
// //
add() { add() {
if (!this.columns.length) return util.errorMsg('请添加栏目')
this.setColumn(this.$refs.column.getCurrentNode())
console.log("🚀 ~ file: index.vue ~ line 267 ~ add ~ this.$refs.column.getCurrentNode()", this.$refs.column.getCurrentNode())
this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}`) this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}`)
}, },
// //

@ -58,11 +58,11 @@
:action="this.api.upload" :action="this.api.upload"
:data="{ :data="{
quote: form.columnName, quote: form.columnName,
site: '粒子研究院中文站点', site: site.siteName,
uploader: userName uploader: userName
}" }"
> >
<img v-if="form.columnBanner" :src="form.columnBanner" class="avatar"> <img v-if="form.columnBanner" :src="form.columnBanner" class="avatar-lg">
<div class="uploader-default" v-else> <div class="uploader-default" v-else>
<img class="plus" src="@/assets/img/plus.png" alt=""> <img class="plus" src="@/assets/img/plus.png" alt="">
<p>点击上传</p> <p>点击上传</p>
@ -155,15 +155,16 @@
<el-option <el-option
v-for="item in sites" v-for="item in sites"
:key="item.id" :key="item.id"
:label="item.name" :label="item.siteName"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="栏目"> <el-form-item label="栏目">
<el-cascader <el-cascader
:options="links" v-model="otherLink"
:props="{ checkStrictly: true }" :options="columns"
:props="columnProps"
clearable></el-cascader> clearable></el-cascader>
</el-form-item> </el-form-item>
</template> </template>
@ -230,12 +231,12 @@ import { mapState } from 'vuex'
export default { export default {
data() { data() {
return { return {
siteId: this.$store.state.content.site.id, site: this.$store.state.content.site,
isEdit: this.$route.query.type === 'edit', isEdit: this.$route.query.type === 'edit',
nameRepeat: false, nameRepeat: false,
types: ColumnConst.types, types: ColumnConst.types,
templates: ColumnConst.templates, templates: ColumnConst.templates,
sites: ColumnConst.sites, sites: [],
columns: [], columns: [],
columnProps: { columnProps: {
checkStrictly: true, checkStrictly: true,
@ -243,6 +244,7 @@ export default {
label: 'columnName' label: 'columnName'
}, },
links: [], links: [],
otherLink: [],
form: { form: {
siteId: this.$store.state.content.site.id, siteId: this.$store.state.content.site.id,
id: this.$route.query.id || '', id: this.$route.query.id || '',
@ -299,7 +301,7 @@ export default {
]) ])
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', name: '站点管理',
route: '/site' route: '/site'
@ -316,7 +318,7 @@ export default {
} }
]) ])
this.getList() this.getList()
this.isEdit && this.getData() this.getSite()
}, },
watch: { watch: {
// , // ,
@ -331,30 +333,50 @@ export default {
// //
getList() { getList() {
this.$post(this.api.listWithTree, { this.$post(this.api.listWithTree, {
siteId: this.siteId, siteId: this.site.id,
columnName: '', columnName: '',
templateId: '', templateId: '',
typeId : '', typeId : '',
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
this.isEdit && this.getData()
}).catch(err => {}) }).catch(err => {})
}, },
// //
getData() { getData() {
this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => { this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => {
this.form = data this.form = data
if (data.typeId === 2) {
let link = data.linkAddress
if (link) {
link = link.split(',').map(e => +e)
if (data.connectionType === 1) {
this.links = link
this.form.linkAddress = ''
} else if (data.connectionType === 3) {
this.otherLink = link
this.form.linkAddress = ''
}
}
}
}).catch(err => {}) }).catch(err => {})
}, },
// //
setFatherId() { getSite() {
this.$post(this.api.site, {
page: 1,
limit: 1000,
siteName: ''
}).then(({ data }) => {
this.sites = data.records
}).catch(e => {})
}, },
// //
nameChange(){ nameChange(){
const { columnName, level, id } = this.form const { columnName, level, id } = this.form
if (columnName && columnName !== this.originalName) { if (columnName && columnName !== this.originalName) {
this.$post(this.api.sameLevelJudgment, { this.$post(this.api.sameLevelJudgment, {
siteId: this.siteId, siteId: this.site.id,
columnName, columnName,
level: +level, level: +level,
id: +id || '' id: +id || ''
@ -398,7 +420,7 @@ export default {
this.form.columnBanner = '' this.form.columnBanner = ''
}, },
uploadSuccess(res) { uploadSuccess(res) {
this.form.columnBanner = res.data.url this.form.columnBanner = res.url
}, },
// //
preview() { preview() {
@ -413,11 +435,16 @@ export default {
if (!form.pageSize) return util.errorMsg('请填写分页条数') if (!form.pageSize) return util.errorMsg('请填写分页条数')
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1]
if (form.typeId === 2 && form.connectionType !== 2) { if (form.typeId === 2 && form.connectionType !== 2) {
const { links } = this const { links, otherLink } = this
if (!links.length && form.connectionType === 1) return util.errorMsg('请选择站内链接') if (form.connectionType === 1) {
if (!links.length && form.connectionType === 3) return util.errorMsg('请选择栏目') if (!links.length) return util.errorMsg('请选择站内链接')
form.linkAddress = links.join() form.linkAddress = links.join()
} }
if (form.connectionType === 3) {
if (!otherLink.length) return util.errorMsg('请选择栏目')
form.linkAddress = otherLink.join()
}
}
this.submiting = true this.submiting = true
if (this.isEdit) { if (this.isEdit) {
delete form.children delete form.children

@ -18,10 +18,10 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button type="primary" @click="add" >新增</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:新增'" type="primary" @click="add" >新增</el-button>
<el-button @click="batchDel">删除</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:删除'" @click="batchDel">删除</el-button>
<el-button class="lg" @click="sort">更改排序</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:更改排序'" class="lg" @click="sort">更改排序</el-button>
<el-button class="lg" @click="styleSet">导航样式设置</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:导航样式设置'" class="lg" @click="styleSet">导航样式设置</el-button>
</div> </div>
</div> </div>
@ -49,9 +49,9 @@
<el-table-column v-if="settings[6].show" prop="id" label="ID" min-width="80"></el-table-column> <el-table-column v-if="settings[6].show" prop="id" label="ID" min-width="80"></el-table-column>
<el-table-column v-if="settings[7].show" label="操作" width="170"> <el-table-column v-if="settings[7].show" label="操作" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="edit(scope.row, 'add')">新增下级</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:新增'" type="text" @click="edit(scope.row, 'add')">新增下级</el-button>
<el-button type="text" @click="edit(scope.row, 'edit')">编辑</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:编辑'" type="text" @click="edit(scope.row, 'edit')">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button> <el-button v-auth="'/site/list:' + siteName + ':内容管理:栏目管理:删除'" type="text" @click="del(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -99,6 +99,7 @@ import util from "@/libs/util";
export default { export default {
data() { data() {
return { return {
siteName: this.$store.state.content.site.siteName,
types: ColumnConst.types, types: ColumnConst.types,
templates: ColumnConst.templates, templates: ColumnConst.templates,
keyword: '', keyword: '',
@ -166,7 +167,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', name: '站点管理',
route: '/site' route: '/site'

@ -1,263 +0,0 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" :content="form.id ? '编辑课程' : '新增课程'"></el-page-header>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<el-form :disabled="isDetail" label-width="80px" label-suffix=":">
<el-form-item label="课程名称">
<div class="d-inline-block">
<el-input placeholder="请输入课程名称" v-model="form.name" clearable maxlength="25"></el-input>
</div>
</el-form-item>
<el-form-item label="课程分类">
<div class="d-inline-block">
<el-select v-model="form.classificationId" placeholder="请选择课程分类">
<el-option v-for="item in classificationList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</el-form-item>
<el-form-item label="课程封面">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:headers="headers"
name="file"
>
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar">
<div class="uploader-default" v-else>
<i class="el-icon-plus"></i>
<p>上传封面</p>
</div>
<div slot="tip" class="el-upload__tip">
<p>只能上传jpg/png文件</p>
<p>课程封面图将按2:1显示最佳分辨率1400*700</p>
</div>
</el-upload>
</el-form-item>
<el-form-item label="课程介绍">
<quill :border="true" :readonly="isDetail" v-model="form.description" :height="400" />
</el-form-item>
<el-form-item>
<el-button type="primary" v-throttle @click="save" v-show="!isDetail">{{ form.id ? "更新" : "创建" }}</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import util from "@/libs/util";
import Setting from "@/setting";
import quill from "@/components/quill";
export default {
name: "courseAddEdit",
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
isDetail: Boolean(this.$route.query.show),
form: {
id: this.$route.query.id,
classificationId: '',
coverUrl: '',
name: '',
description: '',
distinguish: 1
},
classificationList: [],
uploadList: [],
submiting: false,
updateTime: 0
};
},
watch: {
// ,
form: {
handler(val){
this.updateTime++
},
deep:true
}
},
mounted() {
this.getClassification();
this.form.id && this.getData();
},
components: {
quill
},
methods: {
getClassification() {
this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList;
}).catch(res => {});
},
getData() {
this.$get(`${this.api.getCourse}/${this.form.id}`).then(({ course }) => {
this.form = course
this.uploadList.push({
name: "cover.jpg",
url: course.coverUrl
})
}).catch(err => {})
},
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
this.form.coverUrl = res.data.filesResult.fileUrl
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
let fileName = this.form.coverUrl.replace('https://huoran.oss-cn-shenzhen.aliyuncs.com/', "");
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => {
this.form.coverUrl = ''
}).catch(res => {});
},
save() {
if (this.submiting) return false
const { form } = this
if (!form.name) return util.warningMsg("请填写课程名称")
if (!form.classificationId) return util.warningMsg("请选择课程分类")
if (!form.coverUrl) return util.warningMsg("请上传课程封面")
this.submiting = true
if (form.id) {
this.$put(this.api.editCourse, form).then(res => {
this.submiting = false;
util.successMsg("修改成功");
this.$router.back();
}).catch(err => {
this.submiting = false;
});
} else {
this.$post(this.api.addCourse, form).then(res => {
this.submiting = false;
this.$confirm("课程创建成功,是否马上进行课程内容设置?", "提示", {
type: "success",
confirmButtonText: "马上设置",
cancelButtonText: "稍后操作"
}).then(() => {
this.$router.push(`/course/contentSettings?id=${res.courseId}`);
}).catch(() => {
this.$router.back();
});
}).catch(err => {
this.submiting = false;
});
}
},
//
backPage() {
this.$router.back()
},
back() {
const { id } = this.form
const updateTime = this.updateTime
//
if ((id && updateTime > 2) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.save()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
}
}
}
};
</script>
<style lang="scss" scoped>
$avatar-width: 104px;
/deep/ .avatar-uploader {
.el-upload {
position: relative;
width: $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;
}
}
}
}
/deep/ .d-inline-block {
width: 216px;
.el-select, .el-input {
width: 100%;
}
}
</style>

@ -1,888 +0,0 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="goBack" :content="sorting? '更改排序' : '内容设置'"></el-page-header>
</div>
</el-card>
<!--内容设置-->
<el-card shadow="hover" class="m-b-20">
<div class="page">
<div class="relative">
<div class="p-title">内容设置</div>
<div class="btns" style="top: -10px">
<template v-if="!sorting">
<el-button v-auth="'/course/list:课程管理:内容设置:添加章节'" type="primary" round v-throttle @click="addChapter">添加章节</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:编辑顺序'" type="primary" round v-throttle @click="sort">编辑顺序</el-button>
</template>
<template v-else>
<el-button type="primary" round @click="move">批量移动</el-button>
<el-button type="primary" round v-throttle @click="cancelSort">取消</el-button>
<el-button type="primary" round v-throttle @click="saveSort">保存</el-button>
</template>
</div>
</div>
<el-divider></el-divider>
<div class="page-content">
<div class="m-b-20" v-for="(chapter,index) in chapters" :key="chapter.id">
<div class="flex j-between a-center m-b-10">
<div>{{ chapter.name }}</div>
<div>
<template v-if="!sorting">
<el-button v-auth="'/course/list:课程管理:内容设置:修改章节名称'" class="action-btn" type="primary" round v-throttle @click="editChapter(chapter)">修改章节名称</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:添加小节'" class="action-btn" type="primary" round v-throttle @click="addSection(chapter.id)">添加小节</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:章节删除'" class="action-btn" type="primary" round v-throttle @click="delChapter(chapter.id)">删除</el-button>
</template>
<template v-else>
<i class="el-icon-top sort-icon" :class="{disabled: index == 0}" style="margin-right: 5px" @click="sortChapter(chapter,'up',index == 0,index)"></i>
<i class="el-icon-bottom sort-icon" :class="{disabled: index == chapters.length-1}" @click="sortChapter(chapter,'down',index == chapter.length-1,index)"></i>
</template>
</div>
</div>
<el-table :data="chapter.subsectionList" class="table" stripe header-align="center">
<el-table-column v-if="sorting" width="55" align="center">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.check"></el-checkbox>
</template>
</el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="name" label="资源名称">
</el-table-column>
<el-table-column prop="fileType" label="资源类型" align="center">
<template slot-scope="scope">
{{ transferType(scope.row.fileType) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<template v-if="!sorting">
<el-button v-auth="'/course/list:课程管理:内容设置:查看'" type="text" @click="preview(scope.row)">查看</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:小节删除'" type="text" @click="delSection(scope.row)">删除</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:修改小节名称'" type="text" @click="editSectionName(scope.row,chapter.id)">修改小节名称</el-button>
<el-button v-auth="'/course/list:课程管理:内容设置:更换文件'" type="text" @click="switchFile(scope.row,chapter.id)">更换文件</el-button>
</template>
<template v-else>
<i class="el-icon-top sort-icon" :class="{disabled: scope.$index == 0}" style="margin-right: 5px" @click="sortSection(index,'up',scope.$index == 0,scope.$index)"></i>
<i class="el-icon-bottom sort-icon" :class="{disabled: scope.$index == chapter.subsectionList.length-1}" @click="sortSection(index,'down',scope.$index == chapter.subsectionList.length-1,scope.$index)"></i>
</template>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog :title="chapterId ? '编辑章节' : '新增章节'" :visible.sync="chapterVisible" width="24%" :close-on-click-modal="false">
<el-form>
<el-form-item>
<el-input placeholder="请输入章节名称,便于对小节归类" v-model="chapterName" maxlength="50"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="chapterVisible = false">取消</el-button>
<el-button type="primary" @click="chapterSubmit">确定</el-button>
</span>
</el-dialog>
<el-dialog title="添加小节" :visible.sync="sectionVisible" width="28%" @close="closeSection" :close-on-click-modal="false">
<el-form label-width="80px">
<el-form-item label="资源添加">
<el-upload
:before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
name="file"
>
<el-button size="small"><img src="@/assets/img/upload.png" alt=""> 上传资源</el-button>
</el-upload>
</el-form-item>
<el-form-item label="小节名称">
<el-input placeholder="请输入小节名称" v-model="sectionName" maxlength="50"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="sectionVisible = false">取消</el-button>
<el-button type="primary" @click="sectionSubmit">确定</el-button>
</span>
</el-dialog>
<el-dialog title="更换文件" :visible.sync="switchVisible" width="28%" :close-on-click-modal="false" @close="closeSwitch">
<div style="text-align: center">
<el-upload
:before-upload="beforeUpload"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.fileupload"
:file-list="uploadList"
:headers="headers"
name="file"
>
<el-button size="small"><img src="@/assets/img/upload.png" alt=""> 上传资源</el-button>
</el-upload>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="switchVisible = false">取消</el-button>
<el-button type="primary" @click="switchSubmit">确定</el-button>
</span>
</el-dialog>
<el-dialog title="修改小节名称" :visible.sync="sectionNameVisible" width="24%" :close-on-click-modal="false">
<el-form>
<el-form-item>
<el-input placeholder="请输入小节名称" v-model="sectionName" maxlength="50"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="sectionNameVisible = false">取消</el-button>
<el-button type="primary" @click="sectionNameSubmit">确定</el-button>
</span>
</el-dialog>
<div v-show="previewImg" class="el-image-viewer__wrapper" :class="{active: previewImg}" style="z-index: 2000">
<div class="el-image-viewer__mask"></div>
<span class="el-image-viewer__btn el-image-viewer__close" @click="previewImg = ''"><i class="el-icon-circle-close" style="color: #fff"></i></span>
<div class="el-image-viewer__canvas">
<img :src="previewImg" class="el-image-viewer__img" style="transform: scale(1) rotate(0deg);margin-top: -1px; max-height: 100%; max-width: 100%;">
</div>
</div>
<div v-show="iframeSrc" class="el-image-viewer__wrapper" :class="{active: iframeSrc}" style="z-index: 2000">
<div class="el-image-viewer__mask"></div>
<span class="el-image-viewer__btn el-image-viewer__close" :class="{'doc-close': isWord}" :style="{top: isWord ? '50px' : '5px'}" @click="closeIframe"><i class="el-icon-circle-close" style="color: #fff"></i></span>
<div class="el-image-viewer__canvas">
<iframe v-if="iframeSrc" class="fileIframe" id="fileIframe" :src="iframeSrc" frameborder="0"></iframe>
<template v-if="showMask">
<div class="mask" style="width: 200px;height: 30px;top: 53px;right: 320px"></div>
<div class="mask" style="width: 175px;height: 30px;top: 53px;right: 5px"></div>
</template>
<template v-if="showMask1">
<div class="word-mask1" style="width: 200px;height: 50px;"></div>
<div class="word-mask" style="height: 40px;top: 48px;"></div>
<div class="word-mask2" style="top: 55px;left: 28%;width: 44%;height: calc(100% - 80px);"></div>
</template>
<template v-if="showMask2 && iframeSrc">
<div class="excel-mask1" style="height: 48px;"></div>
</template>
</div>
</div>
<div v-show="playAuth" class="el-image-viewer__wrapper" :class="{active: playAuth}" style="z-index: 2000">
<div class="el-image-viewer__mask"></div>
<span class="el-image-viewer__btn el-image-viewer__close" @click="closePlayer"><i class="el-icon-circle-close" style="color: #fff"></i></span>
<div class="player" id="player"></div>
</div>
<pdf :visible.sync="pdfVisible" :src.sync="pdfSrc"></pdf>
</div>
</div>
</el-card>
<el-dialog title="资源移动" :visible.sync="moveVisible" :close-on-click-modal="false" width="330px">
<el-form>
<el-form-item label="目标章节">
<el-select v-model="moveForm.id" placeholder="请选择目标章节" @change="chapterChange">
<el-option v-for="(item, i) in chapters" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="目标排序">
<el-select v-model="moveForm.sort" placeholder="请选择目标排序">
<el-option v-for="(item, i) in sortList" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="moveVisible = false">取消</el-button>
<el-button type="primary" @click="moveConfirm">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import util from "@/libs/util";
import Setting from "@/setting";
import { Loading } from "element-ui";
import pdf from "@/components/pdf";
export default {
name: "contentSettings",
data() {
return {
headers: {
token: util.local.get(Setting.tokenKey)
},
id: "",
originChapters: [],
chapters: [],
sorting: false,
uploading: false,
uploadList: [],
chapterVisible: false,
chapterId: "",
chapterName: "",
sectionVisible: false,
sectionName: "",
sectionId: "",
switchVisible: false,
sectionNameVisible: false,
fileId: "",
fileName: "",
fileUrl: "",
originalFileName: "",
fileType: "",
playAuth: "",
player: null,
previewImg: "",
iframeSrc: "",
curFile: {},
isAddSection: false,
isWord: false,
isPPT: false,
isExcel: false,
showMask: false,
showMask1: false,
showMask2: false,
loadIns: null,
pdfVisible: false,
pdfSrc: "",
previewing: false,
moveVisible: false,
checkList: [],
sortList: [
{
id: 'bottom',
name: '置末'
},
{
id: 'top',
name: '置顶'
}
],
moveForm: {
id: '',
sort: 'bottom'
},
moved: false //
};
},
components: { pdf },
mounted() {
this.insertScript();
this.id = this.$route.query.id;
this.id && this.getData();
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener("popstate", this.goBack, false);
}
},
destroyed() {
window.removeEventListener("popstate", this.goBack, false);
},
methods: {
getData() {
this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`)
.then(res => {
this.chapters = res.chapterList;
})
.catch(err => {
});
},
goBack() {
//
if (this.previewing) {
this.closeIframe();
} else {
//
if (this.sorting) {
//
if (this.moved) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.saveSort()
this.moved = false
}).catch(() => {
this.sorting = false
this.chapters = JSON.parse(JSON.stringify(this.originChapters))
})
} else {
this.sorting = false
}
} else {
this.$router.back()
}
}
},
iframeOnload() {
document.querySelector("#fileIframe").onload = e => {
if (this.isPPT) {
this.showMask = true;
} else {
this.showMask = false;
}
if (this.isWord) {
this.showMask1 = true;
} else {
this.showMask1 = false;
}
if (this.isExcel) {
this.showMask2 = true;
} else {
this.showMask2 = false;
}
this.loadIns.close();
};
},
insertScript() {
const linkTag = document.createElement("link");
linkTag.rel = "stylesheet";
linkTag.href = "https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css";
document.body.appendChild(linkTag);
const scriptTag = document.createElement("script");
scriptTag.type = "text/javascript";
scriptTag.src = "https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-min.js";
document.body.appendChild(scriptTag);
},
//
beforeUpload(file) {
let type = this.transferType(file.name.substring(file.name.lastIndexOf(".") + 1));
if (type != "视频" && type != "图片" && type != "pdf" && (file.size / 1024 / 1024) > 10) {
util.errorMsg("请上传10M以内的文件");
return false;
}
this.uploading = true;
this.originalFileName = file.name;
if (this.isAddSection) this.sectionName = file.name.substring(0, file.name.lastIndexOf("."));
this.fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
},
handleExceed(files, fileList) {
util.warningMsg(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
);
},
uploadSuccess(res, file, fileList) {
this.uploading = false;
this.fileId = res.data.filesResult.fileId;
this.fileType = res.data.filesResult.fileType;
this.fileUrl = res.data.filesResult.fileUrl;
this.fileName = res.data.filesResult.ossFileName;
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
if ((file.size / 1024 / 1024) < 10) {
return this.$confirm(`确定移除 ${file.name}`);
}
},
handleRemove(file, fileList) {
this.uploadList = fileList;
},
uploadSure() {
this.importVisible = false;
this.pageNo = 1;
this.staffGradeId = "";
this.keyword = "";
this.getTeacher();
},
goback() {
this.$router.push("course");
},
transferType(ext) {
const suf = ext.toLowerCase()
if ("jpg,jpeg,png,gif,svg,psd".includes(suf)) return "图片";
if ("mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv".includes(suf)) return "视频";
return suf;
},
addChapter() {
this.chapterName = "";
this.chapterId = "";
this.chapterVisible = true;
},
sort() {
this.originChapters = JSON.parse(JSON.stringify(this.chapters))
this.sorting = true;
},
//
move() {
const list = this.chapters
const checkList = []
list.map(e => {
e.subsectionList.map(n => {
n.check && checkList.push(n)
})
})
this.checkList = checkList
if (checkList.length) {
this.moveForm = {
id: '',
sort: 'bottom'
}
this.sortList = [
{
id: 'bottom',
name: '置末'
},
{
id: 'top',
name: '置顶'
}
]
this.moveVisible = true
} else {
this.$message.warning('请选择小节!')
}
},
//
chapterChange(id) {
const list = []
//
this.chapters.find(e => e.id === id).subsectionList.map((e, i) => {
list.push({
id: i,
name: i+1
})
})
//
this.sortList = [
{
id: 'bottom',
name: '置末'
},
...list,
{
id: 'top',
name: '置顶'
}
]
},
//
moveConfirm() {
let { id, sort } = this.moveForm
if (!id) return this.$message.warning('请选择目标章节')
if (sort === '') return this.$message.warning('请选择目标排序')
if (typeof sort === 'string') sort = sort === 'top' ? 0 : this.sortList.length - 2 //
this.moveVisible = false
const list = this.checkList
list.map(e => e.check = false)
const ids = list.map(e => e.id)
const { chapters } = this
chapters.map(e => {
e.children = []
e.subsectionList.map(n => {
if (!ids.includes(n.id)) {
e.children.push(n)
}
})
e.subsectionList = e.children
delete e.children
if (e.id === id) e.subsectionList.splice(sort, 0, ...list)
})
this.moved = true
},
cancelSort() {
this.chapters = JSON.parse(JSON.stringify(this.originChapters))
this.sorting = false;
},
saveSort() {
this.chapters.forEach((n, k) => {
n.sort = k + 1;
n.subsectionList.forEach((j, i) => {
j.sort = i + 1
j.chapterId = n.id
});
});
let data = {
chapterVOList: this.chapters
};
this.$post(this.api.reorder, data).then(res => {
this.sorting = false;
}).catch(res => {
});
},
editChapter(item) {
this.chapterId = item.id;
this.chapterName = item.name;
this.chapterVisible = true;
},
delChapter(id) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$del(`${this.api.deleteChapter}/${id}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
},
closeSection() {
this.isAddSection = false;
},
addSection(id) {
this.chapterId = id;
this.sectionName = "";
this.fileUrl = "";
this.uploadList = [];
this.sectionId = "";
this.isAddSection = true;
this.sectionVisible = true;
},
chapterSubmit() {
if (!this.chapterName) return util.warningMsg("请填写章节名称");
let data = {
courseId: this.id,
name: this.chapterName
};
if (this.chapterId) {
data.id = this.chapterId;
this.$put(this.api.editChapter, data).then(res => {
util.successMsg("修改成功");
this.chapterVisible = false;
this.getData();
})
.catch(err => {
});
} else {
this.$post(this.api.addChapter, data).then(res => {
util.successMsg("添加成功");
this.chapterVisible = false;
this.getData();
})
.catch(err => {
});
}
},
sectionSubmit() {
if (!this.sectionName) return util.warningMsg("请填写小节名称");
if (this.uploading) return util.warningMsg("资源正在上传中,请稍候");
if (!this.fileUrl && !this.fileId) return util.warningMsg("请上传资源");
let data = {
id: this.sectionId,
courseId: this.id,
chapterId: this.chapterId,
name: this.sectionName,
fileId: this.fileId,
fileUrl: this.fileUrl,
fileName: this.fileName,
fileType: this.fileType,
originalFileName: this.originalFileName
};
this.$post(this.api.addSubsection, data).then(res => {
util.successMsg("添加成功");
this.sectionVisible = false;
this.getData();
})
.catch(err => {
});
},
closeSwitch() {
this.fileId = "";
this.fileName = "";
this.fileType = "";
this.fileUrl = "";
this.sectionId = "";
},
preview(row) {
if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.data.playAuth;
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
} else {
this.player = new Aliplayer({
id: "player",
width: "100%",
autoplay: false,
vid: row.fileId,
playauth: this.playAuth,
encryptType: 1 //
});
}
}).catch(res => {
});
} else if (this.transferType(row.fileType) == "图片") {
this.previewImg = row.fileUrl;
} else if (row.fileType == "pdf") {
this.pdfSrc = row.fileUrl;
this.pdfVisible = true;
} else {
this.$get(`${this.api.getSubsection}/${row.id}`).then(res => {
this.previewing = true;
this.loadIns = Loading.service();
this.$route.fullPath.includes("#file") || history.pushState({ file: true }, "文件预览", "#" + this.$route.fullPath + "#file");
if (row.fileType == "pptx") {
this.isPPT = true;
this.isWord = false;
this.isExcel = false;
} else if (row.fileType == "doc" || row.fileType == "docx") {
this.isPPT = false;
this.isWord = true;
this.isExcel = false;
} else if (row.fileType == "xls" || row.fileType == "xlsx") {
this.isExcel = true;
this.isPPT = false;
this.isWord = false;
} else {
this.isPPT = false;
this.isWord = false;
this.isExcel = false;
}
this.iframeSrc = res.previewUrl;
this.$nextTick(() => {
this.iframeOnload();
});
})
.catch(err => {
});
}
},
editSectionName(row, chapterId) {
this.chapterId = chapterId;
this.sectionId = row.id;
this.sectionName = row.name;
this.sectionNameVisible = true;
},
switchFile(row, chapterId, sectionId) {
this.uploadList = [];
this.curFile = {
fileId: row.fileId,
fileName: row.fileName,
fileType: row.fileType,
fileUrl: row.fileUrl
};
this.chapterId = chapterId;
this.sectionId = row.id;
this.sectionName = row.sectionName;
this.switchVisible = true;
},
switchSubmitFile() {
let data = {
id: this.sectionId,
courseId: this.id,
chapterId: this.chapterId,
name: this.sectionName,
fileId: this.fileId,
fileName: this.fileName,
fileType: this.fileType,
fileUrl: this.fileUrl,
originalFileName: this.originalFileName
};
this.$put(this.api.editSubsection, data).then(res => {
util.successMsg("更换成功");
this.switchVisible = false;
this.getData();
})
.catch(err => {
});
},
switchSubmit() {
if (this.uploading) return util.warningMsg("资源正在上传中,请稍候");
if (!this.fileUrl && !this.fileId) return util.warningMsg("请上传资源");
if (this.transferType(this.curFile.fileType) == "视频") {
let data = {
videoIdList: [this.sectionId]
};
this.$del(`${this.api.removeVideo}/${this.curFile.fileId}`).then(res => {
this.switchSubmitFile();
}).catch(res => {
});
} else {
this.$del(`${this.api.fileDeletion}?keys=${this.curFile.fileName}`).then(res => {
this.switchSubmitFile();
}).catch(res => {
});
}
},
delSection(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$del(`${this.api.deleteSubsection}/${row.id}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
},
sortChapter(row, type, disabled, index) {
if (!disabled) {
if (type == "up") {
let tempItem = this.chapters.splice(index - 1, 1)[0];
this.chapters.splice(index, 0, tempItem);
} else {
let tempItem = this.chapters.splice(index + 1, 1)[0];
this.chapters.splice(index, 0, tempItem);
}
}
},
sortSection(chapterIndex, type, disabled, index) {
if (!disabled) {
this.moved = true
let list = this.chapters[chapterIndex].subsectionList;
if (type == "up") {
let tempItem = list.splice(index - 1, 1)[0];
list.splice(index, 0, tempItem);
} else {
let tempItem = list.splice(index + 1, 1)[0];
list.splice(index, 0, tempItem);
}
this.chapters[chapterIndex].subsectionList = list;
}
},
sectionNameSubmit() {
if (!this.sectionName) return util.warningMsg("请填写小节名称");
let data = {
id: this.sectionId,
courseId: this.id,
chapterId: this.chapterId,
name: this.sectionName
};
this.$put(this.api.editSubsection, data).then(res => {
util.successMsg("修改成功");
this.sectionNameVisible = false;
this.getData();
})
.catch(err => {
});
},
closePlayer() {
this.playAuth = "";
this.player.pause();
},
closeIframe() {
this.iframeSrc = "";
this.showMask = false;
this.showMask1 = false;
this.showMask2 = false;
this.previewing = false;
}
}
};
</script>
<style scoped lang="scss">
.btns {
position: absolute;
top: 12px;
right: 24px;
.el-button {
font-size: 14px;
}
}
/deep/.el-progress-bar {
padding-right: 70px;
margin-right: -70px;
}
.sort-icon {
font-size: 24px;
cursor: pointer;
&.disabled {
color: #ccc;
cursor: not-allowed
}
}
.el-image-viewer__wrapper {
transform: translateY(-10px);
transition: transform .5s;
&.active {
transform: translateY(0)
}
}
.el-image-viewer__close {
z-index: 10000;
top: 15px;
right: 15px;
&.doc-close {
i {
color: #000 !important;
}
}
}
.player {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 1200px !important;
height: 600px !important;
}
.fileIframe {
z-index: 1;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
.mask {
z-index: 1000;
position: fixed;
background-color: rgb(57, 58, 61);
}
.word-mask {
z-index: 1000;
position: fixed;
right: 0;
width: 100%;
background-color: rgb(243, 242, 241);
}
.word-mask1 {
z-index: 1000;
position: fixed;
top: 0;
right: 0;
background-color: #2b579a;
}
.word-mask2 {
z-index: 1000;
position: fixed;
background-color: transparent;
}
.excel-mask1 {
z-index: 9;
position: absolute;
top: 0;
left: 20%;
width: 80%;
background-color: #107c41;
}
</style>

@ -1,222 +0,0 @@
<template>
<!-- 课程管理 -->
<div style="padding-top: 24px">
<div class="tool">
<ul class="filter" style="align-items: flex-start">
<li>
<label>课程分类</label>
<el-select v-model="classificationId" clearable placeholder="请选择课程分类" @change="getData">
<el-option label="不限" value=""></el-option>
<el-option v-for="(item,index) in classificationList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>搜索</label>
<el-input placeholder="请输入课程名称/创建人" suffix-icon="el-icon-search" v-model="keyword" clearable size="small"></el-input>
</li>
</ul>
<div>
<el-button v-auth="'课程管理:新增'" type="info" round @click="addCourse">新增</el-button>
<el-button v-auth="'课程管理:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
</div>
</div>
<el-table :data="courseData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + (current - 1) * pageSize + 1 }}
</template>
</el-table-column>
<el-table-column prop="name" label="课程名称">
</el-table-column>
<el-table-column prop="gmtCreate" label="创建时间" align="center">
</el-table-column>
<el-table-column prop="founder" label="创建人" align="center">
</el-table-column>
<el-table-column label="章节数" align="center">
<template slot-scope="scope">
{{ scope.row.chapterNum ? scope.row.chapterNum : 0 }}({{ scope.row.subsectionNum ? scope.row.subsectionNum : 0 }}小节)
</template>
</el-table-column>
<el-table-column prop="classification" label="课程分类">
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button v-auth="'课程管理:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'课程管理:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'课程管理:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'课程管理:预览'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch
v-auth="'课程管理:禁用'"
v-model="scope.row.isEnable"
:active-value="0"
:inactive-value="1"
style="margin: 0 5px"
:active-text="scope.row.isEnable ? '关' : '开'"
@change="switchOff($event,scope.row,scope.$index)"
></el-switch>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background layout="total, prev, pager, next" :total="totals" @current-change="handleCurrentChange" :current-page="current">
</el-pagination>
</div>
</div>
</template>
<script>
import util from "@/libs/util";
export default {
name: "courseManagement",
data() {
return {
keyword: "",
classificationId: "",
courseData: [],
multipleSelection: [],
classificationList: [],
current: +this.$route.query.page || 1, //
pageSize: 10,
totals: 0
};
},
watch: {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
mounted() {
this.getClassification();
this.getData();
},
methods: {
getData() {
let data = {
classificationId: this.classificationId,
name: this.keyword
};
this.$get(`${this.api.queryCourseByCondition}/${this.current}/${this.pageSize}`, data).then(res => {
this.courseData = res.courseList;
this.totals = res.total;
if (!this.courseData.length && this.totals) {
this.current--;
this.getData();
}
}).catch(res => {
});
},
initData() {
this.current = 1;
this.getData();
},
getClassification() {
this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList;
}).catch(res => {
});
},
changeType(type) {
this.classificationId = type;
this.initData();
},
preview(row) {
this.$router.push(`/course/preview?id=${row.id}`);
},
config(row) {
this.$router.push(`/course/contentSettings?id=${row.id}`);
},
addCourse() {
this.$router.push("/course/add");
},
editCourse(row) {
this.$router.push(`/course/add?id=${row.id}`);
},
handleDelete(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$del(`${this.api.deleteCourse}/${row.id}`).then(res => {
util.successMsg("删除成功");
this.initData();
}).catch(res => {
});
})
.catch(() => {
});
},
getRowKeys(row) {
return row.customerId;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
delAllData() {
if (this.multipleSelection.length != "") {
let newArr = this.multipleSelection;
let delList = newArr.map(item => {
return item.id;
});
this.$confirm(`此批量删除操作不可逆,是否确认删除${newArr[0].name}${newArr.length}个选中项?`, "提示", {
type: "warning"
})
.then(() => {
let data = {
courseIds: delList.join()
};
this.$del(this.api.deleteCourses, data).then(res => {
this.multipleSelection = [];
this.$refs.table.clearSelection();
util.successMsg("删除成功");
this.initData();
}).catch(res => {
});
if(this.multipleSelection.length === this.courseData.length && this.current>1) {
this.handleCurrentChange(this.current - 1)
}
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
}
},
handleCurrentChange(val) {
this.current = val;
this.$router.push(`list?page=${val}`)
this.getData();
},
switchOff(val, row, index) {
this.$put(`${this.api.enableCourse}?courseId=${row.id}&isEnable=${val}`)
.then(res => {
this.getData();
val == 1 ? util.warningMsg("该教学资源已隐藏,对学生端用户不可见") : util.successMsg("该教学资源已公开,对学生端用户可见");
})
.catch(err => {
});
}
}
};
</script>
<style lang="scss" scoped>
/deep/ .tool {
.filter {
.el-input {
min-width: 215px;
}
}
}
</style>

@ -1,63 +0,0 @@
<template>
<!-- 理论课程管理 -->
<div class="page">
<div class="tabs">
<a class="item" v-for="(item,index) in tabs" :key="index" :class="{active: index == active}" @click="tabChange(index)">{{ item }}</a>
</div>
<div class="page-content">
<!-- 课程管理 -->
<CourseManagement v-if="active == 'first'" />
<!-- 分类管理 -->
<SortManagement v-if="active == 'second'" />
</div>
</div>
</template>
<script>
import Setting from "@/setting";
import { mapState } from "vuex";
import CourseManagement from "./courseManagement";
import SortManagement from "./sortManagement";
export default {
name: "course",
components: {
CourseManagement,
SortManagement
},
data() {
return {
active: "first", //
tabs: {
first: "课程管理",
second: "分类管理"
},
showTabs: true
};
},
computed: {
...mapState("auth", [
"btns"
])
},
mounted() {
Setting.dynamicRoute && this.initTabs();
},
methods: {
tabChange(index) {
this.active = index;
},
initTabs() {
const { btns } = this
const tab1 = btns.includes('/course/list:课程管理')
const tab2 = btns.includes('/course/list:分类管理')
tab1 || delete this.tabs.first
tab2 || delete this.tabs.second
}
}
};
</script>
<style lang="scss" scoped>
</style>

@ -1,166 +0,0 @@
<template>
<!-- 分类管理 -->
<div>
<div class="tool">
<ul class="filter">
</ul>
<div style="margin-top: 24px">
<el-button v-auth="'分类管理:新增'" type="primary" round @click="addClass">新增</el-button>
</div>
</div>
<el-table :data="classificationList" class="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + (pageNo - 1) * pageSize + 1 }}
</template>
</el-table-column>
<el-table-column prop="name" label="课程分类名称">
</el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button v-auth="'分类管理:修改'" type="text" @click="editClass(scope.row)">修改</el-button>
<el-divider v-auth="'分类管理:修改'" direction="vertical"></el-divider>
<el-button v-auth="'分类管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="isAddclass ? '添加分类' : '编辑分类'" :visible.sync="classVisible" width="400px" :close-on-click-modal="false" @close="closeColumn">
<el-form>
<el-form-item>
<el-input placeholder="分类名称" v-model="className"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="classVisible = false"> </el-button>
<el-button type="primary" @click="classSubmit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import util from "@/libs/util";
export default {
name: "sortManagement",
data() {
return {
classificationList: [],
multipleSelection: [],
pageNo: 1,
pageSize: 10,
isAddclass: true,
classVisible: false,
curRow: {},
className: ""
};
},
mounted() {
this.getData();
},
methods: {
getData() {
this.$get(this.api.queryGlClassification).then(res => {
this.classificationList = res.classificationList;
}).catch(res => {
});
},
addCourse() {
this.$router.push("/addcourse");
},
editCourse(row) {
this.$router.push(`/addcourse?id=${row.id}`);
},
handleDelete(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$del(`${this.api.deleteClassification}/${row.id}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
},
getRowKeys(row) {
return row.customerId;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
closeColumn() {
this.className = "";
this.curRow = {};
},
delAllData() {
if (this.multipleSelection.length != "") {
let newArr = this.multipleSelection;
let delList = newArr.map(item => {
return item.id;
});
//
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
let data = delList.join();
this.$del(this.api.deleteClassification, data).then(res => {
this.multipleSelection = [];
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
}).catch(() => {
});
} else {
util.errorMsg("请先选择数据 !");
}
},
handleCurrentChange(val) {
this.pageNo = val;
this.getData();
},
addClass() {
this.isAddClass = true;
this.classVisible = true;
},
editClass(row) {
this.curRow = row;
this.className = row.name;
this.isAddClass = false;
this.classVisible = true;
},
classSubmit() {
if (!this.className) return util.warningMsg("请填写分类名称");
let data = {
name: this.className
};
if (this.curRow.id) {
data.id = this.curRow.id;
this.$put(this.api.editClassification, data).then(res => {
util.successMsg("修改成功");
this.classVisible = false;
this.getData();
}).catch(res => {
});
} else {
this.$post(`${this.api.addClassification}/${this.className}?distinguish=1`).then(res => {
util.successMsg("添加成功");
this.classVisible = false;
this.getData();
}).catch(res => {
});
}
}
}
};
</script>
<style lang="scss" scoped>
</style>

@ -1,502 +0,0 @@
<template>
<!-- 课程预览 -->
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="goBack" :content="'课程预览'"></el-page-header>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20" style="background: none;">
<div class="flex">
<div class="cover" :class="{'is-word': showMask1}">
<img v-if="coverUrl" :src="coverUrl" alt="" width="100%" height="100%">
<template v-else-if="iframeSrc">
<iframe class="inner fileIframe" id="fileIframe" :src="iframeSrc" frameborder="0"></iframe>
<template v-if="showMask">
<div class="mask" style="width: 500px;height: 30px;top: 53px;right: 320px"></div>
<div class="mask" style="width: 175px;height: 30px;top: 53px;right: 5px"></div>
</template>
<template v-if="showMask1">
<div class="word-mask" style="height: 40px;"></div>
<div class="word-mask2" style="top: 55px;left: 28%;width: 44%;height: calc(100% - 80px);"></div>
</template>
<template v-if="showMask2">
<div class="excel-mask1" style="height: 48px;"></div>
</template>
</template>
<div class="pdf inner" v-else-if="pdfSrc">
<p class="arrow">
<span @click="changePdfPage(0)" class="turn el-icon-arrow-left" :class="{grey: currentPage==1}"></span>
{{ currentPage }} / {{ pageCount }}
<span @click="changePdfPage(1)" class="turn el-icon-arrow-right" :class="{grey: currentPage==pageCount}"></span>
</p>
<pdf
class="pdf-wrap"
:src="pdfSrc"
:page="currentPage"
@num-pages="pageCount=$event"
@page-loaded="currentPage=$event"
@loaded="loadPdfHandler">
</pdf>
</div>
<div class="inner" v-else-if="playAuth">
<div class="video_wid" id="player"></div>
</div>
</div>
<div class="catalog flex-1">
<div class="list">
<h4 class="title">{{ courseName }}</h4>
<div class="desc-wrap">
<div class="desc" :class="{active: desShrink}" v-html="description"></div>
<i class="arrow" :class="{active: desShrink}" v-if="description.length > 40">
<span>...</span>
<img src="@/assets/img/arrow-down.png" alt="" @click="desShrink = !desShrink">
</i>
</div>
<div class="chapters">
<template v-if="videoList.length">
<div class="chapter" v-for="(item,index) in videoList" :key="index">
<div class="chapterName">{{ item.name }}</div>
<div class="section" v-if="item.subsectionList.length">
<div v-for="(section,i) in item.subsectionList" :key="i" @click="preview(section, item.name)">
<p class="sectionName" :class="{active: curLink === `${item.name}${section.name}`}">{{ section.name }}</p>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import util from "@/libs/util";
import { mapState } from "vuex";
import pdf from "vue-pdf";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
export default {
name: "coursePreview",
data() {
return {
id: this.$route.query.id,
video: "http://liuwanr.oss-cn-shenzhen.aliyuncs.com/mp4/20200519/1589871025648.mp4",
videoSrc: "",
videoList: [],
courseName: "",
description: "",
coverUrl: "",
playAuth: "",
player: null,
previewImg: "",
iframeSrc: "",
isWord: false,
isPPT: false,
isExcel: false,
showMask: false,
showMask1: false,
showMask2: false,
closePosi: {
top: "80px"
},
pdfVisible: false,
pdfSrc: "",
currentPage: 0, // pdf
pageCount: 0, // pdf
fileType: "pdf", //
desShrink: false,
curLink: "", //
};
},
components: { pdf },
mounted() {
this.insertScript();
this.getData();
this.getChapter();
},
methods: {
goBack() {
this.$router.back();
},
async getData() {
let res = await this.$get(`${this.api.getCourse}/${this.id}`);
this.courseName = res.course.name;
this.description = res.course.description;
this.coverUrl = res.course.coverUrl;
},
async getChapter() {
let res = await this.$get(`${this.api.queryChaptersAndSubsections}/${this.id}`);
this.videoList = res.chapterList;
},
insertScript() {
const linkTag = document.createElement("link");
linkTag.rel = "stylesheet";
linkTag.href = "https://g.alicdn.com/de/prismplayer/2.8.2/skins/default/aliplayer-min.css";
document.body.appendChild(linkTag);
const scriptTag = document.createElement("script");
scriptTag.type = "text/javascript";
scriptTag.src = "https://g.alicdn.com/de/prismplayer/2.8.2/aliplayer-min.js";
document.body.appendChild(scriptTag);
},
transferType(ext) {
if ("jpg,jpeg,png,gif,svg,psd".includes(ext)) return "图片";
if ("mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv".includes(ext)) return "视频";
return ext;
},
preview(row, chapterName) {
this.curLink = `${chapterName}${row.name}`;
this.player = null;
this.playauth = "";
this.coverUrl = "";
this.pdfSrc = "";
this.iframeSrc = "";
if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.data.playAuth;
this.$nextTick(() => {
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
} else {
this.player = new Aliplayer({
id: "player",
width: "100%",
autoplay: false,
vid: row.fileId,
playauth: this.playAuth,
encryptType: 1 //
});
}
});
}).catch(res => {
});
} else if (this.transferType(row.fileType) == "图片") {
this.coverUrl = row.fileUrl;
} else if (row.fileType == "pdf") {
this.pdfSrc = row.fileUrl;
this.pdfVisible = true;
} else {
this.$get(`${this.api.getSubsection}/${row.id}`).then(res => {
if (row.fileType == "pptx") {
this.isPPT = true;
this.isWord = false;
this.isExcel = false;
} else if (row.fileType == "doc" || row.fileType == "docx") {
this.isPPT = false;
this.isWord = true;
this.isExcel = false;
} else if (row.fileType == "xls" || row.fileType == "xlsx") {
this.isExcel = true;
this.isPPT = false;
this.isWord = false;
} else {
this.isPPT = false;
this.isWord = false;
this.isExcel = false;
}
if (this.isPPT) {
this.showMask = true;
} else {
this.showMask = false;
}
if (this.isWord) {
this.showMask1 = true;
} else {
this.showMask1 = false;
}
if (this.isExcel) {
this.showMask2 = true;
} else {
this.showMask2 = false;
}
this.iframeSrc = res.previewUrl;
})
.catch(err => {
});
}
},
closePlayer() {
this.playAuth = "";
this.player.pause();
},
closeIframe() {
this.iframeSrc = "";
this.showMask = false;
this.showMask1 = false;
},
closePdf() {
this.pdfSrc = "";
this.currentPage = 1;
},
changePdfPage(val) {
if (val === 0 && this.currentPage > 1) {
this.currentPage--;
}
if (val === 1 && this.currentPage < this.pageCount) {
this.currentPage++;
}
},
loadPdfHandler(e) {
this.currentPage = 1;
}
}
};
</script>
<style lang="scss" scoped>
$height: 700px;
.video_wid, .cover {
position: relative;
width: 76%;
max-width: 1400px;
height: $height !important;
border: 0;
}
.cover {
img {
border-radius: 8px;
}
&.is-word {
overflow: hidden;
}
}
.fileIframe {
height: $height !important;
}
.video_wid, .inner {
width: 100%;
height: 100% !important;
border: 0;
overflow: auto;
}
.cover.is-word {
.inner {
height: calc(100% + 38px) !important;
margin-top: -38px;
}
}
.video_wid:focus {
outline: none;
}
.catalog {
margin-left: 40px;
}
.list {
height: $height;
overflow-y: auto;
padding: 24px 16px;
background: #fff;
.title {
margin-bottom: 8px;
color: rgba(0, 0, 0, 0.85);
font-size: 20px;
}
.desc-wrap {
position: relative;
.desc {
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
line-height: 22px;
@include mul-ellipsis(2);
&.active {
display: block;
overflow: visible;
}
}
.arrow {
position: absolute;
bottom: 2px;
right: 0;
display: flex;
justify-content: space-between;
width: 46px;
background-color: #fff;
span {
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
}
img {
width: 16px;
cursor: pointer;
}
&.active {
span {
opacity: 0;
}
img {
transform: rotate(180deg);
}
}
}
}
.chapters {
margin-top: 16px;
max-height: calc(100% - 53px);
overflow: auto;
}
.chapter {
margin-bottom: 20px;
.chapterName {
color: rgba(0, 0, 0, 0.85);
font-size: 16px;
}
.section {
padding: 5px 15px;
margin-top: 8px;
background: rgba(0, 0, 0, 0.02);
.sectionName {
margin: 10px 0;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
cursor: pointer;
@include ellipsis;
&.active{
color: #9278FF;
}
}
}
}
}
.el-image-viewer__wrapper {
transform: translateY(-10px);
transition: transform .5s;
&.active {
transform: translateY(0)
}
}
.el-image-viewer__close {
z-index: 2000;
top: 15px;
right: 15px;
&.doc-close {
i {
color: #000 !important;
}
}
}
.list::-webkit-scrollbar {
width: 4px;
}
.list::-webkit-scrollbar-thumb {
border-radius: 10px;
background: rgba(0, 0, 0, 0.06);
}
.mask {
z-index: 9;
position: absolute;
background-color: rgb(57, 58, 61);
}
.word-mask {
z-index: 9;
position: absolute;
top: 0;
right: 0;
width: 100%;
background-color: rgb(243, 242, 241);
}
.word-mask1 {
z-index: 9;
position: absolute;
top: 0;
right: 0;
width: 100%;
background-color: #185abd;
}
.word-mask2 {
z-index: 9;
position: absolute;
background-color: transparent;
}
.excel-mask1 {
z-index: 9;
position: absolute;
top: 0;
left: 20%;
width: 60%;
background-color: #107c41;
}
/deep/ .pdf-dia {
border-radius: 0 !important;
.el-dialog__header {
display: none;
}
.el-dialog__body {
padding: 0;
}
.el-dialog__headerbtn {
top: 10px;
.el-dialog__close {
color: #fff;
font-size: 16px;
}
}
}
.pdf {
.arrow {
padding: 10px 0;
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
color: #fff;
background-color: #333;
.turn {
margin: 0 10px;
font-size: 18px;
cursor: pointer;
}
}
.pdf-wrap {
width: 80%;
margin: 0 auto;
}
}
</style>

@ -1,7 +1,7 @@
<template> <template>
<div class="page"> <div class="page">
<div class="tool"> <div class="tool">
<p class="page-name">企业网站管理后台</p> <p class="page-name">页面列表</p>
<div style="display: inline-flex;align-items: center;"> <div style="display: inline-flex;align-items: center;">
<el-dropdown class="setting" trigger="click" :hide-on-click="false"> <el-dropdown class="setting" trigger="click" :hide-on-click="false">
<el-tooltip placement="top"> <el-tooltip placement="top">
@ -25,7 +25,7 @@
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
<el-input class="keyword" placeholder="请输入栏目或模板名称" v-model.trim="keyword" clearable></el-input> <el-input class="keyword" :placeholder="'请输入' + keywords.find(e => e.id === field).name" v-model.trim="keyword" clearable></el-input>
</div> </div>
</div> </div>
</div> </div>
@ -48,9 +48,9 @@
<el-table-column v-if="settings[5].show" prop="editorName" label="编辑人" align="center"></el-table-column> <el-table-column v-if="settings[5].show" prop="editorName" label="编辑人" align="center"></el-table-column>
<el-table-column v-if="settings[6].show" label="操作" width="170" align="center"> <el-table-column v-if="settings[6].show" label="操作" width="170" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="start(scope.row)">预览</el-button> <el-button v-auth="'/site/list:' + site.siteName + ':内容管理:页面管理:预览'" type="text" @click="start(scope.row)">预览</el-button>
<el-button type="text" @click="start(scope.row)">编辑</el-button> <el-button v-auth="'/site/list:' + site.siteName + ':内容管理:页面管理:编辑'" type="text" @click="start(scope.row)">编辑</el-button>
<el-button type="text" @click="start(scope.row)">删除</el-button> <el-button v-auth="'/site/list:' + site.siteName + ':内容管理:页面管理:删除'" type="text" @click="start(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -64,6 +64,7 @@
export default { export default {
data() { data() {
return { return {
site: this.$store.state.content.site,
field: 'programName', field: 'programName',
keywords: [ keywords: [
{ {
@ -122,7 +123,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理', name: '站点管理',
route: '/site' route: '/site'
@ -141,7 +142,7 @@ export default {
// //
getData() { getData() {
this.$post(this.api.longPageColumnList, { this.$post(this.api.longPageColumnList, {
siteId: this.$store.state.content.site.id, siteId: this.site.id,
pageNum: this.page, pageNum: this.page,
pageSize: this.pageSize, pageSize: this.pageSize,
programName: this.field === 'programName' ? this.keyword : '', programName: this.field === 'programName' ? this.keyword : '',

@ -5,21 +5,21 @@
<el-input placeholder="请输入角色名称" v-model.trim="keyword" clearable></el-input> <el-input placeholder="请输入角色名称" v-model.trim="keyword" clearable></el-input>
</div> </div>
<div class="actions"> <div class="actions">
<el-button type="primary" @click="addRole">新增</el-button> <el-button v-auth type="primary" @click="addRole">新增</el-button>
<el-button @click="batchDel">删除</el-button> <el-button v-auth="'批量删除'" @click="batchDel">删除</el-button>
</div> </div>
</div> </div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id"> <el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> <el-table-column type="selection" width="55" align="center" :reserve-selection="true" :selectable="row => row.name !== '超级管理员'"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> <el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="name" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column> <el-table-column prop="name" label="角色名称" align="center" min-width="250" show-overflow-tooltip></el-table-column>
<el-table-column prop="description" label="角色描述" min-width="400" align="center"></el-table-column> <el-table-column prop="description" label="角色描述" min-width="400" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="200"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)">查看</el-button> <el-button v-auth type="text" @click="showRole(scope.row)">查看</el-button>
<el-button v-if="scope.row.name !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button> <el-button v-auth v-if="scope.row.name !== '超级管理员'" type="text" @click="editRole(scope.row)">编辑</el-button>
<el-button v-if="scope.row.name !== '超级管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button> <el-button v-auth v-if="scope.row.name !== '超级管理员'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -96,7 +96,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '用户管理' name: '用户管理'
}, },
@ -187,6 +187,20 @@ export default {
this.permissions.length && this.$refs.per.setCheckedNodes([]) this.permissions.length && this.$refs.per.setCheckedNodes([])
this.roleVisible = true this.roleVisible = true
}, },
//
handleRolePer(data, permissions) {
let result = data
if (permissions.length) {
permissions.map(e => {
if (result.includes(e.id) && e.children) {
// ,idid,,,
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id), 1)
}
e.children && e.children.length && this.handleRolePer(data, e.children)
})
}
return result
},
// //
async getDetail(row) { async getDetail(row) {
this.$get(`${this.api.role}/${row.id}`).then(({ data }) => { this.$get(`${this.api.role}/${row.id}`).then(({ data }) => {
@ -195,8 +209,9 @@ export default {
this.form.description = role.description this.form.description = role.description
this.form.id = role.id this.form.id = role.id
const list = data.permissionList const list = data.permissionList
list[0] === '1' && list.shift() // 11 // list[0] === '1' && list.shift() // 11
this.$refs.per.setCheckedKeys(list) this.checkedIds = this.handleRolePer(list, this.permissions)
this.$refs.per.setCheckedNodes(this.checkedIds)
}).catch(err => {}) }).catch(err => {})
}, },
showRole(row) { showRole(row) {
@ -214,9 +229,8 @@ export default {
const { form } = this const { form } = this
if (!form.name) return util.warningMsg("请填写角色名称") if (!form.name) return util.warningMsg("请填写角色名称")
if (!form.description) return util.warningMsg("请填写角色描述") if (!form.description) return util.warningMsg("请填写角色描述")
const checked = this.$refs.per.getCheckedKeys() const checked = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()]
if (!checked.length) return util.warningMsg("请选择角色权限") if (!checked.length) return util.warningMsg("请选择角色权限")
checked[0] !== '1' && checked.unshift('1')
let data = { let data = {
...form, ...form,
permissions: checked permissions: checked

@ -1,6 +1,5 @@
<template> <template>
<div class="main"> <div class="main">
<div class="wrap">
<div class="left"> <div class="left">
<div class="inner"> <div class="inner">
<div class="text-center"> <div class="text-center">
@ -17,11 +16,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="right"> <info class="flex-1" ref="info" @updateStatus="updateStatus"></info>
<info ref="info" v-if="active == 1" @updateStatus="updateStatus"></info>
<download v-else></download>
</div>
</div>
</div> </div>
</template> </template>
@ -69,15 +64,10 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.main{ .main{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.wrap{
display: flex; display: flex;
width: $min-width; width: $min-width;
padding: 12px 0 0; padding: 12px 0 0;
margin: 0 auto;
.left{ .left{
margin-right: 12px; margin-right: 12px;
background-color: #fff; background-color: #fff;
@ -106,8 +96,5 @@ export default {
} }
} }
} }
.right{
flex: 1;
}
} }
</style> </style>

@ -1,155 +1,37 @@
<template> <template>
<div> <div v-loading="loading">
<div class="scroll" v-loading="loading">
<div class="page"> <div class="page">
<!-- <h6 class="l-title"><img src="@/assets/img/info1.png" alt=""> 用户信息</h6> -->
<div class="page-content"> <div class="page-content">
<ul class="list"> <ul class="list">
<div class="line info"> <div class="line info imp">
<li> <li>
<label>姓名</label> <label>姓名</label>
<el-input id="username" class="username" placeholder="请输入姓名" type="text" v-model="form.userName" /> <el-input placeholder="请输入姓名" type="text" v-model="form.realName" />
</li> </li>
<li>
<label>所在国家</label>
<el-select
v-model="form.countries"
placeholder
>
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</li>
</div>
<div class="line info">
<li> <li>
<label>性别</label> <label>性别</label>
<el-select size="small" v-model="form.sex"> <el-select size="small" v-model="form.sex">
<el-option v-for="item in sexList" :key="item.value" :label="item.name" :value="item.value"></el-option> <el-option v-for="item in sexList" :key="item.value" :label="item.name" :value="item.value"></el-option>
</el-select> </el-select>
</li> </li>
<li class="selects">
<label>所在地</label>
<div class="mul">
<div class="child">
<el-select size="small" v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label"></el-option>
</el-select>
</div>
<div class="child">
<el-select size="small" v-model="form.provinceId" placeholder @change="id => getCity(id,1)">
<el-option v-for="item in provinceList" :key="item.provinceId" :label="item.provinceName" :value="item.provinceId"></el-option>
</el-select>
</div>
<div class="child">
<el-select size="small" v-model="form.cityId" placeholder :disabled="form.provinceId ? false : true">
<el-option v-for="item in cityList" :key="item.cityId" :label="item.cityName" :value="item.cityId"></el-option>
</el-select>
</div>
</div>
</li>
</div>
<div class="line info">
<li>
<label>出生年月</label>
<el-date-picker
v-model="form.dateBirth"
:clearable="false"
class="block-right"
type="date">
</el-date-picker>
</li>
<li>
<label>身份证</label>
<el-input onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" id="idnumber" class="idnumber" placeholder="请输入身份证" type="text" v-model="form.idNumber" />
</li>
</div>
<div class="line info">
<li>
<label>教育程度</label>
<el-select size="small" v-model="form.educationDegree" placeholder="请选择教育程度">
<el-option v-for="(item,index) in educationDegreeList" :key="index" :label="item.name" :value="item.value"></el-option>
</el-select>
</li>
<li>
<label>当前所在学校</label>
<el-input size="small" readonly placeholder="请输入学校" v-model="form.schoolName" clearable></el-input>
</li>
</div>
</ul>
</div>
<div class="arc-action flex j-between a-center">
<!-- <h6 class="l-title"><img src="@/assets/img/info2.png" alt=""> 个人档案</h6> -->
<el-button type="text" icon="el-icon-plus" style="margin-left: 16px" @click="addArch">新增</el-button>
</div>
<div class="page-content">
<div class="archives" v-for="(archive,index) in archivesList" :key="index" v-show="index == 0 || showArch">
<ul class="list">
<div class="line">
<li>
<label>职业</label>
<el-select size="small" v-model="archive.personalCareerId" placeholder="选择职业">
<el-option v-for="item in occupationList" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</li>
<li>
<label>所在国家</label>
<el-select size="small" v-model="form.countries" placeholder>
<el-option v-for="item in countryList" :key="item.value" :label="item.label" :value="item.label" ></el-option>
</el-select>
</li>
</div>
<div class="line">
<li>
<label>学校名称</label>
<el-select size="small" v-model="archive.schoolId" filterable placeholder="选择学校" @change="id => getSchoolName(id,index)">
<el-option v-for="item in schoolList" :key="item.value" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
</li>
<li>
<label>专业学科</label>
<el-select size="small" v-model="archive.disciplineId" placeholder="选择专业学科" @change="id => getItemProfessionalClass(id,index)" @clear="() => clearItemClass(index)">
<el-option v-for="item in subjectList" :key="item.value" :label="item.disciplineName" :value="item.disciplineId"></el-option>
</el-select>
</li>
</div> </div>
<div class="line" style="margin-bottom: 0"> <div class="line info imp">
<li> <li>
<label>专业类</label> <label>账号</label>
<el-select size="small" v-model="archive.professionalClassId" placeholder="选择专业类" :disabled="archive.disciplineId ? false : true" @change="id => getItemProfessional(id,index)" @clear="() => clearItemProfess(index)"> <el-input class="m-r-10" type="text" size="small" v-model="form.username" disabled></el-input>
<el-option v-for="item in archive.ProfessionalClassList" :key="item.professionalClassId" :label="item.professionalClassName" :value="item.professionalClassId"></el-option> <el-button type="text" size="small" @click="showAccount">修改</el-button>
</el-select>
</li> </li>
<li> <li>
<label>专业</label> <label>工号</label>
<el-select size="small" v-model="archive.professionalId" placeholder="选择专业" :disabled="archive.professionalClassId ? false : true" @change="getItemStuGrade"> <el-input size="small" v-model="form.jobNumber" clearable></el-input>
<el-option v-for="item in archive.ProfessionalList" :key="item.professionalId" :label="item.professionalName" :value="item.professionalId"></el-option>
</el-select>
</li> </li>
</div> </div>
</ul>
<!-- <img class="del" src="@/assets/img/trash.png" alt="" v-if="index" @click="delArchive(index)"> -->
</div>
<div class="fold" v-if="archivesList.length > 1">
<span :class="{active: showArch}" @click="showArch = !showArch">
展开更多
<i class="el-icon-arrow-down"></i>
</span>
</div>
</div>
</div>
<div class="page">
<!-- <h6 class="l-title"><img src="@/assets/img/info3.png" alt=""> 账号信息</h6> -->
<div class="page-content">
<ul class="list">
<div class="line info imp"> <div class="line info imp">
<li style="width: 333px;margin-right: 90px"> <li>
<label>学号</label> <label>邮箱</label>
<el-input class="m-r-10" size="small" v-model="form.workNumber" clearable disabled></el-input> <el-input class="m-r-10" size="small" v-model="form.email" disabled></el-input>
<el-button v-if="form.email" type="text" size="small" @click="bindEmail">更换</el-button>
<el-button v-else type="text" size="small" @click="bindEmail">添加</el-button>
</li> </li>
<li> <li>
<label>手机号</label> <label>手机号</label>
@ -159,12 +41,6 @@
</li> </li>
</div> </div>
<div class="line info imp"> <div class="line info imp">
<li>
<label>邮箱</label>
<el-input class="m-r-10" size="small" v-model="form.email" disabled></el-input>
<el-button v-if="form.email" type="text" size="small" @click="bindEmail">更换</el-button>
<el-button v-else type="text" size="small" @click="bindEmail">添加</el-button>
</li>
<li> <li>
<label>密码</label> <label>密码</label>
<el-input class="m-r-10" size="small" value="******" disabled></el-input> <el-input class="m-r-10" size="small" value="******" disabled></el-input>
@ -174,12 +50,10 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="btns"> <div class="btns">
<el-button size="small" v-throttle @click="$router.back()">取消</el-button> <el-button size="small" v-throttle @click="$router.back()">取消</el-button>
<el-button type="primary" size="small" v-throttle @click="save">更新</el-button> <el-button type="primary" size="small" v-throttle @click="save">更新</el-button>
</div> </div>
<el-dialog <el-dialog
:title="form.email ? '更换邮箱' : '绑定邮箱'" :title="form.email ? '更换邮箱' : '绑定邮箱'"
:visible.sync="emailVisible" :visible.sync="emailVisible"
@ -202,7 +76,6 @@
<el-button type="primary" @click="emailSubmit"> </el-button> <el-button type="primary" @click="emailSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:title="form.phone ? '更换手机号' : '绑定手机号'" :title="form.phone ? '更换手机号' : '绑定手机号'"
:visible.sync="phoneVisible" :visible.sync="phoneVisible"
@ -225,7 +98,6 @@
<el-button type="primary" @click="phoneSubmit"> </el-button> <el-button type="primary" @click="phoneSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
title="更换密码" title="更换密码"
:visible.sync="passwordVisible" :visible.sync="passwordVisible"
@ -248,11 +120,10 @@
<el-button type="primary" @click="editPassword"> </el-button> <el-button type="primary" @click="editPassword"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-dialog title="修改账号" :visible.sync="accountVisible" :close-on-click-modal="false" width="30%">
<el-dialog title="修改用户账号" :visible.sync="accountVisible" :close-on-click-modal="false" width="30%"> <el-form label-width="70px">
<el-form label-width="82px"> <el-form-item label="账号">
<el-form-item label="用户账号"> <el-input v-model="editUsername" placeholder="请输入账号"></el-input>
<el-input v-model="editUsername" placeholder="请输入用户账号"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -264,9 +135,9 @@
</template> </template>
<script> <script>
import Setting from "@/setting"; import Setting from '@/setting'
import util from "@/libs/util"; import util from '@/libs/util'
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from 'vuex'
export default { export default {
data() { data() {
@ -279,29 +150,12 @@ export default {
form: { form: {
userName: "", userName: "",
name: "", name: "",
workNumber: "", jobNumber: "",
password: "", password: "",
phone: "", phone: "",
email: "", email: "",
provinceName: "",
cityName: "",
schoolName: "",
professionalName: "",
experimentName: "",
sex: 1, sex: 1,
dateBirth: "",
educationDegree: ""
},
profession: [
{
value: "1",
label: "学生"
}, },
{
value: "2",
label: "老师"
}
],
emailVisible: false, emailVisible: false,
passwordVisible: false, passwordVisible: false,
phoneVisible: false, phoneVisible: false,
@ -321,64 +175,6 @@ export default {
value: 2 value: 2
} }
], ],
countryList: [
{
label: "中国"
}
],
form: {},
occupationList: [{
value: 1,
label: "学生"
},
{
value: 2,
label: "老师"
}],
provinceList: [],
cityList: [],
//
educationDegreeList: [
{
name: "专科",
value: 1
},
{
name: "本科",
value: 2
},
{
name: "硕士",
value: 3
},
{
name: "博士",
value: 4
},
{
name: "其他",
value: 5
}
],
subjectList: [], //
ProfessionalClassList: [], //
ProfessionalList: [], //
schoolList: [],
archivesList: [],
archivesForm: {
//
personalCareerId: "", //
schoolId: "", //
schoolName: "", //
professionalClassId: "", //
professionalClassName: "", //
disciplineId: "", //
disciplineName: "", //
professionalId: "", //
professionalName: "", //
userId: this.userId
},
email: "", email: "",
emailBtnText: "发送验证码", emailBtnText: "发送验证码",
emailCode: "", emailCode: "",
@ -400,202 +196,56 @@ export default {
"userId", "avatar" "userId", "avatar"
]) ])
}, },
watch: {
// ,
form: {
handler(){
this.updateTime++
// if(this.updateTime > 1) this.$emit('updateStatus',this.updateTime > 1)
},
deep:true
}
},
mounted() { mounted() {
this.getData(); this.getData()
this.getProvince();
this.getSchoolData();
this.getSubject();
}, },
methods: { methods: {
...mapActions("user", [ ...mapActions('user', [
"setAvatar", "setUserName" 'setUserName'
]), ]),
//
getData() {
this.loading = true
this.$get(`${this.api.user}/${this.userId}`).then(({ data }) => {
this.form = data
this.loading = false
}).catch(err => {})
},
//
showAccount() {
this.accountVisible = true
},
//
confirmAccount() { confirmAccount() {
if (this.editUsername) { if (this.editUsername) {
this.form.account = this.editUsername form.username = this.editUsername
this.accountVisible = false this.accountVisible = false
const { form } = this
this.$put(this.api.user, form).then(res => {
this.setUserName(form.username)
this.$message.success("提交成功!")
}).catch(res => {})
} else { } else {
util.errorMsg('请输入账号') util.errorMsg('请输入账号')
} }
}, },
openAccount() {
this.editUsername = this.form.account
this.accountVisible = true
},
getProvince() {
this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.list;
}).catch(res => {
});
},
//
getCity(id, type, index) {
if (type == 1) {
if (this.form.provinceId) {
this.form.cityId = 1;
this.getCityData(type, index);
}
} else {
if (this.archivesList[index].provinceId) {
this.archivesList[index].provinceName = this.provinceList[id - 1].provinceName;
this.archivesList[index].cityId = 1;
this.getCityData(type, index);
}
}
},
getCityData(type, index) {
let provinceId = type == 1 ? this.form.provinceId : this.archivesList[index].provinceId;
this.$get(this.api.queryCity, { provinceId }).then(res => {
if (type == 1) {
this.cityList = res.list;
} else {
this.archivesList[index].cityList = res.list;
}
}).catch(res => {
});
},
getCityName(id, index) {
this.archivesList[index].cityName = this.archivesList[index].cityList[id - 1].cityName;
},
getSchoolName(id, index) {
const school = this.schoolList.find(e => e.schoolId == id)
if (school) this.archivesList[index].schoolName = school.schoolName
},
//
getSchoolData() {
this.$get(this.api.querySchoolData, { schoolName: "", provinceId: "", cityId: "" }).then(res => {
this.schoolList = res.list;
}).catch(res => {
});
},
//
getRes(res) {
this.setAvatar(res.message);
},
uploadHeadImg: function() {
this.$el.querySelector(".hiddenInput").click();
},
async accountChange() {
if (this.originAccount != this.form.account) {
let res = await this.$get(this.api.queryAccountIsExist, {
account: this.form.account,
schoolId: this.form.schoolId
});
if (res.message.user.length) {
util.warningMsg("该账号已存在");
this.accountReapeat = true;
} else {
this.accountReapeat = false;
}
} else {
this.accountReapeat = false;
}
},
getData() {
this.loading = true
this.$get(this.api.queryUserInfoDetails).then(({ result }) => {
const userInfo = result.hrUserInfo
const { userAccount } = result
userInfo.account = userAccount.account
userInfo.phone = userAccount.phone
userInfo.workNumber = userAccount.workNumber
this.form = userInfo
this.originAccount = this.form.account;
this.archivesList = result.personalFileList;
this.loading = false
if (userInfo.userAvatars) this.setAvatar(userInfo.userAvatars);
this.$nextTick(() => {
if (this.form.provinceId) {
this.getCityData(1);
}
if (this.archivesList.length != 0) {
this.archivesList.forEach((e, k) => {
this.$set(e, "subjectList", this.subjectList);
this.$set(e, "disciplineId", e.disciplineId ? e.disciplineId : "");
this.$set(e, "disciplineName", e.disciplineName ? e.disciplineName : "");
this.$set(e, "professionalClassId", e.professionalClassId ? e.professionalClassId : "");
this.$set(e, "professionalClassName", e.professionalClassName ? e.professionalClassName : "");
this.$set(e, "professionalId", e.professionalId ? e.professionalId : "");
this.$set(e, "professionalName", e.professionalName ? e.professionalName : "");
this.$set(e, "schoolId", e.schoolId ? e.schoolId : "");
this.$set(e, "schoolName", e.schoolName ? e.schoolName : "");
if (e.disciplineId) {
this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => {
this.$set(e, "ProfessionalClassList", res.list);
}).catch(res => {
});
} else {
this.$set(e, "ProfessionalClassList", []);
}
if (e.professionalClassId) {
this.$get(this.api.queryCourseProfessional, { professionalClassId: e.professionalClassId }).then(res => {
this.$set(e, "ProfessionalList", res.list);
}).catch(res => {
});
} else {
this.$set(e, "ProfessionalList", []);
}
// if(e.provinceId){
// this.$get(this.api.queryCity,{provinceId: e.provinceId}).then(res => {
// this.$set(e, 'cityList', res.message);
// }).catch(res => {});
// }else{
// this.$set(e, 'cityList', []);
// }
});
} else {
this.concatArch(1);
}
});
})
.catch(err => {
console.log(err);
});
},
concatArch(isLoadData) {
this.archivesList = this.archivesList.concat({
isNew: true,
personalCareerId: "", //
schoolId: "", //
schoolName: "", //
subjectList: this.subjectList, //
disciplineId: "", //
disciplineName: "", //
ProfessionalClassList: [], //
professionalClassId: "", //
professionalClassName: "", //
ProfessionalList: [], //
professionalId: "", //
professionalName: "", //
userId: this.userId,
personalFileId: ""
});
// if (!isLoadData) {
// this.$nextTick(() => {
// document.body.scrollTop = document.querySelector(".content-box").scrollHeight;
// document.documentElement.scrollTop = document.querySelector(".content-box").scrollHeight;
// });
// }
},
addArch() {
let isEmpty = false;
this.archivesList.forEach((n, k) => {
if (!n.personalCareerId) isEmpty = true;
});
if (isEmpty) return util.warningMsg("请选择职业");
this.showArch = true;
this.concatArch();
},
bindEmail() { bindEmail() {
this.email = this.form.email; this.email = this.form.email
this.emailVisible = true; this.emailVisible = true
}, },
bindPhone() { bindPhone() {
this.phone = this.form.phone; this.phone = this.form.phone
this.phoneVisible = true; this.phoneVisible = true
}, },
// //
unbind() { unbind() {
@ -609,231 +259,35 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
bindPassword() { bindPassword() {
this.passwordVisible = true; this.passwordVisible = true
}, },
editPassword() { editPassword() {
if (!this.passwordForm.password) return util.warningMsg("请输入原密码"); if (!this.passwordForm.password) return util.warningMsg("请输入原密码")
if (!this.passwordForm.newPassword) return util.warningMsg("请输入新密码"); if (!this.passwordForm.newPassword) return util.warningMsg("请输入新密码")
if (!this.passwordForm.reNewPassword) return util.warningMsg("请确认新密码"); if (!this.passwordForm.reNewPassword) return util.warningMsg("请确认新密码")
if (this.passwordForm.newPassword.length < 6 || this.passwordForm.reNewPassword.length < 6) return util.warningMsg("请输入6位数以上的密码"); if (this.passwordForm.newPassword.length < 6 || this.passwordForm.reNewPassword.length < 6) return util.warningMsg("请输入6位数以上的密码")
if (this.passwordForm.newPassword !== this.passwordForm.reNewPassword) return util.warningMsg("输入的新密码不一致,请重新确认"); if (this.passwordForm.newPassword !== this.passwordForm.reNewPassword) return util.warningMsg("输入的新密码不一致,请重新确认")
if (this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg("原密码跟新密码不能一致"); if (this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg("原密码跟新密码不能一致")
let data = this.passwordForm
let data = this.passwordForm; data.userid = this.userId
data.userid = this.userId; this.$post(this.api.examinePassword, data).then(res => {
this.$post(this.api.examinePassword, data) util.successMsg("更换成功")
.then(res => { this.passwordVisible = false
util.successMsg("更换成功"); }).catch(err => {})
this.passwordVisible = false;
})
.catch(err => {
console.log(err);
});
}, },
closePassword() { closePassword() {
this.passwordForm = { this.passwordForm = {
password: "", password: "",
newPassword: "", newPassword: "",
reNewPassword: "" reNewPassword: ""
};
},
foldArch() {
this.showArch = !this.showArch;
// this.$nextTick(() => {
// document.body.scrollTop = document.querySelector('.content-box').scrollHeight
// document.documentElement.scrollTop = document.querySelector('.content-box').scrollHeight
// })
},
//
getSubject() {
this.$get(this.api.queryCourseDiscipline).then(res => {
this.subjectList = res.list;
}).catch(res => {
});
},
//
clearClass() {
this.archivesForm.professionalClassId = "",
this.archivesForm.professionalId = "";
},
//
getProfessionalClass(val) {
this.clearClass();
if (val) {
let obj = {};
obj = this.subjectList.find((item) => {
return item.disciplineId === val;
});
this.archivesForm.disciplineName = obj.disciplineName;
this.getProfessionalClassData(val);
}
},
clearItemClass(index) {
this.archivesList[index].professionalClassId = "";
this.archivesList[index].professionalClassName = "";
this.archivesList[index].professionalId = "";
this.archivesList[index].professionalName = "";
// this.archivesList.map(e =>{
// if(e.disciplineId == item){
// e.professionalClassId = '',
// e.professionalClassName = '',
// e.professionalId = '',
// e.professionalName = ''
// }
// })
},
getItemProfessionalClass(item, index) {
this.clearItemClass(index);
if (item) {
let obj = {};
obj = this.subjectList.find(r => {
return r.disciplineId === item;
});
this.$get(this.api.queryCourseProfessionalClass, { disciplineId: item }).then(res => {
this.archivesList.map(e => {
if (e.disciplineId == item) {
e.ProfessionalClassList = res.list;
e.disciplineName = obj.disciplineName;
}
});
}).catch(res => {
});
}
},
getProfessionalClassData(value) {
this.$get(this.api.queryCourseProfessionalClass, { disciplineId: value }).then(res => {
this.ProfessionalClassList = res.list;
}).catch(res => {
});
},
//
clearProfess() {
this.archivesForm.professionalId = "";
},
//
getProfessional(val) {
this.clearProfess();
if (val) {
let obj = {};
obj = this.ProfessionalClassList.find((item) => {
return item.professionalClassId === val;
});
this.archivesForm.professionalClassName = obj.professionalClassName;
this.getProfessionalData(val);
}
},
clearItemProfess(index) {
this.archivesList[index].professionalId = "";
this.archivesList[index].professionalName = "";
// this.archivesList.map(e =>{
// if(e.professionalClassId == item){
// e.professionalId = '',
// e.professionalName = ''
// }
// })
},
getItemProfessional(item, index) {
this.clearItemProfess(index);
if (item) {
this.$get(this.api.queryCourseProfessional, { professionalClassId: item }).then(res => {
this.archivesList.map(e => {
if (e.professionalClassId == item) {
let obj = {};
obj = e.ProfessionalClassList.find(r => {
return r.professionalClassId === item;
});
e.ProfessionalList = res.list;
e.professionalClassName = obj.professionalClassName;
}
});
}).catch(res => {
});
}
},
getProfessionalData(value) {
this.$get(this.api.queryCourseProfessional, { professionalClassId: value }).then(res => {
this.ProfessionalList = res.list;
}).catch(res => {
});
},
//
getStuGrade(val) {
if (val) {
let obj = {};
obj = this.ProfessionalList.find(r => {
return r.professionalId === val;
});
this.archivesForm.professionalName = obj.professionalName;
}
},
getItemStuGrade(item) {
if (item) {
this.archivesList.map(e => {
if (e.professionalId == item) {
let obj = {};
obj = e.ProfessionalList.find(r => {
return r.professionalId === item;
});
e.professionalName = obj.professionalName;
}
});
} }
}, },
save() { save() {
let isEmpty = false; const { form } = this
// this.archivesList.forEach((n, k) => { this.$put(this.api.user, form).then(res => {
// if (!n.personalCareerId) isEmpty = true; this.setUserName(form.username)
// n.userId = this.userId; this.$message.success("提交成功!")
// }); }).catch(res => {})
// if (isEmpty) return util.warningMsg("");
// if (this.accountReapeat) return util.warningMsg("");
if (this.form.idNumber && !/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/.test(this.form.idNumber)) return util.warningMsg("请输入正确的身份证号码");
let form = this.form;
let personalFileList = [];
this.archivesList.forEach((n, k) => {
n.personalCareerId && personalFileList.push({
disciplineId: n.disciplineId,
disciplineName: n.disciplineName,
personalCareerId: n.personalCareerId,
personalFileId: n.personalFileId,
professionalClassId: n.professionalClassId,
professionalClassName: n.professionalClassName,
professionalId: n.professionalId,
professionalName: n.professionalName,
provinceId: n.provinceId,
provinceName: n.provinceName,
schoolId: n.schoolId,
schoolName: n.schoolName,
userId: form.userId
});
});
let data = {
userId: form.userId,
userAccountList: [{
id: form.accountId,
account: form.account,
userId: form.userId
}],
hrUserInfo: {
provinceId: form.provinceId,
cityId: form.cityId,
countries: form.countries,
dateBirth: form.dateBirth,
educationDegree: form.educationDegree,
idNumber: form.idNumber,
schoolId: form.schoolId,
sex: form.sex,
userId: form.userId,
userName: form.userName,
wechatId: form.wechatId
},
personalFileList
};
this.$post(this.api.updatePersonCenter, data).then(res => {
this.setUserName(form.userName);
this.$message.success("提交成功!");
}).catch(res => {
});
}, },
emailCountdown() { emailCountdown() {
let count = 60; let count = 60;
@ -966,63 +420,26 @@ export default {
this.$router.go(-1); this.$router.go(-1);
} }
} }
}, }
watch: {
// ,
form: {
handler(){
this.updateTime++
// if(this.updateTime > 1) this.$emit('updateStatus',this.updateTime > 1)
},
deep:true
},
archivesForm: {
handler(){
this.updateTime++
// if(this.updateTime > 1) this.$emit('updateStatus',this.updateTime > 1)
},
deep:true
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.scroll{ .list{
max-height: calc(100vh - 220px); .line {
overflow: auto;
}
.page{
margin-bottom: 12px;
/deep/.el-input__inner{
border-color: #CACFDB;
}
.list{
.line{
display: flex; display: flex;
margin-bottom: 24px; margin-bottom: 24px;
&.info li:not(.selects){
.el-input{
flex: 1;
}
}
&.imp li{
&:nth-child(odd) {
width: 360px;
margin-right: 64px;
} }
} .el-input, .el-select {
}
.el-input, .el-select{
width: 220px; width: 220px;
.el-input__inner{ .el-input__inner{
border-color: #CACFDB; border-color: #CACFDB;
} }
} }
li{ li {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
&>label{ &>label {
width: 100px; width: 100px;
margin-right: 5px; margin-right: 5px;
text-align: right; text-align: right;
@ -1033,67 +450,21 @@ export default {
.el-select { .el-select {
flex: 1; flex: 1;
} }
.el-select .el-input.is-disabled .el-input__inner{ .el-select .el-input.is-disabled .el-input__inner {
border-color: #ddd; border-color: #ddd;
} }
.val{ .val {
margin-right: 15px; margin-right: 15px;
color: #606266; color: #606266;
font-size: 14px; font-size: 14px;
} }
.mul{
display: inline-flex;
.child{
display: inline-flex;
width: 132px;
margin-right: 10px;
&>span{
margin-bottom: 5px;
font-size: 14px;
color: #575757;
}
}
}
&:nth-child(odd) { &:nth-child(odd) {
width: 325px; width: 400px;
margin-right: 100px; margin-right: 100px;
} }
} }
}
.archives{
position: relative;
width: 862px;
padding: 16px 0;
margin-bottom: 6px;
border-radius: 4px;
background-color: #FAFAFA;
.del{
position: absolute;
top: 80px;
right: 19px;
cursor: pointer;
}
}
.arc-action {
width: 862px;
}
.fold{
margin-top: 20px;
text-align: center;
font-size: 12px;
color: #006EFF;
span{
cursor: pointer;
i{
transition: .5s;
}
&.active i{
transform: rotate(180deg);
}
}
}
} }
.btns{ .btns {
width: 100%; width: 100%;
padding: 12px 0; padding: 12px 0;
text-align: center; text-align: center;
@ -1103,15 +474,4 @@ export default {
width: 80px; width: 80px;
} }
} }
.l-title{
display: flex;
align-items: center;
margin-bottom: 12px;
font-size: 14px;
color: #333;
img{
margin-right: 5px;
}
}
</style> </style>

@ -13,12 +13,16 @@
{{ scope.$index + (page - 1) * pageSize + 1 }} {{ scope.$index + (page - 1) * pageSize + 1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="站点名称" align="center"></el-table-column> <el-table-column prop="siteName" label="站点名称" align="center"></el-table-column>
<el-table-column prop="domain" label="域名" align="center"></el-table-column> <el-table-column prop="domainName" label="域名" width="400" align="center">
<template slot-scope="scope">
<el-input v-model.trim="scope.row.domainName" placeholder="请输入域名" @change="update(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="170" align="center"> <el-table-column label="操作" width="170" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="toIndex(scope.row)">前往网站首页</el-button> <el-button v-auth="scope.row.siteName + ':前往网站首页'" type="text" @click="toIndex(scope.row)">前往网站首页</el-button>
<el-button type="text" @click="content(scope.row)">内容管理</el-button> <el-button v-auth="scope.row.siteName + ':内容管理'" type="text" @click="content(scope.row)">内容管理</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -29,28 +33,33 @@
</template> </template>
<script> <script>
import { mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import ColumnConst from '@/const/column'
export default { export default {
data() { data() {
return { return {
keyword: '', keyword: '',
page: +this.$route.query.page || 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 6, total: 0,
list: ColumnConst.sites list: []
}; };
}, },
// watch: { computed: {
// keyword: function(val) { ...mapState('auth', [
// clearTimeout(this.searchTimer) 'btns'
// this.searchTimer = setTimeout(() => { ])
// this.initData() },
// }, 500) watch: {
// } keyword: function(val) {
// }, clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
},
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.getData()
this.$store.commit('user/setCrumbs', [
{ {
name: '站点管理' name: '站点管理'
} }
@ -61,11 +70,36 @@ export default {
'setSite' 'setSite'
]), ]),
getData() { getData() {
this.$post(this.api.site, {
page: this.page,
limit: this.pageSize,
siteName: this.keyword
}).then(({ data }) => {
const { btns } = this
const result = []
data.records.map(e => {
btns.find(n => n.includes(e.siteName)) && result.push(e)
})
this.list = result
this.total = result.length
}).catch(e => {})
},
initData() {
this.page = 1
this.getData()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.page = val this.page = val
}, },
//
update(row) {
this.$put(this.api.updateSite, {
id: row.id,
domainName: row.domainName
}).then(res => {
}).catch(e => {})
},
// //
toIndex(row) { toIndex(row) {

@ -1,6 +1,6 @@
<template> <template>
<div class="flex"> <div class="flex">
<div class="page" style="width: 320px"> <div class="page" style="width: 218px;border-right: 1px solid #EBEDF0">
<div class="m-b-20"> <div class="m-b-20">
<p class="page-name mb">后台员工账号</p> <p class="page-name mb">后台员工账号</p>
<el-radio-group v-model="staffType" @change="changeType"> <el-radio-group v-model="staffType" @change="changeType">
@ -16,7 +16,7 @@
<div> <div>
<div class="flex-between m-b-20"> <div class="flex-between m-b-20">
<p class="page-name">组织管理</p> <p class="page-name">组织管理</p>
<el-button type="text" @click="addOrg">添加</el-button> <el-button v-auth="'新增部门'" type="text" @click="addOrg">添加</el-button>
</div> </div>
<div style="height: 504px;overflow: auto"> <div style="height: 504px;overflow: auto">
@ -30,13 +30,13 @@
<img class="expand" src="@/assets/img/expand.png" alt=""> <img class="expand" src="@/assets/img/expand.png" alt="">
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item>
<el-button class="org-btn" @click="() => editOrg(node, data)" type="text">编辑部门</el-button> <el-button v-auth class="org-btn" @click="() => editOrg(node, data)" type="text">编辑部门</el-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item>
<el-button class="org-btn add" @click="() => addOrg(node, data)" type="text">添加子部门</el-button> <el-button v-auth="'新增部门'" class="org-btn add" @click="() => addOrg(node, data)" type="text">添加子部门</el-button>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item> <el-dropdown-item>
<el-button class="org-btn del" @click="() => delOrg(node, data)" type="text">删除</el-button> <el-button v-auth="'删除部门'" class="org-btn del" @click="() => delOrg(node, data)" type="text">删除</el-button>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@ -75,9 +75,7 @@
</div> </div>
<div class="page list-wrap"> <div class="page list-wrap">
<div class="tool"> <div class="tool">
<div class="search-wrap"> <el-input style="width: 250px;" placeholder="请输入员工姓名/账号/工号/手机号" v-model.trim="keyword" clearable></el-input>
<el-input placeholder="请输入员工姓名/账号" v-model.trim="keyword" clearable></el-input>
</div>
<div class="actions"> <div class="actions">
<el-dropdown class="setting" trigger="click" :hide-on-click="false"> <el-dropdown class="setting" trigger="click" :hide-on-click="false">
<el-tooltip placement="top"> <el-tooltip placement="top">
@ -92,9 +90,9 @@
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button type="primary" @click="addStaff">新增员工</el-button> <el-button v-auth type="primary" @click="addStaff">新增员工</el-button>
<el-button @click="batchImport">批量导入</el-button> <el-button v-auth @click="batchImport">批量导入</el-button>
<el-button @click="batchDel">批量删除</el-button> <el-button v-auth @click="batchDel">批量删除</el-button>
</div> </div>
</div> </div>
@ -103,18 +101,19 @@
<el-table-column type="index" width="60" label="序号"></el-table-column> <el-table-column type="index" width="60" label="序号"></el-table-column>
<el-table-column v-if="settings[1].show" prop="realName" label="员工姓名" min-width="100"></el-table-column> <el-table-column v-if="settings[1].show" prop="realName" label="员工姓名" min-width="100"></el-table-column>
<el-table-column v-if="settings[2].show" prop="username" label="账号" min-width="100"></el-table-column> <el-table-column v-if="settings[2].show" prop="username" label="账号" min-width="100"></el-table-column>
<el-table-column v-if="settings[3].show" prop="phone" label="手机号" min-width="100" show-overflow-tooltip></el-table-column> <el-table-column v-if="settings[3].show" prop="jobNumber" label="工号" min-width="100"></el-table-column>
<el-table-column v-if="settings[4].show" prop="deptArchitectureName" label="所在部门" min-width="100"></el-table-column> <el-table-column v-if="settings[4].show" prop="phone" label="手机号" min-width="100" show-overflow-tooltip></el-table-column>
<el-table-column v-if="settings[5].show" prop="createTime" label="创建日期" min-width="140"></el-table-column> <el-table-column v-if="settings[5].show" prop="deptArchitectureName" label="所在部门" min-width="100"></el-table-column>
<el-table-column v-if="settings[6].show" prop="roleName" label="授权角色" min-width="100"></el-table-column> <el-table-column v-if="settings[6].show" prop="createTime" label="创建日期" min-width="140"></el-table-column>
<el-table-column v-if="settings[7].show" prop="groupName" label="用户组" min-width="100"></el-table-column> <el-table-column v-if="settings[7].show" prop="roleName" label="授权角色" min-width="100"></el-table-column>
<el-table-column v-if="settings[8].show" prop="lastLoginTime" label="最后登录时间" min-width="140"></el-table-column> <el-table-column v-if="settings[8].show" prop="groupName" label="用户组" min-width="100"></el-table-column>
<el-table-column v-if="settings[9].show" label="操作" width="180"> <el-table-column v-if="settings[9].show" prop="lastLoginTime" label="最后登录时间" min-width="140"></el-table-column>
<el-table-column v-if="settings[10].show" label="操作" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button> <el-button v-auth type="text" @click="queryStaff(scope.row,true)">查看</el-button>
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button> <el-button v-auth type="text" @click="queryStaff(scope.row,false)">编辑</el-button>
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button> <el-button v-auth type="text" @click="resetPassword(scope.row)">重置密码</el-button>
<el-button type="text" @click="delStaff(scope.row)">删除</el-button> <el-button v-auth type="text" @click="delStaff(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -279,6 +278,10 @@ export default {
name: '账号', name: '账号',
show: true show: true
}, },
{
name: '工号',
show: true
},
{ {
name: '手机号', name: '手机号',
show: true show: true
@ -377,7 +380,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '用户管理' name: '用户管理'
}, },
@ -754,7 +757,7 @@ export default {
}, },
// //
download() { download() {
location.href = this.api.staffTemplate util.downloadFile('用户导入模板.xlsx', this.api.staffTemplate)
}, },
// //
handleExceed(files, fileList) { handleExceed(files, fileList) {
@ -841,7 +844,6 @@ export default {
} }
} }
.list-wrap { .list-wrap {
width: calc(100% - 340px); width: calc(100% - 219px);
margin-left: 20px;
} }
</style> </style>

@ -5,8 +5,8 @@
<el-input placeholder="请输入用户组名称" v-model.trim="keyword" clearable></el-input> <el-input placeholder="请输入用户组名称" v-model.trim="keyword" clearable></el-input>
</div> </div>
<div class="actions"> <div class="actions">
<el-button type="primary" @click="add" >新增</el-button> <el-button v-auth type="primary" @click="add" >新增</el-button>
<el-button @click="batchDel">删除</el-button> <el-button v-auth @click="batchDel">删除</el-button>
</div> </div>
</div> </div>
@ -16,8 +16,8 @@
<el-table-column prop="description" label="角色描述" min-width="400" align="center"></el-table-column> <el-table-column prop="description" label="角色描述" min-width="400" align="center"></el-table-column>
<el-table-column label="操作" width="170"> <el-table-column label="操作" width="170">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button> <el-button v-auth type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button> <el-button v-auth type="text" @click="del(scope.row)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -78,7 +78,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.$store.commit('user/SET_CRUMBS', [ this.$store.commit('user/setCrumbs', [
{ {
name: '用户管理' name: '用户管理'
}, },

@ -32,12 +32,10 @@ service.interceptors.request.use(config => {
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
const res = response.data; const res = response.data;
console.log("🚀 ~ file: index.js ~ line 34 ~ res", res)
if (res.code == 200) { if (res.code == 200) {
return Promise.resolve(res).catch(e => {}); return Promise.resolve(res).catch(e => {});
} else { } else {
util.errorMsg(res.msg); util.errorMsg(res.msg);
console.log("🚀 ~ file: index.js ~ line 39 ~ res", res)
return Promise.reject(res) return Promise.reject(res)
// return Promise.resolve(res).catch(e => {}); // return Promise.resolve(res).catch(e => {});
} }

@ -4,11 +4,11 @@
const url = location.host; const url = location.host;
const isDev = process.env.NODE_ENV === "development"; // 开发环境 const isDev = process.env.NODE_ENV === "development"; // 开发环境
const isPro = url.includes("occupationlab.com"); //是否生产 const isPro = url.includes("occupationlab.com"); //是否生产
let host = `${location.origin}/` let host = `${location.origin}:10000/`
if (isDev) { if (isDev) {
// host = 'http://121.37.12.51/' // 中台测试服 host = 'http://192.168.31.136:10000/' // 测试服
// host = 'http://192.168.31.151:10000/' // 榕 // host = 'http://192.168.31.151:10000/' // 榕
host = 'http://192.168.31.137:10000/' // 赓 // host = 'http://192.168.31.137:10000/' // 赓
} }
const Setting = { const Setting = {
@ -62,7 +62,7 @@ const Setting = {
// 相同路由,不同参数间进行切换,是否强力更新 // 相同路由,不同参数间进行切换,是否强力更新
sameRouteForceUpdate: false, sameRouteForceUpdate: false,
// 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮) // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮)
dynamicRoute: false dynamicRoute: true
}; };
export default Setting; export default Setting;

@ -8,19 +8,14 @@ export default {
routes: [] routes: []
}, },
mutations: { mutations: {
SET_BTN_AUTH: (state, btns) => { addBtnAuth: (state, btns) => {
state.btns = btns; state.btns = btns
}, },
SET_ROUTE: (state, routes) => { addRoutes: (state, routes) => {
state.routes = routes; state.routes = routes
} }
}, },
actions: { actions: {
addBtnAuth({ state, commit }, btns) {
commit("SET_BTN_AUTH", btns);
},
addRoutes({ state, commit }, routes) {
commit("SET_ROUTE", routes);
}
} }
}; };

@ -4,11 +4,15 @@
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
site: {} site: {},
column: {} // 新增文章的时候获取的当前栏目
}, },
mutations: { mutations: {
setSite: (state, site) => { setSite: (state, site) => {
state.site = site state.site = site
},
setColumn: (state, column) => {
state.column = column
} }
}, },
actions: { actions: {

@ -1,8 +1,6 @@
import Setting from "@/setting"; import Setting from '@/setting'
import util from "@/libs/util"; import util from '@/libs/util'
import { post, get, del, put } from "@/plugins/requests/index.js"; import addRoutes from '@/libs/route/addRoutes'
import api from "@/api";
import addRoutes from "@/libs/route/addRoutes";
/** /**
* 用户信息 * 用户信息
@ -16,16 +14,16 @@ export default {
crumbs: '' crumbs: ''
}, },
mutations: { mutations: {
SET_AVATAR: (state, avatar) => { setAvatar: (state, avatar) => {
state.avatar = avatar state.avatar = avatar
}, },
SET_USERID: (state, userId) => { setUserId: (state, userId) => {
state.userId = userId state.userId = userId
}, },
SET_USERNAME: (state, userName) => { setUserName: (state, userName) => {
state.userName = userName state.userName = userName
}, },
SET_CRUMBS: (state, crumbs) => { setCrumbs: (state, crumbs) => {
state.crumbs = crumbs state.crumbs = crumbs
} }
}, },

@ -175,8 +175,11 @@
} }
.el-table { .el-table {
border-bottom: 0; border-bottom: 0;
th, td {
height: 44px;
padding: 0;
}
td { td {
padding: 5px 0;
.cell { .cell {
font-size: 12px; font-size: 12px;
color: #333; color: #333;

Loading…
Cancel
Save