智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
6.8 KiB

import{a4 as e,a5 as t,a6 as a,a7 as o,a8 as l,o as s,c as r,w as i,z as n,A as u,S as d,n as c,f as b,E as p,g as h,i as m,b as f,Q as g,R as y,_ as v,j as k,d as x,l as S,M as C,a9 as _,k as w,b4 as D,at as N,an as j,aq as I,a3 as O,u as A,F as B,b5 as P,a as $,ar as H}from"./index-ed377420.js";import{_ as V}from"./u-icon.d58f766c.js";import{_ as T}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as z}from"./u-tabbar.55e5eeef.js";const L=T({name:"u-badge",mixins:[t,{props:{isDot:{type:Boolean,default:()=>e.badge.isDot},value:{type:[Number,String],default:()=>e.badge.value},modelValue:{type:[Number,String],default:()=>e.badge.modelValue},show:{type:Boolean,default:()=>e.badge.show},max:{type:[Number,String],default:()=>e.badge.max},type:{type:String,default:()=>e.badge.type},showZero:{type:Boolean,default:()=>e.badge.showZero},bgColor:{type:[String,null],default:()=>e.badge.bgColor},color:{type:[String,null],default:()=>e.badge.color},shape:{type:String,default:()=>e.badge.shape},numberType:{type:String,default:()=>e.badge.numberType},offset:{type:Array,default:()=>e.badge.offset},inverted:{type:Boolean,default:()=>e.badge.inverted},absolute:{type:Boolean,default:()=>e.badge.absolute}}},a],computed:{boxStyle:()=>({}),badgeStyle(){const e={};if(this.color&&(e.color=this.color),this.bgColor&&!this.inverted&&(e.backgroundColor=this.bgColor),this.absolute&&(e.position="absolute",this.offset.length)){const t=this.offset[0],a=this.offset[1]||t;e.top=o(t),e.right=o(a)}return e},showValue(){switch(this.numberType){case"overflow":return Number(this.value)>Number(this.max)?this.max+"+":this.value;case"ellipsis":return Number(this.value)>Number(this.max)?"...":this.value;case"limit":return Number(this.value)>999?Number(this.value)>=9999?Math.floor(this.value/1e4*100)/100+"w":Math.floor(this.value/1e3*100)/100+"k":this.value;default:return Number(this.value)}}},methods:{addStyle:l}},[["render",function(e,t,a,o,l,h){const m=p;return e.show&&(0!==Number(e.value)||e.showZero||e.isDot)?(s(),r(m,{key:0,class:d([[e.isDot?"u-badge--dot":"u-badge--not-dot",e.inverted&&"u-badge--inverted","horn"===e.shape&&"u-badge--horn",`u-badge--${e.type}${e.inverted?"--inverted":""}`],"u-badge"]),style:c([h.addStyle(e.customStyle),h.badgeStyle])},{default:i((()=>[n(u(e.isDot?"":h.showValue),1)])),_:1},8,["class","style"])):b("v-if",!0)}],["__scopeId","data-v-0e56696e"]]);const M=T({name:"u-tabbar-item",mixins:[t,a,{props:{name:{type:[String,Number,null],default:()=>e.tabbarItem.name},icon:{icon:String,default:()=>e.tabbarItem.icon},badge:{type:[String,Number,null],default:()=>e.tabbarItem.badge},dot:{type:Boolean,default:()=>e.tabbarItem.dot},text:{type:String,default:()=>e.tabbarItem.text},badgeStyle:{type:[Object,String],default:()=>e.tabbarItem.badgeStyle}}}],data:()=>({isActive:!1,parentData:{value:null,activeColor:"",inactiveColor:""}}),options:{virtualHost:!0},created(){this.init()},emits:["click","change"],methods:{addStyle:l,init(){this.updateParentData(),this.parent;const e=this.parent.children.indexOf(this);this.isActive=(this.name||e)===this.parentData.value},updateParentData(){this.getParentData("u-tabbar")},updateFromParent(){this.init()},clickHandler(){this.$nextTick((()=>{const e=this.parent.children.indexOf(this),t=this.name||e;t!==this.parent.value&&this.parent.$emit("change",t),this.$emit("click",t)}))}}},[["render",function(e,t,a,o,l,d){const b=h(m("u-icon"),V),x=h(m("u-badge"),L),S=k,C=p;return s(),r(S,{class:"u-tabbar-item cursor-pointer",style:c([d.addStyle(e.customStyle)]),onClick:d.clickHandler},{default:i((()=>[f(S,{class:"u-tabbar-item__icon"},{default:i((()=>[e.icon?(s(),r(b,{key:0,name:e.icon,color:l.isActive?l.parentData.activeColor:l.parentData.inactiveColor,size:20},null,8,["name","color"])):(s(),g(y,{key:1},[l.isActive?v(e.$slots,"active-icon",{key:0},void 0,!0):v(e.$slots,"inactive-icon",{key:1},void 0,!0)],64)),f(x,{absolute:"",offset:[0,e.dot?"34rpx":e.badge>9?"14rpx":"20rpx"],customStyle:e.badgeStyle,isDot:e.dot,value:e.badge||(e.dot?1:null),show:e.dot||e.badge>0},null,8,["offset","customStyle","isDot","value","show"])])),_:3}),v(e.$slots,"text",{},(()=>[f(C,{class:"u-tabbar-item__text",style:c({color:l.isActive?l.parentData.activeColor:l.parentData.inactiveColor})},{default:i((()=>[n(u(e.text),1)])),_:1},8,["style"])]),!0)])),_:3},8,["style","onClick"])}],["__scopeId","data-v-ed2788ef"]]),Z=T(x({__name:"tabbar",props:{addon:{type:String,default:""},color:{type:Object,default:()=>({backgroundColor:"",textColor:"",textHoverColor:""})},border:{type:Boolean,default:!0}},setup(e){const t=e;let a=t.addon;const o=S();!a&&o.addon&&(a=o.addon);const l=C({}),n=()=>{let e=P(S().tabbarList);if(1==e.length)Object.assign(l,e[0]);else{let t=!1;for(let o=0;o<e.length;o++)if(e[o].key==a){Object.assign(l,e[o]),t=!0;break}if(!t){let t=0,a={};try{e&&e.forEach((e=>{"app"==e.info.type&&(t++,a=e)})),1==t&&Object.assign(l,a)}catch(o){}}}if(t.color)for(let a in t.color)t.color[a]&&l.value[a]&&(l.value[a]=t.color[a])};n(),_((()=>t.addon),((e,t)=>{e&&t&&e!=t&&n()}),{immediate:!0}),_((()=>t.color),((e,t)=>{e&&t&&e!=t&&n()}),{immediate:!0,deep:!0}),t.addon||_((()=>S().tabbarList),((e,t)=>{e&&n()}),{deep:!0,immediate:!0});const u=w((()=>{let e=D().params,t=[];for(let a in e)t.push(a+"="+e[a]);return"/"+N()+(t.length>0?"?"+t.join("&"):"")})),d=e=>{if(-1!=e.indexOf("http")||-1!=e.indexOf("http"))window.location.href=e;else{let t=D().params,a=[];for(let e in t)a.push(e+"="+t[e]);if(e=="/"+N()&&!a.length)return;$({url:e,mode:"reLaunch"})}},c=H();return j((()=>{I().in(c).select(".tab-bar-placeholder").boundingClientRect((e=>{let t={height:e?e.height:0};uni.setStorageSync("tabbarInfo",t)})).exec()})),(e,a)=>{const o=h(m("u-tabbar-item"),M),n=h(m("u-tabbar"),z),c=k;return l&&Object.keys(l).length?(s(),g(y,{key:0},[f(n,{value:A(u),zIndex:"9999",fixed:!0,placeholder:!0,safeAreaInsetBottom:!0,"inactive-color":l.value.textColor,"active-color":l.value.textHoverColor,border:t.border},{default:i((()=>[(s(!0),g(y,null,O(l.value.list,(e=>(s(),g(y,null,[1==l.value.type?(s(),r(o,{key:0,class:"py-[5rpx]","custom-style":{"background-color":l.value.backgroundColor},text:e.text,icon:A(B)(A(u)==e.link.url?e.iconSelectPath:e.iconPath),name:e.link.url,onClick:t=>d(e.link.url)},null,8,["custom-style","text","icon","name","onClick"])):b("v-if",!0),2==l.value.type?(s(),r(o,{key:1,class:"py-[5rpx]","custom-style":{"background-color":l.value.backgroundColor},icon:A(B)(A(u)==e.link.url?e.iconSelectPath:e.iconPath),name:e.link.url,onClick:t=>d(e.link.url)},null,8,["custom-style","icon","name","onClick"])):b("v-if",!0),3==l.value.type?(s(),r(o,{key:2,class:"py-[5rpx]","custom-style":{"background-color":l.value.backgroundColor},text:e.text,name:e.link.url,onClick:t=>d(e.link.url)},null,8,["custom-style","text","name","onClick"])):b("v-if",!0)],64)))),256))])),_:1},8,["value","inactive-color","active-color","border"]),f(c,{class:"tab-bar-placeholder"})],64)):b("v-if",!0)}}}),[["__scopeId","data-v-cf8e1309"]]);export{Z as _,L as a};