Files
t-admin/unpackage/dist/build/web/assets/uni_modules-uni-upgrade-center-pages-version-list.DmuEBHVC.js
T
2025-06-13 21:16:12 +08:00

2 lines
8.2 KiB
JavaScript

import{_ as e,e as t,B as a,C as i,n as s,D as n,s as l,r as o,a as r,c as d,w as p,i as u,E as c,b as h,d as f,f as g,g as m,o as _,h as y,j as b,t as w,k as x,l as A,F as v,G as I,H as C,J as k,I as L,m as T,x as D}from"./index-CS85kPhe.js";import{_ as N}from"./uni-data-picker.DxvbsPEd.js";import{_ as E}from"./uni-dateformat.AFBZPd5V.js";import{_ as j}from"./uni-pagination.b7xQ_-xQ.js";import{_ as z}from"./unicloud-db.CIw_Ucsr.js";import{a as M,e as V,d as $,b as O}from"./utils.Cmulk4oG.js";import"./uni-load-more.zWziKaqT.js";const S=t.database(),R=S.command,q=["name","title","stable_publish","type"];function U(e={}){return{create_env:R.neq("uni-stat"),...e}}const B=e({data:()=>({backButtonHover:!1,appVersionListDbName:M,currentAppid:"",currentAppName:"",query:"",where:"",orderby:"stable_publish desc,create_date desc",selectedIndexs:[],options:{pageSize:20,pageCurrent:1,...V},imageStyles:{width:64,height:64},loaded:!1,containerTop:{},appList:[],showAppIndex:0}),async onLoad({appid:e}){await this.getAppList(),this.appList.length?(this.loaded=!0,this.appList.forEach(((t,a)=>{(t.appid===e||$)&&(this.showAppIndex=a)})),this.setAppInfo(this.showAppIndex),this.where=U({appid:this.currentAppid})):this.showModalToAppManager()},computed:{...a("app",["appid"]),appNameList(){return this.appList.map((e=>e.name))}},watch:{showAppIndex(e){this.setAppInfo(e),this.where=U({appid:this.currentAppid})}},onReady(){this.containerTop.height=`${document.documentElement?document.documentElement.clientHeight:window.innerHeight}px`},methods:{setAppInfo(e){this.currentAppid=this.appList[e].appid,this.currentAppName=this.appList[e].name},navigateBack(){i()},getWhere(){const e=this.query.trim();if(!e)return"";const t=new RegExp(e,"i");return q.map((e=>t+".test("+e+")")).join(" || ")},search(){const e=this.getWhere(),t=e===this.where;this.where=e,this.where&&(this.where=`(${this.where}) && `),this.where+=`${new RegExp(this.currentAppid,"i")}.test(appid)`,t&&this.loadData()},loadData(e=!0){this.$refs.udb.loadData({clear:e})},onPageChanged(e){this.$refs.udb.loadData({current:e.current})},navigateTo(e,t){s({url:e,events:{refreshData:()=>{this.loadData(t)}}})},selectedItems(){let e=this.$refs.udb.dataList;return this.selectedIndexs.map((t=>e[t]._id))},delTable(){this.$refs.udb.remove(this.selectedItems())},selectionChange(e){this.selectedIndexs=e.detail.index},confirmDelete(e){this.$refs.udb.remove(e)},publish(e){const{top:t,left:a,width:i,height:s}=document.querySelector(".uni-button.publish").getBoundingClientRect(),l=Object.keys(this.options.type_valuetotext);n({itemList:Object.values(this.options.type_valuetotext),popover:{top:t+s,left:a,width:i},success:async e=>{this.navigateTo(`./add?appid=${this.currentAppid}&name=${this.currentAppName}&type=${l[e.tapIndex]}`)}})},async getAppList(){try{const{result:e}=await S.collection(O).get();e&&e.data&&e.data.length>0?this.appList=e.data.filter((e=>e.appid!==this.appid)):this.showModalToAppManager()}catch(e){-1===["TOKEN_INVALID_TOKEN_EXPIRED","TOKEN_INVALID_ANONYMOUS_USER"].indexOf(e.code)&&this.showModalToAppManager()}},showModalToAppManager(){let e=null,t=3;function a(){s({url:"/pages/system/app/list"}),clearInterval(e)}e=setInterval((()=>{--t<=0&&a()}),1e3),l({title:"请先添加应用",content:"即将跳转至应用管理……",showCancel:!1,confirmText:"立即跳转",success:e=>a()})},store_list_key(e){const t=e?e.filter((e=>e.enable)):[];return t.length?t.sort(((e,t)=>t.priority-e.priority)).map((e=>e.name)).join(","):"-"}}},[["render",function(e,t,a,i,s,n){const l=u,M=o(r("uni-icons"),c),V=k,$=L,O=T,S=o(r("uni-th"),h),R=o(r("uni-tr"),f),q=o(r("uni-td"),g),U=D,B=o(r("uni-data-picker"),N),H=o(r("uni-dateformat"),E),K=o(r("uni-table"),m),P=o(r("uni-pagination"),j),F=o(r("unicloud-db"),z);return _(),d(l,{class:"main"},{default:p((()=>[s.loaded?(_(),d(l,{key:0},{default:p((()=>[y(l,{class:"uni-header"},{default:p((()=>[y(l,{class:"uni-group"},{default:p((()=>[y(l,{class:"uni-sub-title"},{default:p((()=>[b("当前应用:")])),_:1}),y(l,{class:"uni-title app-list"},{default:p((()=>[y(V,{onChange:t[0]||(t[0]=e=>s.showAppIndex=e.detail.value),value:s.showAppIndex,range:n.appNameList},{default:p((()=>[y(l,{class:"uni-input",style:{"font-size":"14px"}},{default:p((()=>[b(w(n.appNameList[s.showAppIndex])+" ",1),y(M,{type:"bottom"})])),_:1})])),_:1},8,["value","range"])])),_:1})])),_:1}),y(l,{class:"uni-group"},{default:p((()=>[y($,{class:"uni-search",type:"text",modelValue:s.query,"onUpdate:modelValue":t[1]||(t[1]=e=>s.query=e),onConfirm:n.search,placeholder:"请输入搜索内容"},null,8,["modelValue","onConfirm"]),y(O,{class:"uni-button",type:"default",size:"mini",onClick:n.search},{default:p((()=>[b("搜索")])),_:1},8,["onClick"]),y(O,{class:"uni-button publish",type:"primary",size:"mini",onClick:n.publish},{default:p((()=>[b("发布新版")])),_:1},8,["onClick"]),y(O,{class:"uni-button",type:"warn",size:"mini",disabled:!s.selectedIndexs.length,onClick:n.delTable},{default:p((()=>[b("批量删除")])),_:1},8,["disabled","onClick"])])),_:1})])),_:1}),y(l,{class:"uni-container"},{default:p((()=>[y(F,{ref:"udb",collection:s.appVersionListDbName,field:"store_list,appid,contents,platform,type,version,min_uni_version,url,stable_publish,create_date,title,name",where:s.where,"page-data":"replace",orderby:s.orderby,getcount:!0,"page-size":s.options.pageSize,"page-current":s.options.pageCurrent,options:s.options},{default:p((({data:e,pagination:t,loading:a,error:i,options:s})=>[y(K,{style:{"overflow-y":"hidden"},loading:a,emptyText:i.message||"没有更多数据",border:"",stripe:"",type:"selection",onSelectionChange:n.selectionChange},{default:p((()=>[y(R,null,{default:p((()=>[y(S,{align:"center"},{default:p((()=>[b("AppID")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("更新标题")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("安装包类型")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("平台")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("已上架应用市场")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("版本号")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("安装包状态")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("上传时间")])),_:1}),y(S,{align:"center"},{default:p((()=>[b("操作")])),_:1})])),_:1}),(_(!0),x(v,null,A(e,((e,t)=>(_(),d(R,{key:t,disabled:e.stable_publish},{default:p((()=>[y(q,{align:"center"},{default:p((()=>[b(w(e.appid),1)])),_:2},1024),y(q,{align:"center"},{default:p((()=>[b(w(e.title||"-"),1)])),_:2},1024),y(q,{align:"center"},{default:p((()=>[y(U,{style:I({padding:"5px 8px",backgroundColor:"wgt"===e.type?"#f0f9eb":"#ecf5ff",color:"wgt"===e.type?"#67c23a":"#409eff",border:"1px solid "+("wgt"===e.type?"#e1f3d8":"#d9ecff"),borderRadius:"4px"})},{default:p((()=>[b(w(s.type_valuetotext[e.type]),1)])),_:2},1032,["style"])])),_:2},1024),y(q,{align:"center"},{default:p((()=>[y(B,{localdata:s.platform_valuetotext,value:e.platform,border:!1,readonly:!0,split:","},null,8,["localdata","value"])])),_:2},1024),y(q,{align:"center"},{default:p((()=>[y(U,null,{default:p((()=>[b(w(n.store_list_key(e.store_list)),1)])),_:2},1024)])),_:2},1024),y(q,{align:"center"},{default:p((()=>[b(w(e.version),1)])),_:2},1024),y(q,{align:"center"},{default:p((()=>[b(w(1==e.stable_publish?"已上线":"已下线"),1)])),_:2},1024),y(q,{align:"center"},{default:p((()=>[y(H,{format:"yyyy-MM-dd hh:mm:ss",date:e.create_date,threshold:[0,0]},null,8,["date"])])),_:2},1024),y(q,{align:"center"},{default:p((()=>[y(O,{onClick:t=>n.navigateTo("./detail?id="+e._id,!1),class:"uni-button",size:"mini",type:"primary"},{default:p((()=>[b("详情")])),_:2},1032,["onClick"])])),_:2},1024)])),_:2},1032,["disabled"])))),128))])),_:2},1032,["loading","emptyText","onSelectionChange"]),y(l,{class:"uni-pagination-box"},{default:p((()=>[y(P,{"show-icon":"","page-size":t.size,modelValue:t.current,"onUpdate:modelValue":e=>t.current=e,total:t.count,onChange:n.onPageChanged},null,8,["page-size","modelValue","onUpdate:modelValue","total","onChange"])])),_:2},1024)])),_:1},8,["collection","where","orderby","page-size","page-current","options"])])),_:1})])),_:1})):(_(),d(l,{key:1,class:"page-loading",style:I(s.containerTop)},{default:p((()=>[C("i",{class:"uni-icon_toast uni-loading"})])),_:1},8,["style"]))])),_:1})}],["__scopeId","data-v-9561d028"]]);export{B as default};