2 lines
4.8 KiB
JavaScript
2 lines
4.8 KiB
JavaScript
"use strict";const e=require("./common/vendor.js"),n=require("./components/NationalDictionary.js"),i=require("./components/request.js"),t=require("./common/assets.js"),s={data:()=>({genders:0,Gender:[{label:"男",value:1},{label:"女",value:2}],Country:n.optionsArray,countrys:"",nameAnchor:"",numberCoins:"",session:"",remarks:"",Display:!1,Hint:!1,datetimesingle:"",id:null,sendingTime:"",filterable:!0,AnchorProfilePicture:""}),mounted(){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}})},methods:{gender(e){this.genders=e.value,console.log(e)},country(e){this.countrys=e.value,console.log(e)},handleOverlayClick(e){e.target===this.$el&&(this.Display=!1,this.Hint=!1)},open(){this.Display?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.numberCoins="",this.remarks="",this.datetimesingle="",this.countrys="",this.session=""):this.Display=!0},blur(n){this.nameAnchor!==n.target.value&&(this.nameAnchor=n.target.value,e.index.showLoading({title:"正在验证主播",mask:!0}),e.index.request({url:"http://47.79.98.113:6600/"+this.nameAnchor,success:n=>{200===n.data.code?(e.index.hideLoading(),e.index.showToast({title:"查询成功",icon:"none",duration:3e3}),this.AnchorProfilePicture=n.data.data):(e.index.hideLoading(),e.index.showToast({title:"未查询到该主播",icon:"none",duration:3e3}))},fail:function(n){e.index.hideLoading(),e.index.showToast({title:"网络请求失败",icon:"none",duration:3e3})}}))},async Publish(){if(""===this.nameAnchor||0===this.genders||""===this.numberCoins||""===this.countrys||""===this.datetimesingle||""===this.session||""===this.AnchorProfilePicture)return void(this.Hint=!0);const n=this.datetimesingle.replace(" ","T"),t=Date.parse(n);if(isNaN(t))throw new Error(`Invalid date format: ${this.datetimesingle}`);this.sendingTime=Math.floor(t/1e3);const s=Math.floor(Date.now()/1e3);if(this.sendingTime<s)return void e.index.showToast({title:"日期不能早于当前时间",icon:"none",duration:2e3});e.index.showLoading({title:"发布中...",mask:!0});200===(await i.request({url:"pk/addPkData",method:"POST",data:{anchorId:this.nameAnchor,pkTime:this.sendingTime,sex:this.genders,country:this.countrys,coin:this.numberCoins,remark:this.remarks,senderId:this.id,anchorIcon:this.AnchorProfilePicture,pkNumber:this.session},userInfo:!0})).code?(this.Display=!1,this.Hint=!1,this.nameAnchor="",this.genders=0,this.numberCoins="",this.remarks="",this.datetimesingle="",this.session="",this.AnchorProfilePicture="",e.index.hideLoading(),e.index.showToast({title:"发布成功",icon:"success",duration:2e3})):(e.index.hideLoading(),e.index.showToast({title:"发布失败",icon:"none",duration:2e3}))}}};if(!Array){(e.resolveComponent("wht-select")+e.resolveComponent("uni-number-box")+e.resolveComponent("uni-datetime-picker")+e.resolveComponent("uni-easyinput"))()}Math||((()=>"./uni_modules/wht-select/components/wht-select/wht-select.js")+(()=>"./uni_modules/uni-number-box/components/uni-number-box/uni-number-box.js")+(()=>"./uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js")+(()=>"./uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js"))();const o=e._export_sfc(s,[["render",function(n,i,s,o,r,a){return e.e({a:r.Display},r.Display?e.e({b:e.o$1((e=>a.open())),c:t._imports_0$2,d:e.o$1(((...e)=>n.NameAnchor&&n.NameAnchor(...e))),e:e.o$1(((...e)=>a.blur&&a.blur(...e))),f:""===r.nameAnchor&&!0===r.Hint},(""===r.nameAnchor&&r.Hint,{}),{g:e.o$1(a.country),h:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:r.Country,filterable:r.filterable,placeholder:"请选择国家"}),i:""===r.countrys&&!0===r.Hint},(""===r.countrys&&r.Hint,{}),{j:e.o$1(a.gender),k:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:r.Gender,placeholder:"性别"}),l:0===r.genders},0===r.genders?{m:t._imports_1$2}:{},{n:1===r.genders},1===r.genders?{o:t._imports_2$3}:{},{p:2===r.genders},2===r.genders?{q:t._imports_3$2}:{},{r:0===r.genders&&!0===r.Hint},(0===r.genders&&r.Hint,{}),{s:e.o$1((e=>r.numberCoins=e)),t:e.p({background:"#03ABA8",modelValue:r.numberCoins}),v:""===r.numberCoins&&!0===r.Hint},(""===r.numberCoins&&r.Hint,{}),{w:e.o$1((e=>r.datetimesingle=e)),x:e.p({type:"datetime","hide-second":"true",modelValue:r.datetimesingle}),y:""===r.datetimesingle&&!0===r.Hint},(""===r.datetimesingle&&r.Hint,{}),{z:e.o$1((e=>r.session=e)),A:e.p({background:"#03ABA8",modelValue:r.session}),B:""===r.session&&!0===r.Hint},(""===r.session&&r.Hint,{}),{C:e.o$1((e=>r.remarks=e)),D:e.p({type:"textarea",placeholder:"备注",modelValue:r.remarks}),E:e.o$1((e=>a.Publish())),F:e.o$1((()=>{})),G:e.n(r.Display?"create-module":"close-animation "),H:e.o$1((e=>a.open()))}):{})}],["__scopeId","data-v-9a5e06a4"]]);exports.MiniProgramPage=o;
|