2 lines
6.1 KiB
JavaScript
2 lines
6.1 KiB
JavaScript
"use strict";const e=require("./common/vendor.js"),t=require("./components/NationalDictionary.js"),n=require("./components/request.js"),i={data:()=>({genders:0,Gender:[{label:"男",value:1},{label:"女",value:2}],Country:t.optionsArray,countrys:"",nameAnchor:"",numberCoins:"",session:"",remarks:"",Display:!1,Hint:!1,datetimesingle:"",id:null,sendingTime:"",filterable:!0,AnchorProfilePicture:"",AnchorList:[],selectedId:null,selectedIddata:null}),mounted(){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}})},methods:{close(){this.$refs.popup.close()},invite(){this.selectedId?(this.nameAnchor=this.selectedIddata.anchorId,this.AnchorProfilePicture=this.selectedIddata.headerIcon.split("/").pop(),this.genders=this.selectedIddata.gender,this.countrys=this.selectedIddata.country,this.close()):e.index.showToast({title:"请选择主播",icon:"none",duration:2e3})},Select(e,t){this.selectedId!==e?(this.selectedId=e,this.selectedIddata=t):(this.selectedId=null,this.selectedIddata=null)},getAnchorList(){n.request({url:"anchor/list",method:"POST",data:{id:this.id},userInfo:!0}).then((e=>{this.triggered=!1,200==e.code?this.AnchorList=e.data:console.log(e.msg)}))},chooseMyStreamer(){this.$refs.popup.open("center"),this.getAnchorList()},gender(e){this.genders=e.value},country(e){this.countrys=e.value},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(t){this.nameAnchor!==t.target.value&&(this.nameAnchor=t.target.value,e.index.showLoading({title:"正在验证主播",mask:!0}),e.index.request({url:"https://python.yolojt.com/api/"+this.nameAnchor,success:t=>{200===t.data.code?(e.index.hideLoading(),e.index.showToast({title:"查询成功",icon:"none",duration:3e3}),this.AnchorProfilePicture=t.data.data):(e.index.hideLoading(),e.index.showToast({title:"未查询到该主播",icon:"none",duration:3e3}))},fail:function(t){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);if(this.remarks.includes(this.nameAnchor))return void e.index.showToast({title:"备注中不能包含主播昵称",icon:"none",duration:2e3});const t=this.datetimesingle.replace(" ","T"),i=Date.parse(t);if(isNaN(i))throw new Error(`Invalid date format: ${this.datetimesingle}`);this.sendingTime=Math.floor(i/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});const o=await n.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});200===o.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}),this.$emit("publishSuccess")):(e.index.hideLoading(),e.index.showToast({title:o.msg,icon:"none",duration:2e3}))}}};if(!Array){(e.resolveComponent("wht-select")+e.resolveComponent("uni-number-box")+e.resolveComponent("uni-datetime-picker")+e.resolveComponent("uni-easyinput")+e.resolveComponent("uni-popup"))()}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")+(()=>"./uni_modules/uni-popup/components/uni-popup/uni-popup.js"))();const s=e._export_sfc(i,[["render",function(t,n,i,s,o,r){return e.e({a:o.Display},o.Display?e.e({b:e.o((e=>r.open())),c:e.o(((...e)=>t.NameAnchor&&t.NameAnchor(...e))),d:e.o(((...e)=>r.blur&&r.blur(...e))),e:o.nameAnchor,f:""===o.nameAnchor&&!0===o.Hint},(""===o.nameAnchor&&o.Hint,{}),{g:e.o(((...e)=>r.chooseMyStreamer&&r.chooseMyStreamer(...e))),h:e.o(r.country),i:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Country,filterable:o.filterable,placeholder:"请选择国家",value:o.countrys}),j:""===o.countrys&&!0===o.Hint},(""===o.countrys&&o.Hint,{}),{k:e.o(r.gender),l:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Gender,placeholder:"性别",value:o.genders}),m:0===o.genders},(o.genders,{}),{n:1===o.genders},(o.genders,{}),{o:2===o.genders},(o.genders,{}),{p:0===o.genders&&!0===o.Hint},(0===o.genders&&o.Hint,{}),{q:e.o((e=>o.numberCoins=e)),r:e.p({max:9999999999,background:"#03ABA8",modelValue:o.numberCoins}),s:""===o.numberCoins&&!0===o.Hint},(""===o.numberCoins&&o.Hint,{}),{t:e.o((e=>o.datetimesingle=e)),v:e.p({type:"datetime","hide-second":"true",modelValue:o.datetimesingle}),w:""===o.datetimesingle&&!0===o.Hint},(""===o.datetimesingle&&o.Hint,{}),{x:e.o((e=>o.session=e)),y:e.p({background:"#03ABA8",modelValue:o.session}),z:""===o.session&&!0===o.Hint},(""===o.session&&o.Hint,{}),{A:e.o((e=>o.remarks=e)),B:e.p({type:"textarea",placeholder:"备注",maxlength:"-1",modelValue:o.remarks}),C:e.o((e=>r.Publish())),D:e.o((()=>{})),E:e.n(o.Display?"create-module":"close-animation "),F:e.o((e=>r.open()))}):{},{G:0!==o.AnchorList.length},0!==o.AnchorList.length?{H:e.f(o.AnchorList,((t,n,i)=>({a:t.headerIcon,b:e.t(t.anchorId),c:e.t(t.country),d:e.o((e=>r.Select(t.id,t)),n),e:o.selectedId===t.id?"#b8ff8c74":"#ffffff",f:n})))}:{},{I:0===o.AnchorList.length},(o.AnchorList.length,{}),{J:e.o((e=>r.invite())),K:e.o((e=>r.close())),L:e.sr("popup","ce54c7bb-6"),M:e.p({type:"center","border-radius":"10px 10px 0 0"})})}],["__scopeId","data-v-ce54c7bb"]]);exports.MiniProgramPage=s;
|