niucloud-admin/niucloud/public/wap/assets/app-pages-auth-bind.c6c0b2a3.js
2023-12-01 16:44:57 +08:00

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{V as e,W as t,X as a,q as l,t as o,i,j as r,w as s,k as n,I as c,J as u,p as d,T as h,K as p,L as b,x as m,N as f,d as k,Y as _,c as g,r as C,a as x,Z as y,n as S,m as v,_ as D,$ as z,e as $,a0 as j,a1 as w}from"./index-ea6e0cb1.js";import{_ as B,a as V}from"./u-input.6341604e.js";import{_ as G}from"./sms-code.vue_vue_type_script_setup_true_lang.3698fa3b.js";import{_ as P}from"./u-icon.d0747f2e.js";import{_ as I}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as T}from"./app-link.vue_vue_type_script_setup_true_lang.71c4d6c7.js";import{_ as L}from"./u-button.50a5fe0d.js";import{_ as N}from"./u-form.35f8de54.js";import"./u-line.fc7fb812.js";import"./u-line.vue_vue_type_style_index_0_scoped_45e31c7a_lang.b0fb96a4.js";import"./u-modal.a7e45f81.js";import"./u-loading-icon.5076bc14.js";import"./u-popup.58d58be7.js";import"./u-transition.58c21162.js";import"./u-safe-bottom.71dc384f.js";import"./u-button.vue_vue_type_style_index_0_scoped_6b0695bb_lang.00626b24.js";const H=I({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){const C=l(o("u-icon"),P),x=m,y=f;return i(),r(x,{class:c(["u-checkbox",[`u-checkbox-label--${_.parentData.iconPlacement}`,_.parentData.borderBottom&&"column"===_.parentData.placement&&"u-border-bottom"]]),style:d([g.checkboxStyle]),onClick:u(g.wrapperClickHandler,["stop"])},{default:s((()=>[n(x,{class:c(["u-checkbox__icon-wrap",g.iconClasses]),onClick:u(g.iconClickHandler,["stop"]),style:d([g.iconWrapStyle])},{default:s((()=>[h(e.$slots,"icon",{},(()=>[n(C,{class:"u-checkbox__icon-wrap__icon",name:"checkbox-mark",size:g.elIconSize,color:g.elIconColor},null,8,["size","color"])]),!0)])),_:3},8,["onClick","class","style"]),n(y,{onClick:u(g.labelClickHandler,["stop"]),style:d({color:g.elDisabled?g.elInactiveColor:g.elLabelColor,fontSize:g.elLabelSize,lineHeight:g.elLabelSize})},{default:s((()=>[p(b(e.label),1)])),_:1},8,["onClick","style"])])),_:3},8,["style","onClick","class"])}],["__scopeId","data-v-fb07f37a"]]);const U=I({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,o,n){const u=m;return i(),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=_(),a=g((()=>t.info)),c=g((()=>w().login)),u=C(!1),d=C(!1),h=x({mobile:"",mobile_code:"",mobile_key:"",openid:uni.getStorageSync("openid")}),k={mobile:[{type:"string",required:!0,message:y("mobilePlaceholder"),trigger:["blur","change"]},{validator:(e,t)=>uni.$u.test.mobile(t),message:y("mobileError"),trigger:["change","blur"]}],mobile_code:{type:"string",required:!0,message:y("codePlaceholder"),trigger:["blur","change"]}},P=()=>{d.value=!d.value},I=C(null),A=()=>{I.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 _=m,g=l(o("u-input"),B),C=l(o("u-form-item"),V),x=l(o("sms-code"),G),D=l(o("u-checkbox"),H),z=l(o("u-checkbox-group"),U),$=f,j=l(o("app-link"),T),w=l(o("u-button"),L),R=l(o("u-form"),N);return i(),r(_,{class:"w-screen h-screen flex flex-col"},{default:s((()=>[n(_,{class:"flex-1"},{default:s((()=>[n(_,{class:"h-[100rpx]"}),n(_,{class:"px-[60rpx] pt-[100rpx] mb-[100rpx]"},{default:s((()=>[n(_,{class:"font-bold text-lg"},{default:s((()=>[p(b(S(y)("bindMobile")),1)])),_:1})])),_:1}),n(_,{class:"px-[60rpx]"},{default:s((()=>[n(R,{labelPosition:"left",model:h,errorType:"toast",rules:k,ref_key:"formRef",ref:I},{default:s((()=>[n(C,{label:"",prop:"mobile","border-bottom":!0},{default:s((()=>[n(g,{modelValue:h.mobile,"onUpdate:modelValue":t[0]||(t[0]=e=>h.mobile=e),border:"none",clearable:"",placeholder:S(y)("mobilePlaceholder")},null,8,["modelValue","placeholder"])])),_:1}),n(_,{class:"mt-[40rpx]"},{default:s((()=>[n(C,{label:"",prop:"mobile_code","border-bottom":!0},{default:s((()=>[n(g,{modelValue:h.mobile_code,"onUpdate:modelValue":t[2]||(t[2]=e=>h.mobile_code=e),border:"none",type:"password",clearable:"",placeholder:S(y)("codePlaceholder")},{suffix:s((()=>[n(x,{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}),!S(a)&&S(c).agreement_show?(i(),r(_,{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:P,customStyle:{marginTop:"4rpx"}},null,8,["checked"])])),_:1}),n(_,{class:"text-xs text-gray-400 flex flex-wrap"},{default:s((()=>[p(b(S(y)("agreeTips"))+" ",1),n(j,{url:"/app/pages/auth/agreement?key=service"},{default:s((()=>[n($,{class:"text-primary"},{default:s((()=>[p("《"+b(S(y)("userAgreement"))+"》",1)])),_:1})])),_:1}),n(j,{url:"/app/pages/auth/agreement?key=privacy"},{default:s((()=>[n($,{class:"text-primary"},{default:s((()=>[p("《"+b(S(y)("privacyAgreement"))+"》",1)])),_:1})])),_:1})])),_:1})])),_:1})):v("v-if",!0),n(_,{class:"mt-[60rpx]"},{default:s((()=>[n(w,{type:"primary",loading:u.value,loadingText:S(y)("logining"),onClick:A},{default:s((()=>[p(b(S(y)("bind")),1)])),_:1},8,["loading","loadingText"])])),_:1})])),_:1},8,["model"])])),_:1})])),_:1})])),_:1})}}});export{A as default};