Files
lcb/pages/signup/index.js
T
maclien bd4e78654d 页面
2024-05-28 21:17:53 +08:00

146 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// pages/signup/index.js
import _ from '../../commons/js/commons'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
navBar: {
title: '签到',
txtColor: '#fff',
bgColor: '#1a1c26',
isShowBg: true,
showHomeIcon: false
},
list: [{
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
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
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(()=>{
///......
//签到方法
})
}
})