Files
t-admin/unpackage/dist/build/web/assets/pages-uni-stat-page-ent-page-ent.BdcW4q6r.js
T
2025-06-13 21:16:12 +08:00

2 lines
8.7 KiB
JavaScript

import{_ as e,e as t,n as a,r as i,a as l,c as n,w as s,i as o,am as r,E as u,b as d,d as p,f as c,g as m,o as h,h as g,j as f,a0 as _,q as y,k as b,l as v,F as q,aq as D,t as C}from"./index-CS85kPhe.js";import{_ as x}from"./uni-stat-breadcrumb.xQt2SQkt.js";import{_ as T}from"./uni-data-select.CTvmxnrn.js";import{_ as w}from"./uni-stat-tabs.BqxEYTBM.js";import{_ as V}from"./uni-stat-panel.BC5-OoT8.js";import{_ as k}from"./uni-tooltip.Bon-gzRk.js";import{_ as P}from"./uni-pagination.b7xQ_-xQ.js";import{s as z,d as j,g as M,a as S,b as A,m as B}from"./util.BgZN-4QF.js";const U=[{title:"入口页",field:"path",tooltip:"设备进入应用访问的第一个页面,例如设备从页面1进入应用,跳转到页面2,1为入口页,而2不是"},{title:"页面名称",field:"title"},{title:"访问次数",field:"visit_times",tooltip:"访问过应用内任意页面总次数,多个页面之间跳转、同一页面的重复访问计为多次访问",value:0},{title:"入口页次数",field:"entry_count",tooltip:"作为访问会话第一个访问页面(即着陆页)的次数",value:0},{title:"跳出率",field:"bounce_rate",formatter:"%%",tooltip:"只浏览一个页面便离开应用的次数占总启动次数的百分比",value:0,stat:"avg"},{title:"访问总时长(秒)",field:"duration",disabled:!0},{title:"次均停留时长",field:"avg_device_session_time",computed:"duration/visit_times",formatter:":",tooltip:"平均每次打开应用停留在应用内的总时长,即应用停留总时长/启动次数",value:0},{title:"设备平均停留时长 ",field:"avg_user_time",computed:"duration/visit_devices",formatter:":",tooltip:"平均每个设备停留在应用内的总时长,即应用停留总时长/访问设备数",value:0}];const O=e({data:()=>({fieldsMap:U,query:{dimension:"day",appid:"",platform_id:"",uni_platform:"",version_id:"",channel_id:"",start_time:[]},options:{pageSize:20,pageCurrent:1,total:0},loading:!1,currentDateTab:1,tableData:[],panelData:U.filter((e=>e.hasOwnProperty("value"))),channelData:[],errorMessage:""}),computed:{channelQuery(){const e=this.query.platform_id;return z({platform_id:e})},versionQuery(){const{appid:e,uni_platform:t}=this.query;return z({appid:e,uni_platform:t})}},created(){this.debounceGet=j((()=>this.getAllData())),this.getChannelData()},watch:{query:{deep:!0,handler(e){this.options.pageCurrent=1,this.debounceGet()}}},methods:{useDatetimePicker(){this.currentDateTab=-1},changeAppid(e){this.getChannelData(e,!1)},changePlatform(e,t,a,i){this.getChannelData(null,e),this.query.version_id=0,this.query.uni_platform=i.code},changeTimeRange(e,t){this.currentDateTab=t;const a=M(e),i=M(0)-1;this.query.start_time=[a,i]},changePageCurrent(e){this.options.pageCurrent=e.current,this.getTableData()},changePageSize(e){this.options.pageSize=e,this.options.pageCurrent=1,this.getTableData()},getAllData(){this.getPanelData(),this.getTableData()},getTableData(e){if(!this.query.appid)return void(this.errorMessage="请先选择应用");this.errorMessage="",e=z(this.query,null,["uni_platform"]);const{pageCurrent:a}=this.options;this.loading=!0;const i=t.database(),l=z({appid:this.query.appid}),n=i.collection("uni-stat-pages").where(l).getTemp(),s=i.collection("uni-stat-page-result").where(e+" && entry_count > 0").getTemp();i.collection(s,n).field(`${S(U)}, stat_date, page_id`).groupBy("page_id").groupField(A(U)).orderBy("entry_count","desc").skip((a-1)*this.options.pageSize).limit(this.options.pageSize).get({getCount:!0}).then((e=>{const{count:t,data:a}=e.result;this.options.total=t,this.tableData=[];for(const i of a){const e=i.page_id;if(Array.isArray(e)){delete i.page_id;const t=e[0];if(t&&Object.keys(t).length)for(const e in t)"_id"!==e&&(i[e]=t[e])}B(U,i,i),this.tableData.push(i)}})).catch((e=>{console.error(e)})).finally((()=>{this.loading=!1}))},getPanelData(e=z(this.query,null,["uni_platform"])){if(!this.query.appid)return void(this.errorMessage="请先选择应用");this.errorMessage="";t.database().collection("uni-stat-page-result").where(e).field(S(U)).groupBy("appid").groupField(A(U)).orderBy("start_time","desc ").get().then((e=>{const t=e.result.data[0];this.panelData=[],this.panelData=B(U,t)}))},navTo(e){a({url:`/pages/uni-stat/overview/overview?id=${e}`})},getChannelData(e,a){this.query.channel_id="";const i=t.database(),l={};(e=e||this.query.appid)&&(l.appid=e),(a=a||this.query.platform_id)&&(l.platform_id=a);let n=i.collection("uni-stat-app-platforms").field("_id, name").getTemp(),s=i.collection("uni-stat-app-channels").where(l).field("_id, channel_name, create_time, platform_id").getTemp();i.collection(s,n).orderBy("platform_id","asc").get().then((e=>{let t=e.result.data,a=[];if(t.length>0){let e;for(let i in t)e=t[i].channel_name?t[i].channel_name:"默认",t[i].platform_id.length>0&&(e=t[i].platform_id[0].name+"-"+e),a.push({value:t[i]._id,text:e})}this.channelData=a})).catch((e=>{console.error(e)})).finally((()=>{}))}}},[["render",function(e,t,a,z,j,M){const S=i(l("uni-stat-breadcrumb"),x),A=o,B=i(l("uni-data-select"),T),U=i(l("uni-stat-tabs"),w),O=i(l("uni-datetime-picker"),r),Q=i(l("uni-stat-panel"),V),F=i(l("uni-icons"),u),I=i(l("uni-tooltip"),k),$=i(l("uni-th"),d),E=i(l("uni-tr"),p),G=i(l("uni-td"),c),L=i(l("uni-table"),m),R=i(l("uni-pagination"),P);return h(),n(A,{class:"fix-top-window"},{default:s((()=>[g(A,{class:"uni-header"},{default:s((()=>[g(S,{class:"uni-stat-breadcrumb-on-phone"}),g(A,{class:"uni-group"},{default:s((()=>[g(A,{class:"uni-sub-title hide-on-phone"},{default:s((()=>[f("入口页数据分析")])),_:1})])),_:1})])),_:1}),g(A,{class:"uni-container"},{default:s((()=>[g(A,{class:"uni-stat--x flex p-1015"},{default:s((()=>[g(A,{class:"uni-stat--app-select"},{default:s((()=>[g(B,{collection:"opendb-app-list",field:"appid as value, name as text",orderby:"text asc",defItem:1,label:"应用选择",modelValue:j.query.appid,"onUpdate:modelValue":t[0]||(t[0]=e=>j.query.appid=e),clear:!1},null,8,["modelValue"]),g(B,{collection:"opendb-app-versions",where:M.versionQuery,class:"ml-m",field:"_id as value, version as text, uni_platform as label, create_date as date",format:"{label} - {text}",orderby:"date desc",label:"版本选择",modelValue:j.query.version_id,"onUpdate:modelValue":t[1]||(t[1]=e=>j.query.version_id=e)},null,8,["where","modelValue"])])),_:1})])),_:1}),g(A,{class:"uni-stat--x flex"},{default:s((()=>[g(U,{label:"日期选择",current:j.currentDateTab,mode:"date",onChange:M.changeTimeRange},null,8,["current","onChange"]),g(O,{type:"datetimerange",end:(new Date).getTime(),modelValue:j.query.start_time,"onUpdate:modelValue":t[2]||(t[2]=e=>j.query.start_time=e),returnType:"timestamp",clearIcon:!1,class:_(["uni-stat-datetime-picker",{"uni-stat__actived":j.currentDateTab<0&&!!j.query.start_time.length}]),onChange:M.useDatetimePicker},null,8,["end","modelValue","class","onChange"])])),_:1}),g(A,{class:"uni-stat--x"},{default:s((()=>[g(U,{label:"平台选择",type:"boldLine",mode:"platform",modelValue:j.query.platform_id,"onUpdate:modelValue":t[3]||(t[3]=e=>j.query.platform_id=e),onChange:M.changePlatform},null,8,["modelValue","onChange"]),j.query.platform_id&&-1===j.query.platform_id.indexOf("==")?(h(),n(B,{key:0,ref:"version-select",collection:"uni-stat-app-channels",where:M.channelQuery,class:"p-channel",field:"_id as value, channel_name as text",orderby:"text asc",label:"渠道/场景值选择",modelValue:j.query.channel_id,"onUpdate:modelValue":t[4]||(t[4]=e=>j.query.channel_id=e)},null,8,["where","modelValue"])):y("",!0)])),_:1}),g(Q,{items:j.panelData},null,8,["items"]),g(A,{class:"uni-stat--x p-m"},{default:s((()=>[g(L,{loading:j.loading,border:"",stripe:"",emptyText:j.errorMessage||e.$t("common.empty")},{default:s((()=>[g(E,null,{default:s((()=>[(h(!0),b(q,null,v(j.fieldsMap,((e,t)=>(h(),b(q,{key:t},[e.title?(h(),n($,{key:t,align:"center"},{default:s((()=>[g(I,null,D({default:s((()=>[f(C(e.title)+" ",1),0===t&&e.tooltip?(h(),n(F,{key:0,type:"help",color:"#666"})):y("",!0)])),_:2},[0===t&&e.tooltip?{name:"content",fn:s((()=>[g(A,{class:"uni-stat-tooltip-s"},{default:s((()=>[f(C(e.tooltip),1)])),_:2},1024)])),key:"0"}:void 0]),1024)])),_:2},1024)):y("",!0)],64)))),128))])),_:1}),(h(!0),b(q,null,v(j.tableData,((e,t)=>(h(),n(E,{key:t},{default:s((()=>[(h(!0),b(q,null,v(j.fieldsMap,((t,a)=>(h(),n(G,{align:0===a?"left":"center",key:a},{default:s((()=>[f(C(void 0!==e[t.field]?e[t.field]:"-"),1)])),_:2},1032,["align"])))),128))])),_:2},1024)))),128))])),_:1},8,["loading","emptyText"]),g(A,{class:"uni-pagination-box"},{default:s((()=>[g(R,{"show-icon":"","show-page-size":"","page-size":j.options.pageSize,current:j.options.pageCurrent,total:j.options.total,onChange:M.changePageCurrent,onPageSizeChange:M.changePageSize},null,8,["page-size","current","total","onChange","onPageSizeChange"])])),_:1})])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-dceffbfc"]]);export{O as default};