2 lines
6.6 KiB
JavaScript
2 lines
6.6 KiB
JavaScript
"use strict";const e=require("./common/vendor.js"),n=require("./components/NationalDictionary.js"),t=require("./components/request.js"),i=require("./components/formatDate.js"),s={data:()=>({genders:"",Gender:[{label:"男",value:1},{label:"女",value:2}],Country:n.optionsArray,countrys:"",nameAnchor:"",numberCoins:"",session:"",remarks:"",Display:!1,Hint:!1,datetimesingle:"",id:"",sendingTime:"",filterable:!0,AnchorList:[],selectedId:null,selectedIddata:null,AnchorProfilePicture:"",senderId:""}),props:{message:{type:Object}},watch:{message(e,n){this.numberCoins=e.coin,this.session=e.pkNumber,this.remarks=e.remark,this.datetimesingle=i.formatDate(e.pkTime),this.id=e.id,this.nameAnchor=e.anchorId,this.countrys=e.country,this.genders="1"===e.sex?1:2,this.AnchorProfilePicture=e.anchorIcon.split("/").pop(),this.senderId=e.senderId}},methods:{close(){this.$refs.popup.close()},invite(){this.selectedId?(this.nameAnchor=this.selectedIddata.anchorId,this.AnchorProfilePicture=this.selectedIddata.headerIcon,this.genders=this.selectedIddata.gender,this.countrys=this.selectedIddata.country,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},country(e){this.countrys=e.value},open(){this.Display?(this.Display=!1,this.Hint=!1):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&&null==this.nameAnchor||0==this.genders&&null==this.genders||""==this.numberCoins&&null==this.numberCoins||""==this.datetimesingle&&null==this.datetimesingle||""==this.countrys&&null==his.countrys||""==this.datetimesingle&&null==this.datetimesingle||""==this.session&&null==this.session)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 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 t.request({url:"pk/updatePkInfoById",method:"POST",data:{id:this.id,anchorId:this.nameAnchor,pkTime:this.sendingTime,sex:this.genders,country:this.countrys,coin:this.numberCoins,remark:this.remarks,senderId:this.senderId,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="",e.index.hideLoading(),this.$emit("Refresh"),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(s,[["render",function(n,t,i,s,o,r){return e.e({a:o.Display},o.Display?e.e({b:e.o((e=>r.open())),c:e.o(((...e)=>n.NameAnchor&&n.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.o(r.blur),j:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Country,filterable:o.filterable,placeholder:"请选择国家",value:o.countrys}),k:""===o.countrys||null===o.countrys&&!0===o.Hint},(""===o.countrys||null===o.countrys&&o.Hint,{}),{l:e.o(r.gender),m:e.p({backgroundColor:"#ffffff",placeholderColor:"#666666",textColor:"#666666",borderColor:"#ffffff",options:o.Gender,placeholder:"性别",value:o.genders}),n:0===o.genders},(o.genders,{}),{o:1===o.genders},(o.genders,{}),{p:2===o.genders},(o.genders,{}),{q:0===o.genders||null===o.genders&&!0===o.Hint},(0===o.genders||null===o.genders&&o.Hint,{}),{r:e.o((e=>o.numberCoins=e)),s:e.p({max:9999999999,background:"#03ABA8",modelValue:o.numberCoins}),t:""===o.numberCoins||null===o.numberCoins&&!0===o.Hint},(""===o.numberCoins||null===o.numberCoins&&o.Hint,{}),{v:e.o((e=>o.datetimesingle=e)),w:e.p({type:"datetime","hide-second":"true",modelValue:o.datetimesingle}),x:""===o.datetimesingle||null===o.datetimesingle&&!0===o.Hint},(""===o.datetimesingle||null===o.datetimesingle&&o.Hint,{}),{y:e.o((e=>o.session=e)),z:e.p({background:"#03ABA8",modelValue:o.session}),A:""===o.session||null===o.session&&!0===o.Hint},(""===o.session||null===o.session&&o.Hint,{}),{B:e.o((e=>o.remarks=e)),C:e.p({type:"textarea",placeholder:"备注",modelValue:o.remarks}),D:e.o((e=>r.Publish())),E:e.o((()=>{})),F:e.n(o.Display?"create-module":"close-animation "),G:e.o((e=>r.open()))}):{},{H:0!==o.AnchorList.length},0!==o.AnchorList.length?{I:e.f(o.AnchorList,((n,t,i)=>({a:n.headerIcon,b:e.t(n.anchorId),c:e.t(n.country),d:e.o((e=>r.Select(n.id,n)),t),e:o.selectedId===n.id?"#b8ff8c74":"#ffffff",f:t})))}:{},{J:0===o.AnchorList.length},(o.AnchorList.length,{}),{K:e.o((e=>r.invite())),L:e.o((e=>r.close())),M:e.sr("popup","a01de091-6"),N:e.p({type:"center","border-radius":"10px 10px 0 0"})})}],["__scopeId","data-v-a01de091"]]);exports.MiniProgramPage=o;
|