Commit fd442cd4 by crushh

update: 校验

parent 2fe04cde
......@@ -25,10 +25,10 @@
<p class="image-tip">图片建议尺寸 750*1800px,格式 jpg/jpeg/png/gif,大小 2M 以内;图片还适用于我的奖品、分享助力等页面。</p>
</el-form-item>
<el-form-item label="游戏背景音乐" prop="backMusicUrl">
<el-checkbox-group v-model="musicSelectList" @change="handleChange" class="checkBoxContainer">
<el-checkbox-group v-model="musicSelectList" @change="handleChange" class="checkBoxContainer">
<el-checkbox v-for="row in musicList" :key="row.materialValue" :label="row.materialValue">{{ row.materialName }}</el-checkbox>
</el-checkbox-group>
<el-upload :action="musicUrl" with-credentials :on-remove="handleRemove" multiple :limit="3" :data="{requestProject: 'gic-web'}" :show-file-list="false" :file-list="defineMusicList" :before-upload="(file) => beforeMusicUpload(file)" :on-exceed="handleExceed" :on-success="uploadOnMusicSuccess">
<el-upload :action="musicUrl" with-credentials multiple accept="audio/mpeg" :data="{requestProject: 'gic-web'}" :show-file-list="false" :file-list="defineMusicList" :before-upload="(file) => beforeMusicUpload(file)" :on-success="uploadOnMusicSuccess">
<el-button size="small">自定义上传</el-button>
</el-upload>
</el-form-item>
......@@ -36,7 +36,7 @@
<dm-sub-title type="fill">游戏首页奖品样式</dm-sub-title>
<div class="section">
<el-form-item label="奖项展示个数" prop="viewPrize">
<el-input class="w340" v-model.number="form.viewPrize" @change="onValChange" placeholder="请输入展示数量" ></el-input>
<el-input class="w340" v-model.number="form.viewPrize" :disabled="isDisabled" @change="onValChange" placeholder="请输入展示数量" ></el-input>
</el-form-item>
<el-form-item label="奖项图片尺寸" required>
<div class="flex">
......@@ -109,11 +109,11 @@
<el-form-item label="模板奖品数量" required>
<div class="flex">
<el-form-item label-width="0" prop="prizeMin" required>
<el-input v-model.number="form.prizeMin"></el-input>
<el-input v-model.number="form.prizeMin" :disabled="isDisabled"></el-input>
</el-form-item>
<span class="ml10 mr10">~</span>
<el-form-item label-width="0" prop="prizeMax" required>
<el-input v-model.number="form.prizeMax"></el-input>
<el-input v-model.number="form.prizeMax" :disabled="isDisabled"></el-input>
</el-form-item>
</div>
......@@ -171,6 +171,10 @@ export default {
c(new Error('请输入不大于右边的值'));
return;
}
if (prizeMin > 20) {
c(new Error('请输入不大于20的数字'));
return;
}
c();
};
......@@ -184,6 +188,10 @@ export default {
c(new Error('请输入不小于左边的值'));
return;
}
if (prizeMax > 20) {
c(new Error('请输入不大于20的数字'));
return;
}
c();
};
......@@ -364,6 +372,19 @@ export default {
'shareReport': '分享海报',
'bgBannerHelpUrl': '助力背景Banner',
},
sizeMap: {
'backImageUrl': { width: 750, height: 1800, size: 2 },
'ruleImageUrl': { width: 750, height: 1800, size: 2 },
'cashCouponImgUrl': { width: 300, height: 300, size: 1 },
'discountCouponImgUrl': { width: 300, height: 300, size: 1 },
'exchangeCouponImgUrl': { width: 300, height: 300, size: 1 },
'pointImgUrl': { width: 300, height: 300, size: 1 },
'physicalGiftImgUrl': { width: 300, height: 300, size: 1 },
'virtutalGiftImgUrl': { width: 300, height: 300, size: 1 },
'shareCard': { width: 320, height: 240, size: 1 },
'shareReport': { width: 750, height: 1334, size: 1 },
'bgBannerHelpUrl': { width: 590, height: 120, size: 1 },
},
defineMusicList: [],
musicSelectList: [],
musicList: [
......@@ -493,11 +514,22 @@ export default {
console.log(this.form.prizeStyleJson);
},
beforeMusicUpload(file){
console.log(file);
if (file.size / 1024 / 1024 > 3) {
this.$message.error('音乐不能大于3M,请重新上传!');
return false;
}
if(![ 'audio/mpeg' ].includes(file.type )){
this.$message.error('请上传mp3格式的音乐!');
return false;
}
return true;
},
uploadOnMusicSuccess(res){
console.log(res);
// res = { 'gameMusicId': null, 'gameId': null, 'enterpriseId': null, 'musicName': 'test1.mp3', 'musicUrl': 'https://music-1251519181.cos.ap-shanghai.myqcloud.com/ff8080816a36326c016a53380d8b5f52/1655627297310_test1.mp3', 'musicFieldCode': 'ff8080816a36326c016a53380d8b5f52/1655627297310_test1.mp3' };
if(res.errorCode != 0){
this.$message.error(res.message);
return;
}
const { musicName, musicUrl } = res.result;
this.musicList.push({ materialName: musicName, materialValue: musicUrl, sort: 0 });
this.musicSelectList.push(musicUrl);
......@@ -527,12 +559,6 @@ export default {
}
console.log(this.form);
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
nextStep() {
this.$refs.form.validate((bool, res)=>{
console.log(res);
......@@ -549,7 +575,7 @@ export default {
val.materialId ? obj.materialId = val.materialId : '';
!val.materialName ? obj.materialName = this.materialNameMap[key] : obj.materialName = val.materialName;
val.sort ? obj.sort = val.sort : obj.sort = 0;
val.materialSize ? obj.materialSize = val.materialSize : obj.materialSize = JSON.stringify(this.sizeMap[key]);
gameExt[key] = obj;
}
if(key == 'noticeImageUrl'){
......@@ -589,7 +615,10 @@ export default {
});
},
handleChange(val){
console.log(val);
if(val.length > 10){
this.musicSelectList.pop();
this.$message.error('请最多选择10首音乐');
}
}
},
computed: {
......@@ -597,6 +626,9 @@ export default {
let origin = window.location.origin;
origin = (origin.indexOf('localhost') >= 0 || origin.indexOf('192.168') >= 0 ) ? 'https://www.gicdev.com' : origin;
return origin + '/marketing-operation/upload-music';
},
isDisabled(){
return this.$route.query.id;
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment