You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
3.0 KiB
JavaScript

// pages/home/index.js
const commonUtil = require("../../utils/commonUtil.js");
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
agencyStatus: 0,
iosDialog1:false
},
makePhoneCall() {
var that = this;
wx.makePhoneCall({
phoneNumber: '18039237825'
});
},
showphone:function(){
this.setData({
iosDialog1: true
});
},
close:function(){
this.setData({
iosDialog1: false
});
},
toGoodJob(){
wx.switchTab({
url: '/pages/index/index',
})
},
tosignUp(){
wx.navigateTo({
url: '/pages/signUp/index',
})
},
goTgIndex() {
wx.navigateTo({
url: '/pages/tgIndex/index',
})
},
goExtend() {
wx.navigateTo({
url: '/pages/extend/index',
})
},
goBrokerage() {
wx.navigateTo({
url: '/pages/myBrokerage/index',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//登录=================================start
if (app.globalData.isLogin) {
this.setData({
agencyStatus: app.globalData.agencyStatus
});
} else {
// 由于 userLogin 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userLoginCallback = res => {
this.setData({
agencyStatus: app.globalData.agencyStatus
});
}
}
let agencyUserId = options.agencyUserId;
if(agencyUserId) {
wx.setStorageSync('storageSyncAgencyUserId', agencyUserId);
console.log('agencyUserId', agencyUserId)
app.globalData.isCommission = 1;
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
agencyStatus: app.globalData.agencyStatus
//agencyStatus: 1
});
const query = wx.createSelectorQuery()
query.select('.redTop').boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(function(res){
console.log(res);
res[0].top // #the-id节点的上边界坐标
res[1].scrollTop // 显示区域的竖直滚动位置
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
var path = commonUtil.getCurrentPageUrlWithArgs();
if(app.globalData.isLogin && app.globalData.agencyStatus - 0 != 0) {//当前用户是代理人
path += (path.indexOf('?') >= 0 ? '&' : '?') + 'agencyUserId=' + app.globalData.loginUserInfo.id;
}
console.log(path)
return {
"title":'伯才',
'path': path,
}
}
})