增加登录类型

This commit is contained in:
YeMingfei666 2024-10-09 17:33:46 +08:00
parent fbfcfc4d82
commit bf588ca7fb
1 changed files with 37 additions and 3 deletions

View File

@ -13,8 +13,21 @@
<!-- 不需要label, 需要修改 label-width="0" -->
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
<view class="u-p-b-30">
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list" textKey="label"></my-tabs>
</view>
<view v-if="vdata.loginType == 'pwd' ">
<template v-if="accountType.sel==1">
<uni-forms-item name="merchantName">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入商户号"
v-model="vdata.formData.merchantName" :clearable="false">
<template #prefixIcon>
<image src="@/static/login/icon-user.svg" class="input-icon" />
</template>
</uni-easyinput>
</uni-forms-item>
</template>
<uni-forms-item name="username">
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
v-model="vdata.formData.username" :clearable="false">
@ -159,6 +172,15 @@
login,
getCodeImg
} from '@/http/yskApi/login.js';
const accountType=reactive({
list:[
{label:'商户',value:'merchant'},
{label:'员工',value:'staff'},
],
sel:0
})
const loginFormRef = ref()
const envChangeTipsRef = ref()
const refAgr = ref()
@ -169,6 +191,9 @@
} from "@/commons/utils/pushmsg/wxTextToSpeach.js"
// #endif
const rules = {
merchantName:{
rules: [formUtil.rules.requiredInputShowToast('商户号')],
},
username: {
rules: [formUtil.rules.requiredInputShowToast('用户名')],
},
@ -223,6 +248,14 @@
vdata.formData.pwd = 'qwer1234'
// #endif
function accountTypeChange(e){
// #ifdef H5
if(e==1){
vdata.formData.merchantName = '18049104914'
vdata.formData.username = '13666666666'
}
// #endif
}
const getCode = () => {
getCodeImg().then(res => {
@ -268,7 +301,7 @@
code: vdata.formData.code,
uuid: vdata.formData.uuid,
merchantName: vdata.formData.merchantName,
loginType: vdata.formData.loginType
loginType: accountType.list[accountType.sel].value
})
} else if (vdata.loginType == 'sms') { //
@ -308,11 +341,12 @@
}
//
async function loginFinishFunc(loginBizData) {
// token
storageManage.setLogin(loginBizData)
storageManage.token(loginBizData.token)
storageManage.shopId(loginBizData.shopId)
storageManage.shopUserId(loginBizData.user.user.id)
storageManage.userInfo(loginBizData)
//
go.to("PAGES_INDEX", {