Commit 1ed5406d by 王志慧

commit

1 parent 99f35003
...@@ -4,7 +4,8 @@ export default { ...@@ -4,7 +4,8 @@ export default {
state: { state: {
videoList: [], videoList: [],
topicDetail: {}, topicDetail: {},
merchantId:'' merchantId: '',
channelStyle: 1
}, },
mutations: { mutations: {
// 设置视频 // 设置视频
...@@ -15,10 +16,15 @@ export default { ...@@ -15,10 +16,15 @@ export default {
['SET_TOPIC_DETAIL'](state, payload) { ['SET_TOPIC_DETAIL'](state, payload) {
state.topicDetail = payload.topicDetail state.topicDetail = payload.topicDetail
}, },
// 设置门店id // 设置门店id
['SET_MERCHANT_ID'](state, payload) { ['SET_MERCHANT_ID'](state, payload) {
state.merchantId = payload.id state.merchantId = payload.id
} },
// 设置频道主题
['SET_CHANNEL_STYLE'](state, payload) {
console.log(payload)
state.channelStyle = payload.channelStyle
}
}, },
actions: { actions: {
// 获取视频列表 // 获取视频列表
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="channel-content gl-form-page"> <div class="channel-content gl-form-page">
<el-form ref="ruleForm" :model="channelForm" label-width="154px" :rules="rules"> <el-form ref="ruleForm" :model="channelForm" label-width="154px" :rules="rules">
<el-form-item label="频道名称:" prop="channelName"> <el-form-item label="频道名称:" prop="channelName">
<el-input v-model="channelForm.channelName" :disabled="true"></el-input> <el-input v-model="channelForm.channelName" :disabled="isDisabled"></el-input>
</el-form-item> </el-form-item>
<span v-if="channelForm.channelType == 1"> <span v-if="channelForm.channelType == 1">
<el-form-item label="频道主题:" prop="channelStyle"> <el-form-item label="频道主题:" prop="channelStyle">
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<el-col :span="11" class="theme dark"></el-col> <el-col :span="11" class="theme dark"></el-col>
</el-form-item> </el-form-item>
<el-form-item label="" prop="channelStyle"> <el-form-item label="" prop="channelStyle">
<el-radio-group v-model="channelForm.channelStyle"> <el-radio-group v-model="channelForm.channelStyle" @input="changeChannelStyle">
<el-radio :label="1"></el-radio> <el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio> <el-radio :label="2"></el-radio>
</el-radio-group> </el-radio-group>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</el-form-item> </el-form-item>
</span> </span>
<el-form-item label="频道banner:" prop="channelImg"> <el-form-item label="频道banner:" prop="channelImg">
<glsx-preview :picOptions="picOptions" :imageUrlArr="channelForm.channelImgImgArr" @change="changeChannelImg"></glsx-preview> <glsx-preview :picOptions="picOptions" :imageUrlArr="channelForm.channelImgArr" @change="changeChannelImg"></glsx-preview>
<div class="el-form-item__error" v-if="channelImgFlag">请上传频道banner</div> <div class="el-form-item__error" v-if="channelImgFlag">请上传频道banner</div>
</el-form-item> </el-form-item>
<div class="text-tip">建议尺寸:750*750</div> <div class="text-tip">建议尺寸:750*750</div>
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
</div> </div>
</div> </div>
<div class="add-container"> <div class="add-container">
<div class="title">{{this.channelForm.channelName}}分享配置</div> <div class="title">{{ this.channelForm.channelName }}分享配置</div>
<div class="channel-content gl-form-page"> <div class="channel-content gl-form-page">
<el-form ref="ruleForm" :model="channelForm" label-width="154px" :rules="rules"> <el-form ref="ruleForm" :model="channelForm" label-width="154px" :rules="rules">
<el-form-item label="频道分享预览图:" prop="publicityImg"> <el-form-item label="频道分享预览图:" prop="publicityImg">
<glsx-preview :picOptions="shareOptions" :imageUrlArr="channelForm.publicityImgImgArr" @change="changeChannelImg"></glsx-preview> <glsx-preview :picOptions="shareOptions" :imageUrlArr="channelForm.publicityImgArr" @change="changeChannelImg"></glsx-preview>
<!-- <div class="el-form-item__error" v-if="publicityImgFlag">请上传频道分享预览图</div> --> <!-- <div class="el-form-item__error" v-if="publicityImgFlag">请上传频道分享预览图</div> -->
</el-form-item> </el-form-item>
<div class="text-tip">建议尺寸:520*416</div> <div class="text-tip">建议尺寸:520*416</div>
...@@ -61,15 +61,17 @@ export default { ...@@ -61,15 +61,17 @@ export default {
data() { data() {
return { return {
loading: false, loading: false,
isDisabled: false,
id: this.$route.query.id ? this.$route.query.id : '', id: this.$route.query.id ? this.$route.query.id : '',
merchantChannelId: this.$route.query.merchantChannelId ? this.$route.query.merchantChannelId : '', merchantChannelId: this.$route.query.merchantChannelId ? this.$route.query.merchantChannelId : '',
channelForm: { channelForm: {
posterImgArr: [], posterImgArr: [],
publicityImgImgArr: [], publicityImgArr: [],
publicityImg: '', publicityImg: '',
channelImg: '', channelImg: '',
channelImgImgArr: [] channelImgArr: []
}, },
channelImgbgArr: ['banner1', 'banner2'],
channelImgFlag: false, channelImgFlag: false,
picOptions: { picOptions: {
width: '104px', width: '104px',
...@@ -90,9 +92,7 @@ export default { ...@@ -90,9 +92,7 @@ export default {
isClose: true isClose: true
}, },
rules: { rules: {
channelName: [ channelName: [{ required: true, message: '请输入频道名称', trigger: 'blur' }],
{ required: true, message: '请输入频道名称', trigger: 'blur' }
],
channelStyle: [{ required: true, message: '请选择频道主题', trigger: 'change' }], channelStyle: [{ required: true, message: '请选择频道主题', trigger: 'change' }],
publicityImg: [{ required: true, message: '请上传频道分享预览图', trigger: 'change' }], publicityImg: [{ required: true, message: '请上传频道分享预览图', trigger: 'change' }],
channelImg: [{ required: true, message: '请上传频道banner', trigger: 'change' }], channelImg: [{ required: true, message: '请上传频道banner', trigger: 'change' }],
...@@ -102,18 +102,30 @@ export default { ...@@ -102,18 +102,30 @@ export default {
}, },
created() { created() {
if (this.id || this.merchantChannelId) this.getChannelDetail() if (this.id || this.merchantChannelId) this.getChannelDetail()
this.isDisabled = this.id ? true : this.merchantChannelId ? false : true
}, },
methods: { methods: {
changeChannelStyle() {
this.diffChannelStyle()
},
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}.png`
},
diffChannelStyle() {
this.channelForm.channelImgArr = [this.commonImg(this.channelImgbgArr[this.channelForm.channelStyle - 1])]
this.channelForm.channelImg = this.commonImg(this.channelImgbgArr[this.channelForm.channelStyle - 1])
},
getChannelDetail() { getChannelDetail() {
let apis = this.id ? 'getChannelDetail' : this.merchantChannelId ? 'getMerchantChannelDetail' : '' let apis = this.id ? 'getChannelDetail' : this.merchantChannelId ? 'getMerchantChannelDetail' : ''
let params = {} let params = {}
this.id ? (params.id = this.id) : this.merchantChannelId ? (params.merchantChannelId = this.merchantChannelId) : '' this.id ? (params.id = this.id) : this.merchantChannelId ? (params.merchantChannelId = this.merchantChannelId) : ''
this.$apis.channel[apis](params).then(res => { this.$apis.channel[apis](params).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.channelForm = { ...res.data, posterImgArr: [], publicityImgImgArr: [], channelImgImgArr: [] } this.channelForm = { ...res.data, posterImgArr: [], publicityImgArr: [], channelImgArr: [] }
this.channelForm.posterImgArr.push(res.data.posterImg) //海报 this.channelForm.posterImgArr.push(res.data.posterImg) //海报
this.channelForm.publicityImgImgArr.push(res.data.publicityImg) //频道分享预览图 this.channelForm.publicityImgArr.push(res.data.publicityImg) //频道分享预览图
this.channelForm.channelImgImgArr.push(res.data.channelImg) //频道banner this.channelForm.channelImgArr.push(res.data.channelImg) //频道banner
// this.diffChannelStyle()
} }
}) })
}, },
...@@ -202,8 +214,8 @@ export default { ...@@ -202,8 +214,8 @@ export default {
background: #0a0e19; background: #0a0e19;
} }
.el-form-item__error { .el-form-item__error {
// margin-top: 25px; // margin-top: 25px;
// margin-bottom: 10px; // margin-bottom: 10px;
} }
.el-radio__input { .el-radio__input {
margin-top: -160px; margin-top: -160px;
......
...@@ -70,10 +70,10 @@ export default { ...@@ -70,10 +70,10 @@ export default {
pagePathType: '', pagePathType: '',
mediaUrl: '', mediaUrl: '',
activityDetails: '', activityDetails: '',
backgroundImgArr: ['https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/item_bg_icon_3.png'], backgroundImgArr: '',
mediaUrlArr: [], mediaUrlArr: [],
backgroundType: 1, backgroundType: 1,
backgroundImg: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/item_bg_icon_3.png' backgroundImg: ''
}, },
bgOptions: { bgOptions: {
width: '233px', width: '233px',
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
key: 'mediaUrl', key: 'mediaUrl',
isClose: true isClose: true
}, },
bgArr: ['single', 'meal', 'swell'],
rules: { rules: {
topicTitle: [ topicTitle: [
{ required: true, message: '请输入频道卡片主标题', trigger: 'blur' }, { required: true, message: '请输入频道卡片主标题', trigger: 'blur' },
...@@ -132,7 +133,6 @@ export default { ...@@ -132,7 +133,6 @@ export default {
itemType: 'goods', itemType: 'goods',
getInterfaceApi: this.$apis.store.goodsActivity, getInterfaceApi: this.$apis.store.goodsActivity,
params: { params: {
merchantId: '',
currentPage: 1 currentPage: 1
} }
} }
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.activityList[3].params.merchantId = this.merchantId this.diffChannelStyle()
}, },
computed: { computed: {
...mapState({ ...mapState({
...@@ -191,7 +191,18 @@ export default { ...@@ -191,7 +191,18 @@ export default {
...mapActions({ ...mapActions({
addChannelTopic: 'channel/addChannelTopic' addChannelTopic: 'channel/addChannelTopic'
}), }),
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}.png`
},
diffChannelStyle() {
if (this.channelType == 4) {
this.activityForm.backgroundType = 3
}
this.activityForm.backgroundImgArr = [this.commonImg(this.bgArr[this.activityForm.backgroundType - 1])]
this.activityForm.backgroundImg = this.commonImg(this.bgArr[this.activityForm.backgroundType - 1])
},
changeBackgroundType(val) { changeBackgroundType(val) {
this.diffChannelStyle()
this.activityForm.mediaUrlArr = [] this.activityForm.mediaUrlArr = []
this.activityForm.mediaUrl = '' this.activityForm.mediaUrl = ''
this.activityForm.activityDetails = '' this.activityForm.activityDetails = ''
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-radio :label="item.optionId" :key="index" v-for="(item, index) in topicStyleList">{{ item.optionLabel }}</el-radio> <el-radio :label="item.optionId" :key="index" v-for="(item, index) in topicStyleList">{{ item.optionLabel }}</el-radio>
</el-radio-group> </el-radio-group>
<div> <div>
<glsx-preview :picOptions="topicStyleOptions" limit="1" :imageUrlArr="topicDetail.channelStyle == 1 ? topicStyleArrFirst[editForm.topicStyle - 1] : topicStyleArrSecond[editForm.topicStyle - 1]"></glsx-preview> <glsx-preview :picOptions="topicStyleOptions" limit="1" :imageUrlArr="editForm.styleArr"></glsx-preview>
</div> </div>
</div> </div>
<!-- 卡片背景图 --> <!-- 卡片背景图 -->
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
</template> </template>
<script> <script>
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
const url = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/'
export default { export default {
data() { data() {
return { return {
...@@ -208,9 +209,9 @@ export default { ...@@ -208,9 +209,9 @@ export default {
dialogType: '', dialogType: '',
dialogSrc: '', dialogSrc: '',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
channelStyle: '',
currentPath: 0, currentPath: 0,
editForm: { editForm: {
styleArr: [],
productPrice: '', productPrice: '',
activityPrice: '', activityPrice: '',
activityDetails: '', activityDetails: '',
...@@ -241,8 +242,8 @@ export default { ...@@ -241,8 +242,8 @@ export default {
} }
] ]
}, },
topicStyleArrFirst: [[require('@/assets/channel/video-style-1.png')], [require('@/assets/channel/praise-style-1.png')], [require('@/assets/channel/theme-style-1.png')]], bgArr: ['video-bg', 'praise-bg', 'theme-bg'],
topicStyleArrSecond: [[require('@/assets/channel/video-style-2.png')], [require('@/assets/channel/praise-style-2.png')], [require('@/assets/channel/theme-style-2.png')]], topicStyleArr: ['video-style', 'praise-style', 'theme-style'],
topicStyleOptions: { topicStyleOptions: {
width: '188px', width: '188px',
height: ' 134px', height: ' 134px',
...@@ -431,11 +432,13 @@ export default { ...@@ -431,11 +432,13 @@ export default {
// this.getChannelDetail() // this.getChannelDetail()
this.initParams() this.initParams()
}, },
mounted() {
this.diffChannelStyle()
},
watch: { watch: {
topicDetail: { topicDetail: {
handler(data) { handler(data) {
// 编辑数据回显 // 编辑数据回显
console.log(data, '1111111')
let data1 = this.$common.utils.deepClone(data) let data1 = this.$common.utils.deepClone(data)
let contentList = [] let contentList = []
let publicPraiseArr = [] let publicPraiseArr = []
...@@ -481,8 +484,8 @@ export default { ...@@ -481,8 +484,8 @@ export default {
this.editForm.productPrice = this.editForm.activityDetails.contentPrice this.editForm.productPrice = this.editForm.activityDetails.contentPrice
this.editForm.activityPrice = this.editForm.activityDetails.activityPrice this.editForm.activityPrice = this.editForm.activityDetails.activityPrice
this.isFlag = true this.isFlag = true
console.log(this.editForm)
this.initParams() this.initParams()
this.diffChannelStyle()
} }
}, },
immediate: true, immediate: true,
...@@ -493,13 +496,22 @@ export default { ...@@ -493,13 +496,22 @@ export default {
...mapState({ ...mapState({
topicDetail: state => state.channel.topicDetail, topicDetail: state => state.channel.topicDetail,
merchantId: state => state.channel.merchantId, merchantId: state => state.channel.merchantId,
videoList: state => state.channel.videoList videoList: state => state.channel.videoList,
channelStyle: state => state.channel.channelStyle
}) })
}, },
methods: { methods: {
...mapActions({ ...mapActions({
addChannelTopic: 'channel/addChannelTopic' addChannelTopic: 'channel/addChannelTopic'
}), }),
diffChannelStyle() {
this.editForm.backgroundImgArr = [this.commonImg(this.bgArr[this.editForm.topicStyle - 1])]
this.editForm.backgroundImg = this.commonImg(this.bgArr[this.editForm.topicStyle - 1])
this.editForm.styleArr = [this.commonImg(this.topicStyleArr[this.editForm.topicStyle - 1])]
},
commonImg(name) {
return `https://img02.glsx.com.cn/weapp/resource/miniprogram/glsx/discover/${name}${this.channelStyle}.png`
},
handleDelePraise(index) { handleDelePraise(index) {
this.editForm.contentList[0].publicPraise.splice(index, 1) this.editForm.contentList[0].publicPraise.splice(index, 1)
}, },
...@@ -508,18 +520,24 @@ export default { ...@@ -508,18 +520,24 @@ export default {
}, },
//上传类型 //上传类型
changeMediaType(val) { changeMediaType(val) {
if (val == 2) { this.editForm.contentList = [
this.editForm.mediaCoverArr = [] {
this.editForm.mediaName = '' mediaType: '',
this.editForm.mediaCover = '' mediaUrl: '',
this.editForm.mediaUrl = '' mediaCover: '',
this.editForm.promotion = '' pagePathContent: '',
this.editForm.mediaId = '' pagePathType: '1',
} else { promotion: '',
this.editForm.mediaCover = '' activityDetails: '',
this.editForm.promotion = '' mediaCoverArr: [],
this.editForm.mediaUrlArr = [] mediaUrlArr: [],
} buttonRegistration: '立即参加', //报名按钮
publicPraise: [{ value: '' }],
contentName: '',
contentPrice: '',
contentImage: ''
}
]
}, },
handleSave() { handleSave() {
console.log(this.editForm) console.log(this.editForm)
...@@ -574,10 +592,9 @@ export default { ...@@ -574,10 +592,9 @@ export default {
publicPraiseArr = this.editForm.contentList[0].publicPraise.map(item => { publicPraiseArr = this.editForm.contentList[0].publicPraise.map(item => {
return item.value return item.value
}) })
this.editForm.contentList.forEach(item => { this.editForm.contentList.forEach(item => {
//上传类型为图片 //上传类型为图片
if (item.mediaType) { if (this.editForm.mediaType == 2) {
item.mediaUrlArr.forEach(pic => { item.mediaUrlArr.forEach(pic => {
mediaList.push({ mediaList.push({
mediaType: 2, mediaType: 2,
...@@ -585,6 +602,7 @@ export default { ...@@ -585,6 +602,7 @@ export default {
}) })
}) })
} else { } else {
mediaList = []
//视频 //视频
mediaList.push({ mediaType: this.editForm.mediaType, mediaName: item.mediaName, mediaUrl: item.mediaUrl, mediaCover: item.mediaCover }) mediaList.push({ mediaType: this.editForm.mediaType, mediaName: item.mediaName, mediaUrl: item.mediaUrl, mediaCover: item.mediaCover })
} }
...@@ -615,7 +633,7 @@ export default { ...@@ -615,7 +633,7 @@ export default {
success: res => { success: res => {
if (res.code == 0) { if (res.code == 0) {
this.loading = false this.loading = false
this.$router.go(-1) this.$router.go(-1)
} }
this.$message({ this.$message({
...@@ -704,6 +722,7 @@ export default { ...@@ -704,6 +722,7 @@ export default {
} }
}, },
changeTopicStyle() { changeTopicStyle() {
this.diffChannelStyle()
this.editForm.contentList = [ this.editForm.contentList = [
{ {
mediaType: '', mediaType: '',
...@@ -892,5 +911,4 @@ export default { ...@@ -892,5 +911,4 @@ export default {
width: 100%; width: 100%;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
<template v-else> <template v-else>
<el-button type="text" v-if="scope.scope.status == 1" @click="handleTop(scope.scope)">置顶</el-button> <el-button type="text" v-if="scope.scope.status == 1" @click="handleTop(scope.scope)">置顶</el-button>
<el-button type="text" @click="handleAddContent(scope.scope)">编辑</el-button> <el-button type="text" @click="handleAddContent(scope.scope)">编辑</el-button>
<el-button type="text" v-if="scope.scope.status == 1" @click="handleOut(scope.scope,'下架')">下架</el-button> <el-button type="text" v-if="scope.scope.status == 1" @click="handleOut(scope.scope, '下架')">下架</el-button>
<el-button type="text" v-if="scope.scope.status == 2" @click="handleOut(scope.scope,'上架')">上架</el-button> <el-button type="text" v-if="scope.scope.status == 2" @click="handleOut(scope.scope, '上架')">上架</el-button>
<el-button type="text" v-if="scope.scope.status == 2" @click="handleDelect(scope.scope)">删除</el-button> <el-button type="text" v-if="scope.scope.status == 2" @click="handleDelect(scope.scope)">删除</el-button>
</template> </template>
</div> </div>
...@@ -161,7 +161,7 @@ export default { ...@@ -161,7 +161,7 @@ export default {
prop: 'activityStatus', prop: 'activityStatus',
width: 150, width: 150,
formatter: cellValue => { formatter: cellValue => {
return cellValue.contentList[0].activityStatus == 1 ? '未开始' :cellValue.contentList[0].activityStatus == 2 ? '进行中' : '已结束' return cellValue.contentList[0].activityStatus == 1 ? '未开始' : cellValue.contentList[0].activityStatus == 2 ? '进行中' : '已结束'
}, },
filter: '3,4' filter: '3,4'
}, },
...@@ -211,7 +211,7 @@ export default { ...@@ -211,7 +211,7 @@ export default {
}, },
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() > Date.now() return time.getTime() > Date.now()
} }
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'data.total' } pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'data.total' }
...@@ -223,7 +223,8 @@ export default { ...@@ -223,7 +223,8 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
...mapMutations({ ...mapMutations({
SET_MERCHANT_ID: 'channel/SET_MERCHANT_ID' SET_MERCHANT_ID: 'channel/SET_MERCHANT_ID',
SET_CHANNEL_STYLE: 'channel/SET_CHANNEL_STYLE'
}), }),
getParams() { getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm)) var params = JSON.parse(JSON.stringify(this.tableSearchForm))
...@@ -277,7 +278,9 @@ export default { ...@@ -277,7 +278,9 @@ export default {
merchantChannelId: item.id merchantChannelId: item.id
}) })
}) })
console.log(res)
this.SET_MERCHANT_ID({ id: this.merchantId }) this.SET_MERCHANT_ID({ id: this.merchantId })
this.SET_CHANNEL_STYLE({ channelStyle: res[0].channelStyle })
this.activeName = res[0].channelType this.activeName = res[0].channelType
this.merchantChannelId = res[0].id this.merchantChannelId = res[0].id
this.tabPaneText = res[0].channelName this.tabPaneText = res[0].channelName
...@@ -307,7 +310,7 @@ export default { ...@@ -307,7 +310,7 @@ export default {
handleAdd(scope) { handleAdd(scope) {
this.$router.push(`/channel/add?merchantChannelId=${this.merchantChannelId}`) this.$router.push(`/channel/add?merchantChannelId=${this.merchantChannelId}`)
}, },
handleOut(row,text) { handleOut(row, text) {
this.secondConfirm(text, `确定${text}此频道主题内容?`, 'store', 'updownshelvesChannel', { topicId: row.topicId }) this.secondConfirm(text, `确定${text}此频道主题内容?`, 'store', 'updownshelvesChannel', { topicId: row.topicId })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!