Commit 6097a276 by 前端

Merge branch 'v2.7.1_feat' into 'v2.7.0'

V2.7.1 feat上线后,代码合并

See merge request !285
2 parents 3a39854c 26aee983
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<slot :name="item.suffixSlot" :scope="item"></slot> <slot :name="item.suffixSlot" :scope="item"></slot>
</template> </template>
<!-- 图文编辑器 --> <!-- 图文编辑器 -->
<textBox v-else-if="item.type === 'textBox'" :ref="item.name + 'TextBox'" @change="e => handleTextBoxChange(e, item)" @focus="handleTextBoxFocus(item)"></textBox> <textBox v-else-if="item.type === 'textBox'" :ref="item.name + 'TextBox'" :excludeMenus="item.excludeMenus || ['code']" @change="e => handleTextBoxChange(e, item)" @focus="handleTextBoxFocus(item)"></textBox>
<!-- 地图 --> <!-- 地图 -->
<div v-else-if="item.type === 'map'" class="flex"> <div v-else-if="item.type === 'map'" class="flex">
<Province ref="provinceForm" :subdistrict="subdistrict" :isDisabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)"></Province> <Province ref="provinceForm" :subdistrict="subdistrict" :isDisabled="item.isDisabled" @selectProvince="e => handleSelectProvince(e, item)" @selectCity="e => handleSelectCity(e, item)"></Province>
......
...@@ -15,6 +15,12 @@ export default { ...@@ -15,6 +15,12 @@ export default {
editorOption: {} editorOption: {}
} }
}, },
props: {
excludeMenus: {
type: Array,
default: () => ['code']
}
},
mounted() { mounted() {
this.getEdit() this.getEdit()
}, },
...@@ -27,7 +33,7 @@ export default { ...@@ -27,7 +33,7 @@ export default {
this.editor.config.menuTooltipPosition = 'down' this.editor.config.menuTooltipPosition = 'down'
this.editor.config.height = 400 this.editor.config.height = 400
this.editor.config.width = 500 this.editor.config.width = 500
this.editor.config.excludeMenus = ['code'] this.editor.config.excludeMenus = this.excludeMenus
this.editor.config.onchange = html => { this.editor.config.onchange = html => {
// console.log(html); // console.log(html);
this.content = html // 绑定当前逐渐地值 this.content = html // 绑定当前逐渐地值
......
...@@ -79,15 +79,31 @@ ...@@ -79,15 +79,31 @@
</div> </div>
</template> </template>
<template slot="activityMusic" slot-scope="scope"> <template slot="activityMusic" slot-scope="scope">
<el-upload v-show="!editForm[scope.scope.name]" class="upload-demo" action="" accept="audio/mp3, audio/m4a" :show-file-list="false" :http-request="handleMusicUpload" :before-upload="e => handleMusicBeforeUpload(e, scope.scope)" :file-list="fileList" :limit="1"> <div class="flex">
<div class="music-box flex-center" v-for="(item, index) in musicList" :key="index" @click="handleMusicChange(index)">
<div class="music-icon" @click.stop="handleMusic(item, index)">
<div :class="[index != playObj.idx ? 'icon-start' : 'icon-stop']"></div>
<img src="@/assets/seckillActivity/icon-music-default.png" />
</div>
<div class="music-name">
<p class="ellipsis-1" style="max-width: 90%;">{{ item.name }}</p>
.mp3
</div>
<img v-show="item.isCheck" :class="{ 'icon-check': item.isCheck }" src="@/assets/seckillActivity/icon-check.png" />
</div>
</div>
<el-upload class="m-t-10" action="" accept="audio/mp3, audio/m4a" :show-file-list="false" :http-request="handleMusicUpload" :before-upload="e => handleMusicBeforeUpload(e, scope.scope)" :file-list="fileList">
<el-button class="el-icon-plus" size="small" type="default">背景音乐</el-button> <el-button class="el-icon-plus" size="small" type="default">背景音乐</el-button>
</el-upload> </el-upload>
<div v-if="editForm[scope.scope.name]" class="flex"> <audio v-if="playObj.src" style="display: none;" id="music-audio" controls>
<source type="audio/mpeg" :src="playObj.src" />
</audio>
<!-- <div v-if="editForm[scope.scope.name]" class="flex">
<audio controls> <audio controls>
<source :src="editForm[scope.scope.name]" type="audio/mpeg" /> <source :src="editForm[scope.scope.name]" type="audio/mpeg" />
</audio> </audio>
<el-button class="describe-delete" icon="el-icon-delete" type="text" @click="handleMusicDelete(scope.scope)"></el-button> <el-button class="describe-delete" icon="el-icon-delete" type="text" @click="handleMusicDelete(scope.scope)"></el-button>
</div> </div> -->
</template> </template>
<template slot="fictitious"> <template slot="fictitious">
<div class="fictitious" id="fictitious"> <div class="fictitious" id="fictitious">
...@@ -455,6 +471,29 @@ export default { ...@@ -455,6 +471,29 @@ export default {
} }
} }
], ],
// 活动音乐
playObj: {
idx: -1,
src: ''
},
musicUploadName: '音频',
musicList: [
{
name: '1',
addr: 'https://img01.glsx.com.cn/group1/M00/23/C8/wKgFHWLh7Y2ARPH_ACav2AhE_vA583.mp3',
isCheck: false
},
{
name: '2',
addr: 'https://img01.glsx.com.cn/group1/M00/23/C8/wKgFHWLh7a-ADfhZABqkegKp2yY992.mp3',
isCheck: false
},
{
name: '3',
addr: 'https://img01.glsx.com.cn/group1/M00/23/C8/wKgFHWLh7cyACPoUACnOiS36FT0760.mp3',
isCheck: false
}
],
// 活动配置 // 活动配置
configEditFormData: [ configEditFormData: [
{ {
...@@ -508,10 +547,16 @@ export default { ...@@ -508,10 +547,16 @@ export default {
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => { this.loading = true
this.$apis.common
.uploadImgApi({ file: base64, fileType: 'image' })
.then(res => {
this.editForm[targetItem.name] = res this.editForm[targetItem.name] = res
this.$refs.configEditFormRef.$refs[this.editChildRef].validateField(targetItem.name) this.$refs.configEditFormRef.$refs[this.editChildRef].validateField(targetItem.name)
}) })
.finally(() => {
this.loading = false
})
} }
}, },
{ {
...@@ -526,16 +571,23 @@ export default { ...@@ -526,16 +571,23 @@ export default {
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.uploadVideoApi({ file: base64 }).then(res => { this.loading = true
this.$apis.common
.uploadVideoApi({ file: base64 })
.then(res => {
this.editForm[targetItem.name].push(res) this.editForm[targetItem.name].push(res)
}) })
.finally(() => {
this.loading = false
})
} }
}, },
{ {
label: '活动详情', label: '活动详情',
name: 'activityDetail', name: 'activityDetail',
tips: '展示活动的详细内容', tips: '展示活动的详细内容',
type: 'textBox' type: 'textBox',
excludeMenus: ['video', 'code']
}, },
{ {
label: '音乐文件', label: '音乐文件',
...@@ -900,13 +952,61 @@ export default { ...@@ -900,13 +952,61 @@ export default {
reader.onload = e => { reader.onload = e => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.common.uploadMusicApi({ file: base64 }).then(res => { this.$apis.common.uploadMusicApi({ file: base64 }).then(res => {
this.loading = false
this.$set(this.editForm, targetItem.name, res) this.$set(this.editForm, targetItem.name, res)
if (this.musicList.length == 4) {
this.musicList.pop()
}
this.musicList.push({
name: this.musicUploadName,
addr: res,
isCheck: false
})
this.handleMusicChange(this.musicList.length - 1)
})
}
},
// 音乐
handleMusic(targetItem, idx) {
// stop-音频结束;play-音频播放
var playFlag = this.playObj.idx != -1 && this.playObj.idx == idx ? 'stop' : 'play'
var audioDom = document.getElementById('music-audio')
this.playObj.idx = -1
this.playObj.src = ''
this.$nextTick(() => {
if (playFlag == 'play') {
this.playObj.idx = idx
this.playObj.src = targetItem.addr
this.$nextTick(() => {
if (playFlag == 'play') {
audioDom = document.getElementById('music-audio')
audioDom && audioDom.play()
}
})
}
}) })
},
stopMusic() {
this.playObj.idx = -1
this.playObj.src = ''
},
handleMusicChange(idx) {
this.musicList.forEach((item, index) => {
if (index != idx) {
item.isCheck = false
} }
})
this.musicList[idx].isCheck = !this.musicList[idx].isCheck
this.editForm.activityMusic = this.musicList[idx].isCheck ? this.musicList[idx].addr : ''
}, },
handleMusicBeforeUpload(file, targetItem) { handleMusicBeforeUpload(file, targetItem) {
this.stopMusic()
this.musicUpload(file, targetItem) this.musicUpload(file, targetItem)
}, },
...@@ -994,6 +1094,21 @@ export default { ...@@ -994,6 +1094,21 @@ export default {
this.editForm.activityDetail = decodeURIComponent(info.activityDetail) this.editForm.activityDetail = decodeURIComponent(info.activityDetail)
this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(this.editForm.activityDetail) this.$refs.configEditFormRef.$refs.activityDetailTextBox[0].setEdit(this.editForm.activityDetail)
} }
// 活动音乐
if (info.activityMusic) {
var checkIdx = this.musicList.map(item => item.addr).findIndex(k => k == info.activityMusic)
if (checkIdx != -1) {
this.musicList[checkIdx].isCheck = false
this.handleMusicChange(checkIdx)
} else {
this.musicList.push({
name: this.musicUploadName,
addr: info.activityMusic,
isCheck: false
})
this.handleMusicChange(this.musicList.length - 1)
}
}
// 表单设置 // 表单设置
this.formDescribeList = [] this.formDescribeList = []
Object.values(this.describeIdxToAttr).forEach((item, index) => { Object.values(this.describeIdxToAttr).forEach((item, index) => {
...@@ -1107,6 +1222,7 @@ export default { ...@@ -1107,6 +1222,7 @@ export default {
}, },
handleConfirm() { handleConfirm() {
this.stopMusic()
this.validateRules() this.validateRules()
var flag = true var flag = true
if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) { if (this.nameToValSpecsList && this.nameToValSpecsList.length > 0) {
...@@ -1354,6 +1470,60 @@ export default { ...@@ -1354,6 +1470,60 @@ export default {
padding: 20px 20px 0 20px; padding: 20px 20px 0 20px;
background: #f9f9f9; background: #f9f9f9;
} }
.edit-activity .music-box {
position: relative;
box-sizing: border-box;
width: 160px;
height: 56px;
background: #fafbfe;
border-radius: 2px;
border: 1px solid #e8e8ea;
padding: 10px 7px;
margin: 0 8px 8px 0;
cursor: pointer;
.music-icon {
position: relative;
cursor: pointer;
width: 36px;
height: 36px;
}
.icon-start {
position: absolute;
display: inline-block;
top: 0;
left: 0;
width: 36px;
height: 36px;
cursor: pointer;
}
.icon-stop {
position: absolute;
display: inline-block;
top: 0;
left: 0;
width: 36px;
height: 36px;
background-image: url('../../assets/seckillActivity/icon-stop.png');
cursor: pointer;
}
.icon-start:hover {
background-image: url('../../assets/seckillActivity/icon-start.png');
z-index: 999;
}
.icon-check {
width: 15px;
height: 15px;
position: absolute;
right: 0;
bottom: 0;
}
.music-name {
display: flex;
box-sizing: border-box;
width: calc(100% - 36px);
padding-left: 8px;
}
}
.edit-activity .fictitious { .edit-activity .fictitious {
width: 600px; width: 600px;
padding: 20px 20px 0 20px; padding: 20px 20px 0 20px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!