feat: 接入三tab导航(首页/中奖记录/我的)、活动规则静态页、奖品详情弹窗;接口切换hnlylaw并透传authorization;缓存键统一Sft后缀;问卷ID切1005;注册增加收货地址;答题计时精确到0.01s及交互优化
This commit is contained in:
+92
-12
@@ -11,7 +11,7 @@
|
||||
<text class="input-icon">👤</text>
|
||||
<input class="input" v-model="userName" placeholder="请输入您的姓名" />
|
||||
</view>
|
||||
<text class="name-tip">本次演唱会门票实行实名制管理,参与抽奖活动须如实填报本人姓名与手机号码;中奖后须在24小时内完成兑奖操作,兑奖时需补充填报本人身份证号码。</text>
|
||||
<text class="name-tip">本次活动实行实名制管理,参与抽奖活动须如实填报本人姓名与手机号码,中奖后根据预留信息发货。</text>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">手机号</text>
|
||||
@@ -32,6 +32,22 @@
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">所在地区</text>
|
||||
<picker mode="multiSelector" :range="areaColumns" :value="areaIndex" @columnchange="onAreaColumnChange" @change="onAreaConfirm">
|
||||
<view class="input-wrap">
|
||||
<text class="input-icon">📍</text>
|
||||
<text class="area-text" :class="{ placeholder: !areaText }">{{ areaText || '请选择省市区' }}</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="label">详细地址</text>
|
||||
<view class="input-wrap">
|
||||
<text class="input-icon">🏠</text>
|
||||
<input class="input" v-model="detailAddress" placeholder="请输入街道、门牌号等详细地址" maxlength="100" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="agree-row" @tap="agreed = !agreed">
|
||||
<view class="agree-checkbox" :class="{ checked: agreed }">
|
||||
<text v-if="agreed" class="agree-check-mark">✓</text>
|
||||
@@ -49,6 +65,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import provinceData from '@/uview-ui/libs/util/province.js'
|
||||
import cityData from '@/uview-ui/libs/util/city.js'
|
||||
import areaData from '@/uview-ui/libs/util/area.js'
|
||||
|
||||
const HUNAN_INDEX = provinceData.findIndex(x => x.label.indexOf('湖南') > -1)
|
||||
const PROVINCE_ORDER = HUNAN_INDEX > -1 ? [HUNAN_INDEX].concat(provinceData.map((_, i) => i).filter(i => i !== HUNAN_INDEX)) : provinceData.map((_, i) => i)
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -59,10 +82,47 @@
|
||||
countdown: 60,
|
||||
timer: null,
|
||||
submitting: false,
|
||||
agreed: false
|
||||
agreed: false,
|
||||
areaIndex: [0, 0, 0],
|
||||
areaText: '',
|
||||
detailAddress: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
areaColumns() {
|
||||
const pIdx = PROVINCE_ORDER[this.areaIndex[0]] !== undefined ? PROVINCE_ORDER[this.areaIndex[0]] : 0
|
||||
const cities = cityData[pIdx] || []
|
||||
const cIdx = Math.min(this.areaIndex[1], Math.max(cities.length - 1, 0))
|
||||
const areas = (areaData[pIdx] && areaData[pIdx][cIdx]) || []
|
||||
return [
|
||||
PROVINCE_ORDER.map(i => provinceData[i].label),
|
||||
cities.length ? cities.map(c => c.label) : ['—'],
|
||||
areas.length ? areas.map(a => a.label) : ['—']
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onAreaColumnChange(e) {
|
||||
const { column, value } = e.detail
|
||||
const idx = this.areaIndex.slice()
|
||||
idx[column] = value
|
||||
if (column === 0) {
|
||||
idx[1] = 0
|
||||
idx[2] = 0
|
||||
} else if (column === 1) {
|
||||
idx[2] = 0
|
||||
}
|
||||
this.areaIndex = idx
|
||||
},
|
||||
onAreaConfirm(e) {
|
||||
const [p, c, a] = e.detail.value
|
||||
this.areaIndex = [p, c, a]
|
||||
const pIdx = PROVINCE_ORDER[p] !== undefined ? PROVINCE_ORDER[p] : 0
|
||||
const pname = (provinceData[pIdx] || {}).label || ''
|
||||
const cname = ((cityData[pIdx] || [])[c] || {}).label || ''
|
||||
const aname = (((areaData[pIdx] || [])[c] || [])[a] || {}).label || ''
|
||||
this.areaText = pname + cname + aname
|
||||
},
|
||||
goPrivacy() {
|
||||
uni.navigateTo({ url: '/pages/privacy/privacy' })
|
||||
},
|
||||
@@ -101,27 +161,36 @@
|
||||
uni.showToast({ title: '请填写完整信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.areaText) {
|
||||
uni.showToast({ title: '请选择所在地区', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.detailAddress.trim()) {
|
||||
uni.showToast({ title: '请填写详细地址', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.agreed) {
|
||||
uni.showToast({ title: '请阅读并同意《用户隐私协议》', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.submitting = true
|
||||
const openId = uni.getStorageSync('openId')
|
||||
const openId = uni.getStorageSync('openIdSft')
|
||||
this.$u.api.userRegist({
|
||||
wenjuan_id: 1001,
|
||||
wenjuan_id: 1005,
|
||||
open_id: openId,
|
||||
user_name: this.userName,
|
||||
user_phone: this.phone,
|
||||
sms_code: this.smsCode,
|
||||
address: this.areaText + this.detailAddress.trim(),
|
||||
channel: 1
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
uni.setStorageSync('isRegistered', true)
|
||||
uni.setStorageSync('isRegisteredSft', true)
|
||||
const data = res.Data || {}
|
||||
const userId = data.user_id || data.uesr_id
|
||||
if (userId) uni.setStorageSync('userId', userId)
|
||||
if (data.user_name) uni.setStorageSync('userName', data.user_name)
|
||||
if (data.user_phone) uni.setStorageSync('userPhone', data.user_phone)
|
||||
if (userId) uni.setStorageSync('userIdSft', userId)
|
||||
if (data.user_name) uni.setStorageSync('userNameSft', data.user_name)
|
||||
if (data.user_phone) uni.setStorageSync('userPhoneSft', data.user_phone)
|
||||
this.syncUserInfo(openId)
|
||||
uni.showToast({ title: '注册成功' })
|
||||
setTimeout(() => uni.navigateBack(), 1500)
|
||||
@@ -135,12 +204,12 @@
|
||||
})
|
||||
},
|
||||
syncUserInfo(openId) {
|
||||
this.$u.api.wxOpenidLogin({ wenjuan_id: 1001, open_id: openId }).then(loginRes => {
|
||||
this.$u.api.wxOpenidLogin({ wenjuan_id: 1005, open_id: openId }).then(loginRes => {
|
||||
if (loginRes.code === 0 && loginRes.Data) {
|
||||
const data = loginRes.Data
|
||||
if (data.user_id || data.uesr_id) uni.setStorageSync('userId', data.user_id || data.uesr_id)
|
||||
if (data.user_name) uni.setStorageSync('userName', data.user_name)
|
||||
if (data.user_phone) uni.setStorageSync('userPhone', data.user_phone)
|
||||
if (data.user_id || data.uesr_id) uni.setStorageSync('userIdSft', data.user_id || data.uesr_id)
|
||||
if (data.user_name) uni.setStorageSync('userNameSft', data.user_name)
|
||||
if (data.user_phone) uni.setStorageSync('userPhoneSft', data.user_phone)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error('注册后同步用户信息失败', err)
|
||||
@@ -239,6 +308,17 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.area-text {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
line-height: 84rpx;
|
||||
}
|
||||
|
||||
.area-text.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.name-tip {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
|
||||
Reference in New Issue
Block a user