"use strict";const t=require("../common/vendor.js"),e=require("../api/index.js"),s=t.defineStore("counter",{state:()=>({userId:"",userInfo:{inviteCode:"",nickname:"",mobile:"",avatar:"",puser:null,paywallet:{balance:0},userRights:null},tem_list:[],set_title:"",set_options:[],set_end_function:()=>{}}),actions:{setUserId(t){this.userId=t},setTemList(t=[]){this.tem_list=t},removeTemList(t){if(!t||0===this.tem_list.length)return;let e=this.tem_list.findIndex((e=>e._id===t));this.tem_list.splice(e,1)},updateTemList(t,e,s){if(!t||!e||0===this.tem_list.length)return;let i=this.tem_list.findIndex((e=>e._id===t)),n=this.tem_list[i];n[e]=s,this.tem_list.splice(i,1,n)},setOptions({set_title:e,set_options:s,set_end_function:i}){e||(e="设置"),s&&0!==s.length||(s=[{type:"input",list:[{title:"Breathe的主题配置一",value:"",type:"text"}]},{type:"switch",list:[{title:"自动（跟随系统）",value:!1}]},{type:"select",tip:"选择主题并应用到程序选择主题并应用到程序选择主题并应用到程序选择主题并应用到程序。",list:[{title:"默认",value:!0},{title:"暗黑",value:!1},{title:"激光红",value:!1},{title:"天空蓝",value:!1}]}]),i||(i=t=>{console.log("-------\x3e默认的set_end_function，e:",t)}),this.set_title=e,this.set_options=s,this.set_end_function=i;const{type:n,path:l}=s[0];if(1===s.length&&"select-list"===n)return t.index.navigateTo({url:l});t.index.navigateTo({url:"/pages-system/set/set-options"})},async syncStore(){},async logoutUser(){this.userInfo={inviteCode:"",nickname:"",mobile:"",avatar:"",paywallet:{balance:0}},t.index.clearStorage({success(){t.index.switchTab({url:"/pages/index/index"})},fail(t){console.error("清除缓存失败",t)}})},async usersGetInfo(){try{let t={};t=await e.api.usersGetInfo(),console.log(t),this.userInfo=t}catch(t){throw t}}}});exports.Store=s;
