| 1 |
- import{m as e,a,r as t,s as o,Y as n,I as l,J as m,c as s,w as r,i,o as c,b as d,d as p,L as u}from"./index-ESTWQ1DK.js";import{_ as h}from"./my-topbar.8HnIktHp.js";import{r as f}from"./uni-app.es.B2O8FBxl.js";import{_ as g,a as D,b as S}from"./uni-file-picker.C74izXFa.js";import{_ as b,a as I}from"./uni-forms.t1Z1JyyC.js";import{_ as T}from"./e-select.C93dsHhZ.js";import{t as L}from"./tools.CwkibfPM.js";import{d as x,c as B,r as V,n as y,o as E,p as _,q as k}from"./api.BMgalDqr.js";import{_ as M}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.CCSIFyQK.js";const j=M({data:()=>({queryObj:{},queryString:"",from:"",compId:0,pubState:0,title:"赛事修改",mapSelectionProps:{text:"Label",value:"Value"},planSelectionProps:{text:"Label",value:"Value"},mapRs:[],planRs:[],matchLogoObj:{},formData:{matchLogo:"",matchBanner:"",compName:"",description:"",rules:"",contactName:"",phone:"",regBeginTime:"",regBeginSecond:"",regEndTime:"",regEndSecond:"",compBeginTime:"",compBeginSecond:"",compEndTime:"",compEndSecond:"",mapId:null,planId:null},checkRules:{compName:{rules:[{required:!0,errorMessage:"请输入赛事名称"},{minLength:5,maxLength:25,errorMessage:"赛事名称长度在 {minLength} 到 {maxLength} 个字符"}]},compBeginTime:{rules:[{required:!0,errorMessage:"请选择赛事起始时间"}]},compEndTime:{rules:[{required:!0,errorMessage:"请选择赛事截止时间"},{validateFunction:function(e,a,t,o){return!(a<=t.compBeginSecond)||(o("截止时间必须大于起始时间"),!1)}}]},description:{rules:[{required:!0,errorMessage:"请输入赛事简介"},{minLength:20,maxLength:500,errorMessage:"赛事简介长度在 {minLength} 到 {maxLength} 个字符"}]},rules:{rules:[{required:!0,errorMessage:"请输入活动规则"},{minLength:20,maxLength:500,errorMessage:"活动规则长度在 {minLength} 到 {maxLength} 个字符"}]},mapId:{rules:[{required:!0,errorMessage:"请选择赛事场地"},{minimum:1,errorMessage:"请选择赛事场地"}]},planId:{rules:[{required:!0,errorMessage:"请选择赛事方案"},{minimum:1,errorMessage:"请选择赛事方案"}]},contactName:{rules:[{required:!0,errorMessage:"请输入联系人姓名"},{minLength:2,maxLength:20,errorMessage:"联系人姓名长度在 {minLength} 到 {maxLength} 个字符"}]},phone:{rules:[{required:!0,errorMessage:"请输入联系人电话"},{pattern:"^((1[3456789][0-9]{1})+\\d{8})$",errorMessage:"请输入合法的手机号"}]}}}),computed:{...e(["username","token"]),...a(["metadata"])},onLoad(e){this.queryObj=e,this.queryString=L.objectToQueryString(this.queryObj),this.from=e.from??"",this.compId=e.compId??0,this.compInfoDetail(),this.selectMapQuery()},mounted(){},methods:{compInfoDetail(){t({url:x,header:this.metadata,method:"POST",data:{compId:this.compId},success:e=>{if(console.log("[compInfoDetail] res",e),B(e)){this.pubState=e.data.data.otherInfo.pubState;const a=e.data.data.config;this.formData.matchLogo=a.tplInfo.matchLogo,this.formData.matchBanner=a.tplInfo.matchBanner,this.formData.compName=a.matchInfo.compName,this.formData.description=a.matchInfo.description,this.formData.rules=a.matchInfo.rules,this.formData.contactName=a.matchInfo.contactName,this.formData.phone=a.matchInfo.phone,this.formData.regBeginTime=L.timestampToTime(1e3*a.matchInfo.regBeginSecond),this.formData.regBeginSecond=a.matchInfo.regBeginSecond,this.formData.regEndTime=L.timestampToTime(1e3*a.matchInfo.regEndSecond),this.formData.regEndSecond=a.matchInfo.regEndSecond,this.formData.compBeginTime=L.timestampToTime(1e3*a.matchInfo.compBeginSecond),this.formData.compBeginSecond=a.matchInfo.compBeginSecond,this.formData.compEndTime=L.timestampToTime(1e3*a.matchInfo.regEndSecond),this.formData.compEndSecond=a.matchInfo.compEndSecond,this.formData.mapId=a.mapInfo[0].mapId,this.formData.planId=a.mapInfo[0].planId,this.matchLogoObj={url:a.tplInfo.matchLogo},this.selectPlanQuery(this.formData.mapId)}},fail:e=>{console.log("[compInfoDetail] err",e)}})},compInfoEdit(){this.formData.regBeginTime=this.formData.compBeginTime,this.formData.regEndTime=this.formData.compEndTime,this.formData.regBeginSecond=Date.parse(this.formData.regBeginTime)/1e3,this.formData.regEndSecond=Date.parse(this.formData.regEndTime)/1e3,this.formData.compBeginSecond=Date.parse(this.formData.compBeginTime)/1e3,this.formData.compEndSecond=Date.parse(this.formData.compEndTime)/1e3,console.log("[compInfoEdit] formData:",this.formData),console.log("[compInfoEdit] formData:",JSON.stringify(this.formData)),t({url:V,header:this.metadata,method:"POST",data:{compId:this.compId,inJson:JSON.stringify(this.formData)},success:e=>{console.log("compInfoEdit",e),B(e)&&(o({title:"保存成功",icon:"none",duration:3e3}),setTimeout((()=>{this.btnBack()}),200))},fail:e=>{console.log("compInfoEdit err",e)}})},selectSsctQuery(){t({url:y,header:this.metadata,method:"POST",data:{},success:e=>{console.log("selectSsctQuery",e),B(e)},fail:e=>{console.log("selectSsctQuery err",e)}})},selectMapQuery(){t({url:E,header:this.metadata,method:"POST",data:{},success:e=>{if(console.log("selectMapQuery",e),B(e)){const a=e.data.data;this.mapRs=a}},fail:e=>{console.log("selectMapQuery err",e)}})},selectPlanQuery(e){t({url:_,header:this.metadata,method:"POST",data:{mapId:e},success:e=>{if(console.log("selectPlanQuery",e),B(e)){const a=e.data.data;this.planRs=a}},fail:e=>{console.log("selectPlanQuery err",e)}})},btnBack(){if("index"==this.from){const e="/pages/actManage/index";L.appAction(e,"uni.switchTab")}else if("actDetail"==this.from){const e="/pages/actManage/actDetail?compId="+this.compId;L.appAction(e,"uni.navigateTo")}else window.history.back()},onLogoUploadSelect(e){console.log("[onLogoUploadSelect] 选择文件:",e);const a=e.tempFiles[0];a&&n({url:k,filePath:a.path,name:"uploadFile",header:{token:this.token},formData:{},success:e=>{let t=JSON.parse(e.data).data;this.formData.matchLogo=t.url,this.matchLogoObj={name:a.name,extname:a.extname,url:t.url}},fail:e=>{console.error("上传失败",e)}})},onLogoUploadDelete(){this.formData.matchLogo=""},saveClick(){let e=this;this.$refs.form.validate().then((a=>{l({title:"提示",content:"修改后需要重新进行审核\r\n您确定要继续吗?",confirmText:"确定",cancelText:"取消",showCancel:!0,success:function(a){a.confirm?e.compInfoEdit():a.cancel}})})).catch((e=>{console.log("表单错误信息:",e),o({title:`错误: ${e[0].errorMessage}`,icon:"none",duration:3e3})}))},submitClick(){},getMapSelectText(e){},getPlanSelectText(e){},mapSelectChange(e){"clear"==e&&(this.planRs=[]);const a=e.Value;a>0&&this.selectPlanQuery(a)},planSelectChange(e){}}},[["render",function(e,a,t,o,n,l){const L=f(m("my-topbar"),h),x=i,B=f(m("uni-easyinput"),g),V=f(m("uni-forms-item"),b),y=f(m("uni-datetime-picker"),D),E=f(m("uni-file-picker"),S),_=f(m("e-select"),T),k=f(m("uni-forms"),I),M=u;return c(),s(x,{class:"body"},{default:r((()=>[d(x,{class:"content uni-column"},{default:r((()=>[d(x,{class:"uni-column uni-jcc top"},{default:r((()=>[d(L,{title:n.title,showBack:!0,onBtnBackClick:l.btnBack},null,8,["title","onBtnBackClick"]),d(x,{class:"top-content uni-row"})])),_:1}),d(x,{class:"main uni-column"},{default:r((()=>[d(k,{ref:"form",class:"form",modelValue:n.formData,rules:n.checkRules},{default:r((()=>[d(V,{label:"赛事名称",name:"compName"},{default:r((()=>[d(B,{maxlength:"25",placeholder:"请输入赛事名称",modelValue:n.formData.compName,"onUpdate:modelValue":a[0]||(a[0]=e=>n.formData.compName=e),disabled:n.pubState>1},null,8,["modelValue","disabled"])])),_:1}),d(V,{label:"赛事起始时间",name:"compBeginTime"},{default:r((()=>[d(y,{modelValue:n.formData.compBeginTime,"onUpdate:modelValue":a[1]||(a[1]=e=>n.formData.compBeginTime=e),type:"datetime",placeholder:"选择赛事起始时间"},null,8,["modelValue"])])),_:1}),d(V,{label:"赛事截止时间",name:"compEndTime"},{default:r((()=>[d(y,{modelValue:n.formData.compEndTime,"onUpdate:modelValue":a[2]||(a[2]=e=>n.formData.compEndTime=e),type:"datetime",placeholder:"选择赛事截止时间"},null,8,["modelValue"])])),_:1}),d(V,{label:"赛事简介",name:"description"},{default:r((()=>[d(B,{type:"textarea",autoHeight:"",maxlength:"500",modelValue:n.formData.description,"onUpdate:modelValue":a[3]||(a[3]=e=>n.formData.description=e),placeholder:"请输入赛事简介",disabled:n.pubState>1},null,8,["modelValue","disabled"])])),_:1}),d(V,{label:"活动规则",name:"rules"},{default:r((()=>[d(B,{type:"textarea",autoHeight:"",maxlength:"500",modelValue:n.formData.rules,"onUpdate:modelValue":a[4]||(a[4]=e=>n.formData.rules=e),placeholder:"请输入活动规则",disabled:n.pubState>1},null,8,["modelValue","disabled"])])),_:1}),d(V,{label:"赛事LOGO",name:"matchLogo"},{default:r((()=>[d(E,{modelValue:n.matchLogoObj,"onUpdate:modelValue":a[5]||(a[5]=e=>n.matchLogoObj=e),"auto-upload":!1,limit:"1",title:n.pubState>1?"":"请选择赛事使用的LOGO图片",sizeType:["original","compressed"],"file-mediatype":"image","file-extname":"jpg,jpeg,png,gif,bmp,heic",onSelect:l.onLogoUploadSelect,onDelete:l.onLogoUploadDelete,readonly:n.pubState>1},null,8,["modelValue","title","onSelect","onDelete","readonly"])])),_:1}),d(V,{label:"赛事场地",name:"mapId"},{default:r((()=>[d(_,{modelValue:n.formData.mapId,"onUpdate:modelValue":a[6]||(a[6]=e=>n.formData.mapId=e),options:n.mapRs,props:n.mapSelectionProps,clearable:"",maxHeight:"40vh",placeholder:"请选择赛事场地(可输入关键字)",onGetText:l.getMapSelectText,onChange:l.mapSelectChange,disabled:n.pubState>1},null,8,["modelValue","options","props","onGetText","onChange","disabled"])])),_:1}),d(V,{label:"赛事方案",name:"planId"},{default:r((()=>[d(_,{modelValue:n.formData.planId,"onUpdate:modelValue":a[7]||(a[7]=e=>n.formData.planId=e),options:n.planRs,props:n.planSelectionProps,clearable:"",maxHeight:"40vh",placeholder:"请选择赛事方案",onGetText:l.getPlanSelectText,onChange:l.planSelectChange,disabled:n.pubState>1},null,8,["modelValue","options","props","onGetText","onChange","disabled"])])),_:1}),d(V,{label:"联系人姓名",name:"contactName"},{default:r((()=>[d(B,{maxlength:"20",placeholder:"请输入联系人姓名",modelValue:n.formData.contactName,"onUpdate:modelValue":a[8]||(a[8]=e=>n.formData.contactName=e)},null,8,["modelValue"])])),_:1}),d(V,{label:"联系人电话",name:"phone"},{default:r((()=>[d(B,{maxlength:"11",placeholder:"请输入联系人电话",modelValue:n.formData.phone,"onUpdate:modelValue":a[9]||(a[9]=e=>n.formData.phone=e)},null,8,["modelValue"])])),_:1})])),_:1},8,["modelValue","rules"]),d(x,{class:"uni-row uni-jcse",style:{width:"90%"}},{default:r((()=>[d(M,{class:"button",onClick:l.btnBack},{default:r((()=>[p("返回")])),_:1},8,["onClick"]),d(M,{class:"button button-save",onClick:l.saveClick},{default:r((()=>[p("保存")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-651c23d7"]]);export{j as default};
|