|
|
|
|
@ -20,7 +20,7 @@
|
|
|
|
|
<view class="menu-list">
|
|
|
|
|
<view class="menu-item" @click="toAddress">
|
|
|
|
|
<image class="menu-icon" src="@/static/me1.png" mode="aspectFit"></image>
|
|
|
|
|
<text class="menu-text">收货地址</text>
|
|
|
|
|
<text class="menu-text">奖品快递地址</text>
|
|
|
|
|
<u-icon name="arrow-right" color="#333" size="38rpx"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="menu-item" @click="torecord">
|
|
|
|
|
@ -41,12 +41,18 @@
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 收货地址弹窗 -->
|
|
|
|
|
<u-popup v-model="showAddress" mode="bottom" border-radius="20">
|
|
|
|
|
<!-- 奖品快递地址弹窗 -->
|
|
|
|
|
<u-popup v-model="showAddress" :mask-close-able="!forcePrizeAddress" mode="bottom" border-radius="20">
|
|
|
|
|
<view class="address-popup">
|
|
|
|
|
<view class="address-header">
|
|
|
|
|
<text class="address-title">收货地址</text>
|
|
|
|
|
<u-icon name="close" @click="showAddress = false" size="40rpx" color="#999"></u-icon>
|
|
|
|
|
<text class="address-title">奖品快递地址</text>
|
|
|
|
|
<u-icon
|
|
|
|
|
v-if="!forcePrizeAddress"
|
|
|
|
|
name="close"
|
|
|
|
|
@click="showAddress = false"
|
|
|
|
|
size="40rpx"
|
|
|
|
|
color="#999"
|
|
|
|
|
></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="address-form">
|
|
|
|
|
<view class="form-item">
|
|
|
|
|
@ -81,10 +87,10 @@
|
|
|
|
|
></u-input>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="form-item">
|
|
|
|
|
<text class="form-label">地址</text>
|
|
|
|
|
<text class="form-label">奖品快递地址</text>
|
|
|
|
|
<textarea
|
|
|
|
|
v-model="addressForm.address"
|
|
|
|
|
placeholder="请输入详细地址"
|
|
|
|
|
placeholder="请输入详细的奖品快递地址"
|
|
|
|
|
class="address-textarea"
|
|
|
|
|
maxlength="200"
|
|
|
|
|
></textarea>
|
|
|
|
|
@ -202,7 +208,7 @@
|
|
|
|
|
<!-- 已中奖 -->
|
|
|
|
|
<template v-if="hasWon">
|
|
|
|
|
<image src="@/static/answer_right.png" class="win-record-image" mode="aspectFit"></image>
|
|
|
|
|
<view class="win-record-text">恭喜您已中奖!</view>
|
|
|
|
|
<view class="win-record-text">恭喜您已抽中 <text class="prize-text">科普图书</text> 一本!</view>
|
|
|
|
|
<view class="win-record-buttons">
|
|
|
|
|
<u-button
|
|
|
|
|
size="mini"
|
|
|
|
|
@ -247,6 +253,11 @@
|
|
|
|
|
</template>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 底部悬浮继续答题按钮 -->
|
|
|
|
|
<view class="float-answer-btn" @click="continueAnswer">
|
|
|
|
|
继续答题
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -269,6 +280,8 @@
|
|
|
|
|
joinContent: "",
|
|
|
|
|
rulesContent: "",
|
|
|
|
|
showAddress: false,
|
|
|
|
|
fromPrize: false, // 是否从抽奖页跳转
|
|
|
|
|
forcePrizeAddress: false, // 是否为从抽奖页跳转过来的奖品地址,必须填写后才能关闭
|
|
|
|
|
addressForm: {
|
|
|
|
|
name: "",
|
|
|
|
|
mobile: "",
|
|
|
|
|
@ -300,8 +313,9 @@
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async toAddress() {
|
|
|
|
|
|
|
|
|
|
// 显示收货地址表单弹窗
|
|
|
|
|
// 普通入口,允许关闭
|
|
|
|
|
this.forcePrizeAddress = false;
|
|
|
|
|
// 显示奖品快递地址表单弹窗
|
|
|
|
|
this.showAddress = true;
|
|
|
|
|
// 从用户信息中预填充表单
|
|
|
|
|
this.addressForm = {
|
|
|
|
|
@ -347,7 +361,8 @@
|
|
|
|
|
this.userInfo = res;
|
|
|
|
|
toast('保存成功');
|
|
|
|
|
this.showAddress = false;
|
|
|
|
|
// 清空表单
|
|
|
|
|
this.forcePrizeAddress = false;
|
|
|
|
|
// 重新获取用户信息
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.error('保存失败:', error);
|
|
|
|
|
@ -367,7 +382,7 @@
|
|
|
|
|
url: '/pages/answer/index'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async getUserInfo() {
|
|
|
|
|
async getUserInfo(option) {
|
|
|
|
|
const res = await this.$u.api.user()
|
|
|
|
|
this.$u.vuex('vuex_user', res);
|
|
|
|
|
this.userInfo = res;
|
|
|
|
|
@ -375,6 +390,26 @@
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '/pages/login/index'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果是从抽奖页跳转过来,且当前用户还没有填写奖品快递地址,则在获取到用户信息后再预填地址并弹窗
|
|
|
|
|
if (option && option.fromPrize === '1') {
|
|
|
|
|
const hasAddress =
|
|
|
|
|
res.address &&
|
|
|
|
|
typeof res.address === 'string' &&
|
|
|
|
|
res.address.trim().length > 0
|
|
|
|
|
|
|
|
|
|
if (!hasAddress) {
|
|
|
|
|
this.fromPrize = true
|
|
|
|
|
this.forcePrizeAddress = true;
|
|
|
|
|
this.showAddress = true;
|
|
|
|
|
this.addressForm = {
|
|
|
|
|
name: this.userInfo.name || "",
|
|
|
|
|
mobile: this.userInfo.mobile || "",
|
|
|
|
|
address: this.userInfo.address || ""
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getConfig() {
|
|
|
|
|
@ -404,9 +439,9 @@
|
|
|
|
|
if (item.key === "rules") {
|
|
|
|
|
this.rulesContent = item.value;
|
|
|
|
|
}
|
|
|
|
|
if (item.key == 'open_win') {
|
|
|
|
|
this.open_win = item.value == 1 ? true : false
|
|
|
|
|
}
|
|
|
|
|
if (item.key == 'open_win') {
|
|
|
|
|
this.open_win = item.value == 1 ? true : false
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
@ -433,10 +468,10 @@
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onLoad() {
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
this.getConfig()
|
|
|
|
|
// 先获取用户信息
|
|
|
|
|
this.getUserInfo();
|
|
|
|
|
this.getUserInfo(option);
|
|
|
|
|
// 获取奖品信息
|
|
|
|
|
this.getPrize();
|
|
|
|
|
},
|
|
|
|
|
@ -783,7 +818,7 @@
|
|
|
|
|
|
|
|
|
|
::v-deep .rule-text {
|
|
|
|
|
color: #496690;
|
|
|
|
|
flex: 1;
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -824,7 +859,7 @@
|
|
|
|
|
background: #f5f5f5;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
padding: 20rpx 30rpx;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
@ -870,6 +905,9 @@
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
text-align: center;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
.prize-text {
|
|
|
|
|
color: #fd9d0c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.win-record-buttons {
|
|
|
|
|
@ -892,6 +930,23 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 底部悬浮继续答题按钮 */
|
|
|
|
|
.float-answer-btn {
|
|
|
|
|
position: fixed;
|
|
|
|
|
left: 50%;
|
|
|
|
|
bottom: 40rpx;
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
min-width: 300rpx;
|
|
|
|
|
padding: 20rpx 60rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
background: linear-gradient(to right, #57b0fe, #446efd);
|
|
|
|
|
border-radius: 999rpx;
|
|
|
|
|
box-shadow: 0 8rpx 20rpx rgba(68, 110, 253, 0.5);
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<!-- 非 scoped 样式,用于 v-html 渲染的内容 -->
|
|
|
|
|
|