|
|
@@ -29,7 +29,7 @@
|
|
|
<uni-forms-item label="赛事LOGO" name="matchLogo">
|
|
|
<uni-file-picker v-model="matchLogoObj" :auto-upload="false" limit="1" title="请选择赛事使用的LOGO图片"
|
|
|
:sizeType="['original', 'compressed']" file-mediatype="image"
|
|
|
- file-extname="jpg,jpeg,png,gif,bmp,heic" @select="onLogoUploadSelect"
|
|
|
+ file-extname="jpg,jpeg,png,gif" @select="onLogoUploadSelect"
|
|
|
@delete="onLogoUploadDelete"></uni-file-picker>
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item label="赛事场地" name="mapId">
|
|
|
@@ -51,6 +51,7 @@
|
|
|
</uni-forms>
|
|
|
|
|
|
<view class="uni-row uni-jcse" style="width: 90%;">
|
|
|
+ <button class="button button-clear" @click="clearClick">清空</button>
|
|
|
<button class="button button-save" @click="saveClick">暂存</button>
|
|
|
<button class="button button-submit" @click="submitClick">提交审核</button>
|
|
|
</view>
|
|
|
@@ -157,7 +158,7 @@
|
|
|
errorMessage: '请输入赛事简介',
|
|
|
},
|
|
|
{
|
|
|
- minLength: 20,
|
|
|
+ minLength: 10,
|
|
|
maxLength: 500,
|
|
|
errorMessage: '赛事简介长度在 {minLength} 到 {maxLength} 个字符',
|
|
|
}
|
|
|
@@ -165,11 +166,11 @@
|
|
|
},
|
|
|
rules: {
|
|
|
rules: [{
|
|
|
- required: true,
|
|
|
+ required: false,
|
|
|
errorMessage: '请输入活动规则',
|
|
|
},
|
|
|
{
|
|
|
- minLength: 20,
|
|
|
+ minLength: 10,
|
|
|
maxLength: 500,
|
|
|
errorMessage: '活动规则长度在 {minLength} 到 {maxLength} 个字符',
|
|
|
}
|
|
|
@@ -253,7 +254,7 @@
|
|
|
methods: {
|
|
|
getSaveData() {
|
|
|
const saveData = uni.getStorageSync(this.saveKey);
|
|
|
- console.log("getSaveData", saveData);
|
|
|
+ // console.log("getSaveData", saveData);
|
|
|
// if (saveData) {
|
|
|
// this.formData = saveData;
|
|
|
// }
|
|
|
@@ -281,8 +282,8 @@
|
|
|
this.formData.compBeginSecond = Date.parse(this.formData.compBeginTime) / 1000;
|
|
|
this.formData.compEndSecond = Date.parse(this.formData.compEndTime) / 1000;
|
|
|
|
|
|
- console.log("[compInfoAdd] formData:", this.formData);
|
|
|
- console.log("[compInfoAdd] formData:", JSON.stringify(this.formData));
|
|
|
+ // console.log("[compInfoAdd] formData:", this.formData);
|
|
|
+ // console.log("[compInfoAdd] formData:", JSON.stringify(this.formData));
|
|
|
|
|
|
uni.request({
|
|
|
url: apiCompInfoAdd,
|
|
|
@@ -292,7 +293,7 @@
|
|
|
inJson: JSON.stringify(this.formData)
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- console.log("compInfoAdd", res);
|
|
|
+ // console.log("compInfoAdd", res);
|
|
|
if (checkResCode(res)) {
|
|
|
// const data = res.data.data;
|
|
|
uni.showToast({
|
|
|
@@ -321,7 +322,7 @@
|
|
|
method: "POST",
|
|
|
data: {},
|
|
|
success: (res) => {
|
|
|
- console.log("selectSsctQuery", res);
|
|
|
+ // console.log("selectSsctQuery", res);
|
|
|
if (checkResCode(res)) {
|
|
|
// const data = res.data.data;
|
|
|
}
|
|
|
@@ -339,7 +340,7 @@
|
|
|
method: "POST",
|
|
|
data: {},
|
|
|
success: (res) => {
|
|
|
- console.log("selectMapQuery", res);
|
|
|
+ // console.log("selectMapQuery", res);
|
|
|
if (checkResCode(res)) {
|
|
|
const data = res.data.data;
|
|
|
this.mapRs = data;
|
|
|
@@ -360,7 +361,7 @@
|
|
|
mapId: mapId
|
|
|
},
|
|
|
success: (res) => {
|
|
|
- console.log("selectPlanQuery", res);
|
|
|
+ // console.log("selectPlanQuery", res);
|
|
|
if (checkResCode(res)) {
|
|
|
const data = res.data.data;
|
|
|
this.planRs = data;
|
|
|
@@ -376,7 +377,7 @@
|
|
|
tools.appAction(url, "uni.switchTab");
|
|
|
},
|
|
|
onLogoUploadSelect(e) {
|
|
|
- console.log('[onLogoUploadSelect] 选择文件:', e);
|
|
|
+ // console.log('[onLogoUploadSelect] 选择文件:', e);
|
|
|
// const imgUrl = e.tempFilePaths[0]; // 获取图片的本地路径
|
|
|
const img = e.tempFiles[0]; // 获取图片信息
|
|
|
// 上传图片
|
|
|
@@ -395,16 +396,36 @@
|
|
|
success: (uploadFileRes) => {
|
|
|
// console.log("[onLogoUploadSelect] uploadFileRes", uploadFileRes);
|
|
|
// console.log("上传成功", JSON.parse(uploadFileRes.data));
|
|
|
- let data = JSON.parse(uploadFileRes.data).data;
|
|
|
- this.formData.matchLogo = data.url;
|
|
|
- this.matchLogoObj = {
|
|
|
- "name": img.name,
|
|
|
- "extname": img.extname,
|
|
|
- "url": data.url
|
|
|
- };
|
|
|
+ const uploadFileData = JSON.parse(uploadFileRes.data);
|
|
|
+ if (uploadFileData.code == 0) {
|
|
|
+ const data = uploadFileData.data;
|
|
|
+ this.formData.matchLogo = data.url;
|
|
|
+ this.matchLogoObj = {
|
|
|
+ "name": img.name,
|
|
|
+ "extname": img.extname,
|
|
|
+ "url": data.url
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.formData.matchLogo = "";
|
|
|
+ this.matchLogoObj = {};
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: `图片上传失败 (${uploadFileData.message})`,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 5000
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
- console.error("上传失败", err);
|
|
|
+ console.error("图片上传失败", err);
|
|
|
+ this.formData.matchLogo = "";
|
|
|
+ this.matchLogoObj = {};
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: `图片上传失败 (${err.errMsg})`,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 5000
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -412,8 +433,25 @@
|
|
|
onLogoUploadDelete() {
|
|
|
this.formData.matchLogo = "";
|
|
|
},
|
|
|
+ clearClick() {
|
|
|
+ let that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `您确定要清空表单内容吗?`,
|
|
|
+ confirmText: '确定', //确定文本的文字
|
|
|
+ cancelText: '取消', //确定文本的文字
|
|
|
+ showCancel: true, //没有取消按钮的弹框
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.setStorageSync(that.saveKey, "");
|
|
|
+ that.$router.go(0); // 刷新当前页面
|
|
|
+ } else if (res.cancel) {}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
saveClick() {
|
|
|
- console.log(this.formData);
|
|
|
+ // console.log(this.formData);
|
|
|
// const saveData = this.formData;
|
|
|
const saveData = {
|
|
|
mapRs: this.mapRs,
|
|
|
@@ -430,9 +468,22 @@
|
|
|
},
|
|
|
submitClick() {
|
|
|
// console.log(this.formData);
|
|
|
+ let that = this;
|
|
|
this.$refs.form.validate().then(res => {
|
|
|
// console.log('表单数据信息:', res);
|
|
|
- this.compInfoAdd();
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `您确定要提交审核吗?`,
|
|
|
+ confirmText: '确定', //确定文本的文字
|
|
|
+ cancelText: '取消', //确定文本的文字
|
|
|
+ showCancel: true, //没有取消按钮的弹框
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ that.compInfoAdd();
|
|
|
+ } else if (res.cancel) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}).catch(err => {
|
|
|
console.log('表单错误信息:', err);
|
|
|
uni.showToast({
|
|
|
@@ -517,12 +568,18 @@
|
|
|
word-spacing: 15px;
|
|
|
}
|
|
|
|
|
|
+ .button-clear {
|
|
|
+ width: 30%;
|
|
|
+ }
|
|
|
+
|
|
|
.button-save {
|
|
|
+ width: 30%;
|
|
|
color: #ffffff;
|
|
|
background-color: #5b8839;
|
|
|
}
|
|
|
|
|
|
.button-submit {
|
|
|
+ width: 30%;
|
|
|
color: #ffffff;
|
|
|
background-color: #e39700;
|
|
|
}
|