Commit d89cea08 by 李伟康

Merge branch 'dev_lwk' into 'v3.24.0'

提交接龙

See merge request !27
2 parents 67ae498d d3a43214
<template> <template>
<div class="box"> <div class="box">
<div class="content">
<div class="title">{{title}}</div> <div class="title">{{title}}</div>
<el-scrollbar
class="form-box"
>
<glsx-combi-form <glsx-combi-form
class="from"
ref="formRef" ref="formRef"
:isEdit="true" :isEdit="true"
:isBlock="true" :isBlock="true"
...@@ -9,74 +14,206 @@ ...@@ -9,74 +14,206 @@
:formData="formData" :formData="formData"
:formRules="rule" :formRules="rule"
> >
<div
slot="posterImg"
class="edit-tips"
>图片大小10M</div>
<template #endTimeType>
<div
v-if="configForm.endTimeType == 1"
class="item-box"
>
<el-date-picker
v-model="configForm.endTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</div>
</template>
<template #showTime>
<el-date-picker
v-model="configForm.winningTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="afterRangePickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"
class="end-time"
>
</el-date-picker>
</template>
<template #groupType>
<div
v-if="configForm.groupType == 1"
class="item-box"
>
<div class="label">群聊列表:</div>
<el-select
v-model="configForm.groupList"
multiple
placeholder="请选择"
filterable
multiple-limit="5"
class="options"
collapse-tags
>
<el-option
v-for="item in groupList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</div>
</template>
</glsx-combi-form> </glsx-combi-form>
</el-scrollbar>
</div>
<GLFooter>
<el-button
@click="$router.go(-1)"
size="medium"
>取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
size="medium"
>确定</el-button>
</GLFooter>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { formData, rule, afterRangePickerOptions } from './addJS/add.js'
export default { export default {
name: '', name: '',
data () { data () {
return { return {
afterRangePickerOptions,
title: this.$route.query.$title, title: this.$route.query.$title,
configForm: { configForm: {
filtration: 1, filtration: 1,
activityDetail: '' activityDetail: '',
}, merchantId: '',
rule: { posterImg: '',
name: [{ required: true, message: '请输入问卷名称', trigger: 'change' }], maxNumber: 9,
merchantId: [{ required: true, message: '请选择所属渠道', trigger: 'change' }], winningNumber: 0,
cardTitle: [{ required: true, message: '请输入卡片标题', trigger: 'change' }], endTimeType: 0,
cardCover: [{ required: true, message: '请上传卡片封面', trigger: 'change' }], endTime: '',
}, winningTime: '',
formData: [ groupType: 0,
{ groupList: []
label: '群接龙种类',
type: 'radio',
name: 'filtration',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
{
label: '群接龙说明',
name: 'activityDetail',
type: 'textBox',
excludeMenus: ['video', 'code'],
boxHeight: 240
}, },
{ rule,
label: '群接龙种类', formData,
type: 'radio', groupList: [],
name: 'filtration', }
optionList: [
{
text: '猜数字',
id: 1
}, },
],
optionId: 'id', watch: {
optionLabel: 'text', 'configForm.maxNumber' (n) {
this.configForm.winningNumber = 0
this.formData.find(e => e.name == 'winningNumber').optionList.map(i => {
i.isDisabled = i.optionId > n
})
}, },
], 'configForm.groupType' (n) {
if (n == 1 && !this.configForm.merchantId) {
this.configForm.groupType = 0
this.showError()
}
} }
}, },
mounted () { mounted () {
console.log()
}, },
methods: { methods: {
handleConfirm () {
},
showError (message) {
this.$message.error(message || '请先选择所属渠道!')
}
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.box{ .box {
position: absolute;
width: 100%;
height: calc(100vh - 48px);
top: 0;
left: 0;
.content {
height: calc(100% - 88px);
background-color: #fff;
border-radius: 0 4px 4px 4px;
margin: 16px;
.form-box {
width: 100%;
height: calc(100% - 59px);
box-sizing: border-box;
.from {
margin-top: 30px;
/deep/.activity-img {
width: 104px;
height: 104px;
}
/deep/.muti-imgs {
.img-w-h,
.img-btns {
width: 106px;
height: 106px;
}
}
}
/deep/.el-scrollbar__wrap {
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
}
}
}
.title {
font-weight: 500;
font-size: 16px;
color: #333333;
line-height: 28px;
padding: 15px 20px;
border-bottom: 1px solid #e5e5e5;
background-color: #fff; background-color: #fff;
}
.edit-tips {
font-size: 14px;
color: #999999;
}
.item-box {
width: 480px;
height: 52px;
background: #f9f9f9;
display: flex;
align-items: center;
padding-left: 20px;
box-sizing: border-box;
.end-time,
.options {
width: 284px;
/deep/.el-input {
width: 100% !important;
}
/deep/.el-tag--info {
max-width: 50%;
}
}
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
const generateOptionsArray = function (count = 9) {
return Array.from({ length: count }, (_, index) => ({
optionId: Number(index + 1),
optionLabel: Number(index + 1)
}))
}
export const formData = [
{
label: '群接龙种类',
type: 'radio',
name: 'filtration',
optionList: [
{
text: '猜数字',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
},
{
label: '群接龙说明',
name: 'activityDetail',
type: 'textBox',
excludeMenus: ['video', 'code', 'table'],
boxHeight: 240
},
{
label: '所属渠道',
name: 'merchantId',
type: 'select',
width: '432px',
// multiple: true,
// attrs: {
// multipleLimit: 10
// },
noFilter: false,
optionList: [],
optionId: 'confId',
optionLabel: 'confName'
},
{
label: '卡片标题',
name: 'name',
type: 'input',
maxlength: 100
},
{
label: '海报图片',
name: 'posterImg',
type: 'upload',
width: '320px',
limitSize: 10,
maxPhotoNum: 1,
suffixSlot: 'posterImg',
beforeLoading: true,
handleUpload: async (e, file, targetItem, config, _this) => {
try {
const { result: imgFile } = e.target,
arrBase64 = imgFile.split(',')[1],
str = file.name.split('.'),
base64 = str.at(-1) + '@' + arrBase64,
res = await _this.$apis.common.pictureUpload({ file: base64, fileType: 'image' })
_this.$loading().close()
if (res) {
config[targetItem.name] = res
_this.formRef().validateField(targetItem.name)
} else throw '上传失败'
} catch (error) {
_this.$loading().close()
_this.$message(error)
}
}
},
{
label: '数字上限',
name: 'maxNumber',
type: 'select',
optionList: generateOptionsArray(),
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '中奖数字',
name: 'winningNumber',
type: 'select',
optionList: [
{
optionId: 0,
optionLabel: '随机'
},
...generateOptionsArray()
],
optionId: 'optionId',
optionLabel: 'optionLabel',
},
{
label: '接龙结束时间',
type: 'radio',
name: 'endTimeType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '选择时间',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'endTimeType',
},
{
label: '接龙开奖时间',
addHtml: 'showTime'
},
{
label: '转发群限制',
type: 'radio',
name: 'groupType',
optionList: [
{
text: '无限制',
id: 0
},
{
text: '限制群',
id: 1
},
],
optionId: 'id',
optionLabel: 'text',
suffixSlot: 'groupType',
},
]
export const rule = {
name: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
merchantId: [{ required: true, message: '请选择所属渠道', trigger: 'change' }],
cardTitle: [{ required: true, message: '请输入卡片标题', trigger: 'change' }],
cardCover: [{ required: true, message: '请上传卡片封面', trigger: 'change' }],
}
export const afterRangePickerOptions = {
disabledDate (time) {
let oneDay = 60 * 60 * 24 * 1000;
return time.getTime() < Date.now() - oneDay
},
}
// computed: {
// afterRangePickerOptions () {
// //这里判断是不是今天
// let newVal = new Date(this.configForm.endTime)
// let selectableRange = '00:00:00 - 23:59:59' //默认的时间范围
// if (
// newVal &&
// newVal.getFullYear() == new Date().getFullYear() &&
// newVal.getMonth() == new Date().getMonth() &&
// newVal.getDate() == new Date().getDate()
// ) {
// //如果为今天,则限制当前时间前的时间+1分钟不能选择。
// selectableRange = new Date().getHours() + ':' + (new Date().getMinutes() + 1) + ':00 - 23:59:59'
// }
// return {
// selectableRange,
// disabledDate (time) {
// // 只能选大于当前截止时间的
// return time.getTime() < Date.now() - 8.64e7
// }
// }
// }
// }
\ No newline at end of file \ No newline at end of file
...@@ -145,8 +145,8 @@ export default { ...@@ -145,8 +145,8 @@ export default {
}, },
noFilter: false, noFilter: false,
optionList: [], optionList: [],
optionId: 'confId', optionId: 'value',
optionLabel: 'confName' optionLabel: 'label'
}, },
{ {
label: '创建时间', label: '创建时间',
...@@ -155,7 +155,7 @@ export default { ...@@ -155,7 +155,7 @@ export default {
isClear: true, isClear: true,
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
customPickerOptions: { customPickerOptions: {
disabledDate(date) { disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate())) const yesterday = new Date(new Date().setDate(new Date().getDate()))
return date > yesterday return date > yesterday
} }
...@@ -341,6 +341,9 @@ export default { ...@@ -341,6 +341,9 @@ export default {
.sticky { .sticky {
position: relative; position: relative;
z-index: 2; z-index: 2;
/deep/.el-tag--info {
max-width: 50%;
}
&-btns { &-btns {
position: absolute; position: absolute;
right: 0; right: 0;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!