修改注册类型为点击选择

This commit is contained in:
TOP糯米 2023-04-06 22:32:51 +08:00
parent cafaa46d72
commit 9edf5248f3
1 changed files with 48 additions and 13 deletions

View File

@ -81,14 +81,12 @@
placeholder-class="placeholder-style-3" placeholder-class="placeholder-style-3"
/> />
</view> </view>
<view class="input-item"> <view class="input-item" @click="showRegisterTypeModal = true">
<picker mode="selector" :range="registerType" range-key="name" @change="changeRegisterType"> <view class="text-view register-type">
<view class="picker-view register-type"> <text class="text" :class="{ active: currentRegisterType.name != '' }">
<text class="name" :class="{ active: currentRegisterType.name != '' }"> {{ currentRegisterType.name ? currentRegisterType.name : "请选择注册类型" }}
{{ currentRegisterType.name ? currentRegisterType.name : "请选择注册类型" }} </text>
</text> </view>
</view>
</picker>
</view> </view>
<view class="helper"> <view class="helper">
<app-agreement v-model="isAgree" /> <app-agreement v-model="isAgree" />
@ -105,12 +103,26 @@
</view> </view>
</view> </view>
</view> </view>
<widget-modal title="选择注册类型" v-show="showRegisterTypeModal" @close="showRegisterTypeModal = false">
<view class="register-type-group">
<view
class="register-type-item"
v-for="(item, index) in registerType"
:key="index"
@click="changeRegisterType(item)"
:class="{ active: currentRegisterType.id == item.id }"
>
{{ item.name }}
</view>
</view>
</widget-modal>
</app-layout> </app-layout>
</template> </template>
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import AppAgreement from "@/components/auth/agreement"; import AppAgreement from "@/components/auth/agreement";
import WidgetModal from "@/components/widgets/modal";
import { mapState } from "vuex"; import { mapState } from "vuex";
export default { export default {
name: "auth", name: "auth",
@ -118,6 +130,7 @@ export default {
return { return {
utils: this.$utils, utils: this.$utils,
safePt: 0, safePt: 0,
showRegisterTypeModal: false,
backgroundImage: require("@/static/temp/1.png"), backgroundImage: require("@/static/temp/1.png"),
canUse: true, canUse: true,
sec: 0, sec: 0,
@ -137,6 +150,7 @@ export default {
components: { components: {
AppLayout, AppLayout,
AppAgreement, AppAgreement,
WidgetModal,
}, },
computed: { computed: {
...mapState({ ...mapState({
@ -159,8 +173,8 @@ export default {
* 修改注册类型 * 修改注册类型
*/ */
changeRegisterType(e) { changeRegisterType(e) {
let currentRegisterType = this.registerType[e.detail.value]; this.currentRegisterType = e;
this.currentRegisterType = currentRegisterType; this.showRegisterTypeModal = false;
}, },
/** /**
* 忘记密码 * 忘记密码
@ -379,14 +393,35 @@ export default {
margin: 160rpx auto 160rpx auto; margin: 160rpx auto 160rpx auto;
} }
} }
.picker-view.register-type { .text-view.register-type {
font-size: 32rpx; font-size: 32rpx;
padding: 30rpx 0; padding: 30rpx 0;
.name { .text {
color: #c9c9c9; color: #c9c9c9;
} }
.name.active { .text.active {
color: #666666; color: #666666;
} }
} }
.register-type-group {
width: 100%;
.register-type-item {
display: inline-block;
width: 270rpx;
margin: 0 10rpx 10rpx 0;
box-sizing: border-box;
padding: 20rpx 0;
text-align: center;
font-size: 28rpx;
color: #333333;
background-color: #ededed;
}
.register-type-item:nth-child(2n) {
margin-right: 0;
}
.register-type-item.active {
color: #ffffff;
background-color: #ffa800;
}
}
</style> </style>