Browse Source

feat(login): 增加登录类型选择功能

- 在登录页面添加登录类型选择输入框
- 实现登录类型选择的弹窗功能
- 优化登录类型的默认值和显示逻辑
master
liutong 11 months ago
parent
commit
1747879ce0
  1. 2
      pages/market/my/info.vue
  2. 54
      pages/student/login/login.vue

2
pages/market/my/info.vue

@ -66,7 +66,7 @@
:options="options_sex_arr"
:show="picker_show_sex"
@change="changePickerSex"
@cancel="picker_sex_show=false"
@cancel="picker_show_sex=false"
></fui-picker>
</view>
</view>

54
pages/student/login/login.vue

@ -16,6 +16,7 @@
<fui-input borderTop placeholder="登录账号" v-model="user" @input="input"
backgroundColor="#f2f2f2"></fui-input>
</view>
<view style="width: 95%;margin: auto;">
<fui-input borderTop :padding="['20rpx','32rpx']" v-model="password1" placeholder="登录密码"
:password="password" @input="input" backgroundColor="#f2f2f2">
@ -23,6 +24,28 @@
@click="change"></fui-icon>
</fui-input>
</view>
<view style="width: 95%;height: 30rpx;"></view>
<view style="width: 95%;margin:30rpx auto;">
<fui-input
@click="picker_show_loginType=true"
v-model="loginType_str"
placeholder="请选择登录类型"
backgroundColor="#f2f2f2"
>
<fui-icon name="arrowdown" color="#B2B2B2" :size="50"
@click="change"></fui-icon>
</fui-input>
<fui-picker
layer="1"
:linkage="true"
:options="loginType_Arr"
:show="picker_show_loginType"
@change="changePicker_loginType"
@cancel="picker_show_loginType=false"
></fui-picker>
</view>
<view style="width: 95%;margin:60rpx auto;">
<fui-button background="#00be8c" radius="5rpx" @click="login">登录</fui-button>
</view>
@ -44,11 +67,30 @@ export default {
password: true,
user: '15374889135', //
password1: '15374889135', //
loginType:'',//|1=,2=,3=
loginType_str:'',//
loginType_Arr:[
{
value: '1',
text: '教师登陆'
},
{
value: '2',
text: '销售登陆'
},
{
value: '3',
text: '学员登陆'
}
],
picker_show_loginType:false,//
}
},
onLoad(options) {
this.loginType = options.loginType ?? '1'//|1=,2=,3=
this.loginType = options.loginType ?? '2'//|1=,2=,3=
const selectedItem = this.loginType_Arr.find(item => item.value === String(this.loginType));
this.loginType_str = selectedItem ? selectedItem.text : '未知类型';
// uni.hideHomeButton()
// console.log(uni.getStorageSync('um_id'))
},
@ -66,6 +108,8 @@ export default {
},
//
async login() {
alert(this.loginType)
return
let item = {};
item['username'] = this.user
item['password'] = this.password1
@ -154,6 +198,14 @@ export default {
}
});
},
//
changePicker_loginType(e){
console.log('监听选择', e)
this.loginType = e.value
this.loginType_str = e.text
this.picker_show_loginType = false
},
}
}
</script>

Loading…
Cancel
Save