增加注册类型选择

This commit is contained in:
TOP糯米 2023-04-03 13:48:05 +08:00
parent 4e4157286f
commit 0b0dffc89d
3 changed files with 64 additions and 1 deletions

View File

@ -69,6 +69,10 @@ export default {
url: "/wxapp/Useraddress/deleteaddress",
auth: true,
}
},
registerType: {
url: "/wxapp/index/registertype",
showLoading: true,
}
},
service: {

View File

@ -117,6 +117,28 @@ export default {
}).catch(e => { });
});
},
/**
* 获取注册类型
*/
getRegisterType() {
return new Promise((resolve, reject) => {
prototype.$request({
api: "user.registerType",
}).then(response => {
if (response.code == 1) {
let list = [];
response.data.forEach(item => {
list.push({
id: item.id,
name: item.name,
});
});
return resolve(list);
}
return reject(response.msg);
}).catch(e => { });
});
},
/**
* 用户注册
*/
@ -138,6 +160,7 @@ export default {
password: user.password,
openid: user.openId,
verification_code: verificationCode,
register_type: user.registerType,
types: 1,
}
}).then((response) => {

View File

@ -81,6 +81,15 @@
placeholder-class="placeholder-style-3"
/>
</view>
<view class="input-item">
<picker mode="selector" :range="registerType" range-key="name" @change="changeRegisterType">
<view class="picker-view register-type">
<text class="name" :class="{ active: currentRegisterType.name != '' }">
{{ currentRegisterType.name ? currentRegisterType.name : "请选择注册类型" }}
</text>
</view>
</picker>
</view>
<view class="helper">
<app-agreement v-model="isAgree" />
</view>
@ -117,6 +126,11 @@ export default {
mobile: "",
password: "",
verificationCode: "",
registerType: [],
currentRegisterType: {
id: 0,
name: "",
},
isAgree: false,
};
},
@ -129,7 +143,11 @@ export default {
openId: (state) => state.user.openId,
}),
},
onLoad() {},
onLoad() {
this.$models.user.getRegisterType().then((list) => {
this.registerType = list;
});
},
onShow() {},
onReady() {},
onReachBottom() {},
@ -137,6 +155,13 @@ export default {
onShareTimeline() {},
onShareAppMessage() {},
methods: {
/**
* 修改注册类型
*/
changeRegisterType(e) {
let currentRegisterType = this.registerType[e.detail.value];
this.currentRegisterType = currentRegisterType;
},
/**
* 忘记密码
*/
@ -235,6 +260,7 @@ export default {
mobile: this.mobile,
password: this.password,
openId: this.openId,
registerType: this.currentRegisterType.id,
},
this.verificationCode
)
@ -349,4 +375,14 @@ export default {
margin: 160rpx auto 160rpx auto;
}
}
.picker-view.register-type {
font-size: 32rpx;
padding: 30rpx 0;
.name {
color: #c9c9c9;
}
.name.active {
color: #666666;
}
}
</style>