pages-uni-stat-page-ent-page-ent.DQF6TaZN.js 8.7 KB

12
  1. import{_ as e,W as t,n as a,r as i,a as l,o as n,c as s,w as o,i as r,aD as u,A as d,b as p,d as c,e as h,f as m,g,j as f,z as _,h as y,k as b,l as v,F as D,ap as q,t as C}from"./index-BAMs4g2N.js";import{_ as x}from"./uni-stat-breadcrumb.BZcF2zJw.js";import{_ as T}from"./uni-data-select.UeW2d6Yw.js";import{_ as w}from"./uni-stat-tabs.SY9F3mAw.js";import{_ as V}from"./uni-stat-panel.X3T1D0jX.js";import{_ as k}from"./uni-tooltip.BDlhxQuq.js";import{_ as z}from"./uni-pagination.7SrZmsZK.js";import{s as P,d as j,g as M,a as S,b as A,m as B}from"./util.BXBhmNoy.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 F=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 P({platform_id:e})},versionQuery(){const{appid:e,uni_platform:t}=this.query;return P({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=P(this.query,null,["uni_platform"]);const{pageCurrent:a}=this.options;this.loading=!0;const i=t.database(),l=P({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=P(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,P,j,M){const S=i(l("uni-stat-breadcrumb"),x),A=r,B=i(l("uni-data-select"),T),U=i(l("uni-stat-tabs"),w),F=i(l("uni-datetime-picker"),u),I=i(l("uni-stat-panel"),V),Q=i(l("uni-icons"),d),O=i(l("uni-tooltip"),k),$=i(l("uni-th"),p),G=i(l("uni-tr"),c),R=i(l("uni-td"),h),L=i(l("uni-table"),m),W=i(l("uni-pagination"),z);return n(),s(A,{class:"fix-top-window"},{default:o((()=>[g(A,{class:"uni-header"},{default:o((()=>[g(S,{class:"uni-stat-breadcrumb-on-phone"}),g(A,{class:"uni-group"},{default:o((()=>[g(A,{class:"uni-sub-title hide-on-phone"},{default:o((()=>[f("入口页数据分析")])),_:1})])),_:1})])),_:1}),g(A,{class:"uni-container"},{default:o((()=>[g(A,{class:"uni-stat--x flex p-1015"},{default:o((()=>[g(A,{class:"uni-stat--app-select"},{default:o((()=>[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:o((()=>[g(U,{label:"日期选择",current:j.currentDateTab,mode:"date",onChange:M.changeTimeRange},null,8,["current","onChange"]),g(F,{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:o((()=>[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("==")?(n(),s(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(I,{items:j.panelData},null,8,["items"]),g(A,{class:"uni-stat--x p-m"},{default:o((()=>[g(L,{loading:j.loading,border:"",stripe:"",emptyText:j.errorMessage||e.$t("common.empty")},{default:o((()=>[g(G,null,{default:o((()=>[(n(!0),b(D,null,v(j.fieldsMap,((e,t)=>(n(),b(D,{key:t},[e.title?(n(),s($,{key:t,align:"center"},{default:o((()=>[g(O,null,q({default:o((()=>[f(C(e.title)+" ",1),0===t&&e.tooltip?(n(),s(Q,{key:0,type:"help",color:"#666"})):y("",!0)])),_:2},[0===t&&e.tooltip?{name:"content",fn:o((()=>[g(A,{class:"uni-stat-tooltip-s"},{default:o((()=>[f(C(e.tooltip),1)])),_:2},1024)])),key:"0"}:void 0]),1024)])),_:2},1024)):y("",!0)],64)))),128))])),_:1}),(n(!0),b(D,null,v(j.tableData,((e,t)=>(n(),s(G,{key:t},{default:o((()=>[(n(!0),b(D,null,v(j.fieldsMap,((t,a)=>(n(),s(R,{align:0===a?"left":"center",key:a},{default:o((()=>[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:o((()=>[g(W,{"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{F as default};