master
271556543@qq.com 3 years ago
parent 5d24744fba
commit f97b2709ca

@ -2,6 +2,6 @@
// Detail plugins list see https://www.tinymce.com/docs/plugins/ // Detail plugins list see https://www.tinymce.com/docs/plugins/
// Custom builds see https://www.tinymce.com/download/custom-builds/ // Custom builds see https://www.tinymce.com/download/custom-builds/
const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'] const plugins = ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount']
export default plugins export default plugins

@ -88,7 +88,7 @@
</template> </template>
</xy-table> </xy-table>
<orderLog :is-show.sync="isShowLog"></orderLog> <orderLog :is-show.sync="isShowLog" @refresh="getOrders"></orderLog>
</div> </div>
</template> </template>

@ -46,7 +46,7 @@
<template v-slot:content> <template v-slot:content>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
内容 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>内容
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<tinymce ref="tinymce" :height="200" v-model="form.content" id='tinymce'></tinymce> <tinymce ref="tinymce" :height="200" v-model="form.content" id='tinymce'></tinymce>
@ -56,7 +56,7 @@
<template v-slot:coverPicture> <template v-slot:coverPicture>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label"> <div class="xy-table-item-label">
封面图 <span style="color: red;font-weight: 600;padding-right: 4px;">*</span>封面图
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<div v-if="form.coverPicture" style="position: relative;"> <div v-if="form.coverPicture" style="position: relative;">
@ -113,7 +113,7 @@
<script> <script>
import {index as typeIndex} from "@/api/strategyType" import {index as typeIndex} from "@/api/strategyType"
import {store} from "@/api/strategy" import {store,save} from "@/api/strategy"
import {getparameter} from '@/api/system/dictionary' import {getparameter} from '@/api/system/dictionary'
import tinymce from "@/components/Tinymce" import tinymce from "@/components/Tinymce"
@ -129,6 +129,7 @@ export default {
id:'', id:'',
action:`${process.env.VUE_APP_BASE_API}api/admin/upload-file`, action:`${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
detail:{},
labels:[], labels:[],
strategyTypes:[], strategyTypes:[],
form:{ form:{
@ -147,6 +148,12 @@ export default {
], ],
strategyTypeId:[ strategyTypeId:[
{required:true,message:'请选择类型'} {required:true,message:'请选择类型'}
],
coverPicture:[
{required:true,message:'请上传封面图'}
],
content:[
{required:true,message:'请填写内容'}
] ]
} }
} }
@ -170,6 +177,19 @@ export default {
} }
}, },
getDetail(){
this.form = {
title:this.detail.title,
subheading:this.detail.subheading,
strategyTypeId:this.detail.strategy_types_id,
state:!!Number(this.detail.state),
coverPicture:this.detail.cover_picture,
sortNumber:this.detail.sort_number,
label:this.detail.label,
content:this.detail.content,
}
this.$refs['tinymce'].setContent(this.form.content)
},
async getLabel(){ async getLabel(){
const res = await getparameter({number:'strategyLabel'}) const res = await getparameter({number:'strategyLabel'})
this.labels = res.detail this.labels = res.detail
@ -197,6 +217,29 @@ export default {
type:'success', type:'success',
message:'新增攻略信息成功' message:'新增攻略信息成功'
}) })
this.$emit('refresh')
this.isShow = false
})
return
}
if(this.type === 'editor'){
save({
id:this.id,
strategy_types_id:this.form.strategyTypeId,
state:this.form.state ? 1 : 0,
sort_number:this.form.sortNumber,
title:this.form.title,
content:this.form.content,
subheading:this.form.subheading,
label:this.form.label.toString(),
cover_picture:this.form.coverPicture
}).then(res => {
Message({
type:'success',
message:'编辑攻略信息成功'
})
this.$emit('refresh')
this.isShow = false
}) })
} }
} }
@ -206,6 +249,9 @@ export default {
if(newVal){ if(newVal){
this.getStrategyTypes() this.getStrategyTypes()
this.getLabel() this.getLabel()
if(this.type === 'editor'){
this.getDetail()
}
}else{ }else{
this.id = '' this.id = ''
this.type = '' this.type = ''

@ -6,7 +6,7 @@
<slot> <slot>
<div> <div>
<Input style="width: 200px; margin-right: 10px" v-model="select.keywords" placeholder="关键字搜索" /> <Input style="width: 200px; margin-right: 10px" v-model="select.keywords" placeholder="关键字搜索" />
<Button type="primary"></Button> <Button type="primary" @click="getStrategies"></Button>
<Button type="primary" style="margin-left: 10px" @click="$refs['addStrategy'].type = 'add',$refs['addStrategy'].isShow = true">新增</Button> <Button type="primary" style="margin-left: 10px" @click="$refs['addStrategy'].type = 'add',$refs['addStrategy'].isShow = true">新增</Button>
</div> </div>
</slot> </slot>
@ -18,16 +18,20 @@
:list="list" :list="list"
:table-item="table" :table-item="table"
@pageSizeChange="e => select.pageSize = e" @pageSizeChange="e => select.pageSize = e"
@pageIndexChange="pageChange"></xy-table> @pageIndexChange="pageChange"
@editor="editorClick"
@delete="deleteStrategy"></xy-table>
<addStrategy ref="addStrategy"></addStrategy> <addStrategy ref="addStrategy" @refresh="getStrategies"></addStrategy>
</div> </div>
</template> </template>
<script> <script>
import {index} from '@/api/strategy' import {index,destroy} from '@/api/strategy'
import {parseTime,deepCopy} from '@/utils'
import addStrategy from './components/addStrategy' import addStrategy from './components/addStrategy'
import { Message } from 'element-ui'
export default { export default {
components:{ components:{
addStrategy addStrategy
@ -43,7 +47,38 @@ export default {
total:0, total:0,
list:[], list:[],
table:[ table:[
{
label:'攻略类型',
prop:'strategy_type.name',
width:160
},
{
label:'标题',
prop:'title',
align:'left',
width: 200
},
{
label:'副标题',
prop:'subheading',
align:'left',
width: 180
},
{
label:'状态',
width: 120,
customFn:(row)=>{
return (<div style={{'color':row.state == 1 ? 'green' : 'red'}}>{row.state == 1 ? '启动' : '未启用'}</div>)
}
},
{
label:'创建时间',
prop:'created_at',
minWidth:200,
formatter:(cell,value,data,index)=>{
return parseTime(new Date(data),'{y}-{m}-{d}')
}
}
] ]
} }
}, },
@ -54,11 +89,31 @@ export default {
page_size:this.select.pageSize, page_size:this.select.pageSize,
keyword:this.select.keywords keyword:this.select.keywords
}) })
console.log(res) this.total = res.total
this.list = res.rows
console.log(this.list)
}, },
pageChange(e){ pageChange(e){
this.select.pageIndex = e this.select.pageIndex = e
},
editorClick(row){
this.$refs['addStrategy'].detail = deepCopy(row)
this.$refs['addStrategy'].id = row.id
this.$refs['addStrategy'].type = 'editor'
this.$refs['addStrategy'].isShow = true
},
deleteStrategy(row){
destroy({
id:row.id
}).then(res => {
Message({
type:'success',
message:'删除攻略成功'
})
this.getStrategies()
})
} }
}, },
mounted() { mounted() {

Loading…
Cancel
Save