11 changed files with 533 additions and 30 deletions
@ -0,0 +1,106 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px"> |
||||||
|
<el-form-item label="关于我们"> |
||||||
|
<!-- <el-input v-model="form.site_url" style="width: 370px;" />--> |
||||||
|
<vue-ueditor-wrap v-model="form.aboutUs" :config="myConfig" @beforeInit="addCustomDialog" style="width: 90%;"></vue-ueditor-wrap> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label=""> |
||||||
|
<el-button type="primary" @click="doAdd">提交</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import checkPermission from '@/utils/permission' |
||||||
|
import initData from '@/mixins/crud' |
||||||
|
import { add, get } from '@/api/bxg/yxSystemConfig' |
||||||
|
import eForm from './form' |
||||||
|
import picUpload from '@/components/pic-upload' |
||||||
|
import VueUeditorWrap from 'vue-ueditor-wrap'; |
||||||
|
export default { |
||||||
|
components: { eForm, picUpload ,VueUeditorWrap}, |
||||||
|
mixins: [initData], |
||||||
|
data() { |
||||||
|
return { |
||||||
|
myConfig: { |
||||||
|
autoHeightEnabled: false, // 编辑器不自动被内容撑高 |
||||||
|
initialFrameHeight: 500, // 初始容器高度 |
||||||
|
initialFrameWidth: '100%', // 初始容器宽度 |
||||||
|
UEDITOR_HOME_URL: '/UEditor/', |
||||||
|
serverUrl: '' |
||||||
|
}, |
||||||
|
delLoading: false, |
||||||
|
form: { |
||||||
|
aboutUs:'', |
||||||
|
}, |
||||||
|
rules: { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
created() { |
||||||
|
get().then(rese => { |
||||||
|
const that = this; |
||||||
|
rese.content.map(function(key, value) { |
||||||
|
const keyName = key.menuName |
||||||
|
const newValue = key.value |
||||||
|
if(keyName in that.form){ |
||||||
|
that.form[keyName] = newValue |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
doAdd() { |
||||||
|
add(this.form).then(res => { |
||||||
|
this.$notify({ |
||||||
|
title: '添加成功', |
||||||
|
type: 'success', |
||||||
|
duration: 2500 |
||||||
|
}) |
||||||
|
this.loading = false |
||||||
|
this.$parent.init() |
||||||
|
}).catch(err => { |
||||||
|
this.loading = false |
||||||
|
console.log(err.response.data.message) |
||||||
|
}) |
||||||
|
}, |
||||||
|
// beforeInit() { |
||||||
|
// this.url = 'bxg/api/yxSystemGroupData' |
||||||
|
// const sort = 'id,desc' |
||||||
|
// this.params = { page: this.page, size: this.size, sort: sort, groupName: 'zsw_home_aboutUs' } |
||||||
|
// return true |
||||||
|
// }, |
||||||
|
addCustomDialog () { |
||||||
|
window.UE.registerUI('yshop', function (editor, uiName) { |
||||||
|
let dialog = new window.UE.ui.Dialog({ |
||||||
|
iframeUrl: '/yshop/materia/index', |
||||||
|
editor: editor, |
||||||
|
name: uiName, |
||||||
|
title: '上传图片', |
||||||
|
cssRules: 'width:1200px;height:500px;padding:20px;' |
||||||
|
}); |
||||||
|
this.dialog = dialog; |
||||||
|
|
||||||
|
var btn = new window.UE.ui.Button({ |
||||||
|
name: 'dialog-button', |
||||||
|
title: '上传图片', |
||||||
|
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`, |
||||||
|
onclick: function () { |
||||||
|
dialog.render(); |
||||||
|
dialog.open(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
return btn; |
||||||
|
}, 37); |
||||||
|
}, |
||||||
|
checkPermission, |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
|
||||||
|
</style> |
@ -0,0 +1,130 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<!--工具栏--> |
||||||
|
<div class="head-container"> |
||||||
|
<!-- 新增 --> |
||||||
|
<div style="display: inline-block;margin: 0px 2px;"> |
||||||
|
<el-button |
||||||
|
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE']" |
||||||
|
class="filter-item" |
||||||
|
size="mini" |
||||||
|
type="primary" |
||||||
|
icon="el-icon-plus" |
||||||
|
@click="add" |
||||||
|
>新增</el-button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!--表单组件--> |
||||||
|
<eForm ref="form" :is-add="isAdd" /> |
||||||
|
<!--表格渲染--> |
||||||
|
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;"> |
||||||
|
<el-table-column prop="id" label="ID" /> |
||||||
|
<el-table-column prop="map.problem" label="问题" /> |
||||||
|
<el-table-column prop="map.answer" label="答案" width="300" type="textarea" /> |
||||||
|
<el-table-column label="状态" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<div> |
||||||
|
<el-tag v-if="scope.row.status === 1" style="cursor: pointer" :type="''">显示</el-tag> |
||||||
|
<el-tag v-else style="cursor: pointer" :type=" 'info' ">不显示</el-tag> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column v-if="checkPermission(['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT','YXSYSTEMGROUPDATA_DELETE'])" label="操作" width="150px" align="center"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-button v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)" /> |
||||||
|
<el-popover |
||||||
|
:ref="scope.row.id" |
||||||
|
v-permission="['admin','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE']" |
||||||
|
placement="top" |
||||||
|
width="180" |
||||||
|
> |
||||||
|
<p>确定删除本条数据吗?</p> |
||||||
|
<div style="text-align: right; margin: 0"> |
||||||
|
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button> |
||||||
|
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button> |
||||||
|
</div> |
||||||
|
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini" /> |
||||||
|
</el-popover> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<!--分页组件--> |
||||||
|
<el-pagination |
||||||
|
:total="total" |
||||||
|
:current-page="page + 1" |
||||||
|
style="margin-top: 8px;" |
||||||
|
layout="total, prev, pager, next, sizes" |
||||||
|
@size-change="sizeChange" |
||||||
|
@current-change="pageChange" |
||||||
|
/> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import checkPermission from '@/utils/permission' |
||||||
|
import initData from '@/mixins/crud' |
||||||
|
import { del } from '@/api/bxg/yxSystemGroupData' |
||||||
|
import eForm from './problemform' |
||||||
|
export default { |
||||||
|
components: { eForm }, |
||||||
|
mixins: [initData], |
||||||
|
data() { |
||||||
|
return { |
||||||
|
delLoading: false |
||||||
|
} |
||||||
|
}, |
||||||
|
created() { |
||||||
|
this.$nextTick(() => { |
||||||
|
this.init() |
||||||
|
}) |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
checkPermission, |
||||||
|
beforeInit() { |
||||||
|
this.url = 'bxg/api/yxSystemGroupData' |
||||||
|
const sort = 'id,desc' |
||||||
|
this.params = { page: this.page, size: this.size, sort: sort, groupName: 'zsw_home_problem' } |
||||||
|
return true |
||||||
|
}, |
||||||
|
subDelete(id) { |
||||||
|
this.delLoading = true |
||||||
|
del(id).then(res => { |
||||||
|
this.delLoading = false |
||||||
|
this.$refs[id].doClose() |
||||||
|
this.dleChangePage() |
||||||
|
this.init() |
||||||
|
this.$notify({ |
||||||
|
title: '删除成功', |
||||||
|
type: 'success', |
||||||
|
duration: 2500 |
||||||
|
}) |
||||||
|
}).catch(err => { |
||||||
|
this.delLoading = false |
||||||
|
this.$refs[id].doClose() |
||||||
|
console.log(err.response.data.message) |
||||||
|
}) |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.isAdd = true |
||||||
|
this.$refs.form.dialog = true |
||||||
|
}, |
||||||
|
edit(data) { |
||||||
|
this.isAdd = false |
||||||
|
const _this = this.$refs.form |
||||||
|
_this.form = { |
||||||
|
id: data.id, |
||||||
|
groupName: data.groupName, |
||||||
|
problem: data.map.problem, |
||||||
|
answer: data.map.answer, |
||||||
|
sort: data.map.sort, |
||||||
|
status: data.map.status, |
||||||
|
} |
||||||
|
_this.dialog = true |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
|
||||||
|
</style> |
@ -0,0 +1,113 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px"> |
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px"> |
||||||
|
<el-form-item label="问题"> |
||||||
|
<el-input v-model="form.problem" style="width: 300px;" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="回答"> |
||||||
|
<el-input v-model="form.answer" style="width: 300px;" type="textarea" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="排序"> |
||||||
|
<el-input v-model="form.sort" style="width: 300px;" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label="是否显示"> |
||||||
|
<el-radio v-model="form.status" :label="1">是</el-radio> |
||||||
|
<el-radio v-model="form.status" :label="0" style="width: 200px;">否</el-radio> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div slot="footer" class="dialog-footer"> |
||||||
|
<!--<el-input v-model="form.groupName" />--> |
||||||
|
<el-button type="text" @click="cancel">取消</el-button> |
||||||
|
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { add, edit } from '@/api/bxg/yxSystemGroupData' |
||||||
|
import picUpload from '@/components/pic-upload' |
||||||
|
import MaterialList from '@/components/material' |
||||||
|
export default { |
||||||
|
components: { picUpload, MaterialList }, |
||||||
|
props: { |
||||||
|
isAdd: { |
||||||
|
type: Boolean, |
||||||
|
required: true |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
loading: false, dialog: false, |
||||||
|
form: { |
||||||
|
id: '', |
||||||
|
groupName: 'zsw_home_problem', |
||||||
|
problem: '', |
||||||
|
answer: '', |
||||||
|
sort: 0, |
||||||
|
status: 1, |
||||||
|
}, |
||||||
|
rules: { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
cancel() { |
||||||
|
this.resetForm() |
||||||
|
}, |
||||||
|
doSubmit() { |
||||||
|
this.loading = true |
||||||
|
if (this.isAdd) { |
||||||
|
this.doAdd() |
||||||
|
} else this.doEdit() |
||||||
|
}, |
||||||
|
doAdd() { |
||||||
|
add(this.form).then(res => { |
||||||
|
this.resetForm() |
||||||
|
this.$notify({ |
||||||
|
title: '添加成功', |
||||||
|
type: 'success', |
||||||
|
duration: 2500 |
||||||
|
}) |
||||||
|
this.loading = false |
||||||
|
this.$parent.init() |
||||||
|
}).catch(err => { |
||||||
|
this.loading = false |
||||||
|
console.log(err.response.data.message) |
||||||
|
}) |
||||||
|
}, |
||||||
|
doEdit() { |
||||||
|
edit(this.form).then(res => { |
||||||
|
this.resetForm() |
||||||
|
this.$notify({ |
||||||
|
title: '修改成功', |
||||||
|
type: 'success', |
||||||
|
duration: 2500 |
||||||
|
}) |
||||||
|
this.loading = false |
||||||
|
this.$parent.init() |
||||||
|
}).catch(err => { |
||||||
|
this.loading = false |
||||||
|
console.log(err.response.data.message) |
||||||
|
}) |
||||||
|
}, |
||||||
|
resetForm() { |
||||||
|
this.dialog = false |
||||||
|
this.$refs['form'].resetFields() |
||||||
|
this.form = { |
||||||
|
id: '', |
||||||
|
groupName: 'zsw_home_problem', |
||||||
|
problem: '', |
||||||
|
answer: '', |
||||||
|
sort: 0, |
||||||
|
status: 1, |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
|
||||||
|
</style> |
@ -0,0 +1,65 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px"> |
||||||
|
<el-form-item label="Webhook地址"> |
||||||
|
<el-input v-model="form.robotUrl" style="width: 800px;"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item label=""> |
||||||
|
<el-button type="primary" @click="doSubmit">提交</el-button> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
|
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import checkPermission from '@/utils/permission' |
||||||
|
import initData from '@/mixins/crud' |
||||||
|
import { del, add, get } from '@/api/bxg/yxSystemConfig' |
||||||
|
import eForm from './form' |
||||||
|
import picUpload from '@/components/pic-upload' |
||||||
|
import { Message } from 'element-ui' |
||||||
|
import fileUpload from '@/components/file-upload' |
||||||
|
export default { |
||||||
|
components: { eForm, picUpload, fileUpload }, |
||||||
|
mixins: [initData], |
||||||
|
data() { |
||||||
|
return { |
||||||
|
delLoading: false, |
||||||
|
form: { |
||||||
|
robotUrl:'' |
||||||
|
}, |
||||||
|
rules: { |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
created() { |
||||||
|
get().then(rese => { |
||||||
|
const that = this |
||||||
|
rese.content.map(function(key, value) { |
||||||
|
const keyName = key.menuName |
||||||
|
const newValue = key.value |
||||||
|
if(keyName in that.form){ |
||||||
|
that.form[keyName] = newValue |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
checkPermission, |
||||||
|
doSubmit() { |
||||||
|
add(this.form).then(res => { |
||||||
|
Message({ message: '设置成功', type: 'success' }) |
||||||
|
}).catch(err => { |
||||||
|
// this.loading = false |
||||||
|
console.log(err.response.data.message) |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped> |
||||||
|
|
||||||
|
</style> |
Loading…
Reference in new issue