提交 acb03d61 编写于 作者: K keyinghao

提交

上级 dd7e1f12
import request from '@/utils/request'
// 审核课程分页列表接口
export function getCourseAuditList(params, pageCurrent = 1, pageSize = 20) {
export function courseAuditList(params, pageCurrent = 1, pageSize = 20) {
return request({
url: '/course/pc/course/audit/list',
method: 'post',
......@@ -64,11 +64,11 @@ export function courseView(id) {
}
// 课程详情接口(用于修改)
export function courseViewForEdit(id) {
export function courseViewForEdit(data = {}) {
return request({
url: '/course/pc/course/get',
method: 'post',
data: { id: id }
data: data
})
}
......@@ -107,3 +107,12 @@ export function categoryDelete(data = {}) {
data: data
})
}
// 课程分类查看接口
export function categoryView(data = {}) {
return request({
url: '/course/pc/course/category/view',
method: 'post',
data: data
})
}
import request from '@/utils/request'
export function login(mobile, password, clientId, ip) {
console.log(mobile)
const data = {
mobile: mobile,
password: password,
......
......@@ -135,6 +135,15 @@ export function templateUpdate(data = {}) {
})
}
// 消息模板查看接口
export function templateView(data = {}) {
return request({
url: `/system/pc/msg/template/view`,
method: 'post',
data: data
})
}
// 获取站点信息接口
export function websiteView(data = {}) {
return request({
......@@ -252,6 +261,15 @@ export function userUpdate(data = {}) {
})
}
// 后台管理员查看口
export function userView(data = {}) {
return request({
url: `/system/pc/sys/user/view`,
method: 'post',
data: data
})
}
// 后台管理员密码接口
export function updatePassword(data = {}) {
return request({
......@@ -315,6 +333,15 @@ export function roleUpdate(data = {}) {
})
}
// 角色查看接口
export function roleView(data = {}) {
return request({
url: `/system/pc/sys/role/view`,
method: 'post',
data: data
})
}
// 列出菜单角色关联信息接口
export function menuRoleList(data = {}) {
return request({
......@@ -368,3 +395,12 @@ export function menuUpdate(data = {}) {
data: data
})
}
// 菜单信息查看接口
export function menuView(data = {}) {
return request({
url: `/system/pc/menu/view`,
method: 'post',
data: data
})
}
......@@ -15,7 +15,6 @@ router.beforeEach((to, from, next) => {
NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
} else {
if (store.getters.menu.init === false) {
console.log('-------- init menu ---------')
// 获取用户数据
// store.dispatch('getUserInfo')
// 设置菜单
......
......@@ -17,8 +17,8 @@
{
"id": 0,
"name": "首页",
"path": "/dashboard",
"icon": null,
"path": "dashboard",
"icon": null
}/*,
{
"id": 0,
......@@ -45,7 +45,7 @@
{
"id": 0,
"name": "首页管理",
"path": "/homepage",
"path": "homepage",
"icon": null,
"children": [
{
......@@ -234,7 +234,7 @@
{
"id": 0,
"name": "系统管理",
"path": "/sys",
"path": "sys",
"icon": null,
"children": [
{
......
......@@ -29,12 +29,10 @@ const menu = {
actions: {
setMenu({ commit }) {
return new Promise(resolve => {
commit('set_system_menu', mockMenuData)
api.menuUserList({}).then(res => {
if (res.data.sysMenu !== []) {
const mockMenuList = res.data.sysMenu
// TODO 后续续修改为从服务器获取,并且做数据处理
commit('set_system_menu', mockMenuList)
commit('set_system_menu', res.data.sysMenu)
} else {
// 如果没有权限默认初始化首页权限页路由
commit('set_system_menu', mockMenuData)
......
......@@ -6,10 +6,10 @@
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="分类名称:" prop="categoryName">
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="formData.categoryName"></el-input>
</el-form-item>
<el-form-item label="备注:">
<el-form-item label="备注">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="formData.remark">
</el-input>
</el-form-item>
......@@ -49,7 +49,7 @@ export default {
}
},
methods: {
// 保存管理员信息
// 保存信息
submitForm(formData) {
if (formData.categoryName) {
this.$message({
......@@ -61,42 +61,34 @@ export default {
this.$refs[formData].validate((valid) => {
if (valid) {
this.formData.categoryType = 1
this.handleConfirm()
this.loading.show()
api.categorySave(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('保存成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "保存失败"
});
}
}).catch(() => {
this.loading.hide()
})
} else {
return false;
this.$message({
type: 'error',
message: "保存失败"
});
}
})
},
//异步课程分类保存
async handleConfirm() {
this.load = true
let res = {}
if (this.formData === undefined) {
this.$alert(res.msg || '提交失败')
} else {
res = await api.categorySave(this.formData)
// this.tips('成功', 'success')
}
this.load = false
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.$emit('close-cllback')
} else {
this.$alert(res.msg || '提交失败')
}
},
// 关闭弹窗
handleClose(done) {
this.$emit('close-cllback')
this.$emit('close-callback')
}
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -6,13 +6,13 @@
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="分类名称:" prop="categoryName">
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="formData.categoryName"></el-input>
</el-form-item>
<el-form-item label="排序:">
<el-input v-model="formData.sort"></el-input>
<el-form-item label="排序">
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="备注:">
<el-form-item label="备注">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="formData.remark"></el-input>
</el-form-item>
</el-form>
......@@ -52,9 +52,43 @@
},
methods: {
handleClose(done) {
this.$emit('close-cllback')
this.$emit('close-callback')
},
handleChange(value) {
this.formData.sort = value
},
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "提交失败"
});
}
this.loading.show()
api.categoryUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('更新成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
}).catch(() => {
this.loading.hide()
})
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
})
this.$refs[formData].validate((valid) => {
if (valid) {
this.handleConfirm()
......@@ -62,33 +96,7 @@
return false;
}
})
},
async handleConfirm() {
this.load = true
let res = {}
if (this.formData.id === undefined) {
this.$alert(res.msg || '提交失败')
} else {
res = await api.categoryUpdate(this.formData)
// this.tips('成功', 'success')
}
this.load = false
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('成功', 'success')
this.$emit('close-cllback')
} else {
this.$alert(res.msg || '提交失败')
}
}
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -20,6 +20,11 @@
border
row-key="id"
:default-expand-all="false">
<el-table-column
type="index"
label="序号"
width="40">
</el-table-column>
<el-table-column
prop="categoryName"
label="分类名称"
......@@ -48,8 +53,8 @@
</template>
</el-table-column>
</el-table>
<add :visible="ctrl.addDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-cllback="closeCllback"></add>
<edit :visible="ctrl.editDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-cllback="closeCllback"></edit>
<add :visible="ctrl.addDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></add>
<edit :visible="ctrl.editDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></edit>
<el-pagination
background
style="float: right;margin-top: 20px; margin-bottom: 22px"
......@@ -144,10 +149,19 @@
this.ctrl.addDialogVisible = true
},
editSubMmenu(row) {
this.formData = row
this.ctrl.dialogTitle = row.categoryName + "修改"
this.getCategory(row.id)
this.ctrl.editDialogVisible = true
},
getCategory(id) {
this.ctrl.load = true
api.categoryView({ id: id }).then(res => {
this.formData = res.data
this.ctrl.dialogTitle = res.data.categoryName + " —— 修改"
this.ctrl.load = false
}).catch(() => {
this.ctrl.load = false
})
},
// 关闭弹窗回调
closeCllback() {
this.ctrl.addDialogVisible = false
......
<template>
<el-dialog
:title="this.head"
:visible.sync="vb"
:before-close="handleClose"
width="30%"
top="30vh">
<el-form ref="map" :model="map">
<el-row>
审核状态:
<el-radio v-model="map.auditStatus" label="1">通过</el-radio>
<el-radio v-model="map.auditStatus" label="2">不通过</el-radio>
</el-row>
<el-row style="margin-top:15px;">
<el-col>审核意见:</el-col>
</el-row>
<el-row style="margin-left:70px;">
<el-input type="textarea" :rows="3" placeholder="系统默认通过" v-model="map.auditOpinion"> </el-input>
</el-row>
<el-row style="margin-top:17px; ">
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
<el-button style="float:right" size="mini" type="primary" @click="submitForm('map')">确定</el-button>
</el-row>
:title="title"
:visible.sync="visible"
:before-close="handleClose"
width="30%">
<el-form ref="formData" :model="formData" label-width="100px">
<el-form-item label="审核状态:">
<el-radio-group v-model="auditStatus">
<el-radio :label="1">通过</el-radio>
<el-radio :label="2">不通过</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注:">
<el-input type="textarea" :rows="3" placeholder="系统默认通过" v-model="formData.auditOpinion"></el-input>
</el-form-item>
</el-form>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as courseApis from '@/api/course'
import * as api from '@/api/course'
export default {
name: 'CourseAudit',
name: 'Audit',
data() {
return {
ctrl: {
load: false
},
map: {
id: '',
auditStatus: '1',
auditOpinion: ''
},
head: '',
vb: false
auditStatus: 1
}
},
props: {
// route object
formData: {
type: Object,
default: () => {}
},
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
}
},
watch: {
'visible': function(newValue) {
this.vb = newValue
this.head = this.formData.courseName + " —— 信息审核"
// route object
formData: {
type: Object,
default: () => {}
},
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
}
},
methods: {
handleClose(done) {
this.$emit('close-cllback')
this.$emit('close-callback')
},
submitForm(map) {
this.$refs[map].validate((valid) => {
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
this.handleConfirm()
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "审核失败"
});
}
if (this.formData.auditOpinion === '') {
this.formData.auditOpinion = "系统默认通过"
}
this.formData.auditStatus = this.auditStatus
this.loading.show()
api.courseAudit(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('审核成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "审核失败"
});
}
}).catch(() => {
this.loading.hide()
})
} else {
return false;
this.$message({
type: 'error',
message: "审核失败"
});
}
})
},
async handleConfirm() {
if (this.map.auditOpinion === '') {
this.map.auditOpinion = "系统默认通过"
}
this.map.id = this.formData.id
this.ctrl.load = true
courseApis.courseAudit(this.map).then(res => {
this.tips('审核成功', 'success')
this.$emit('close-cllback')
this.ctrl.load = false
}).catch(() => {
this.$alert('审核失败')
})
}
}
}
</script>
<style scoped>
</style>
......@@ -20,7 +20,6 @@
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</el-form-item> -->
<el-form-item label="课程名称:">
<el-input v-model="formData.courseName"></el-input>
</el-form-item>
......@@ -30,7 +29,6 @@
<el-radio :label="1">免费</el-radio>
</el-radio-group>
</el-form-item>
<el-row v-if="formData.isFree == 0">
<el-col :span="12">
<el-form-item label="原价:">
......@@ -44,7 +42,7 @@
</el-col> -->
</el-row>
<el-form-item label="排序:">
<el-input v-model="formData.sort"></el-input>
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1" :max="100000000"></el-input-number>
</el-form-item>
<el-form-item label="课程简介:">
<div id="introduce"></div>
......@@ -57,16 +55,13 @@
</el-dialog>
</template>
<script>
import * as courseApis from '@/api/course'
import * as api from '@/api/course'
import * as commonalityApi from '@/api/commonality'
export default {
name: 'Edit',
data() {
return {
editor: {},
ctrl: {
dialogVisible: true
}
editor: {}
}
},
props: {
......@@ -85,8 +80,8 @@ export default {
}
},
watch: {
formData: function(val) {
if (val !== undefined) {
visible: function(val) {
if (val) {
setTimeout(() => {
this.editor.create();
this.editor.customConfig.customUploadImg = this.editorUpload
......@@ -95,7 +90,7 @@ export default {
} else {
this.editor.txt.html('')
}
}, 100)
}, 200)
}
}
},
......@@ -104,8 +99,11 @@ export default {
},
methods: {
createEdit() {
const E = require('wangeditor')
this.editor = new E('#introduce')
const E = require('wangeditor')
this.editor = new E('#introduce')
},
handleChange(value) {
this.formData.sort = value
},
submitForm(formData) {
if (parseInt(this.formData.isFree) !== 1) {
......@@ -122,30 +120,37 @@ export default {
}
this.$refs[formData].validate((valid) => {
if (valid) {
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "更新失败"
});
}
this.loading.show()
this.formData.introduce = this.editor.txt.html()
this.handleConfirm()
api.courseAuditUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('更新成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "更新失败"
});
}
}).catch(() => {
this.loading.hide()
})
} else {
return false;
this.$message({
type: 'error',
message: "更新失败"
});
}
})
},
async handleConfirm() {
this.ctrl.load = true
let res = {}
if (this.formData.id === undefined) {
this.$alert(res.msg || '修改失败')
} else {
res = await courseApis.courseAuditUpdate(this.formData)
}
this.ctrl.load = false
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('成功', 'success')
this.$emit('close-cllback')
} else {
this.$alert(res.msg || '修改失败')
}
},
// 编辑器上传图片
editorUpload(files, insert) {
const file = files[0];
......@@ -164,7 +169,8 @@ export default {
})
},
handleClose(done) {
this.$emit('close-cllback')
this.editor.txt.clear()
this.$emit('close-callback')
}
}
}
......
......@@ -51,7 +51,6 @@
</el-form-item>
</el-form>
</div>
<el-table v-loading="ctrl.load" size="medium" :data="list" stripe border style="width: 100%">
<el-table-column type="index" label="序号" width="40">
</el-table-column>
......@@ -77,7 +76,7 @@
</template>
</el-table-column>
<el-table-column
width="150"
width="160"
prop="isPutaway"
label="上下架"
align="center">
......@@ -95,7 +94,7 @@
</template>
</el-table-column>
<el-table-column
width="150"
width="160"
prop="statusId"
label="状态"
align="center">
......@@ -112,14 +111,14 @@
</el-switch>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" width="70">
<el-table-column prop="sort" label="排序" width="80">
</el-table-column>
<el-table-column label="审核状态" width="110">
<el-table-column label="审核状态" width="100">
<template slot-scope="scope">
<span :class="textAuditStatusClass(scope.row.auditStatus)">{{textAuditStatus[scope.row.auditStatus]}}</span>
</template>
</el-table-column>
<el-table-column width="150" label="操作">
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<el-button type="primary" @click="handleAudit(scope.row)" size="mini">审核</el-button>
<el-button type="success" @click="handleEdit(scope.row)" size="mini">修改</el-button>
......@@ -136,16 +135,16 @@
layout="total, sizes, prev, pager, next, jumper"
:total="page.totalCount">
</el-pagination>
<course-audit :visible="ctrl.dialogVisible" :formData="formdata" :title="ctrl.dialogTitle" @close-cllback="closeCllback"></course-audit>
<edit :visible="ctrl.editVisible" :formData="formdata" :title="ctrl.dialogTitle" @close-cllback="closeCllback"></edit>
<audit :visible="ctrl.dialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></audit>
<edit :visible="ctrl.editVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></edit>
</div>
</template>
<script>
import * as courseApis from '@/api/course'
import CourseAudit from './audit'
import * as api from '@/api/course'
import Audit from './audit'
import Edit from './edit'
export default {
components: { CourseAudit, Edit },
components: { Audit, Edit },
data() {
return {
ctrl: {
......@@ -153,13 +152,8 @@ export default {
dialogVisible: false,
editVisible: false
},
map: {
isFree: '',
courseName: '',
isPutaway: ''
},
formLabelWidth: '120px',
formdata: {},
map: {},
formData: {},
list: [],
opts: {
isFreeList: [],
......@@ -209,7 +203,7 @@ export default {
methods: {
getList() {
this.ctrl.load = true
courseApis.getCourseAuditList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
api.courseAuditList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.ctrl.load = false
this.list = res.data.list
this.page.pageSize = res.data.pageSize
......@@ -243,7 +237,7 @@ export default {
},
// 请求更新上下架方法
changeIsPutaway(row, command) {
courseApis.courseUpdate({ id: row.id, isPutaway: command }).then(res => {
api.courseUpdate({ id: row.id, isPutaway: command }).then(res => {
const msg = { 0: '下架成功', 1: '上架成功' }
this.$message({
type: 'success',
......@@ -268,7 +262,7 @@ export default {
},
// 请求更新状态方法
changeStatusId(row, command) {
courseApis.courseUpdate({ id: row.id, statusId: command }).then(res => {
api.courseUpdate({ id: row.id, statusId: command }).then(res => {
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
......@@ -277,36 +271,35 @@ export default {
this.reload()
})
},
// 刷新当前页面
reload() {
this.getList()
},
handleAudit(data) {
this.ctrl.load = true
courseApis.courseAuditView(data.id).then(res => {
this.ctrl.load = false
this.formdata = res.data
this.ctrl.dialogVisible = true
}).catch(() => {
this.ctrl.load = false
})
var title = '信息审核'
this.getCourseAudit(data.id, title)
this.ctrl.dialogVisible = true
},
handleEdit(data) {
this.ctrl.load = true
courseApis.courseAuditView(data.id).then(res => {
var title = '编辑'
this.getCourseAudit(data.id, title)
this.ctrl.editVisible = true
},
getCourseAudit(id, title) {
api.courseAuditView(id).then(res => {
this.formData = res.data
this.ctrl.dialogTitle = res.data.courseName + " —— " + title
this.ctrl.load = false
this.formdata = res.data
this.ctrl.dialogTitle = "编辑"
this.ctrl.editVisible = true
}).catch(() => {
this.ctrl.load = false
})
},
// 重置查询条件
handleReset() {
// 刷新当前页面
reload() {
this.map = {}
this.formData = {}
this.getList()
},
// 重置查询条件
handleReset() {
this.reload()
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
......
......@@ -57,36 +57,33 @@
</el-dialog>
</template>
<script>
import * as courseApis from '@/api/course'
import * as api from '@/api/course'
import * as commonalityApi from '@/api/commonality'
export default {
name: 'Edit',
data() {
return {
editor: {},
ctrl: {
dialogVisible: true
}
}
},
return {
editor: {}
}
},
props: {
// route object
formData: {
type: Object,
default: () => {}
type: Object,
default: () => {}
},
visible: {
type: Boolean,
default: false
type: Boolean,
default: false
},
title: {
type: String,
default: ''
type: String,
default: ''
}
},
watch: {
formData: function(val) {
if (val !== undefined) {
visible: function(val) {
if (val) {
setTimeout(() => {
this.editor.create();
this.editor.customConfig.customUploadImg = this.editorUpload
......@@ -120,6 +117,38 @@ export default {
} else {
this.formData.courseOriginal = 0;
}
this.$refs[formData].validate((valid) => {
if (valid) {
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "更新失败"
});
}
this.loading.show()
this.formData.introduce = this.editor.txt.html()
api.courseUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('更新成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "更新失败"
});
}
}).catch(() => {
this.loading.hide()
})
} else {
this.$message({
type: 'error',
message: "更新失败"
});
}
})
this.$refs[formData].validate((valid) => {
if (valid) {
this.formData.introduce = this.editor.txt.html()
......@@ -129,23 +158,6 @@ export default {
}
})
},
async handleConfirm() {
this.ctrl.load = true
let res = {}
if (this.formData.id === undefined) {
this.$alert(res.msg || '修改失败')
} else {
res = await courseApis.courseUpdate(this.formData)
}
this.ctrl.load = false
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('成功', 'success')
this.$emit('close-cllback')
} else {
this.$alert(res.msg || '修改失败')
}
},
// 编辑器上传图片
editorUpload(files, insert) {
const file = files[0];
......@@ -164,7 +176,8 @@ export default {
})
},
handleClose(done) {
this.$emit('close-cllback')
this.editor.txt.clear()
this.$emit('close-callback')
}
}
}
......
......@@ -42,7 +42,7 @@
</el-form>
</div>
<el-table v-loading="ctrl.load" size="medium" :data="list" stripe border style="width: 100%">
<el-table v-loading="ctrl.load" size="medium" :data="list" stripe border>
<el-table-column type="index" label="序号" width="40">
</el-table-column>
<el-table-column prop="courseName" label="课程名称">
......@@ -56,7 +56,7 @@
{{scope.row.categoryName1}}/{{scope.row.categoryName2}}/{{scope.row.categoryName3}}
</template>
</el-table-column>
<el-table-column label="是否收费" width="90">
<el-table-column label="是否收费" width="100">
<template slot-scope="scope">
<span :class="textClass(scope.row.isFree)">{{textIsFree[scope.row.isFree]}}</span>
</template>
......@@ -67,7 +67,7 @@
</template>
</el-table-column>
<el-table-column
width="150"
width="160"
prop="isPutaway"
label="上下架"
align="center">
......@@ -85,7 +85,7 @@
</template>
</el-table-column>
<el-table-column
width="150"
width="160"
prop="statusId"
label="状态"
align="center">
......@@ -102,11 +102,11 @@
</el-switch>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" width="70">
<el-table-column prop="sort" label="排序" width="100">
</el-table-column>
<el-table-column width="150" label="操作">
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-button type="success" @click="handleEdit(scope.row)" size="mini">修改</el-button>
<el-button type="success" @click="handleEdit(scope.row.id)" size="mini">修改</el-button>
</template>
</el-table-column>
</el-table>
......@@ -120,11 +120,11 @@
layout="total, sizes, prev, pager, next, jumper"
:total="page.totalCount">
</el-pagination>
<edit :visible="ctrl.editVisible" :formData="formdata" :title="ctrl.dialogTitle" @close-cllback="closeCllback"></edit>
<edit :visible="ctrl.editVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></edit>
</div>
</template>
<script>
import * as courseApis from '@/api/course'
import * as api from '@/api/course'
import Edit from './edit'
export default {
components: { Edit },
......@@ -135,13 +135,8 @@ export default {
dialogVisible: false,
editVisible: false
},
map: {
isFree: '',
courseName: '',
isPutaway: ''
},
formLabelWidth: '120px',
formdata: {},
map: {},
formData: {},
list: [],
opts: {
isFreeList: [],
......@@ -182,7 +177,7 @@ export default {
methods: {
getList() {
this.ctrl.load = true
courseApis.courseList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
api.courseList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.ctrl.load = false
this.list = res.data.list
this.page.pageSize = res.data.pageSize
......@@ -192,6 +187,27 @@ export default {
})
},
handleCheck() {
this.page.pageCurrent = 1
this.getList()
},
// 重置查询条件
handleReset() {
this.reload()
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
this.getList()
},
handleCurrentChange(val) {
// console.log(`当前页: ${val}`)
this.page.pageCurrent = val
this.getList()
},
// 刷新当前页面
reload() {
this.map = {}
this.formData = {}
this.getList()
},
// 关闭编辑弹窗回调
......@@ -216,7 +232,7 @@ export default {
},
// 请求更新上下架方法
changeIsPutaway(row, command) {
courseApis.courseUpdate({ id: row.id, isPutaway: command }).then(res => {
api.courseUpdate({ id: row.id, isPutaway: command }).then(res => {
const msg = { 0: '下架成功', 1: '上架成功' }
this.$message({
type: 'success',
......@@ -241,7 +257,9 @@ export default {
},
// 请求更新状态方法
changeStatusId(row, command) {
courseApis.courseUpdate({ id: row.id, statusId: command }).then(res => {
this.ctrl.load = true
api.courseUpdate({ id: row.id, statusId: command }).then(res => {
this.ctrl.load = false
const msg = { 0: '禁用成功', 1: '启用成功' }
this.$message({
type: 'success',
......@@ -250,36 +268,18 @@ export default {
this.reload()
})
},
// 刷新当前页面
reload() {
this.getList()
},
handleEdit(data) {
// 修改弹窗
handleEdit(row) {
this.ctrl.load = true
courseApis.courseViewForEdit(data.id).then(res => {
api.courseViewForEdit({ id: row }).then(res => {
this.ctrl.load = false
this.formdata = res.data
this.formData = res.data
this.ctrl.dialogTitle = "编辑"
this.ctrl.editVisible = true
}).catch(() => {
this.ctrl.load = false
})
},
// 重置查询条件
handleReset() {
this.map = {}
this.getList()
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
this.getList()
},
handleCurrentChange(val) {
// console.log(`当前页: ${val}`)
this.page.pageCurrent = val
this.getList()
},
textClass(isFree) {
return {
c_red: isFree === 0,
......
......@@ -13,7 +13,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="审核意见:">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="系统默认通过" v-model="formData.auditOpinion"></el-input>
<el-input type="textarea" :rows="3" :autosize="{ minRows: 2, maxRows: 4}" placeholder="系统默认通过" v-model="formData.auditOpinion"></el-input>
</el-form-item>
</el-form>
<el-row style="margin-top:17px; ">
......
......@@ -5,7 +5,7 @@
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" label-width="80px">
<el-form ref="formData" :model="formData" label-width="100px">
<el-alert class="title" :closable="false" title="一、讲师基本信息" type="info" />
<br/>
<el-row>
......@@ -28,7 +28,7 @@
</div></el-col>
<el-col :span="12"><div>
<el-form-item label="排序:">
<el-input v-model="formData.sort"></el-input>
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1"></el-input-number>
</el-form-item>
</div></el-col>
</el-row>
......@@ -101,8 +101,8 @@
}
},
watch: {
formData: function(val) {
if (val !== undefined) {
visible: function(val) {
if (val) {
setTimeout(() => {
this.editor.customConfig.customUploadImg = this.editorUpload
this.editor.create();
......@@ -111,7 +111,7 @@
} else {
this.editor.txt.html('')
}
}, 200)
}, 100)
}
}
},
......@@ -144,10 +144,12 @@
this.editor.txt.clear()
this.$emit('close-callback')
},
handleChange(value) {
this.formData.sort = value
},
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
this.formData.introduce = this.editor.txt.html()
if (this.formData.id === undefined) {
this.$message({
type: 'error',
......@@ -155,6 +157,7 @@
});
}
this.loading.show()
this.formData.introduce = this.editor.txt.html()
api.lecturerAuditUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
......
......@@ -19,7 +19,7 @@
</el-select>
</el-form-item>
<el-form-item label="审核情况:" >
<el-select v-model="map.auditStatus" class="auto-width" clearable filterable placeholder="审核情况" style="width: 85px">
<el-select v-model="map.auditStatus" class="auto-width" clearable filterable placeholder="审核情况" style="width: 110px">
<el-option
v-for="item in opts.auditStatusList"
:key="item.code"
......@@ -118,7 +118,6 @@
data() {
return {
auditMap: {
id: '',
auditStatus: 1
},
ctrl: {
......@@ -136,7 +135,6 @@
map: {},
formData: {},
lecturerExt: {},
title: '',
page: {
beginPageIndex: 1,
pageCurrent: 1,
......@@ -182,7 +180,7 @@
this.reload()
},
lecturerAuditList() {
this.ctrl.loading === true
this.ctrl.loading = true
api.lecturerAuditList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.list = res.data.list
this.page.pageCurrent = res.data.pageCurrent
......@@ -209,7 +207,7 @@
},
// 请求更新用户方法
changeStatus(id, statusId) {
this.ctrl.loading === true
this.ctrl.loading = true
api.lecturerAuditUpdate({ id: id, statusId: statusId }).then(res => {
this.ctrl.loading = false
if (res.code === 200 && res.data > 0) {
......@@ -244,21 +242,19 @@
},
// 修改跳页面操作
handleEdit(id) {
this.title = '信息修改'
this.getById(id, this.title)
this.ctrl.editDialogVisible = true
var type = 'edit'
this.getById(id, type)
},
// 审核页面弹窗
handleAudit(row) {
this.auditMap.id = row.id
this.ctrl.dialogTitle = '审核'
this.ctrl.dialogTitle = row.lecturerName + ' —— 审核'
this.ctrl.auditDialogVisible = true
},
// 跳查看讲师弹窗
handleView(id) {
this.title = '查看详情'
this.getById(id, this.title)
this.ctrl.viewVisible = true
var type = 'view'
this.getById(id, type)
},
// 关闭弹窗回调
closeCllback() {
......@@ -269,14 +265,20 @@
this.reload()
},
//查看讲师审核信息
getById(id, title) {
this.ctrl.loading === true
getById(id, type) {
this.ctrl.loading = true
api.lecturerAuditView({ id: id }).then(res => {
this.formData = res.data
if (JSON.stringify(res.data.lecturerExt) !== '{}') {
this.lecturerExt = res.data.lecturerExt
}
this.ctrl.dialogTitle = res.data.lecturerMobile + '——' + title
if (type === 'edit') {
this.ctrl.dialogTitle = res.data.lecturerName + ' —— 信息修改'
this.ctrl.editDialogVisible = true
} else if (type === 'view') {
this.ctrl.dialogTitle = res.data.lecturerName + ' —— 查看详情'
this.ctrl.viewVisible = true
}
this.ctrl.loading = false
}).catch(() => {
this.ctrl.loading = true
......
<template>
<!--弹窗-->
<el-dialog
width="70%"
width="60%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
......
<template>
<!--弹窗-->
<el-dialog
width="60%"
width="70%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
......@@ -12,29 +12,29 @@
<br/>
<el-row>
<el-col :span="12"><div>
<el-form-item label="用户手机:">
<el-form-item label="用户手机">
<el-input :disabled="true" v-model="formData.lecturerMobile"></el-input>
</el-form-item>
</div></el-col>
<el-col :span="12"><div>
<el-form-item label="讲师名称:">
<el-form-item label="讲师名称">
<el-input v-model="formData.lecturerName"></el-input>
</el-form-item>
</div></el-col>
</el-row>
<el-row>
<el-col :span="12"><div>
<el-form-item label="邮箱:">
<el-form-item label="邮箱">
<el-input v-model="formData.lecturerEmail"></el-input>
</el-form-item>
</div></el-col>
<el-col :span="12"><div>
<el-form-item label="排序:">
<el-form-item label="排序">
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1" :max="10000"></el-input-number>
</el-form-item>
</div></el-col>
</el-row>
<el-form-item label="讲师简介:">
<el-form-item label="讲师简介">
<div id="introduce"></div>
</el-form-item>
</div>
......@@ -43,29 +43,29 @@
<br/>
<el-row>
<el-col :span="12"><div>
<el-form-item label="银行名称:">
<el-form-item label="银行名称">
<el-input :disabled="true" v-model="lecturerExt.bankName"></el-input>
</el-form-item>
</div></el-col>
<el-col :span="12"><div>
<el-form-item label="银行卡号:">
<el-form-item label="银行卡号">
<el-input :disabled="true" v-model="lecturerExt.bankCardNo"></el-input>
</el-form-item>
</div></el-col>
</el-row>
<el-row>
<el-col :span="12"><div>
<el-form-item label="开户名称:">
<el-form-item label="开户名称">
<el-input :disabled="true" v-model="lecturerExt.bankUserName"></el-input>
</el-form-item>
</div></el-col>
<el-col :span="12"><div>
<el-form-item label="银行卡号:">
<el-form-item label="银行卡号">
<el-input :disabled="true" v-model="lecturerExt.bankIdCardNo"></el-input>
</el-form-item>
</div></el-col>
</el-row>
<el-form-item label="支行名称:">
<el-form-item label="支行名称">
<el-input :disabled="true" v-model="lecturerExt.bankBranchName"></el-input>
</el-form-item>
</div>
......@@ -106,8 +106,8 @@
}
},
watch: {
formData: function(val) {
if (val !== undefined) {
visible: function(val) {
if (val) {
setTimeout(() => {
this.editor.create();
this.editor.customConfig.customUploadImg = this.editorUpload
......@@ -116,7 +116,7 @@
} else {
this.editor.txt.html('')
}
}, 100)
}, 200)
}
}
},
......@@ -138,30 +138,42 @@
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
this.formData.introduce = this.editor.txt.html()
this.handleConfirm()
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "提交失败"
});
} else {
this.formData.introduce = this.editor.txt.html()
this.loading.show()
api.lecturerUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
}).catch(() => {
this.loading.hide()
this.$message({
type: 'error',
message: "提交失败"
});
})
}
} else {
return false;
this.$message({
type: 'error',
message: "提交失败"
});
}
})
},
async handleConfirm() {
this.load = true
let res = {}
if (this.formData.id === undefined) {
this.$alert(res.msg || '提交失败')
} else {
res = await api.lecturerUpdate(this.formData)
}
this.load = false
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('成功', 'success')
this.$emit('close-callback')
} else {
this.$alert(res.msg || '提交失败')
}
},
// 编辑器上传图片
editorUpload(files, insert) {
const file = files[0];
......
......@@ -57,7 +57,7 @@
</el-table-column>
<el-table-column label="分成比例">
<template slot-scope="scope">
[ 讲师: {{scope.row.lecturerProportion*100}}%]
[ 讲师: {{scope.row.lecturerProportion}}%]
</template>
</el-table-column>
<el-table-column
......@@ -68,6 +68,7 @@
<ul class="list-item-actions">
<li>
<el-button type="success" @click="handleEdit(scope.row.id)" size="mini">修改</el-button>
<el-button type="warning" @click="handleProportion(scope.row.id)" size="mini">设置分成</el-button>
</li>
</ul>
</template>
......@@ -85,25 +86,27 @@
:total="page.totalCount">
</el-pagination>
<edit :visible="ctrl.dialogVisible" :formData="formData" :lecturerExt="lecturerExt" :title="ctrl.dialogTitle" @close-callback="closeCllback"></edit>
<proportion :visible="ctrl.proportionDialogVisible" :formData="formData" :title="ctrl.dialogTitle" @close-callback="closeCllback"></proportion>
<view-lecturer :visible="ctrl.viewVisible" :formData="formData" :lecturerExt="lecturerExt" :title="ctrl.dialogTitle" @close-callback="closeCllback"></view-lecturer>
</div>
</template>
<script>
import * as api from '@/api/lecturer'
import Edit from './edit'
import viewLecturer from './view'
import Proportion from './proportion'
import ViewLecturer from './view'
export default {
components: { Edit, viewLecturer },
components: { Edit, ViewLecturer, Proportion },
data() {
return {
list: [],
map: {},
formData: {},
lecturerExt: {},
title: '',
ctrl: {
loading: false,
dialogVisible: false,
proportionDialogVisible: false,
viewVisible: false
},
opts: {
......@@ -126,37 +129,27 @@
this.lecturerList(1)
},
methods: {
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
this.lecturerList()
handleProportion(id) {
var type = 'proportion'
this.getById(id, type)
},
handleCurrentChange(val) {
this.page.pageCurrent = val
this.lecturerList()
// console.log(`当前页: ${val}`)
// 修改跳页面操作
handleEdit(id) {
var type = 'edit'
this.getById(id, type)
},
// 查询条件
handleCheck() {
this.page.pageCurrent = 1
this.lecturerList()
// 查看跳页面设置
handleView(id) {
var type = 'view'
this.getById(id, type)
},
// 重置查询条件
handleReset() {
// 关闭弹窗回调
closeCllback() {
this.ctrl.viewVisible = false;
this.ctrl.proportionDialogVisible = false;
this.ctrl.dialogVisible = false;
this.reload()
},
lecturerList() {
this.ctrl.loading === true
api.lecturerList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.list = res.data.list
this.page.pageCurrent = res.data.pageCurrent
this.page.totalCount = res.data.totalCount
this.page.pageSize = res.data.pageSize
this.ctrl.loading = false
}).catch(() => {
this.ctrl.loading = false
})
},
// 修改状态
handleChangeStatus(id, statusId) {
const title = { 0: '禁用', 1: '启用' }
......@@ -201,22 +194,46 @@
this.reload()
})
},
// 修改跳页面操作
handleEdit(id) {
this.title = '信息修改'
this.getById(id, this.title)
this.ctrl.dialogVisible = true
// 查看信息
getById(id, type) {
this.ctrl.loading = true
api.lecturerView({ id: id }).then(res => {
this.formData = res.data
if (JSON.stringify(res.data.lecturerExt) !== '{}') {
this.lecturerExt = res.data.lecturerExt
}
if (type === 'proportion') {
this.ctrl.dialogTitle = res.data.lecturerName + ' —— 设置分成'
this.ctrl.proportionDialogVisible = true
} else if (type === 'edit') {
this.ctrl.dialogTitle = res.data.lecturerName + ' —— 信息修改'
this.ctrl.dialogVisible = true
} else {
this.ctrl.dialogTitle = res.data.lecturerName + ' —— 信息查看'
this.ctrl.viewVisible = true
}
this.ctrl.loading = false
}).catch(() => {
this.ctrl.loading = true
})
},
// 查看跳页面设置
handleView(id) {
this.title = '查看详情'
this.getById(id, this.title)
this.ctrl.viewVisible = true
handleSizeChange(val) {
// console.log(`每页 ${val} 条`)
this.page.pageSize = val
this.lecturerList()
},
// 关闭弹窗回调
closeCllback() {
this.ctrl.viewVisible = false;
this.ctrl.dialogVisible = false;
handleCurrentChange(val) {
this.page.pageCurrent = val
this.lecturerList()
// console.log(`当前页: ${val}`)
},
// 查询条件
handleCheck() {
this.page.pageCurrent = 1
this.lecturerList()
},
// 重置查询条件
handleReset() {
this.reload()
},
// 刷新当前页面
......@@ -226,19 +243,16 @@
this.lecturerExt = {}
this.lecturerList()
},
// 查看信息
getById(id, title) {
this.ctrl.loading === true
api.lecturerView({ id: id }).then(res => {
this.formData = res.data
if (JSON.stringify(res.data.lecturerExt) !== '{}') {
this.lecturerExt = res.data.lecturerExt
}
this.introduce = res.data.introduce
this.ctrl.dialogTitle = res.data.lecturerMobile + '——' + title
lecturerList() {
this.ctrl.loading = true
api.lecturerList(this.map, this.page.pageCurrent, this.page.pageSize).then(res => {
this.list = res.data.list
this.page.pageCurrent = res.data.pageCurrent
this.page.totalCount = res.data.totalCount
this.page.pageSize = res.data.pageSize
this.ctrl.loading = false
}).catch(() => {
this.ctrl.loading = true
this.ctrl.loading = false
})
}
}
......
<template>
<!--弹窗-->
<el-dialog
width="30%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="讲师分成:">
<el-input v-model="formData.lecturerProportion">%</el-input>
</el-form-item>
</el-form>
<el-row style="margin-top:17px; ">
<el-button style="float:right" size="mini" type="primary" @click="submitForm('formData')">确 定</el-button>
<el-button style="float:right;margin-left:6px;" size="mini" type="danger" plain @click="handleClose">取 消</el-button>
</el-row>
</el-dialog>
</template>
<script>
import * as api from '@/api/lecturer'
export default {
name: 'Proportion',
data() {
return {
rules: {
}
}
},
props: {
formData: {
type: Object,
default: () => {}
},
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
}
},
methods: {
// 更新讲师分成信息
submitForm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
if (this.formData.id === undefined) {
this.$alert('提交失败')
} else {
this.loading.show()
api.lecturerUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.handleClose()
} else {
this.$alert('提交失败')
}
})
// this.tips('成功', 'success')
}
} else {
return false;
}
})
},
// 关闭弹窗
handleClose(done) {
this.$emit('close-callback')
}
}
}
</script>
<template>
<!--弹窗-->
<el-dialog
width="70%"
width="60%"
:title="title"
:visible.sync="visible"
:before-close="handleClose">
......@@ -74,7 +74,7 @@
<el-row>
<el-col :span="8"><div>
<el-form-item label="讲师分成情况:">
<span>{{formData.lecturerProportion*100}}%</span>
<span>{{formData.lecturerProportion}}%</span>
</el-form-item>
</div></el-col>
<el-col :span="8"><div>
......
......@@ -35,7 +35,7 @@
</div>
<div>
<el-table @selection-change="handleSelectionChange" v-loading="ctrl.load" size="medium" :data="list" stripe border style="width: 100%">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column type="selection" width="40"></el-table-column>
<el-table-column type="index" label="序号" width="40"></el-table-column>
<el-table-column width="100" prop="lecturerName" label="讲师名称"></el-table-column>
<el-table-column width="120" prop="lecturerMobile" label="讲师手机"></el-table-column>
......@@ -185,7 +185,7 @@
},
// 打款跳页面操作
handleEdit(row) {
this.formData.id = row.id
this.formData = row
this.ctrl.dialogTitle = '打款进度'
this.ctrl.dialogVisible = true
},
......
......@@ -41,23 +41,41 @@ export default {
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
this.handleConfirm()
if (this.formData.id === undefined) {
this.$message({
type: 'error',
message: "提交失败"
});
} else {
this.loading.show()
orderApi.orderUpdate(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.tips('操作成功', 'success')
this.handleClose()
} else {
this.$message({
type: 'error',
message: "提交失败"
});
}
}).catch(() => {
this.loading.hide()
this.$message({
type: 'error',
message: "提交失败"
});
})
}
} else {
return false;
this.$message({
type: 'error',
message: "提交失败"
});
}
})
},
async handleConfirm() {
let res = {}
res = await orderApi.orderUpdate(this.formData)
this.tips('成功', 'success')
if (res.code === 200 && res.data > 0) {
// 提交成功, 关闭窗口, 刷新列表
this.$emit('close-callback')
} else {
this.$alert(res.msg || '备注失败')
}
},
handleClose(done) {
this.$emit('close-callback')
}
......
......@@ -73,8 +73,7 @@ export default {
},
watch: {
visible: function(val) {
console.log(val)
if (val === true) {
if (val) {
setTimeout(() => {
this.editor.create();
this.editor.customConfig.customUploadImg = this.editorUpload
......
......@@ -136,11 +136,3 @@ export default {
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -183,21 +183,26 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.ctrl.load = true
api.msgPush({ id: row }).then(res => {
if (res.code === 200 && res.data > 0) {
this.$message({
type: 'success',
message: "发送成功"
});
this.reload()
} else {
this.$message({
type: 'error',
message: "发送失败"
});
this.reload()
}
})
this.ctrl.load = false
if (res.code === 200 && res.data > 0) {
this.$message({
type: 'success',
message: "发送成功"
});
this.reload()
} else {
this.$message({
type: 'error',
message: "发送失败"
});
this.reload()
}
}).catch(() => {
this.ctrl.load = false
this.reload()
})
}).catch(() => {
this.reload()
})
......
......@@ -168,7 +168,7 @@
api.msgView({ id: row }).then(res => {
if (res.code === 200) {
this.formData.msgTitle = res.data.msgTitle
this.ctrl.dialogTitle = mobile + '——查看'
this.ctrl.dialogTitle = mobile + ' —— 查看'
this.ctrl.dialogVisible = true
}
})
......
......@@ -45,12 +45,3 @@
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -96,12 +96,3 @@ export default {
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -87,24 +87,14 @@ export default {
// this.tips('成功', 'success')
}
} else {
return false;
this.$alert('提交失败')
}
})
},
// 关闭弹窗
handleClose(done) {
this.form = {}
this.$emit('close-callback')
}
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -127,7 +127,9 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.ctrl.load = true
api.templateDelete({ id: id }).then(res => {
this.ctrl.load = false
if (res.code === 200 && res.data > 0) {
this.$message({
type: 'success',
......@@ -143,6 +145,7 @@
}
})
}).catch(() => {
this.ctrl.load = false
this.reload()
})
},
......@@ -150,10 +153,16 @@
this.ctrl.addDialogVisible = true
this.dialogTitle = '添加'
},
handleEdit(res) {
this.formData = res
this.dialogTitle = res.title + '编辑'
this.ctrl.dialogVisible = true
handleEdit(id) {
this.ctrl.load = true
api.templateView({ id: id }).then(res => {
this.formData = res
this.dialogTitle = res.title + '编辑'
this.ctrl.dialogVisible = true
this.ctrl.load = false
}).catch(() => {
this.ctrl.load = false
})
},
// 关闭弹窗回调
closeCallback() {
......
......@@ -6,17 +6,27 @@
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="菜单名称:" prop="menuName">
<el-form-item label="类型:">
<el-radio-group v-model="menuType">
<el-radio :label="1">目录</el-radio>
<el-radio :label="2">菜单</el-radio>
<el-radio :label="3">按钮</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="菜单名称:" prop="menuName">
<el-input v-model="formData.menuName"></el-input>
</el-form-item>
<el-form-item label="菜单地址:" prop="menuUrl">
<el-form-item label="路由地址:" prop="menuUrl" v-if="menuType != 3">
<el-input v-model="formData.menuUrl"></el-input>
</el-form-item>
<el-form-item label="目标名称:">
<el-input v-model="formData.targetName"></el-input>
<el-form-item label="接口地址:" v-if="menuType == 2 || menuType == 3">
<el-input v-model="formData.apiUrl"></el-input>
</el-form-item>
<el-form-item label="图标:" prop="menuIcon">
<el-input v-model="formData.menuIcon"></el-input>
<el-form-item label="显示菜单:">
<el-radio-group v-model="hiddenType">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">不显示</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序:">
<el-input-number style="width: 300px;" v-model="sort" @change="handleChange" :min="1" :max="10000"></el-input-number>
......@@ -39,12 +49,11 @@ export default {
data() {
return {
sort: 1,
hiddenType: 1,
menuType: 1,
rules: {
menuName: [
{ required: true, message: '请输入菜单名称', trigger: 'blur' }
],
menuUrl: [
{ required: true, message: '请输入菜单地址', trigger: 'blur' }
]
}
}
......@@ -70,6 +79,7 @@ export default {
},
// 保存管理员信息
submitForm(formData) {
this.formData.menuType = this.menuType
if (!this.formData.menuName) {
this.$message({
type: 'error',
......@@ -77,16 +87,29 @@ export default {
});
return false
}
if (!this.formData.menuUrl) {
this.$message({
type: 'error',
message: '请输入菜单地址'
});
return false
if (this.formData.menuType !== 3) {
if (!this.formData.menuUrl) {
this.$message({
type: 'error',
message: '请输入路由地址'
});
return false
}
}
if (this.formData.menuType === 2 || this.formData.menuType === 3) {
if (!this.formData.apiUrl) {
this.$message({
type: 'error',
message: '请输入接口地址'
});
return false
}
}
this.$refs[formData].validate((valid) => {
if (valid) {
this.loading.show()
this.formData.sort = this.sort
this.formData.hiddenType = this.hiddenType
api.menuSave(this.formData).then(res => {
this.loading.hide()
if (res.code === 200 && res.data > 0) {
......
......@@ -5,20 +5,33 @@
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" :rules="rules" label-width="100px">
<el-form-item label="菜单名称:" prop="menuName">
<el-form ref="formData" :model="formData" label-width="100px">
<el-form-item label="类型:">
<el-radio-group v-model="formData.menuType">
<el-radio :label="1">目录</el-radio>
<el-radio :label="2">菜单</el-radio>
<el-radio :label="3">按钮</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="菜单名称:" prop="menuName">
<el-input v-model="formData.menuName"></el-input>
</el-form-item>
<el-form-item label="菜单路径:" prop="menuUrl">
<el-form-item label="路由地址:" prop="menuUrl" v-if="formData.menuType != 3">
<el-input v-model="formData.menuUrl"></el-input>
</el-form-item>
<el-form-item label="目标名称:">
<el-input v-model="formData.targetName"></el-input>
<el-form-item label="接口地址:" v-if="formData.menuType == 2 || formData.menuType == 3">
<el-input v-model="formData.apiUrl"></el-input>
</el-form-item>
<el-form-item label="显示菜单:">
<el-radio-group v-model="formData.hiddenType">
<el-radio :label="1">显示</el-radio>
<el-radio :label="0">不显示</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序:">
<el-form-item label="排序">
<el-input-number style="width: 300px;" v-model="formData.sort" @change="handleChange" :min="1" :max="10000"></el-input-number>
</el-form-item>
<el-form-item label="备注:">
<el-form-item label="备注">
<el-input type="textarea" v-model="formData.remark"></el-input>
</el-form-item>
</el-form>
......@@ -34,14 +47,6 @@
name: 'Edit',
data() {
return {
rules: {
menuName: [
{ required: true, message: '请输入菜单名称', trigger: 'blur' }
],
menuUrl: [
{ required: true, message: '请输入菜单路径', trigger: 'blur' }
]
}
}
},
props: {
......@@ -69,6 +74,37 @@
submitForm(formData) {
this.$refs[formData].validate((valid) => {
if (valid) {
if (!this.formData.menuName) {
this.$message({
type: 'error',
message: '请输入菜单名称'
});
return false
}
if (this.formData.menuType !== 3) {
if (!this.formData.menuUrl) {
this.$message({
type: 'error',
message: '请输入路由地址'
});
return false
}
}
if (this.formData.menuType === 2 || this.formData.menuType === 3) {
if (!this.formData.apiUrl) {
this.$message({
type: 'error',
message: '请输入接口地址'
});
return false
}
}
if (!this.formData.id) {
this.$message({
type: 'error',
message: '提交失败'
});
}
this.loading.show()
api.menuUpdate(this.formData).then(res => {
this.loading.hide()
......
......@@ -20,42 +20,58 @@
border
row-key="id"
:default-expand-all="false">
<el-table-column
type="index"
label="序号"
width="55">
</el-table-column>
<el-table-column
prop="menuName"
label="菜单名称"
sortable
width="180">
</el-table-column>
<el-table-column
prop="menuIcon"
label="菜单图标"
width="100">
width="210">
</el-table-column>
<el-table-column
prop="menuUrl"
label="路由地址"
sortable
width="250">
width="170">
</el-table-column>
<el-table-column
prop="apiUrl"
label="接口地址">
</el-table-column>
<el-table-column
prop="targetName"
label="目标名称">
width="60"
prop="hiddenType"
label="类型">
<template slot-scope="scope">
<span>{{textMenuType[scope.row.menuType]}}</span>
</template>
</el-table-column>
<el-table-column
width="80"
prop="hiddenType"
label="显示菜单">
<template slot-scope="scope">
<span>{{textHiddenType[scope.row.hiddenType]}}</span>
</template>
</el-table-column>
<el-table-column
width="60"
prop="sort"
label="排序">
</el-table-column>
<el-table-column
prop="remark"
label="备注"
width="200">
width="150">
</el-table-column>
<el-table-column label="操作" width="240">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-circle-plus-outline" @click="addSubMmenu(scope.row.id)">添加</el-button>
<el-button type="danger" @click="handleDelete(scope.row.id)" size="mini">删除</el-button>
<el-button type="success" @click="handleEdit(scope.row)" size="mini">编辑</el-button>
<el-button type="success" @click="handleEdit(scope.row.id)" size="mini">编辑</el-button>
</template>
</el-table-column>
</el-table>
......@@ -83,6 +99,15 @@
opts: {
statusIdList: []
},
textHiddenType: {
0: '不显示',
1: '显示'
},
textMenuType: {
1: '目录',
2: '菜单',
3: '按钮'
},
textuStatusId: {
0: '禁用',
1: '正常'
......@@ -104,7 +129,7 @@
handleReset() {
this.reload()
},
// 后台管理员分页列表接口
// 分页列表接口
menuList() {
this.ctrl.load = true
api.menuList(this.map).then(res => {
......@@ -119,10 +144,16 @@
this.ctrl.dialogTitle = "添加"
this.ctrl.addDialogVisible = true
},
handleEdit(row) {
this.formData = row
this.ctrl.dialogTitle = row.menuName + "——编辑"
this.ctrl.editDialogVisible = true
handleEdit(id) {
this.ctrl.load = true
api.menuView({ id: id }).then(res => {
this.ctrl.load = false
this.formData = res.data
this.ctrl.dialogTitle = res.menuName + " —— 信息编辑"
this.ctrl.editDialogVisible = true
}).catch(() => {
this.ctrl.load = false
})
},
// 关闭弹窗回调
closeCallback() {
......
......@@ -93,11 +93,3 @@
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -237,10 +237,16 @@
this.ctrl.dialogTitle = "添加"
},
// 角色修改弹窗
handleEdit(res) {
this.formData = res
this.ctrl.editDialogVisible = true
this.ctrl.dialogTitle = res.roleName + "——修改"
handleEdit(id) {
this.ctrl.load = true
api.roleView({ id: id }).then(res => {
this.ctrl.load = false
this.formData = res.data
this.ctrl.editDialogVisible = true
this.ctrl.dialogTitle = res.roleName + " —— 信息修改"
}).catch(() => {
this.ctrl.load = false
})
},
handlePms(id, roleName) {
this.id = id
......@@ -270,11 +276,3 @@
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -8,7 +8,7 @@
<el-form-item>
<el-button icon='el-icon-search' type="primary" @click="handleCheck">查询</el-button>
<el-button icon='el-icon-refresh' class="filter-item" @click="handleReset">重置</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="handleAdd()">添加</el-button>
<el-button type="primary" perms="sys:user:add" icon="el-icon-circle-plus-outline" size="mini" @click="handleAdd()">添加</el-button>
</el-form-item>
</el-form>
</div>
......@@ -50,7 +50,7 @@
<ul class="list-item-actions">
<li>
<el-button type="danger" @click="handleDelete(scope.row.id)" size="mini">删除</el-button>
<el-button type="success" @click="handleEdit(scope.row)" size="mini">修改</el-button>
<el-button type="success" @click="handleEdit(scope.row.id)" size="mini">修改</el-button>
<el-button type="success" @click="handleUserRole(scope.row.id, scope.row.realName)" size="mini">设置角色</el-button>
<el-button type="success" @click="handlePassword(scope.row.userNo, scope.row.realName)" size="mini">密码修改</el-button>
</li>
......@@ -127,22 +127,28 @@
this.dialogTitle = '添加'
},
// 跳修改弹窗页面
handleEdit(row) {
this.formData = row
this.ctrl.dialogVisible = true
this.ctrl.dialogTitle = row.realName + '——编辑'
handleEdit(id) {
this.ctrl.load = true
api.userView({ id: id }).then(res => {
this.formData = res.data
this.ctrl.dialogVisible = true
this.ctrl.dialogTitle = res.realName + ' —— 信息编辑'
this.ctrl.load = false
}).catch(() => {
this.ctrl.load = false
})
},
// 跳出修改密码弹窗
handlePassword(userNo, realName) {
this.formData.adminUserNo = userNo
this.ctrl.passwordDialogVisible = true
this.ctrl.dialogTitle = realName + '——密码修改'
this.ctrl.dialogTitle = realName + ' —— 密码修改'
},
// 跳出设置角色弹窗
handleUserRole(id, realName) {
this.id = id
this.ctrl.serRoleDialogVisible = true
this.ctrl.dialogTitle = realName + '——设置角色'
this.ctrl.dialogTitle = realName + ' —— 设置角色'
},
// 关闭弹窗回调
closeCallback() {
......@@ -177,6 +183,10 @@
}
}).catch(() => {
this.ctrl.load = true
this.$message({
type: 'error',
message: "删除失败"
});
})
})
},
......@@ -215,6 +225,7 @@
this.reload()
}
}).catch(() => {
this.ctrl.load = false
const msg = { 0: '禁用失败', 1: '启用失败' }
this.$message({
type: 'error',
......
......@@ -177,8 +177,3 @@
}
}
</script>
<style scoped>
.button {
padding: 5px 10px;
}
</style>
......@@ -5,7 +5,7 @@
:title="title"
:visible.sync="visible"
:before-close="handleClose">
<el-form ref="formData" :model="formData" label-width="80px">
<el-form ref="formData" :model="formData" label-width="100px">
<el-form-item label="头像:">
<el-upload
class="upload-demo"
......
......@@ -80,7 +80,7 @@
<template slot-scope="scope">
<ul class="list-item-actions">
<li>
<el-button type="success" @click="handleEdit(scope.row)" size="mini">编辑</el-button>
<el-button type="success" @click="handleEdit(scope.row.id)" size="mini">编辑</el-button>
<el-button type="success" @click="handleStudy(scope.row.userNo)" size="mini">学习记录</el-button>
</li>
</ul>
......@@ -154,22 +154,14 @@
this.$router.push({ path: '/user/user/studyLog', query: { userNo: row }});
},
// 跳修改弹窗页面
handleEdit(row) {
this.formData = row
this.ctrl.dialogTitle = '编辑'
this.ctrl.dialogVisible = true
handleEdit(id) {
var type = 'edit'
this.getExt(id, type);
},
// 查看弹窗
handleView(id) {
this.ctrl.load = true
api.userExtView({ id: id }).then(res => {
this.formData = res.data
this.ctrl.dialogTitle = "查看"
this.ctrl.load = false
}).catch(() => {
this.ctrl.load = false
})
this.ctrl.viewVisible = true
var type = 'view'
this.getExt(id, type);
},
// 关闭弹窗回调
closeCallback() {
......@@ -179,6 +171,22 @@
this.ctrl.studyVisible = false
this.reload()
},
getExt(id, type) {
this.ctrl.load = true
api.userExtView({ id: id }).then(res => {
this.formData = res.data
if (type === 'view') {
this.ctrl.dialogTitle = '信息查看'
this.ctrl.viewVisible = true
} else {
this.ctrl.dialogTitle = '信息修改'
this.ctrl.dialogVisible = true
}
this.ctrl.load = false
}).catch(() => {
this.ctrl.load = false
})
},
// 修改状态
handleChangeStatus(id, statusId) {
const title = { 0: '禁用', 1: '启用' }
......
......@@ -130,12 +130,3 @@
}
}
</script>
<style scoped>
.cancel {
text-align: right;
}
.button {
padding: 5px 10px;
}
</style>
......@@ -96,9 +96,9 @@ public class FilterPre extends ZuulFilter {
}
String tk = stringRedisTemplate.opsForValue().get(RedisPreEnum.ADMINI_MENU.getCode().concat(userNo.toString()));
// if (!checkUri(uri, tk)) {
// throw new BaseException(ResultEnum.MENU_NO);
// }
if (!checkUri(uri, tk)) {
throw new BaseException(ResultEnum.MENU_NO);
}
// 更新时间,使用户菜单不过期
stringRedisTemplate.opsForValue().set(RedisPreEnum.ADMINI_MENU.getCode().concat(userNo.toString()), tk, 1, TimeUnit.HOURS);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册