2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{U as e,V as t,W as a,p as l,q as i,h as o,i as r,w as s,j as n,H as c,I as u,n as d,S as h,J as p,K as b,t as m,M as f,d as k,X as g,c as C,r as x,a as _,Y as S,m as y,l as v,Z as D,_ as z,$,a0 as j,a1 as w}from"./index-849cf30e.js";import{_ as B}from"./u-input.46b72faa.js";import{_ as V,a as G}from"./u-form.4f9a45b5.js";import{_ as P}from"./sms-code.vue_vue_type_script_setup_true_lang.55fd252c.js";import{_ as I}from"./u-icon.e3aa4770.js";import{_ as H}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as L}from"./app-link.vue_vue_type_script_setup_true_lang.d62f9cf3.js";import{_ as N}from"./u-button.9fa3f2a0.js";import"./u-line.19eb5c40.js";import"./u-modal.081e9589.js";import"./u-loading-icon.d012ecbf.js";import"./u-popup.e01742d2.js";import"./u-transition.75065529.js";import"./u-safe-bottom.2f6af56c.js";const T=H({name:"u-checkbox",mixins:[t,a,{props:{name:{type:[String,Number,Boolean],default:e.checkbox.name},shape:{type:String,default:e.checkbox.shape},size:{type:[String,Number],default:e.checkbox.size},checked:{type:Boolean,default:e.checkbox.checked},disabled:{type:[String,Boolean],default:e.checkbox.disabled},activeColor:{type:String,default:e.checkbox.activeColor},inactiveColor:{type:String,default:e.checkbox.inactiveColor},iconSize:{type:[String,Number],default:e.checkbox.iconSize},iconColor:{type:String,default:e.checkbox.iconColor},label:{type:[String,Number],default:e.checkbox.label},labelSize:{type:[String,Number],default:e.checkbox.labelSize},labelColor:{type:String,default:e.checkbox.labelColor},labelDisabled:{type:[String,Boolean],default:e.checkbox.labelDisabled}}}],data:()=>({isChecked:!1,parentData:{iconSize:12,labelDisabled:null,disabled:null,shape:"square",activeColor:null,inactiveColor:null,size:18,modelValue:null,iconColor:null,placement:"row",borderBottom:!1,iconPlacement:"left"}}),computed:{elDisabled(){return""!==this.disabled?this.disabled:null!==this.parentData.disabled&&this.parentData.disabled},elLabelDisabled(){return""!==this.labelDisabled?this.labelDisabled:null!==this.parentData.labelDisabled&&this.parentData.labelDisabled},elSize(){return this.size?this.size:this.parentData.size?this.parentData.size:21},elIconSize(){return this.iconSize?this.iconSize:this.parentData.iconSize?this.parentData.iconSize:12},elActiveColor(){return this.activeColor?this.activeColor:this.parentData.activeColor?this.parentData.activeColor:"#2979ff"},elInactiveColor(){return this.inactiveColor?this.inactiveColor:this.parentData.inactiveColor?this.parentData.inactiveColor:"#c8c9cc"},elLabelColor(){return this.labelColor?this.labelColor:this.parentData.labelColor?this.parentData.labelColor:"#606266"},elShape(){return this.shape?this.shape:this.parentData.shape?this.parentData.shape:"circle"},elLabelSize(){return uni.$u.addUnit(this.labelSize?this.labelSize:this.parentData.labelSize?this.parentData.labelSize:"15")},elIconColor(){const e=this.iconColor?this.iconColor:this.parentData.iconColor?this.parentData.iconColor:"#ffffff";return this.elDisabled?this.isChecked?this.elInactiveColor:"transparent":this.isChecked?e:"transparent"},iconClasses(){let e=[];return e.push("u-checkbox__icon-wrap--"+this.elShape),this.elDisabled&&e.push("u-checkbox__icon-wrap--disabled"),this.isChecked&&this.elDisabled&&e.push("u-checkbox__icon-wrap--disabled--checked"),e},iconWrapStyle(){const e={};return e.backgroundColor=this.isChecked&&!this.elDisabled?this.elActiveColor:"#ffffff",e.borderColor=this.isChecked&&!this.elDisabled?this.elActiveColor:this.elInactiveColor,e.width=uni.$u.addUnit(this.elSize),e.height=uni.$u.addUnit(this.elSize),"right"===this.parentData.iconPlacement&&(e.marginRight=0),e},checkboxStyle(){const e={};return this.parentData.borderBottom&&"row"===this.parentData.placement&&uni.$u.error("检测到您将borderBottom设置为true,需要同时将u-checkbox-group的placement设置为column才有效"),this.parentData.borderBottom&&"column"===this.parentData.placement&&(e.paddingBottom="8px"),uni.$u.deepMerge(e,uni.$u.addStyle(this.customStyle))}},mounted(){this.init()},methods:{init(){this.updateParentData(),this.parent||uni.$u.error("u-checkbox必须搭配u-checkbox-group组件使用");const e=this.parentData.modelValue;this.checked?this.isChecked=!0:uni.$u.test.array(e)&&(this.isChecked=e.some((e=>e===this.name)))},updateParentData(){this.getParentData("u-checkbox-group")},wrapperClickHandler(e){"right"===this.parentData.iconPlacement&&this.iconClickHandler(e)},iconClickHandler(e){this.preventEvent(e),this.elDisabled||this.setRadioCheckedStatus()},labelClickHandler(e){this.preventEvent(e),this.elLabelDisabled||this.elDisabled||this.setRadioCheckedStatus()},emitEvent(){this.$emit("change",this.isChecked),this.$nextTick((()=>{uni.$u.formValidate(this,"change")}))},setRadioCheckedStatus(){this.isChecked=!this.isChecked,this.emitEvent(),"function"==typeof this.parent.unCheckedOther&&this.parent.unCheckedOther(this)}},watch:{checked(){this.isChecked=this.checked}}},[["render",function(e,t,a,k,g,C){const x=l(i("u-icon"),I),_=m,S=f;return o(),r(_,{class:c(["u-checkbox",[`u-checkbox-label--${g.parentData.iconPlacement}`,g.parentData.borderBottom&&"column"===g.parentData.placement&&"u-border-bottom"]]),style:d([C.checkboxStyle]),onClick:u(C.wrapperClickHandler,["stop"])},{default:s((()=>[n(_,{class:c(["u-checkbox__icon-wrap",C.iconClasses]),onClick:u(C.iconClickHandler,["stop"]),style:d([C.iconWrapStyle])},{default:s((()=>[h(e.$slots,"icon",{},(()=>[n(x,{class:"u-checkbox__icon-wrap__icon",name:"checkbox-mark",size:C.elIconSize,color:C.elIconColor},null,8,["size","color"])]),!0)])),_:3},8,["onClick","class","style"]),n(S,{onClick:u(C.labelClickHandler,["stop"]),style:d({color:C.elDisabled?C.elInactiveColor:C.elLabelColor,fontSize:C.elLabelSize,lineHeight:C.elLabelSize})},{default:s((()=>[p(b(e.label),1)])),_:1},8,["onClick","style"])])),_:3},8,["style","onClick","class"])}],["__scopeId","data-v-fb07f37a"]]);const U=H({name:"u-checkbox-group",mixins:[t,a,{props:{name:{type:String,default:e.checkboxGroup.name},modelValue:{type:Array,default:e.checkboxGroup.value},shape:{type:String,default:e.checkboxGroup.shape},disabled:{type:Boolean,default:e.checkboxGroup.disabled},activeColor:{type:String,default:e.checkboxGroup.activeColor},inactiveColor:{type:String,default:e.checkboxGroup.inactiveColor},size:{type:[String,Number],default:e.checkboxGroup.size},placement:{type:String,default:e.checkboxGroup.placement},labelSize:{type:[String,Number],default:e.checkboxGroup.labelSize},labelColor:{type:[String],default:e.checkboxGroup.labelColor},labelDisabled:{type:Boolean,default:e.checkboxGroup.labelDisabled},iconColor:{type:String,default:e.checkboxGroup.iconColor},iconSize:{type:[String,Number],default:e.checkboxGroup.iconSize},iconPlacement:{type:String,default:e.checkboxGroup.iconPlacement},borderBottom:{type:Boolean,default:e.checkboxGroup.borderBottom}}}],computed:{parentData(){return[this.modelValue,this.disabled,this.inactiveColor,this.activeColor,this.size,this.labelDisabled,this.shape,this.iconSize,this.borderBottom,this.placement]},bemClass(){return this.bem("checkbox-group",["placement"])}},watch:{parentData:{handler(){this.children.length&&this.children.map((e=>{"function"==typeof e.init&&e.init()}))},deep:!0}},data:()=>({}),created(){this.children=[]},emits:["update:modelValue","change"],methods:{unCheckedOther(e){const t=[];this.children.map((e=>{e.isChecked&&t.push(e.name)})),this.$emit("change",t),this.$emit("update:modelValue",t)}}},[["render",function(e,t,a,l,i,n){const u=m;return o(),r(u,{class:c(["u-checkbox-group",n.bemClass])},{default:s((()=>[h(e.$slots,"default",{},void 0,!0)])),_:3},8,["class"])}],["__scopeId","data-v-f5bb36e2"]]),A=k({__name:"bind",setup(e){const t=g(),a=C((()=>t.info)),c=C((()=>w().login)),u=x(!1),d=x(!1),h=_({mobile:"",mobile_code:"",mobile_key:""});uni.getStorageSync("openid")&&Object.assign(h,{openid:uni.getStorageSync("openid")}),uni.getStorageSync("pid")&&Object.assign(h,{pid:uni.getStorageSync("pid")});const k={mobile:[{type:"string",required:!0,message:S("mobilePlaceholder"),trigger:["blur","change"]},{validator:(e,t)=>uni.$u.test.mobile(t),message:S("mobileError"),trigger:["change","blur"]}],mobile_code:{type:"string",required:!0,message:S("codePlaceholder"),trigger:["blur","change"]}},I=()=>{d.value=!d.value},H=x(null),A=()=>{H.value.validate().then((()=>{if(u.value)return;u.value=!0;(a.value?D:z)(h).then((e=>{a.value?(t.getMemberInfo(),$({url:"/app/pages/member/personal",mode:"redirectTo"})):(t.setToken(e.data.token),j().handleLoginBack())})).catch((()=>{u.value=!1}))}))};return(e,t)=>{const g=m,C=l(i("u-input"),B),x=l(i("u-form-item"),V),_=l(i("sms-code"),P),D=l(i("u-checkbox"),T),z=l(i("u-checkbox-group"),U),$=f,j=l(i("app-link"),L),w=l(i("u-button"),N),E=l(i("u-form"),G);return o(),r(g,{class:"w-screen h-screen flex flex-col"},{default:s((()=>[n(g,{class:"flex-1"},{default:s((()=>[n(g,{class:"h-[100rpx]"}),n(g,{class:"px-[60rpx] pt-[100rpx] mb-[100rpx]"},{default:s((()=>[n(g,{class:"font-bold text-lg"},{default:s((()=>[p(b(y(S)("bindMobile")),1)])),_:1})])),_:1}),n(g,{class:"px-[60rpx]"},{default:s((()=>[n(E,{labelPosition:"left",model:h,errorType:"toast",rules:k,ref_key:"formRef",ref:H},{default:s((()=>[n(x,{label:"",prop:"mobile","border-bottom":!0},{default:s((()=>[n(C,{modelValue:h.mobile,"onUpdate:modelValue":t[0]||(t[0]=e=>h.mobile=e),border:"none",clearable:"",placeholder:y(S)("mobilePlaceholder")},null,8,["modelValue","placeholder"])])),_:1}),n(g,{class:"mt-[40rpx]"},{default:s((()=>[n(x,{label:"",prop:"mobile_code","border-bottom":!0},{default:s((()=>[n(C,{modelValue:h.mobile_code,"onUpdate:modelValue":t[2]||(t[2]=e=>h.mobile_code=e),border:"none",type:"password",clearable:"",placeholder:y(S)("codePlaceholder")},{suffix:s((()=>[n(_,{mobile:h.mobile,type:"bind_mobile",modelValue:h.mobile_key,"onUpdate:modelValue":t[1]||(t[1]=e=>h.mobile_key=e)},null,8,["mobile","modelValue"])])),_:1},8,["modelValue","placeholder"])])),_:1})])),_:1}),!y(a)&&y(c).agreement_show?(o(),r(g,{key:0,class:"flex items-start mt-[30rpx]"},{default:s((()=>[n(z,null,{default:s((()=>[n(D,{checked:d.value,shape:"shape",size:"14",onChange:I,customStyle:{marginTop:"4rpx"}},null,8,["checked"])])),_:1}),n(g,{class:"text-xs text-gray-400 flex flex-wrap"},{default:s((()=>[p(b(y(S)("agreeTips"))+" ",1),n(j,{url:"/app/pages/auth/agreement?key=service"},{default:s((()=>[n($,{class:"text-primary"},{default:s((()=>[p("《"+b(y(S)("userAgreement"))+"》",1)])),_:1})])),_:1}),n(j,{url:"/app/pages/auth/agreement?key=privacy"},{default:s((()=>[n($,{class:"text-primary"},{default:s((()=>[p("《"+b(y(S)("privacyAgreement"))+"》",1)])),_:1})])),_:1})])),_:1})])),_:1})):v("v-if",!0),n(g,{class:"mt-[60rpx]"},{default:s((()=>[n(w,{type:"primary",loading:u.value,loadingText:y(S)("logining"),onClick:A},{default:s((()=>[p(b(y(S)("bind")),1)])),_:1},8,["loading","loadingText"])])),_:1})])),_:1},8,["model"])])),_:1})])),_:1})])),_:1})}}});export{A as default};
|