Commit 1ed5406d by 王志慧

commit

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