初始化导入 hjsq H5 项目代码
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div class="bindingCode">
|
||||
<Header title="绑定邀请码" />
|
||||
<div class="content overflow-y-auto">
|
||||
<div class="tips">
|
||||
<p>输入邀请码</p>
|
||||
<p>邀请码只能绑定一次 且不能修改</p>
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<span>邀请码</span>
|
||||
<van-field v-model="state.value" :border="false" placeholder="请输入邀请码(字母大写)" />
|
||||
</div>
|
||||
<div class="share">邀请1人 获得1天会员</div>
|
||||
<div class="btn"><span @click="bindingCode">立即绑定</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { showToast } from 'vant';
|
||||
import UserApi from '@/service/user';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
userInfo: userStore.userInfo,
|
||||
value: <string>'',
|
||||
});
|
||||
|
||||
/**
|
||||
* 绑定邀请码
|
||||
*/
|
||||
const bindingCode = () => {
|
||||
if (!state.value) {
|
||||
showToast('请输入邀请码');
|
||||
return;
|
||||
}
|
||||
let req = {
|
||||
promotionCode: state.value,
|
||||
};
|
||||
let res: any = UserApi.inviteBind(req);
|
||||
res.then(() => {
|
||||
showToast('绑定邀请码成功!');
|
||||
state.userInfo.inviterCode = state.value;
|
||||
userStore.saveUserInfo(state.userInfo);
|
||||
router.back();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bindingCode {
|
||||
height: 100%;
|
||||
.content {
|
||||
height: calc(100vh - 44px);
|
||||
.tips {
|
||||
padding: 20px;
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
&:nth-child(1) {
|
||||
font-weight: 500;
|
||||
font-size: 30px;
|
||||
}
|
||||
&:nth-child(2) {
|
||||
font-size: 16px;
|
||||
color: #525252;
|
||||
}
|
||||
}
|
||||
}
|
||||
.inputBox {
|
||||
margin: 30px 20px 15px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: solid 1px rgba(0, 0, 0, 0.05);
|
||||
span {
|
||||
font-weight: 500;
|
||||
}
|
||||
:deep(.van-cell) {
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
background: rgba(3, 15, 24, 1);
|
||||
height: 42px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.van-field__control) {
|
||||
color: #fff;
|
||||
}
|
||||
::placeholder {
|
||||
color: rgba(82, 82, 82, 1);
|
||||
}
|
||||
}
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
span {
|
||||
width: 284px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
border-radius: 3px;
|
||||
background: #f68804;
|
||||
}
|
||||
}
|
||||
}
|
||||
.share {
|
||||
font-size: 12px;
|
||||
color: rgba(82, 82, 82, 1);
|
||||
margin-bottom: 30px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user