master
zsk 2 years ago
parent 2c2cef52c5
commit d62ca3d9c4

@ -46,9 +46,13 @@ Page({
currPage: 0,
list:[
{
label:'全部',
tip:0,
},
{
label:'分类1',
tip:0,
tip:1,
children:[
{
title:'模拟0-1'
@ -60,7 +64,7 @@ Page({
},
{
label:'分类2',
tip:1,
tip:2,
children:[
{
title:'模拟1-1'
@ -72,7 +76,7 @@ Page({
},
{
label:'分类3',
tip:2,
tip:3,
children:[
{
title:'模拟2-1'
@ -89,11 +93,11 @@ Page({
sList:[],
},
handleTab(e){
console.log('点击tab',e)
console.log('点击tab',e.currentTarget.dataset.active)
this.setData({
active:e.currentTarget.dataset.active,// tab切换
scrollInfoView:'category_' + e.currentTarget.dataset.active // 右侧锚点滚动
// scrollInfoView:'category_' + e.currentTarget.dataset.active // 右侧锚点滚动
});
console.log(this.data.scrollInfoView)
@ -106,115 +110,7 @@ Page({
},
onLoad(options) {
var that = this;
let arr = [];
arr.logResult();
if (app.isNotEmptyCheck(options.scene)) {
//扫小程序码携带参数
var sceneStr = decodeURIComponent(options.scene);
var sceneJson = commonUtil.sceneToJson(sceneStr);
console.log("sceneJson===", sceneJson);
if (sceneJson.fromType == 1) {
app.globalData.isCommission = 1;
wx.setStorageSync("storageSyncAgencyUserId", sceneJson.userId);
}
//先设置代理人缓存人再登录
app.getLoginUserTokenInfo();
} else if (app.isNotEmptyCheck(options.fromType)) {
//扫小程序普通二维码携带参数-来源ID
console.log("options.fromType========" + options.fromType);
if (options.fromType == 0) {
console.log("options.id========" + options.id);
console.log("options.userId========" + options.userId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", options.id);
that.getAgencyUserId(options.id);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
} else if (options.fromType.indexOf("0&id=") >= 0) {
//兼容2021-9-9之前的二维码
var paramsTempId = options.fromType.replace("0&id=", "");
console.log("&paramsTempId========" + paramsTempId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", paramsTempId);
that.getAgencyUserId(paramsTempId);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
} else {
//兼容2021-9-9之前的二维码
var paramsTempId = options.fromType.replace("0,id=", "");
console.log("=paramsTempId========" + paramsTempId);
try {
app.globalData.isCommission = 1;
wx.setStorageSync("fromQrCodeChannelContactId", paramsTempId);
that.getAgencyUserId(paramsTempId);
} catch (e) {
console.log("0-扫描微信二维码,设置参数错误:", e);
}
}
} else {
console.log("options.fromType===else=====" + options);
}
//this.wxLogin();
let res = wx.getStorageSync("storeJobId"); //详情页返回
console.log(res);
if (app.isEmptyCheck(res.data)) {
this.setData({
recordList: [],
});
} else {
wx.removeStorageSync({
key: "storeJobId",
});
}
console.log("on show");
//登录=================================start
if (app.globalData.isLogin) {
this.setData({
isLogin: app.globalData.isLogin,
hasUserInfo: app.globalData.hasUserInfo,
agencyStatus: app.globalData.loginUserInfo.agencyStatus,
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
userInfo: app.globalData.loginUserInfo,
serviceInfo: app.globalData.serviceInfo,
isLoading: true,
});
} else {
// 由于 userLogin 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userLoginCallback = (res) => {
this.setData({
isLogin: app.globalData.isLogin,
hasUserInfo: app.globalData.hasUserInfo,
agencyStatus: app.globalData.loginUserInfo.agencyStatus,
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
userInfo: app.globalData.loginUserInfo,
serviceInfo: app.globalData.serviceInfo,
});
console.log(that.data.serviceInfo);
};
console.log(that.data.serviceInfo);
}
//登录=================================end
var reset = true;
let agencyUserId = options.agencyUserId;
if (agencyUserId) {
wx.setStorageSync("storageSyncAgencyUserId", agencyUserId);
console.log("agencyUserId", agencyUserId);
app.globalData.isCommission = 1;
}
app.getLoginUserTokenInfo();
this.getJobList();
},
onReady() {
@ -228,76 +124,27 @@ Page({
onShow() {
let that = this;
that.data.storeJobListSearchForm.pageNum = 1;
wx.setStorageSync("BILLFROM", "firstBill");
if (typeof this.getTabBar === "function" && this.getTabBar()) {
this.getTabBar().setData({
selected: 0,
isShow: true,
});
}
wx.setStorageSync("comeFromPage", "index");
this.setData({
storeJobListSearchForm: that.data.storeJobListSearchForm,
isLogin: app.globalData.isLogin,
recordBillType: "",
});
console.log(app.globalData);
setTimeout(() => {
if (app.globalData.isLogin) {
that.setData({
agencyStatus: app.globalData.loginUserInfo.agencyStatus,
corpUserFlag: app.globalData.loginUserInfo.corpUserFlag,
userInfo: app.globalData.loginUserInfo,
serviceInfo: app.globalData.serviceInfo,
});
console.log(app.globalData.loginUserInfo);
} else {
that.setData({
serviceInfo: app.globalData.serviceInfo,
});
this.wxLogin();
}
}, 100);
console.log(app.globalData.headers);
// if (that.data.inputVal != "搜索工作") {
// console.log(that.data.inputVal);
// that.setData({
// recordList: [],
// });
// that.getJobList();
// }
that.getJobList('onshow');
wx.removeStorage({
key: "townsManInfo",
});
wx.removeStorage({
key: "townsManInfoJob",
});
that.getType();
},
getType(){
var that = this;
wx.request({
url: app.globalData.ip + "/yishoudan/labels/type/app/95",
method: "get",
header: app.globalData.headers,
success: function (res) {
console.log(res);
}
})
},
getJobList($type) {
var that = this;
// debugger
that.setData({
pageShow: false,
});
return new Promise(function (resolve, reject) {
if (that.data.storeJobListSearchForm.sortTag == 2) {
//如果按照距离排序,拼接上坐标
that.data.storeJobListSearchForm.lng = app.globalData.lng;
that.data.storeJobListSearchForm.lat = app.globalData.lat;
}
console.log(that.data.inputVal);
that.data.storeJobListSearchForm.keys = that.data.inputVal == "搜索工作" ? "" : that.data.inputVal;
// debugger;
wx.showLoading({
title: "加载中...",
});
@ -363,15 +210,13 @@ Page({
});
let _stopList = [];
if($type == 'onshow'){
that.data.list.forEach((item,index) => {
// 动态计算高度并赋值
that.getDomInfo('category_' + index,(categoryRes)=>{
// console.log('指定区域:',categoryRes)
_stopList.push(Number(categoryRes.top))
})
});
}
// if($type == 'onshow'){
// that.data.list.forEach((item,index) => {
// that.getDomInfo('category_' + index,(categoryRes)=>{
// _stopList.push(Number(categoryRes.top))
// })
// });
// }
that.setData({
sList:_stopList,
@ -397,42 +242,41 @@ Page({
},
bindCategoryScroll(e){
let that = this;
// console.log('分类滚动:',e.detail.scrollTop,' ',that.data.sList)
// 核心思想:判断当前数值在数组的哪两个区间中,取临界值 Math方法
if(0 <= e.detail.scrollTop && e.detail.scrollTop < 4241){
that.setData({
active:0
})
}else if(4241 <= e.detail.scrollTop && e.detail.scrollTop < 8482){
that.setData({
active:1
})
}else {
that.setData({
active:2
})
}
},
getDomInfo($obj,callback=()=>{}){
if($obj){
const query = wx.createSelectorQuery()
query.select('#' + $obj).boundingClientRect(function(categoryRes){
callback(categoryRes);
})
query.exec()
}else{
callback({
bottom: -1,
dataset: {},
height: -1,
id: "",
left: -1,
right: -1,
top: -1,
width: -1
});
};
// if(0 <= e.detail.scrollTop && e.detail.scrollTop < 4241){
// that.setData({
// active:0
// })
// }else if(4241 <= e.detail.scrollTop && e.detail.scrollTop < 8482){
// that.setData({
// active:1
// })
// }else {
// that.setData({
// active:2
// })
// }
},
// getDomInfo($obj,callback=()=>{}){
// if($obj){
// const query = wx.createSelectorQuery()
// query.select('#' + $obj).boundingClientRect(function(categoryRes){
// callback(categoryRes);
// })
// query.exec()
// }else{
// callback({
// bottom: -1,
// dataset: {},
// height: -1,
// id: "",
// left: -1,
// right: -1,
// top: -1,
// width: -1
// });
// };
// },
/**
* 标准详情

Loading…
Cancel
Save