Browse Source

课程管理,文章管理,服务老师,授课老师....

master
杨豪 4 years ago
parent
commit
5a6d6b18f0
  1. 27
      src/api/CourseCategory.js
  2. 27
      src/api/CourseMaster.js
  3. 35
      src/api/CourseSMaster.js
  4. 2
      src/components/Crud/CRUD.operation.vue
  5. 2
      src/components/Crud/UD.operation.vue
  6. 9
      src/components/Crud/crud.js
  7. 1
      src/utils/index.js
  8. 3
      src/views/course/add.vue
  9. 199
      src/views/course/category.vue
  10. 140
      src/views/course/index.vue
  11. 8
      src/views/shop/cate/index.vue
  12. 28
      src/views/shop/user/index.vue
  13. 173
      src/views/shop/user/master.vue
  14. 273
      src/views/shop/user/sMaster.vue
  15. 351
      src/views/system/menu/index.vue
  16. 19
      src/views/wechat/article/form.vue
  17. 1
      src/views/wechat/article/index.vue
  18. 1
      vue.config.js

27
src/api/CourseCategory.js

@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/CourseCategory',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/CourseCategory/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/CourseCategory',
method: 'put',
data
})
}
export default { add, edit, del }

27
src/api/CourseMaster.js

@ -0,0 +1,27 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/CourseMaster',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/CourseMaster/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/CourseMaster',
method: 'put',
data
})
}
export default { add, edit, del }

35
src/api/CourseSMaster.js

@ -0,0 +1,35 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/CourseMaster',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/CourseMaster/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/CourseMaster',
method: 'put',
data
})
}
export function moveMembers(data) {
return request({
url: 'api/member/moveMembers',
method: 'POST',
data
})
}
export default { add, edit, del, moveMembers }

2
src/components/Crud/CRUD.operation.vue

@ -99,7 +99,7 @@
</el-popover> </el-popover>
</el-button-group> </el-button-group>
</div> </div>
</template> </template>
<script> <script>
import CRUD, { crud } from '@crud/crud' import CRUD, { crud } from '@crud/crud'
export default { export default {

2
src/components/Crud/UD.operation.vue

@ -1,5 +1,5 @@
<template> <template>
<div> <div style="display:inline-block;margin-right:px;">
<el-button v-permission="permission.edit" :disabled="disabledEdit" size="mini" type="primary" icon="el-icon-edit" @click="crud.toEdit(data)" /> <el-button v-permission="permission.edit" :disabled="disabledEdit" size="mini" type="primary" icon="el-icon-edit" @click="crud.toEdit(data)" />
<el-popover v-model="pop" v-permission="permission.del" placement="top" width="180" trigger="manual" @show="onPopoverShow" @hide="onPopoverHide"> <el-popover v-model="pop" v-permission="permission.del" placement="top" width="180" trigger="manual" @show="onPopoverShow" @hide="onPopoverHide">
<p>{{ msg }}</p> <p>{{ msg }}</p>

9
src/components/Crud/crud.js

@ -158,8 +158,6 @@ function CRUD(options) {
* @param {*} data 数据项 * @param {*} data 数据项
*/ */
toEdit(data) { toEdit(data) {
console.log('data', data)
console.log('data', JSON.parse(JSON.stringify(data)))
crud.resetForm(JSON.parse(JSON.stringify(data))) crud.resetForm(JSON.parse(JSON.stringify(data)))
if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) { if (!(callVmHook(crud, CRUD.HOOK.beforeToEdit, crud.form) && callVmHook(crud, CRUD.HOOK.beforeToCU, crud.form))) {
return return
@ -375,8 +373,13 @@ function CRUD(options) {
* @param {Array} data 数据 * @param {Array} data 数据
*/ */
resetForm(data) { resetForm(data) {
console.log(data)
const form = data || (typeof crud.defaultForm === 'object' ? JSON.parse(JSON.stringify(crud.defaultForm)) : crud.defaultForm()) const form = data || (typeof crud.defaultForm === 'object' ? JSON.parse(JSON.stringify(crud.defaultForm)) : crud.defaultForm())
if(form.categoryId){
form.categoryId = form.categoryId.toString()
}
if(form.imageArr && form.imageArr.length>0){
form.imageInput = form.imageArr[0]
}
const crudFrom = crud.form const crudFrom = crud.form
for (const key in form) { for (const key in form) {
if (crudFrom.hasOwnProperty(key)) { if (crudFrom.hasOwnProperty(key)) {

1
src/utils/index.js

@ -9,6 +9,7 @@
* @returns {string} * @returns {string}
*/ */
export function parseTime(time, cFormat) { export function parseTime(time, cFormat) {
// console.log('time',time)
if (arguments.length === 0) { if (arguments.length === 0) {
return null return null
} }

3
src/views/course/add.vue

@ -1,3 +0,0 @@
<template>
<div>add</div>
</template>

199
src/views/course/category.vue

@ -0,0 +1,199 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="500px"
>
<el-form
ref="form"
:model="form"
:rules="rules"
size="small"
label-width="80px"
>
<el-form-item style="" label="上级分类" prop="pid">
<treeselect v-model="form.parentId" :options="depts" style="width: 370px;" placeholder="选择上级分类" />
</el-form-item>
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="form.categoryName" style="width: 370px" />
</el-form-item>
<el-form-item label="分类简介">
<el-input type="textarea" v-model="form.categoryDetails" style="width: 370px" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button
:loading="crud.cu === 2"
type="primary"
@click="crud.submitCU"
>确认</el-button
>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="small"
style="width: 100%"
@selection-change="crud.selectionChangeHandler"
row-key="id"
:tree-props="{children: 'categoryList', hasChildren: 'hasChildren'}"
>
<el-table-column type="selection" width="55" />
<!-- <el-table-column v-if="columns.visible('id')" prop="id" label="id" /> -->
<el-table-column
v-if="columns.visible('categoryName')"
prop="categoryName"
label="分类名称"
/>
<el-table-column
v-if="columns.visible('categoryDetails')"
prop="categoryDetails"
label="分类简介"
/>
<el-table-column
v-if="columns.visible('createTime')"
prop="createTime"
label="创建时间"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
v-permission="['admin', 'CourseCategory:edit', 'CourseCategory:del']"
label="操作"
width="150px"
align="center"
>
<template slot-scope="scope">
<udOperation :data="scope.row" :permission="permission" />
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudCourseCategory from "@/api/CourseCategory";
import CRUD, { presenter, header, form, crud } from "@crud/crud";
import rrOperation from "@crud/RR.operation";
import crudOperation from "@crud/CRUD.operation";
import udOperation from "@crud/UD.operation";
import pagination from "@crud/Pagination";
import MaterialList from "@/components/material";
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { initData } from '@/api/data'
// crudpresenter
const defaultCrud = CRUD({
title: "课程分类",
url: "api/CourseCategory",
sort: "id,desc",
crudMethod: { ...crudCourseCategory },
});
const defaultForm = {
id: null,
categoryName: null,
sort: null,
isDel: null,
createTime: null,
updateTime: null,
categoryDetails: null,
};
export default {
name: "CourseCategory",
components: {
pagination,
crudOperation,
rrOperation,
udOperation,
MaterialList,
Treeselect
},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ["admin", "CourseCategory:add"],
edit: ["admin", "CourseCategory:edit"],
del: ["admin", "CourseCategory:del"],
},
rules: {
categoryName: [
{ required: true, message: "分类名称不能为空", trigger: "blur" },
],
},
depts:[],
};
},
watch: {},
methods: {
//
[CRUD.HOOK.beforeRefresh]() {
return true;
}, //
[CRUD.HOOK.afterToCU](crud, form) {
initData('/api/CourseCategory',{
page: 1,
size: 100,
sort: ['id,desc'],
}).then((res)=>{
console.log(res)
// this.categoryList = res.content
this.depts = []
const dept = { id: 0, label: '顶级类目', children: [] }
res.content.forEach((item)=>{
item.label = item.categoryName
item.children = item.categoryList
item.categoryList.forEach((child)=>{
child.label = child.categoryName
child.children = child.categoryList
})
})
dept.children = res.content
this.depts.push(dept)
})
//
// crudCyCourse.getCates({ isShow: true }).then(res => {
// this.depts = []
// const dept = { id: 0, label: '', children: [] }
// dept.children = res.content
// this.depts.push(dept)
// })
},
},
};
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
</style>

140
src/views/course/index.vue

@ -4,11 +4,20 @@
<div class="head-container"> <div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'--> <!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" /> <crudOperation :permission="permission" />
<el-input
v-model="query.courseName"
clearable placeholder="输入搜索内容"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery" />
<!--表单组件--> <!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title"> <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
<el-form-item label="课程等级">
<el-input-number v-model="form.level" :min="1" label="文章等级"></el-input-number>
</el-form-item>
<el-form-item label="课程分类"> <el-form-item label="课程分类">
<el-select v-model.number="form.categoryId"> <el-select v-model="form.categoryId" filterable allow-create default-first-option>
<el-option v-for="item in categoryList" <el-option v-for="item in categoryList"
:key="item.id" :key="item.id"
:label="item.categoryName" :label="item.categoryName"
@ -44,14 +53,14 @@
@change="courseTimeChange"> @change="courseTimeChange">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="课程表" v-if="form.courseList.length>0"> <el-form-item label="课程表" v-if="form.courseScheduleList.length>0">
<el-input <el-input
type="textarea" type="textarea"
style="margin-bottom:10px;" style="margin-bottom:10px;"
v-for="(item,index) in form.courseList" v-for="(item,index) in form.courseScheduleList"
:key="index" :key="index"
:placeholder="'请输入第'+ item.id + '天的课程内容'" :placeholder="'请输入第'+ item.day + '天的课程内容'"
v-model="item.desc"></el-input> v-model="item.courseContent"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="签到时间" prop="signEndTime"> <el-form-item label="签到时间" prop="signEndTime">
<el-date-picker <el-date-picker
@ -91,7 +100,8 @@
<el-input v-model="form.coursePlace" /> <el-input v-model="form.coursePlace" />
</el-form-item> </el-form-item>
<el-form-item label="报名人数" prop="courseEnterPerson"> <el-form-item label="报名人数" prop="courseEnterPerson">
<el-input v-model="form.courseEnterPerson" /> <el-input v-model="form.courseEnterPerson" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')"
maxlength="6"/>
</el-form-item> </el-form-item>
<el-form-item label="收费类型" prop="chargeType"> <el-form-item label="收费类型" prop="chargeType">
<el-radio-group v-model="form.chargeType"> <el-radio-group v-model="form.chargeType">
@ -99,8 +109,9 @@
<el-radio :label="1">收费</el-radio> <el-radio :label="1">收费</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="课程费用" prop="courseCharge"> <el-form-item label="课程费用" prop="courseCharge" v-if="form.chargeType == 1">
<el-input v-model="form.courseCharge" /> <el-input v-model="form.courseCharge" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')"
maxlength="6" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -114,34 +125,75 @@
<el-table-column v-if="columns.visible('id')" prop="id" label="id" width="75"/> <el-table-column v-if="columns.visible('id')" prop="id" label="id" width="75"/>
<el-table-column v-if="columns.visible('courseName')" prop="courseName" label="课程名称"/> <el-table-column v-if="columns.visible('courseName')" prop="courseName" label="课程名称"/>
<el-table-column v-if="columns.visible('categoryName')" prop="categoryName" label="分类名称" /> <el-table-column v-if="columns.visible('categoryName')" prop="categoryName" label="分类名称" />
<el-table-column v-if="columns.visible('courseIntroduce')" prop="courseIntroduce" label="课程简介" width="160"/> <el-table-column v-if="columns.visible('courseIntroduce')" prop="courseIntroduce" label="课程简介" :show-overflow-tooltip="true"/>
<el-table-column v-if="columns.visible('courseStartTime')" prop="courseStartTime" label="课程时间" width="280px"> <el-table-column prop="courseState" label="课程状态">
<template slot-scope="scope">
<span>{{scope.row.courseState == 1 ? '进行中' : scope.row.courseState == 2 ? '已结束' : '已取消' }}</span>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('courseStartTime')" prop="courseStartTime" label="课程时间" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.courseStartTime)}} ~ {{parseTime(scope.row.courseEndTime)}}</span> <span>{{ parseTime(scope.row.courseStartTime)}} ~ {{parseTime(scope.row.courseEndTime)}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('signStartTime')" label="签到时间" width="280px"> <el-table-column v-if="columns.visible('signStartTime')" label="签到时间" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.signStartTime) }} ~ {{ parseTime(scope.row.signEndTime) }}</span> <span>{{ parseTime(scope.row.signStartTime) }} ~ {{ parseTime(scope.row.signEndTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('enterStartTime')" label="报名开始时间" width="280px"> <el-table-column v-if="columns.visible('enterStartTime')" label="报名开始时间" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.enterStartTime) }} ~ {{ parseTime(scope.row.enterEndTime) }}</span> <span>{{ parseTime(scope.row.enterStartTime) }} ~ {{ parseTime(scope.row.enterEndTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('coursePlace')" prop="coursePlace" label="开课地点" width="200px" /> <el-table-column v-if="columns.visible('coursePlace')" prop="coursePlace" label="开课地点"/>
<el-table-column v-if="columns.visible('courseEnterPerson')" prop="courseEnterPerson" label="报名人数" /> <el-table-column v-if="columns.visible('courseEnterPerson')" prop="courseEnterPerson" label="报名人数" />
<el-table-column v-if="columns.visible('courseCharge')" prop="courseCharge" label="费用" /> <el-table-column v-if="columns.visible('courseCharge')" prop="courseCharge" label="费用" />
<el-table-column v-permission="['admin','cyCourse:del']" label="操作" width="150px" align="center"> <el-table-column v-permission="['admin','cyCourse:del']" label="操作" width="260px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<udOperation <udOperation
:data="scope.row" :data="scope.row"
:permission="permission" :permission="permission"
/> />
<el-button type="primary" icon="el-icon-view" size="mini" @click="showDetail(scope.row)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 课程详情弹框 -->
<el-dialog title="课程详情" :visible.sync="detailDialog" width="80%">
<div class="detail-box">
<el-row>
<el-col :span="12">
<span>课程名称</span>
<span>{{detail.courseName}}</span>
</el-col>
<el-col :span="12" >
<span>课程分类</span>
<span>{{detail.categoryName}}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<span>课程时间</span>
<span>{{detail.courseStartTime}}~{{detail.courseEndTime}}</span>
</el-col>
<el-col :span="12">
<span>课程地点</span>
<span>{{detail.coursePlace}}</span>
</el-col>
</el-row>
</div>
<div class="title-w">报名信息 签到数/报名数</div>
<div class="sign-up-table">
<el-table :data="signUpData" size="small" style="width: 100%;">
<el-table-column label="会员姓名"></el-table-column>
<el-table-column label="手机号"></el-table-column>
<el-table-column label="是否签到"></el-table-column>
<el-table-column label="服务老师"></el-table-column>
</el-table>
</div>
</el-dialog>
<!--分页组件--> <!--分页组件-->
<pagination /> <pagination />
</div> </div>
@ -158,6 +210,7 @@ import pagination from '@crud/Pagination'
import picUpload from '@/components/pic-upload' import picUpload from '@/components/pic-upload'
import MaterialList from "@/components/material" import MaterialList from "@/components/material"
import { initData } from '@/api/data' import { initData } from '@/api/data'
import { parseTime } from '@/utils/index'
// crudpresenter // crudpresenter
const defaultCrud = CRUD({ const defaultCrud = CRUD({
@ -169,6 +222,7 @@ const defaultCrud = CRUD({
const defaultForm = { const defaultForm = {
id: null, id: null,
categoryId: null, categoryId: null,
level:null,
courseName: null, courseName: null,
categoryName: null, categoryName: null,
courseIntroduce: null, courseIntroduce: null,
@ -189,7 +243,7 @@ const defaultForm = {
updateUser: null, updateUser: null,
imageInput: '', imageInput: '',
imageArr: [], imageArr: [],
courseList:[], courseScheduleList:[],
} }
export default { export default {
name: 'CyCourse', name: 'CyCourse',
@ -202,6 +256,7 @@ export default {
permission: { permission: {
add: ['admin', 'cyCourse:add'], add: ['admin', 'cyCourse:add'],
edit: ['admin', 'cyCourse:edit'], edit: ['admin', 'cyCourse:edit'],
view: ['admin', 'cyCourse:view'],
del: ['admin', 'cyCourse:del'] del: ['admin', 'cyCourse:del']
}, },
categoryList: [], categoryList: [],
@ -231,7 +286,7 @@ export default {
{ required: true, message: '收费类型(0:免费;1:收费)不能为空', trigger: 'blur' } { required: true, message: '收费类型(0:免费;1:收费)不能为空', trigger: 'blur' }
], ],
courseCharge: [ courseCharge: [
{ required: true, message: '课程费用不能为空', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
] ]
}, },
courseStart: { courseStart: {
@ -281,7 +336,10 @@ export default {
return time.getTime() < beginDateVal - 0 return time.getTime() < beginDateVal - 0
} }
} }
} },
detailDialog:false,
detail:{},
signUpData:[],
} }
}, },
@ -297,10 +355,13 @@ export default {
}, // }, //
[CRUD.HOOK.afterToCU](crud, form) { [CRUD.HOOK.afterToCU](crud, form) {
}, },
// toQuery(){
// console.log(this.crud)
// },
getCategory(){ getCategory(){
initData('/api/cyCourseCategory',this.getQueryParams()).then((res)=>{ initData('/api/CourseCategory',this.getQueryParams()).then((res)=>{
console.log(res) // console.log(res)
this.categoryList = res.content this.categoryList = res.content
}) })
}, },
getQueryParams: function() { getQueryParams: function() {
@ -311,29 +372,34 @@ export default {
} }
}, },
courseTimeChange(){ courseTimeChange(){
console.log(this.form.courseStartTime) // console.log(this.form.courseStartTime)
console.log(this.form.courseEndTime) // console.log(this.form.courseEndTime)
this.form.courseList = []; this.form.courseScheduleList = [];
if(this.form.courseStartTime && this.form.courseEndTime){ if(this.form.courseStartTime && this.form.courseEndTime){
var day1 = new Date(this.form.courseStartTime) var day1 = new Date(this.form.courseStartTime)
var day2 = new Date(this.form.courseEndTime) var day2 = new Date(this.form.courseEndTime)
var num = (day2 - day1) / (1000 * 60 * 60 * 24) var num = (day2 - day1) / (1000 * 60 * 60 * 24) + 1 ;
for(var i = 0; i < num; i++){ for(let i = 0; i < num; i++){
this.form.courseList.push({id:i+1,desc:''}) let date = parseTime(day1.getTime()+(24*60*60*1000*i));
this.form.courseScheduleList.push({day:i+1,courseDate:date, courseContent:''})
} }
} }
console.log(this.form.courseList) // console.log(this.form.courseList)
}, },
submit(){ submit(){
this.form.imageArr = [this.form.imageInput] this.form.imageArr = [this.form.imageInput]
this.crud.submitCU() this.crud.submitCU()
} },
showDetail(row){
this.detail = row;
console.log(this.detail)
this.detailDialog = true;
},
} }
} }
</script> </script>
<style scoped> <style scoped>
@ -350,4 +416,20 @@ export default {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
.detail-box{
width: 100%;
font-size: 16px;
padding: 24px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.18);
border-radius: 12px;
}
.el-row{
margin: 24px 0;
}
.title-w{
font-size:19px;
font-weight: bold;
margin: 32px 0;
color: #000;
}
</style> </style>

8
src/views/shop/cate/index.vue

@ -37,7 +37,13 @@
</div> </div>
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :data="crud.data" row-key="id" @select="crud.selectChange" @select-all="crud.selectAllChange" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:data="crud.data"
row-key="id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler">
<el-table-column :selectable="checkboxT" type="selection" width="55" /> <el-table-column :selectable="checkboxT" type="selection" width="55" />
<el-table-column v-if="columns.visible('cateName')" label="名称" prop="cateName" /> <el-table-column v-if="columns.visible('cateName')" label="名称" prop="cateName" />
<el-table-column v-if="columns.visible('isShow')" label="状态" align="center" prop="isShow"> <el-table-column v-if="columns.visible('isShow')" label="状态" align="center" prop="isShow">

28
src/views/shop/user/index.vue

@ -39,8 +39,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="phone" label="手机号码" /> <el-table-column prop="phone" label="手机号码" />
<el-table-column prop="nowMoney" label="用户余额" /> <!-- <el-table-column prop="nowMoney" label="用户余额" />
<el-table-column prop="brokeragePrice" label="佣金金额" /> <el-table-column prop="brokeragePrice" label="佣金金额" /> -->
<el-table-column prop="integral" label="用户积分" /> <el-table-column prop="integral" label="用户积分" />
<el-table-column prop="createTime" label="创建日期" width="140"> <el-table-column prop="createTime" label="创建日期" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
@ -68,13 +68,25 @@
<el-table-column prop="payCount" label="购买次数" /> <el-table-column prop="payCount" label="购买次数" />
<el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="215" align="center" fixed="right"> <el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="215" align="center" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!-- <el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']" v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini" size="mini"
type="danger" type="danger"
@click="editD(scope.row)" @click="editD(scope.row)"
>查看下级</el-button> >查看下级</el-button> -->
<el-dropdown size="mini" split-button type="primary" trigger="click"> <el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
type="primary"
@click="edit(scope.row)"
>修改用户</el-button>
<el-button
v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']"
size="mini"
type="primary"
@click="editP(scope.row)"
>修改余额</el-button>
<!-- <el-dropdown size="mini" split-button type="primary" trigger="click">
操作 操作
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item> <el-dropdown-item>
@ -94,7 +106,7 @@
>修改余额</el-button> >修改余额</el-button>
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -165,9 +177,9 @@ export default {
.catch(() => { }) .catch(() => { })
}, },
beforeInit() { beforeInit() {
this.url = 'api/yxUser' this.url = 'api/member/listMembers'
const sort = 'uid,desc' const sort = 'uid,desc'
this.params = { page: this.page, size: this.size, sort: sort, userType: this.userType } this.params = { page: this.page, size: this.size, sort: sort, userType: this.userType,isPromoter:0 }
const query = this.query const query = this.query
const type = query.type const type = query.type
const value = query.value const value = query.value

173
src/views/shop/user/master.vue

@ -0,0 +1,173 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
>
<el-form
ref="form"
:model="form"
:rules="rules"
size="small"
label-width="80px"
>
<el-form-item label="姓名">
<el-input v-model="form.name" style="width: 370px" />
</el-form-item>
<el-form-item label="照片路径" prop="photoPath">
<picUpload v-model="form.photoPath"></picUpload>
<!-- <el-input v-model="form.photoPath" style="width: 370px" /> -->
</el-form-item>
<el-form-item label="个人简介">
<el-input type="textarea" v-model="form.introduction" style="width: 370px" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button
:loading="crud.cu === 2"
type="primary"
@click="crud.submitCU"
>确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="small"
style="width: 100%"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('id')" prop="id" label="id" />
<el-table-column
v-if="columns.visible('name')"
prop="name"
label="姓名"
/>
<el-table-column
v-if="columns.visible('photoPath')"
prop="photoPath"
label="照片路径"
/>
<el-table-column
v-if="columns.visible('introduction')"
prop="introduction"
label="个人简介"
/>
<el-table-column
v-if="columns.visible('arrangeNum')"
prop="arrangeNum"
label="已安排的课程数量"
/>
<el-table-column
v-if="columns.visible('finishedNum')"
prop="finishedNum"
label="已授课完毕的课程数量"
/>
<el-table-column
v-permission="['admin', 'CourseMaster:edit', 'CourseMaster:del']"
label="操作"
width="150px"
align="center"
>
<template slot-scope="scope">
<udOperation :data="scope.row" :permission="permission" />
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudCourseMaster from "@/api/CourseMaster";
import CRUD, { presenter, header, form, crud } from "@crud/crud";
import rrOperation from "@crud/RR.operation";
import crudOperation from "@crud/CRUD.operation";
import udOperation from "@crud/UD.operation";
import pagination from "@crud/Pagination";
import MaterialList from "@/components/material";
import picUpload from '@/components/pic-upload'
// crudpresenter
const defaultCrud = CRUD({
title: "课程讲师",
url: "api/CourseMaster",
sort: "id,desc",
crudMethod: { ...crudCourseMaster },
});
const defaultForm = {
id: null,
name: null,
photoPath: null,
introduction: null,
createTime: null,
updateTime: null,
isDel: null,
arrangeNum: null,
finishedNum: null,
};
export default {
name: "CourseMaster",
components: {
pagination,
crudOperation,
rrOperation,
udOperation,
MaterialList,
picUpload
},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ["admin", "CourseMaster:add"],
edit: ["admin", "CourseMaster:edit"],
del: ["admin", "CourseMaster:del"],
},
rules: {
photoPath: [
{ required: true, message: "照片路径不能为空", trigger: "blur" },
],
},
};
},
watch: {},
methods: {
//
[CRUD.HOOK.beforeRefresh]() {
return true;
}, //
[CRUD.HOOK.afterToCU](crud, form) {},
},
};
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
</style>

273
src/views/shop/user/sMaster.vue

@ -0,0 +1,273 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="small"
style="width: 100%"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="uid" label="用户id" />
<el-table-column prop="nickname" label="用户昵称" />
<el-table-column prop="realName" label="真实姓名" />
<el-table-column ref="table" prop="avatar" label="用户头像">
<template slot-scope="scope">
<a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img :src="scope.row.avatar" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column ref="table" prop="avatar" label="工作照">
<template slot-scope="scope">
<a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img :src="scope.row.avatar" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column prop="phone" label="手机号码" />
<el-table-column v-if="columns.visible('memberNum')" prop="memberNum" label="会员数量"/>
<el-table-column
v-permission="['admin', 'CourseMaster:edit', 'CourseMaster:del']"
label="操作"
width="150px"
align="center"
>
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-view" size="mini" @click="showDetail(scope.row)"></el-button>
<!-- <udOperation :data="scope.row" :permission="permission" /> -->
</template>
</el-table-column>
</el-table>
<!-- 老师信息详情弹框 -->
<el-dialog title="信息详情" :close-on-click-modal="false" :visible.sync="detailDialog" width="80%">
<div class="detail-box">
<el-row>
<el-col :span="12">
<span>昵称</span>
<span>{{detail.nickname}}</span>
</el-col>
<el-col :span="12" >
<span>真实姓名</span>
<span>{{detail.realName}}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<span>电话号码</span>
<span>{{detail.phone}}</span>
</el-col>
<el-col :span="12">
<span>工作照</span>
<img :src="detail.avatar" :alt="detail.realName" class="table-img">
</el-col>
</el-row>
</div>
<div class="title-w">
<span>会员信息</span>
<el-select v-model="masterId" clearable filterable placeholder="请选择要转移到的老师">
<el-option
v-for="item in crud.data"
:key="item.uid"
:label="item.realName"
:value="item.uid">
</el-option>
</el-select>
</div>
<div class="sign-up-table">
<el-table
:data="detail.members"
size="small"
@selection-change="selectionMemberChange"
style="width: 100%;">
<el-table-column type="selection" width="55" />
<el-table-column label="会员姓名" prop="nickname"></el-table-column>
<el-table-column label="手机号" prop="phone"></el-table-column>
<el-table-column label="等级" prop="level"></el-table-column>
</el-table>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="detailDialog = false">取消</el-button>
<el-button
type="primary"
@click="submitDialog"
>确认</el-button>
</div>
</el-dialog>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudCourseSMaster from "@/api/CourseSMaster";
import CRUD, { presenter, header, form, crud } from "@crud/crud";
import rrOperation from "@crud/RR.operation";
import crudOperation from "@crud/CRUD.operation";
import udOperation from "@crud/UD.operation";
import pagination from "@crud/Pagination";
import MaterialList from "@/components/material";
import picUpload from '@/components/pic-upload'
// crudpresenter
const defaultCrud = CRUD({
title: "课程讲师",
url: "api/member/listMembers",
sort: "uid,desc",
params :{ isPromoter:1 },
crudMethod: { ...crudCourseSMaster },
});
const defaultForm = {
id: null,
name: null,
photoPath: null,
introduction: null,
createTime: null,
updateTime: null,
isDel: null,
arrangeNum: null,
finishedNum: null,
};
export default {
name: "CourseSMaster",
components: {
pagination,
crudOperation,
rrOperation,
udOperation,
MaterialList,
picUpload
},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() {
return {
permission: {
add: ["admin", "CourseMaster:add"],
edit: ["admin", "CourseMaster:edit"],
del: ["admin", "CourseMaster:del"],
},
rules: {
photoPath: [
{ required: true, message: "照片路径不能为空", trigger: "blur" },
]
},
detailDialog:false,
detail:{},
memberData:[],
selectionMember:[],
masterId:'',
};
},
watch: {},
methods: {
beforeInit() {
this.url = 'api/CourseSMaster'
const sort = 'uid,desc'
this.params = { page: this.page, size: this.size, sort: sort,isPromoter:1 }
const query = this.query
const type = query.type
const value = query.value
if (type && value) { this.params[type] = value }
return true
},
//
[CRUD.HOOK.beforeRefresh]() {
return true;
}, //
[CRUD.HOOK.afterToCU](crud, form) {},
showDetail(row){
this.detail = row;
console.log(this.detail)
this.detailDialog = true;
},
showDialog(){
},
selectionMemberChange(val){
console.log(val)
this.selectionMember = val;
},
submitDialog(){
if(this.selectionMember.length > 0 && this.masterId != ''){
var memberIds = [];
this.selectionMember.forEach((item)=>{
memberIds.push(item.uid)
})
console.log(memberIds)
this.$confirm('是否确认将会员转移?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = {
sellerId: this.masterId,
membersId: memberIds
}
crudCourseSMaster.moveMembers(data).then((res)=>{
console.log(res)
if(res){
this.detailDialog = false;
this.crud.refresh()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
},
},
};
</script>
<style scoped>
.table-img {
display: inline-block;
text-align: center;
background: #ccc;
color: #fff;
white-space: nowrap;
position: relative;
overflow: hidden;
vertical-align: middle;
width: 32px;
height: 32px;
line-height: 32px;
}
.detail-box{
width: 100%;
font-size: 16px;
padding: 24px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.18);
border-radius: 12px;
}
.el-row{
margin: 24px 0;
}
.title-w{
font-size:19px;
font-weight: bold;
margin: 32px 0;
color: #000;
display: flex;
justify-content: space-between;
}
</style>

351
src/views/system/menu/index.vue

@ -4,10 +4,18 @@
<div class="head-container"> <div class="head-container">
<div v-if="crud.props.searchToggle"> <div v-if="crud.props.searchToggle">
<!-- 搜索 --> <!-- 搜索 -->
<el-input v-model="query.blurry" clearable size="small" placeholder="模糊搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" /> <el-input
v-model="query.blurry"
clearable
size="small"
placeholder="模糊搜索"
style="width: 200px"
class="filter-item"
@keyup.enter.native="toQuery"
/>
<el-date-picker <el-date-picker
v-model="query.createTime" v-model="query.createTime"
:default-time="['00:00:00','23:59:59']" :default-time="['00:00:00', '23:59:59']"
type="daterange" type="daterange"
range-separator=":" range-separator=":"
size="small" size="small"
@ -21,8 +29,22 @@
<crudOperation :permission="permission" /> <crudOperation :permission="permission" />
</div> </div>
<!--表单渲染--> <!--表单渲染-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="580px"> <el-dialog
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px"> append-to-body
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="580px"
>
<el-form
ref="form"
:inline="true"
:model="form"
:rules="rules"
size="small"
label-width="80px"
>
<el-form-item label="菜单类型" prop="type"> <el-form-item label="菜单类型" prop="type">
<el-radio-group v-model="form.type" size="mini" style="width: 178px"> <el-radio-group v-model="form.type" size="mini" style="width: 178px">
<el-radio-button label="0">目录</el-radio-button> <el-radio-button label="0">目录</el-radio-button>
@ -30,7 +52,11 @@
<el-radio-button label="2">按钮</el-radio-button> <el-radio-button label="2">按钮</el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单图标" prop="icon"> <el-form-item
v-show="form.type.toString() !== '2'"
label="菜单图标"
prop="icon"
>
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
width="450" width="450"
@ -38,101 +64,259 @@
@show="$refs['iconSelect'].reset()" @show="$refs['iconSelect'].reset()"
> >
<IconSelect ref="iconSelect" @selected="selected" /> <IconSelect ref="iconSelect" @selected="selected" />
<el-input slot="reference" v-model="form.icon" style="width: 450px;" placeholder="点击选择图标" readonly> <el-input
<svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" class="el-input__icon" style="height: 32px;width: 16px;" /> slot="reference"
v-model="form.icon"
style="width: 450px"
placeholder="点击选择图标"
readonly
>
<svg-icon
v-if="form.icon"
slot="prefix"
:icon-class="form.icon"
class="el-input__icon"
style="height: 32px; width: 16px"
/>
<i v-else slot="prefix" class="el-icon-search el-input__icon" /> <i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input> </el-input>
</el-popover> </el-popover>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="外链菜单" prop="iframe"> <el-form-item
v-show="form.type.toString() !== '2'"
label="外链菜单"
prop="iframe"
>
<el-radio-group v-model="form.iframe" size="mini"> <el-radio-group v-model="form.iframe" size="mini">
<el-radio-button label="true"></el-radio-button> <el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button> <el-radio-button label="false"></el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() === '1'" label="菜单缓存" prop="cache"> <el-form-item
v-show="form.type.toString() === '1'"
label="菜单缓存"
prop="cache"
>
<el-radio-group v-model="form.cache" size="mini"> <el-radio-group v-model="form.cache" size="mini">
<el-radio-button label="true"></el-radio-button> <el-radio-button label="true"></el-radio-button>
<el-radio-button label="false"></el-radio-button> <el-radio-button label="false"></el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单可见" prop="hidden"> <el-form-item
v-show="form.type.toString() !== '2'"
label="菜单可见"
prop="hidden"
>
<el-radio-group v-model="form.hidden" size="mini"> <el-radio-group v-model="form.hidden" size="mini">
<el-radio-button label="false"></el-radio-button> <el-radio-button label="false"></el-radio-button>
<el-radio-button label="true"></el-radio-button> <el-radio-button label="true"></el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() !== '2'" label="菜单标题" prop="name"> <el-form-item
<el-input v-model="form.name" :style=" form.type.toString() === '0' ? 'width: 450px' : 'width: 178px'" placeholder="菜单标题" /> v-show="form.type.toString() !== '2'"
label="菜单标题"
prop="name"
>
<el-input
v-model="form.name"
:style="
form.type.toString() === '0' ? 'width: 450px' : 'width: 178px'
"
placeholder="菜单标题"
/>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() === '2'" label="按钮名称" prop="name"> <el-form-item
<el-input v-model="form.name" placeholder="按钮名称" style="width: 178px;" /> v-show="form.type.toString() === '2'"
label="按钮名称"
prop="name"
>
<el-input
v-model="form.name"
placeholder="按钮名称"
style="width: 178px"
/>
</el-form-item> </el-form-item>
<el-form-item v-show="form.type.toString() !== '0'" label="权限标识" prop="permission"> <el-form-item
<el-input v-model="form.permission" :disabled="form.iframe" placeholder="权限标识" style="width: 178px;" /> v-show="form.type.toString() !== '0'"
label="权限标识"
prop="permission"
>
<el-input
v-model="form.permission"
:disabled="form.iframe"
placeholder="权限标识"
style="width: 178px"
/>
</el-form-item> </el-form-item>
<el-form-item v-if="form.type.toString() !== '2'" label="路由地址" prop="path"> <el-form-item
<el-input v-model="form.path" placeholder="路由地址" style="width: 178px;" /> v-if="form.type.toString() !== '2'"
label="路由地址"
prop="path"
>
<el-input
v-model="form.path"
placeholder="路由地址"
style="width: 178px"
/>
</el-form-item> </el-form-item>
<el-form-item label="菜单排序" prop="sort"> <el-form-item label="菜单排序" prop="sort">
<el-input-number v-model.number="form.sort" :min="0" :max="999" controls-position="right" style="width: 178px;" /> <el-input-number
v-model.number="form.sort"
:min="0"
:max="999"
controls-position="right"
style="width: 178px"
/>
</el-form-item> </el-form-item>
<el-form-item v-show="!form.iframe && form.type.toString() === '1'" label="组件名称" prop="componentName"> <el-form-item
<el-input v-model="form.componentName" style="width: 178px;" placeholder="匹配组件内Name字段" /> v-show="!form.iframe && form.type.toString() === '1'"
label="组件名称"
prop="componentName"
>
<el-input
v-model="form.componentName"
style="width: 178px"
placeholder="匹配组件内Name字段"
/>
</el-form-item> </el-form-item>
<el-form-item v-show="!form.iframe && form.type.toString() === '1'" label="组件路径" prop="component"> <el-form-item
<el-input v-model="form.component" style="width: 178px;" placeholder="组件路径" /> v-show="!form.iframe && form.type.toString() === '1'"
label="组件路径"
prop="component"
>
<el-input
v-model="form.component"
style="width: 178px"
placeholder="组件路径"
/>
</el-form-item> </el-form-item>
<el-form-item label="上级类目" prop="pid"> <el-form-item label="上级类目" prop="pid">
<treeselect v-model="form.pid" :options="menus" style="width: 450px;" placeholder="选择上级类目" /> <treeselect
v-model="form.pid"
:options="menus"
style="width: 450px"
placeholder="选择上级类目"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button> <el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> <el-button
:loading="crud.cu === 2"
type="primary"
@click="crud.submitCU"
>确认</el-button
>
</div> </div>
</el-dialog> </el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" row-key="id" @select="crud.selectChange" @select-all="crud.selectAllChange" @selection-change="crud.selectionChangeHandler"> <el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
row-key="id"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column v-if="columns.visible('name')" :show-overflow-tooltip="true" label="菜单名称" width="125px" prop="name" /> <el-table-column
<el-table-column v-if="columns.visible('icon')" prop="icon" label="图标" align="center" width="60px"> v-if="columns.visible('name')"
:show-overflow-tooltip="true"
label="菜单名称"
width="125px"
prop="name"
/>
<el-table-column
v-if="columns.visible('icon')"
prop="icon"
label="图标"
align="center"
width="60px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon" /> <svg-icon :icon-class="scope.row.icon" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('sort')" prop="sort" align="center" label="排序"> <el-table-column
v-if="columns.visible('sort')"
prop="sort"
align="center"
label="排序"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.sort }} {{ scope.row.sort }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('path')" :show-overflow-tooltip="true" prop="path" label="路由地址" /> <el-table-column
<el-table-column v-if="columns.visible('permission')" :show-overflow-tooltip="true" prop="permission" label="权限标识" /> v-if="columns.visible('path')"
<el-table-column v-if="columns.visible('component')" :show-overflow-tooltip="true" prop="component" label="组件路径" /> :show-overflow-tooltip="true"
<el-table-column v-if="columns.visible('iframe')" prop="iframe" label="外链" width="75px"> prop="path"
label="路由地址"
/>
<el-table-column
v-if="columns.visible('permission')"
:show-overflow-tooltip="true"
prop="permission"
label="权限标识"
/>
<el-table-column
v-if="columns.visible('component')"
:show-overflow-tooltip="true"
prop="component"
label="组件路径"
/>
<el-table-column
v-if="columns.visible('iframe')"
prop="iframe"
label="外链"
width="75px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.iframe"></span> <span v-if="scope.row.iframe"></span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('cache')" prop="cache" label="缓存" width="75px"> <el-table-column
v-if="columns.visible('cache')"
prop="cache"
label="缓存"
width="75px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.cache"></span> <span v-if="scope.row.cache"></span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('hidden')" prop="hidden" label="可见" width="75px"> <el-table-column
v-if="columns.visible('hidden')"
prop="hidden"
label="可见"
width="75px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.hidden"></span> <span v-if="scope.row.hidden"></span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('createTime')" prop="createTime" label="创建日期" width="135px"> <el-table-column
v-if="columns.visible('createTime')"
prop="createTime"
label="创建日期"
width="135px"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-permission="['admin','menu:edit','menu:del']" label="操作" width="130px" align="center" fixed="right"> <el-table-column
v-permission="['admin', 'menu:edit', 'menu:del']"
label="操作"
width="130px"
align="center"
fixed="right"
>
<template slot-scope="scope"> <template slot-scope="scope">
<udOperation <udOperation
:data="scope.row" :data="scope.row"
@ -146,60 +330,81 @@
</template> </template>
<script> <script>
import crudMenu from '@/api/system/menu' import crudMenu from "@/api/system/menu";
import IconSelect from '@/components/IconSelect' import IconSelect from "@/components/IconSelect";
import Treeselect from '@riophae/vue-treeselect' import Treeselect from "@riophae/vue-treeselect";
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import CRUD, { presenter, header, form, crud } from '@crud/crud' import CRUD, { presenter, header, form, crud } from "@crud/crud";
import rrOperation from '@crud/RR.operation' import rrOperation from "@crud/RR.operation";
import crudOperation from '@crud/CRUD.operation' import crudOperation from "@crud/CRUD.operation";
import udOperation from '@crud/UD.operation' import udOperation from "@crud/UD.operation";
// crudpresenter // crudpresenter
const defaultCrud = CRUD({ title: '菜单', url: 'api/menus', crudMethod: { ...crudMenu }}) const defaultCrud = CRUD({
const defaultForm = { id: null, name: null, sort: 999, path: null, component: null, componentName: null, iframe: false, roles: [], pid: 0, icon: null, cache: false, hidden: false, type: 0, permission: null } title: "菜单",
url: "api/menus",
crudMethod: { ...crudMenu },
});
const defaultForm = {
id: null,
name: null,
sort: 999,
path: null,
component: null,
componentName: null,
iframe: false,
roles: [],
pid: 0,
icon: null,
cache: false,
hidden: false,
type: 0,
permission: null,
};
export default { export default {
name: 'Menu', name: "Menu",
components: { Treeselect, IconSelect, crudOperation, rrOperation, udOperation }, components: {
Treeselect,
IconSelect,
crudOperation,
rrOperation,
udOperation,
},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() { data() {
return { return {
menus: [], menus: [],
permission: { permission: {
add: ['admin', 'menu:add'], add: ["admin", "menu:add"],
edit: ['admin', 'menu:edit'], edit: ["admin", "menu:edit"],
del: ['admin', 'menu:del'] del: ["admin", "menu:del"],
}, },
rules: { rules: {
name: [ name: [{ required: true, message: "请输入名称", trigger: "blur" }],
{ required: true, message: '请输入名称', trigger: 'blur' } path: [{ required: true, message: "请输入地址", trigger: "blur" }],
], },
path: [ };
{ required: true, message: '请输入地址', trigger: 'blur' }
]
}
}
}, },
methods: { methods: {
// //
[CRUD.HOOK.afterToCU](crud, form) { [CRUD.HOOK.afterToCU](crud, form) {
crudMenu.getMenusTree().then(res => { crudMenu.getMenusTree().then((res) => {
this.menus = [] this.menus = [];
const menu = { id: 0, label: '顶级类目', children: [] } const menu = { id: 0, label: "顶级类目", children: [] };
menu.children = res menu.children = res;
this.menus.push(menu) this.menus.push(menu);
}) });
}, },
// //
selected(name) { selected(name) {
this.form.icon = name this.form.icon = name;
} },
} },
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
/deep/ .el-input-number .el-input__inner { /deep/ .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
</style> </style>

19
src/views/wechat/article/form.vue

@ -1,6 +1,19 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="收费类型" prop="chargeType">
<el-radio-group v-model="form.chargeType">
<el-radio :label="0">免费</el-radio>
<el-radio :label="1">收费</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="文章费用" prop="courseCharge" v-if="form.chargeType == 1">
<el-input v-model="form.articleCharge" onkeyup="value=value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,'')"
maxlength="6" style="width: 370px;" />
</el-form-item>
<el-form-item label="文章等级">
<el-input-number v-model="form.level" :min="1" label="文章等级"></el-input-number>
</el-form-item>
<el-form-item label="标题"> <el-form-item label="标题">
<el-input v-model="form.title" style="width: 370px;" /> <el-input v-model="form.title" style="width: 370px;" />
</el-form-item> </el-form-item>
@ -50,6 +63,9 @@ export default {
form: { form: {
id: '', id: '',
cid: '', cid: '',
chargeType:0,
articleCharge:'',
level:'',
title: '', title: '',
author: '', author: '',
imageInput: '', imageInput: '',
@ -177,6 +193,9 @@ export default {
this.form = { this.form = {
id: '', id: '',
cid: '', cid: '',
chargeType:0,
articleCharge:'',
level:'',
title: '', title: '',
author: '', author: '',
imageInput: '', imageInput: '',

1
src/views/wechat/article/index.vue

@ -158,6 +158,7 @@ export default {
_this.form = { _this.form = {
id: data.id, id: data.id,
cid: data.cid, cid: data.cid,
title: data.level,
title: data.title, title: data.title,
author: data.author, author: data.author,
imageInput: data.imageInput, imageInput: data.imageInput,

1
vue.config.js

@ -22,6 +22,7 @@ module.exports = {
warnings: false, warnings: false,
errors: true errors: true
}, },
disableHostCheck:true,
proxy: { proxy: {
'/api': { '/api': {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,

Loading…
Cancel
Save