Commit 7601d90b authored by 黄奎's avatar 黄奎

页面修改

parent e1b0ccd6
...@@ -38,8 +38,12 @@ ...@@ -38,8 +38,12 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
//返回类型 //默认选中值
id: [String, Array], defaultArray: {
type: Array,
required: true,
},
//节点Key //节点Key
nodeKey: { nodeKey: {
type: String, type: String,
...@@ -90,20 +94,25 @@ ...@@ -90,20 +94,25 @@
this.chooseArray = [lastItem]; this.chooseArray = [lastItem];
} }
this.setTreeCheckNode() this.setTreeCheckNode()
}
}, },
mounted() { defaultArray(val) {
// 把传进来的参数转成数组处理 if (val) {
if (this.id) { if (this.defaultArray && Array.isArray(this.defaultArray) && this.defaultArray.length > 0) {
if (this.multiple && Array.isArray(this.id)) { this.defaultArray.forEach(item => {
this.chooseArray = this.id if (item != '') {
if (this.multiple) {
this.chooseArray.push(item)
} else { } else {
if (this.id != '') { this.chooseArray = [item];
this.chooseArray.push(this.id)
} }
} }
})
} }
this.setTreeCheckNode(); this.setTreeCheckNode();
}
}
},
mounted() {
}, },
methods: { methods: {
//全选 //全选
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
class="col-6 q-pr-lg q-pb-lg" label="课程名称" :rules="[val => !!val || '请填写课程名称']" /> class="col-6 q-pr-lg q-pb-lg" label="课程名称" :rules="[val => !!val || '请填写课程名称']" />
<div class="col-6 q-pr-lg q-pb-lg"> <div class="col-6 q-pr-lg q-pb-lg">
<selectTree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList' <selectTree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList'
:id.sync="returnString" nodeKey="CateId" :multiple="false" labelKey="CateName" childrenKey="ChildList" :defaultArray="defaultArray" nodeKey="CateId" :multiple="false" labelKey="CateName"
tipText="课程分类" @getChild="getChild"></selectTree> childrenKey="ChildList" tipText="课程分类" @getChild="getChild"></selectTree>
</div> </div>
<div class="col-6 q-pb-lg upload-assiatant-box"> <div class="col-6 q-pb-lg upload-assiatant-box">
<q-uploader :style="{backgroundImage:'url(' + objOption.CoverImg + ')'}" flat hide-upload-btn max-files="1" <q-uploader :style="{backgroundImage:'url(' + objOption.CoverImg + ')'}" flat hide-upload-btn max-files="1"
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
</div> </div>
<div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍 <div class="text-caption q-my-md q-px-xs text-grey-6">课程介绍
</div> </div>
<q-editor :toolbar="toolbar" :fonts="fonts" v-model="objOption.CourseIntro" class="col-12" <editor :defaultMsg="objOption.CourseIntro" classStr="col-12"></editor>
:definitions="{bold: {label: 'Bold', icon: null, tip: 'My bold tooltip'}}" />
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
...@@ -42,15 +41,15 @@ ...@@ -42,15 +41,15 @@
queryCourseInfo, queryCourseInfo,
} from '../../api/course/index' } from '../../api/course/index'
import { import {
getToolBarConfig,
getFontConfig,
uploadConfig, uploadConfig,
UploadSelfFile UploadSelfFile
} from '../../api/common/common' } from '../../api/common/common'
import selectTree from '../common/select-tree' import selectTree from '../common/select-tree'
import editor from '../common/editor'
export default { export default {
components: { components: {
selectTree selectTree,
editor,
}, },
props: { props: {
saveObj: { saveObj: {
...@@ -69,86 +68,16 @@ ...@@ -69,86 +68,16 @@
CateId: 0, //课程编号 CateId: 0, //课程编号
}, },
optionTitle: "", optionTitle: "",
returnString: "", defaultArray: [],
saveCourseLoading: false, saveCourseLoading: false,
TreeCategoryList: [], //课程分类树形列表 TreeCategoryList: [], //课程分类树形列表
toolbar: [],
fonts: {},
} }
}, },
mounted() { mounted() {
this.initToolBar();
this.getCategorytree(); this.getCategorytree();
this.initObj() this.initObj()
}, },
methods: { methods: {
initToolBar() {
this.toolbar = [
[{
label: '对齐',
icon: this.$q.iconSet.editor.align,
fixedLabel: true,
list: 'only-icons',
options: ['left', 'center', 'right', 'justify']
}],
['bold', 'italic', 'strike', 'underline', 'subscript', 'superscript'],
[{
label: '格式',
icon: this.$q.iconSet.editor.formatting,
list: 'no-icons',
fixedLabel: true,
fixedIcon: true,
options: [
'p',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'code'
]
},
{
label: '字号',
icon: this.$q.iconSet.editor.fontSize,
fixedLabel: true,
fixedIcon: true,
list: 'no-icons',
options: [
'size-1',
'size-2',
'size-3',
'size-4',
'size-5',
'size-6',
'size-7'
]
},
{
label: '字体',
icon: this.$q.iconSet.editor.font,
fixedLabel: true,
fixedIcon: true,
list: 'no-icons',
options: [
'default_font',
'arial',
'arial_black',
'comic_sans',
'courier_new',
'impact',
'lucida_grande',
'times_new_roman',
'verdana'
]
},
'removeFormat'
],
['ordered', 'outdent', 'indent'],
];
this.fonts = getFontConfig();
},
getChild(obj) { getChild(obj) {
this.objOption.CateId = obj; this.objOption.CateId = obj;
}, },
...@@ -168,6 +97,7 @@ ...@@ -168,6 +97,7 @@
}, },
//初始化表单 //初始化表单
initObj() { initObj() {
this.defaultArray = [];
if (this.saveObj && this.saveObj.CourseId > 0) { if (this.saveObj && this.saveObj.CourseId > 0) {
queryCourseInfo({ queryCourseInfo({
CourseId: this.saveObj.CourseId CourseId: this.saveObj.CourseId
...@@ -177,7 +107,7 @@ ...@@ -177,7 +107,7 @@
this.objOption.CourseName = res.Data.CourseName; this.objOption.CourseName = res.Data.CourseName;
this.objOption.CourseIntro = res.Data.CourseIntro; this.objOption.CourseIntro = res.Data.CourseIntro;
this.objOption.CateId = res.Data.CateId; this.objOption.CateId = res.Data.CateId;
this.returnString = res.Data.CateId; this.defaultArray.push(res.Data.CateId);
}) })
this.optionTitle = "修改课程信息" this.optionTitle = "修改课程信息"
} else { } else {
......
...@@ -18,14 +18,9 @@ ...@@ -18,14 +18,9 @@
</div> </div>
<div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div> <div class="text-caption q-mb-lg q-px-md text-grey-6">权限设置</div>
<div class="row wrap"> <div class="row wrap">
<div class="q-pa-md q-gutter-sm"> <selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :defaultArray="returnString"
<q-tree :nodes="TreeMenuList" node-key="MenuId" label-key="MenuName" children-key="SubList" nodeKey="MenuId" :multiple="true" labelKey="MenuName" childrenKey="SubList" tipText="选择菜单"
tick-strategy="leaf-filtered" default-expand-all :ticked.sync="checkMenuArray" no-connectors> @getChild="getChild"></selectTree>
</q-tree>
</div>
<!-- <selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :id.sync="returnString"
nodeKey="MenuId" :multiple="false" labelKey="MenuName" childrenKey="SubList" tipText="课程分类"
@getChild="getChild"></selectTree> -->
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
...@@ -65,7 +60,7 @@ ...@@ -65,7 +60,7 @@
RoleAuth: "", //角色权限 RoleAuth: "", //角色权限
Status: 0, //状态(0-正常,1-禁用)}, Status: 0, //状态(0-正常,1-禁用)},
}, },
returnString: "", returnString: [],
optionTitle: "", optionTitle: "",
//菜单列表 //菜单列表
TreeMenuList: [], TreeMenuList: [],
...@@ -79,8 +74,17 @@ ...@@ -79,8 +74,17 @@
this.initObj() this.initObj()
}, },
methods: { methods: {
getChild(obj) { getChild(menuArray) {
console.log("obj", obj); var tempStr = "";
if (menuArray && Array.isArray(menuArray) && menuArray.length > 0) {
menuArray.forEach(item => {
tempStr += "," + item;
})
}
if (tempStr != '') {
tempStr = tempStr.substring(1, tempStr.length);
}
this.objOption.RoleAuth = tempStr;
}, },
//获取菜单列表 //获取菜单列表
queryMenuList() { queryMenuList() {
...@@ -92,6 +96,7 @@ ...@@ -92,6 +96,7 @@
}, },
//初始化表单 //初始化表单
initObj() { initObj() {
this.returnString = [];
if (this.saveObj && this.saveObj.RoleId > 0) { if (this.saveObj && this.saveObj.RoleId > 0) {
queryRoleInfo({ queryRoleInfo({
RoleId: this.saveObj.RoleId RoleId: this.saveObj.RoleId
...@@ -101,7 +106,7 @@ ...@@ -101,7 +106,7 @@
this.objOption.RoleIntro = res.Data.RoleIntro; this.objOption.RoleIntro = res.Data.RoleIntro;
this.objOption.RoleAuth = res.Data.RoleAuth; this.objOption.RoleAuth = res.Data.RoleAuth;
this.objOption.Status = res.Data.Status; this.objOption.Status = res.Data.Status;
this.checkMenuArray = res.Data.CheckMenuList; this.returnString = res.Data.CheckMenuList;
}) })
this.optionTitle = "修改角色信息" this.optionTitle = "修改角色信息"
} else { } else {
...@@ -120,16 +125,6 @@ ...@@ -120,16 +125,6 @@
}, },
//保存菜单 //保存菜单
saveRole() { saveRole() {
var tempKeys = "";
if (this.checkMenuArray && this.checkMenuArray.length > 0) {
this.checkMenuArray.forEach(item => {
tempKeys += "," + item;
})
}
if (tempKeys && tempKeys != '') {
tempKeys = tempKeys.substring(1, tempKeys.length);
}
this.objOption.RoleAuth = tempKeys;
this.saveLoading = true this.saveLoading = true
saveRoleInfo(this.objOption).then(res => { saveRoleInfo(this.objOption).then(res => {
this.saveLoading = false this.saveLoading = false
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</div> </div>
<div class="col-3"> <div class="col-3">
<select-tree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList' <select-tree v-if="TreeCategoryList&&TreeCategoryList.length>0" :treeData='TreeCategoryList'
:id.sync="returnString" nodeKey="CateId" :multiple="true" labelKey="CateName" childrenKey="ChildList" :defaultArray="returnString" nodeKey="CateId" :multiple="true" labelKey="CateName" childrenKey="ChildList"
tipText="课程分类" @getChild="getChild"></select-tree> tipText="课程分类" @getChild="getChild"></select-tree>
</div> </div>
<div class="col-3"> <div class="col-3">
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
}, },
//课程分类树形列表 //课程分类树形列表
TreeCategoryList: [], TreeCategoryList: [],
returnString: "", //返回字符串 returnString: [], //默认值
pageCount: 0, pageCount: 0,
isShowCourseForm: false, isShowCourseForm: false,
courseObjOption: null, courseObjOption: null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment