2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
|
|
import{c as s,g as e,v as t,h as a,s as i,x as l,y as o,z as n,b as u,A as r,r as p,e as c,f as h,w as d,i as g,j as m,o as f,k as _,l as A,m as k,p as y,q as T,u as C,F as U,t as b,B as x,C as D,D as B}from"./index-759PoYgM.js";import{_ as v}from"./uni-easyinput.C4HErVdH.js";import{r as w}from"./uni-app.es.Hulr8kk-.js";import{_ as S,a as V}from"./uni-popup.DAsKHQxH.js";import{n as I}from"./nav.BBjj-z52.js";import{l as j}from"./logo.DDDG-929.js";import{l as O}from"./logout.q3EjtEfG.js";import{_ as z}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.BNs6RC_T.js";const L=z({components:{navBar:I},data:()=>({searchValue:"",noUnionImage:s.not_unionUrl,baseBgUrl:s.new_unionUrl,unionBgUrl:s.unicon_url,logo:j,logout:O,loading:!1,noMore:!1,isMerber:null,listData:[],UnionByUser:null,statusBarHeight:0,ThemeData:null,isAuth:!1,isLeader:!1,isHasUnicon:!1,messageContent:"",popupStstus:0,messageText:"",msgType:"success",detailData:null,lastRefreshTime:0}),onShow(s){e("token")?(e("BarHeight")&&(this.statusBarHeight=e("BarHeight")),e("Theme_Data")&&(this.ThemeData=JSON.parse(e("Theme_Data"))),this.refreshUserInfo(),s&&s.guild_id&&(this.searchValue=s.guild_id,this.getUnionList(s.guild_id))):t()},methods:{async refreshUserInfo(s=!1){const t=Date.now();if(!s&&t-this.lastRefreshTime<3e3)console.log("跳过频繁刷新");else try{const s=await a.get("/api/User/get_user_info",{token:e("token")||""});s.code&&(this.isAuth=s.data.auth||!1,i("user_auth_status",this.isAuth),this.lastRefreshTime=t)}catch(l){console.error("获取用户信息失败:",l),this.isAuth=e("user_auth_status")||!1}},async getUnionList(s){this.loading=!0,a.get("/api/Guild/guild_list",{page:1,limit:1e3,search_id:s,token:e("token")||""}).then((s=>{const{data:e,code:t}=s;t&&(this.loading=!1,this.listData=e.list||[])})).catch((s=>{this.loading=!1}))},search(){this.searchValue&&this.getUnionList(this.searchValue)},async applyUnion(s){l({title:"检查实名状态...",mask:!0});try{const t=await a.get("/api/User/get_user_info",{token:e("token")||""});if(o(),t.code){const e=t.data.auth||!1;this.isAuth=e,this.lastRefreshTime=Date.now(),i("user_auth_status",e),e?(this.detailData=s,this.popupStstus=1,this.messageContent="是否选择加入当前公会",this.$refs.popup.open("center")):(this.detailData=s,this.popupStstus=3,this.messageContent="当前尚未实名认证,是否跳转到实名认证页面?",this.$refs.popup.open("center"))}else n({title:t.msg||"获取用户信息失败",icon:"none",duration:2e3})}catch(t){o(),console.error("获取用户信息失败:",t),this.messageText="请求失败,请重试!",this.msgType="error",this.$refs.message.open()}},closePopup(){this.popupStstus=null,this.detailData=null,this.messageContent="",this.$refs.popup.close()},confirmPopup(){null!==this.popupStstus&&(1===this.popupStstus?this.joinUnionize():3===this.popupStstus&&this.authConfirm())},authConfirm(){const s=u().platform;"ios"===s?window.webkit.messageHandlers.nativeHandler.postMessage({action:"enterAuthent"}):"android"===s&&window.Android.enterAuthent(),this.closePopup(),n({title:"请完成实名认证后返回",icon:"none",duration:3e3})},async joinUnionize(){a.post("/api/Guild/join_guild",{guild_id:this.detailData.id,token:e("token")||""}).then((s=>{const{data:e,code:a,msg:i}=s;a?(this.messageText="加入成功",this.$refs.message.open(),this.msgType="success",r("refreshList"),t()):(this.messageText=i,this.msgType="error",this.$refs.message.open()),this.closePopup()}))}}},[["render",function(s,e,t,a,i,l){const o=m,n=p("navBar"),r=w(c("uni-easyinput"),v),I=w(c("uni-popup-message"),S),j=w(c("uni-popup"),V);return f(),h(o,{class:"view-page",style:g({backgroundImage:`url('${i.ThemeData?i.ThemeData.app_bg:i.baseBgUrl}')`})},{default:d((()=>[_(n,{style:g({marginTop:`${i.statusBarHeight}${"ios"===u().platform?"px":"dp"}`}),navTitle:"公会中心"},{rightView:d((()=>[i.isHasUnicon&&!i.isLeader?(f(),h(o,{key:0,class:"icon-right flex-line",onClick:s.exit},{default:d((()=>[A("img",{src:i.logout,alt:""},null,8,["src"])])),_:1},8,["onClick"])):k("",!0)])),_:1},8,["style"]),_(o,{
|