Files
tk-mini-program/unpackage/dist/build/mp-weixin/NewAddedPk.js
pengxiaolong 8ec7365e7c 优化页面
2025-06-16 22:09:12 +08:00

2 lines
6.0 KiB
JavaScript

"use strict";const e=require("./common/vendor.js"),n=require("./components/NationalDictionary.js"),t=require("./components/request.js"),i={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:"",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,this.close()):e.index.showToast({title:"请选择主播",icon:"none",duration:2e3})},Select(e,n){this.selectedId!==e?(this.selectedId=e,this.selectedIddata=n):(this.selectedId=null,this.selectedIddata=null)},getAnchorList(){t.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,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:"https://python.yolojt.com/api/"+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);if(this.remarks.includes(this.nameAnchor))return void e.index.showToast({title:"备注中不能包含主播昵称",icon:"none",duration:2e3});const n=this.datetimesingle.replace(" ","T"),i=Date.parse(n);if(isNaN(i))throw new Error(`Invalid date format: ${this.datetimesingle}`);this.sendingTime=Math.floor(i/1e3);const o=Math.floor(Date.now()/1e3);if(this.sendingTime<o)return void e.index.showToast({title:"日期不能早于当前时间",icon:"none",duration:2e3});e.index.showLoading({title:"发布中...",mask:!0});200===(await t.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")+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 o=e._export_sfc(i,[["render",function(n,t,i,o,s,r){return e.e({a:s.Display},s.Display?e.e({b:e.o$1((e=>r.open())),c:e.o$1(((...e)=>n.NameAnchor&&n.NameAnchor(...e))),d:e.o$1(((...e)=>r.blur&&r.blur(...e))),e:s.nameAnchor,f:""===s.nameAnchor&&!0===s.Hint},(""===s.nameAnchor&&s.Hint,{}),{g:e.o$1(((...e)=>r.chooseMyStreamer&&r.chooseMyStreamer(...e))),h:e.o$1(r.country),i:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:s.Country,filterable:s.filterable,placeholder:"请选择国家"}),j:""===s.countrys&&!0===s.Hint},(""===s.countrys&&s.Hint,{}),{k:e.o$1(r.gender),l:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:s.Gender,placeholder:"性别"}),m:0===s.genders},(s.genders,{}),{n:1===s.genders},(s.genders,{}),{o:2===s.genders},(s.genders,{}),{p:0===s.genders&&!0===s.Hint},(0===s.genders&&s.Hint,{}),{q:e.o$1((e=>s.numberCoins=e)),r:e.p({max:9999999999,background:"#03ABA8",modelValue:s.numberCoins}),s:""===s.numberCoins&&!0===s.Hint},(""===s.numberCoins&&s.Hint,{}),{t:e.o$1((e=>s.datetimesingle=e)),v:e.p({type:"datetime","hide-second":"true",modelValue:s.datetimesingle}),w:""===s.datetimesingle&&!0===s.Hint},(""===s.datetimesingle&&s.Hint,{}),{x:e.o$1((e=>s.session=e)),y:e.p({background:"#03ABA8",modelValue:s.session}),z:""===s.session&&!0===s.Hint},(""===s.session&&s.Hint,{}),{A:e.o$1((e=>s.remarks=e)),B:e.p({type:"textarea",placeholder:"备注",maxlength:"-1",modelValue:s.remarks}),C:e.o$1((e=>r.Publish())),D:e.o$1((()=>{})),E:e.n(s.Display?"create-module":"close-animation "),F:e.o$1((e=>r.open()))}):{},{G:0!==s.AnchorList.length},0!==s.AnchorList.length?{H:e.f(s.AnchorList,((n,t,i)=>({a:n.headerIcon,b:e.t(n.anchorId),c:e.t(n.country),d:e.o$1((e=>r.Select(n.id,n)),t),e:s.selectedId===n.id?"#f6f6f6":"#ffffff",f:t})))}:{},{I:0===s.AnchorList.length},(s.AnchorList.length,{}),{J:e.o$1((e=>r.invite())),K:e.o$1((e=>r.close())),L:e.sr("popup","48ce7947-6"),M:e.p({type:"center","border-radius":"10px 10px 0 0"})})}],["__scopeId","data-v-48ce7947"]]);exports.MiniProgramPage=o;