This commit is contained in:
maclien
2024-05-28 21:17:53 +08:00
parent 20be16ebcc
commit bd4e78654d
5 changed files with 93 additions and 8 deletions
+82 -4
View File
@@ -1,4 +1,6 @@
// pages/signup/index.js
import _ from '../../commons/js/commons'
const app = getApp()
Page({
/**
@@ -16,19 +18,24 @@ Page({
icon: 'iconfont icon-yonghu',
title: '用户全程0负担',
content: '无需额外付费,即可享受报价权益'
},{
}, {
icon: 'iconfont icon-yonghu',
title: '1次覆盖全范围',
content: '权益覆盖空间站所有合作品牌'
},{
}, {
icon: 'iconfont icon-yonghu',
title: '赔付至高2万元',
content: '根据所购车型官方指导价划分,赔付差价'
},{
}, {
icon: 'iconfont icon-yonghu',
title: '保价长达3个月',
content: '自购车之日起(含购车当日)90天'
}]
}],
userinfo: {},
has_mobile: false,
lat: 0,
lng: 0
},
/**
@@ -65,4 +72,75 @@ Page({
onUnload() {
},
/**
* 是否绑定用户手机号
*/
isBindMobile() {
_.userManager.isBindMobile().then(re => {
if (re) {
this.setData({
has_mobile: true
})
} else {
this.setData({
has_mobile: false
})
}
})
},
//授权手机号码
getPhoneNumber(e) {
if (e.detail.errMsg && e.detail.errMsg.indexOf('ok') > -1){
let that = this;
_.apiQuery.authUserPhone(e).then(res=>{
_.apiQuery.getUserInfo()
that.setData({
has_mobile: true
})
})
}else{
app.printErrorClient('failGetPhoneNumber',['用户拒绝授权手机号码:'+JSON.stringify(e)])
}
},
/**
* 授权地理位置
*/
getUserLocation(){
let that = this
return new Promise(function (resolve, reject) {
if(app.getStorageByKey('u_lat')&&app.getStorageByKey('u_lng')){
that.setData({
lat: app.getStorageByKey('u_lat'),
lng: app.getStorageByKey('u_lng')
},()=>{
resolve()
})
}else{
//u_lat u_lng
_.userManager.getUserLocation().then(location => {
console.log(location)
that.setData({
lat: location.lat,
lng: location.lng
},()=>{
resolve()
})
}).catch(res=>{
reject(res)
})
}
})
},
/**
* 签到
*/
bindsignup(){
this.getUserLocation().then(()=>{
///......
//签到方法
})
}
})
+2 -1
View File
@@ -30,7 +30,8 @@
</view>
<view class="fixed left-0 right-0 bottom-0 mb40 ml40 mr40">
<button class="btn btn-36afa2 color-fff">签到有礼</button>
<button wx:if="{{!has_mobile}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="btn btn-36afa2 color-fff">签到有礼</button>
<button wx:else class="btn btn-36afa2 color-fff" bindtap="bindsignup">签到有礼</button>
</view>
</view>
</view>
-1
View File
@@ -6,7 +6,6 @@ page{
background-size:cover;
background-color:#1a1c26;
background-image:url('https://img.liche.cn/spacestation/bg.jpg?v=20240526');
}
.card{
+8 -1
View File
@@ -1,4 +1,11 @@
/* pages/signup/status.wxss */
//- page{
//- background-image:linear-gradient(to bottom, #f9fdff, #fff);
//- }
page{
background-image:linear-gradient(to bottom, #f9fdff, #fff);
background-repeat:no-repeat;
background-position:center bottom;
background-size:cover;
background-color:#1a1c26;
background-image:url('https://img.liche.cn/spacestation/bg.jpg?v=20240526');
}
+1 -1
View File
@@ -1,5 +1,5 @@
{
"appid": "wx4733380c110313ec",
"appid": "wx71095d4049de3ed1",
"compileType": "miniprogram",
"libVersion": "3.0.0",
"packOptions": {