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.
2 lines
20 KiB
2 lines
20 KiB
11 months ago
|
import{y as e,o as t,c as o,w as l,a as s,n as a,k as i,i as d,e as r,f as n,t as u,l as c,$ as f,b as p,F as m,d as h,I as _,j as y,g}from"./index-4ddb689d.js";import{_ as x}from"./u-loading.7bd69747.js";import{r as k}from"./uni-app.es.24af5d4f.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as w}from"./u-modal.9219359e.js";import{_ as v}from"./u-popup.37b3343e.js";import{_ as C}from"./u-icon.e981d1c2.js";import{i as S,b as T}from"./verify.b5e41237.js";import{C as I}from"./CouponType.eb6d2fde.js";import{O as P,D}from"./OrderType.16ab6c02.js";const E=b({name:"u-switch",emits:["update:modelValue","input","change"],props:{value:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{type:[Number,String],default:50},activeColor:{type:String,default:"#2979ff"},inactiveColor:{type:String,default:"#ffffff"},vibrateShort:{type:Boolean,default:!1},activeValue:{type:[Number,String,Boolean],default:!0},inactiveValue:{type:[Number,String,Boolean],default:!1}},data:()=>({}),computed:{valueCom(){return this.modelValue},switchStyle(){let e={};return e.fontSize=this.size+"rpx",e.backgroundColor=this.valueCom?this.activeColor:this.inactiveColor,e},loadingColor(){return this.valueCom?this.activeColor:null}},methods:{onClick(){this.disabled||this.loading||(this.vibrateShort&&uni.vibrateShort(),this.$emit("input",!this.valueCom),this.$emit("update:modelValue",!this.valueCom),this.$nextTick((()=>{this.$emit("change",this.valueCom?this.activeValue:this.inactiveValue)})))}}},[["render",function(r,n,u,c,f,p){const m=k(e("u-loading"),x),h=d;return t(),o(h,{class:i(["u-switch",[1==p.valueCom?"u-switch--on":"",u.disabled?"u-switch--disabled":""]]),onClick:p.onClick,style:a([p.switchStyle])},{default:l((()=>[s(h,{class:"u-switch__node node-class",style:a({width:r.$u.addUnit(u.size),height:r.$u.addUnit(u.size)})},{default:l((()=>[s(m,{show:u.loading,class:"u-switch__loading",size:.6*u.size,color:p.loadingColor},null,8,["show","size","color"])])),_:1},8,["style"])])),_:1},8,["class","onClick","style"])}],["__scopeId","data-v-7debaf62"]]);const V=b({name:"u-toast",props:{zIndex:{type:[Number,String],default:""}},data:()=>({isShow:!1,timer:null,config:{params:{},title:"",type:"",duration:2e3,isTab:!1,url:"",icon:!0,position:"center",callback:null,back:!1},tmpConfig:{}}),computed:{iconName(){if(["error","warning","success","info"].indexOf(this.tmpConfig.type)>=0&&this.tmpConfig.icon){return this.$u.type2icon(this.tmpConfig.type)}},uZIndex(){return this.isShow?this.zIndex?this.zIndex:this.$u.zIndex.toast:"999999"}},methods:{show(e){this.tmpConfig=this.$u.deepMerge(this.config,e),this.timer&&(clearTimeout(this.timer),this.timer=null),this.isShow=!0,this.timer=setTimeout((()=>{this.isShow=!1,clearTimeout(this.timer),this.timer=null,"function"==typeof this.tmpConfig.callback&&this.tmpConfig.callback(),this.timeEnd()}),this.tmpConfig.duration)},hide(){this.isShow=!1,this.timer&&(clearTimeout(this.timer),this.timer=null)},timeEnd(){if(this.tmpConfig.url){if("/"!=this.tmpConfig.url[0]&&(this.tmpConfig.url="/"+this.tmpConfig.url),Object.keys(this.tmpConfig.params).length){let e="";/.*\/.*\?.*=.*/.test(this.tmpConfig.url)?(e=this.$u.queryParams(this.tmpConfig.params,!1),this.tmpConfig.url=this.tmpConfig.url+"&"+e):(e=this.$u.queryParams(this.tmpConfig.params),this.tmpConfig.url+=e)}this.tmpConfig.isTab?uni.switchTab({url:this.tmpConfig.url}):uni.navigateTo({url:this.tmpConfig.url})}else this.tmpConfig.back&&this.$u.route({type:"back"})}}},[["render",function(f,p,m,h,_,y){const g=k(e("u-icon"),C),x=d,b=c;return t(),o(x,{class:i(["u-toast",[_.isShow?"u-show":"","u-type-"+_.tmpConfig.type,"u-position-"+_.tmpConfig.position]]),style:a({zIndex:y.uZIndex})},{default:l((()=>[s(x,{class:"u-icon-wrap"},{default:l((()=>[_.tmpConfig.icon?(t(),o(g,{key:0,class:"u-icon",name:y.iconName,size:30,color:_.tmpConfig.type},null,8,["name","color"])):r("",!0)])),_:1}),s(b,{class:"u-text"},{default:l((()=>[n(u(_.tmpConfig.title),1)])),_:1})])),_:1},8,["class","style"])}],["__s
|