| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007 |
- import tool from "../../../utils/tool.js";
- import volunteer from "../../../pages/data/volunteer.js";
- import growth from "../../../pages/data/growth.js";
- var app = getApp();
- var util = require("../../../utils/util.js");
- var QQMapWX = require("../../../utils/qqmap-wx-jssdk.js");
- var map;
- map = new QQMapWX({
- key: "RA3BZ-PSGW4-GZUUX-DDAU7-6B54E-KJFQ7", // 必填
- });
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- appAssetsUrl: app.appAssetsUrl,
- appAssetsUrl2: app.appAssetsUrl2,
- appAssetsUrl3: app.appAssetsUrl3,
- nodata: util.nodata(),
- indicatorData: true,
- autoplay: true,
- interval: 3000,
- circular: true,
- autostop: false,
- params: {
- pageNum: 1,
- pageSize: 10,
- city: "",
- area: "",
- type: 1, //1推荐 2最新 3最热
- },
- total: {
- currPage: 0,
- totalPage: 0,
- },
- noMore: false,
- statusBarHeightTop: 0,
- statusBarHeight: 0,
- nameIndex: 0,
- nameList: [{
- name: "推荐兼职",
- },
- {
- name: "最新兼职",
- },
- {
- name: "最热兼职",
- },
- ],
- classList: [{
- // image: app.appAssetsUrl2 + "wjxy/homejianzhi.png",
- // image: app.appAssetsUrl2 + "new/job-icon.png",
- image: app.appAssetsUrl3 + 'home/icon_1.png',
- name: "勤工俭学",
- },
- {
- // image: app.appAssetsUrl2 + "wjxy/homeactive.png",
- // image: app.appAssetsUrl2 + "new/activity-icon.png",
- image: app.appAssetsUrl3 + 'home/icon_2.png',
- name: "热门活动",
- },
- {
- // image: app.appAssetsUrl2 + "wjxy/homeshen.png",
- image: app.appAssetsUrl3 + 'home/icon_3.png',
- name: "青雲问鼎",
- },
- // {
- // // image: app.appAssetsUrl2 + "wjxy/homevip.png",
- // image: app.appAssetsUrl2 + "new/goods-icon.png",
- // name: "市集优选",
- // },
- {
- // image: app.appAssetsUrl2 + "wjxy/homevip.png",
- // image: app.appAssetsUrl2 + "new/member-icon.png",
- image: app.appAssetsUrl3 + 'home/icon_4.png',
- name: "联名福利",
- },
- // {
- // image: app.appAssetsUrl2 + "wjxy/homecode.png",
- // name: "邀请码",
- // },
- ],
- cityList: [],
- cityListPickerData: [],
- cityListIndex: [],
- listData: [],
- imglist: [],
- currentCity: {},
- current: 0,
- maskShow: false,
- activeList: [],
- jobList: [],
- perList: [],
- expertList: [],
- shopObj: {},
- popupImg: "",
- latitude: "",
- longitude: "",
- goodsClassfiyList: [],
- goodsList0: [],
- goodsList1: [],
- shopList: [],
- activeTitle: false
- },
- moreHandler() {
- this.experience();
- },
- selectCity(e) {
- wx.navigateTo({
- url: "/pages/home/location/index",
- });
- },
- experience(e) {
- // console.log(e, 11111111);
- if (
- e.currentTarget.dataset.index == 4 ||
- e.currentTarget.dataset.index == 3
- ) {
- // if (wx.getStorageSync("USER")) {
- const obj = this.data.goodsClassfiyList.find(v => v.name == '联名福利') || '';
- // console.log(obj);
- wx.setStorageSync('classfiyId', obj ? obj.id : '')
- wx.navigateTo({
- url: e.currentTarget.dataset.index == 4 ?
- "/invitationCode/index" : `/pages/quality/index/index`,
- });
- // } else {
- // wx.navigateTo({
- // url: "/pages/login",
- // });
- // }
- } else {
- app.params.pePageToIndex =
- e === undefined ? 0 : e.currentTarget.dataset.index + 1;
- switch (e.currentTarget.dataset.index) {
- case 0:
- wx.switchTab({
- url: "/pages/practicalExperience/practicalExperience",
- });
- break;
- case 1:
- wx.navigateTo({
- url: "/pages/experience/index/index",
- });
- break;
- case 2:
- wx.switchTab({
- url: "/pages/dashen/index",
- // url: "/pages/quality/index/index",
- });
- break;
- case 3:
- wx.navigateTo({
- url: "/pages/myMember/myMember",
- });
- break;
- default:
- wx.navigateTo({
- url: "/invitationCode/index",
- });
- }
- }
- },
- // 热门活动
- hotActive() {
- let nowCity = wx.getStorageSync("CHOOSECITY");
- let that = this;
- app._post_form(
- "act/list",
- "", {
- city: nowCity.cityId,
- limit: 10,
- page: 1,
- isFrontPage: 1,
- },
- function (res) {
- if (res.code == 0) {
- res.page.list.map((v) => {
- v.startTime = v.startTime.replace(/-/g, ".").split(" ")[0];
- v.endTime = v.endTime.replace(/-/g, ".").split(" ")[0];
- });
- that.setData({
- activeList: res.page.list,
- });
- }
- },
- function (res) { }
- );
- },
- // 最新兼职
- newJob() {
- let nowCity = wx.getStorageSync("CHOOSECITY");
- console.log(nowCity);
- let that = this;
- app._post_form(
- "home/label",
- "", {
- city: nowCity.cityId,
- pageNum: 1,
- isHome: 1,
- pageSize: 4,
- },
- function (res) {
- if (res.code == 0) {
- that.setData({
- jobList: res.page.list,
- });
- }
- },
- function (res) { }
- );
- },
- // 校园代理人
- schoolPer() {
- let that = this;
- app._get(
- `campusagent/page`, {
- page: 1,
- limit: 10,
- },
- (res) => {
- if (res.code === 0) {
- that.setData({
- perList: res.page.list,
- });
- }
- }
- );
- },
- // 推荐行家
- getExpert() {
- let that = this;
- let nowCity = wx.getStorageSync("CHOOSECITY");
- app._get(
- "expert/greatGodGangPage", {
- page: 1,
- limit: 10,
- city: nowCity.cityId,
- },
- function (res) {
- if (res.code == 0) {
- that.setData({
- expertList: res.page.list,
- });
- }
- }
- );
- },
- // 门店推荐
- getShop() {
- let that = this;
- let nowCity = wx.getStorageSync("CHOOSECITY");
- app._get(
- "store/storeRecommendation", {
- lon: that.data.longitude,
- lat: that.data.latitude,
- },
- function (res) {
- if (res.code == 0 && res.data) {
- let val = res.data.calculateNew / 1000;
- let formatVal = parseInt(val * 10);
- that.setData({
- shopObj: res.data,
- "shopObj.calculateNew": formatVal / 10,
- "shopObj.storePhoto": res.data.storePhoto.split(",")[0],
- });
- }
- }
- );
- },
- // 查看门店详情
- goStore(e) {
- console.log(e, 111);
- let that = this;
- wx.navigateTo({
- url: "/expert/storedetail/storedetail?id=" +
- that.data.shopObj.id +
- "&lon=" +
- that.data.longitude +
- "&lat=" +
- that.data.latitude,
- });
- },
- // 查看地图
- goLocal() {
- let that = this;
- let [latitude, longitude] = [
- this.data.shopObj.coordinate.split(",")[0],
- this.data.shopObj.coordinate.split(",")[1],
- ];
- console.log(Number(latitude), Number(longitude));
- wx.openLocation({
- latitude: Number(longitude),
- longitude: Number(latitude),
- name: that.data.shopObj.name,
- address: that.data.shopObj.address,
- success: function () {
- console.log("success");
- },
- });
- },
- callPhone() {
- let that = this;
- wx.makePhoneCall({
- phoneNumber: that.data.shopObj.phone,
- });
- },
- // 开屏弹窗
- openPopup() {
- app._get("openscreenpopup/openScreenPopup", {}, (res) => {
- if (res.code == 0 && res.data) {
- let maskShow = false;
- if (wx.getStorageSync("popId") != res.data.id) {
- wx.setStorageSync("popId", res.data.id);
- maskShow = true;
- }
- this.setData({
- popupImg: res.data.popUpPicture,
- maskShow: maskShow,
- });
- }
- });
- },
- // 兼职详情
- toPartDetail(e) {
- wx.navigateTo({
- url: `/pages/home/index/partDetail/partDetail?id=${e.currentTarget.dataset.id}`,
- });
- },
- // 校园代理人详情
- perDetail(e) {
- // console.log(e)
- wx.navigateTo({
- url: "/expert/agentdetail/agentdetail?id=" +
- e.currentTarget.dataset.id +
- "&type=校园代理人",
- });
- },
- // 行家详情
- toExpertDetail(e) {
- wx.navigateTo({
- url: `/expert/detail/detail?id=${e.currentTarget.dataset.id}`,
- });
- },
- onBindFocus: function (e) {
- let _this = this;
- wx.navigateTo({
- url: "/pages/search/index",
- });
- },
- closePopup() {
- this.setData({
- maskShow: false,
- });
- },
- nameHandler(e) {
- this.setData({
- nameIndex: e.target.dataset.index,
- });
- this.loadList(true);
- },
- growthMore: function (event) {
- wx.navigateTo({
- url: "/pages/home/index/growth/growthMore/growthMore",
- });
- },
- activitymore: function (event) {
- wx.reLaunch({
- url: "/pages/experience/index/index?type=1",
- });
- },
- onReady: function () {
- this.popup2 = this.selectComponent("#popup2");
- // this.setData({
- // maskShow: true
- // })
- },
- onLoad: function (options) {
- console.log("options", options);
- if (!options.cityId) {
- this.loadCity();
- }
- this.height();
- if (wx.getStorageSync("USER")) {
- this.PushVipInfo();
- }
- let _this = this;
- _this.data.option = options;
- setTimeout(function () {
- _this.loadDictionary();
- }, 100);
- _this.addScore();
- if (options.cityId) {
- _this.loadImg();
- let cityData = {
- cityName: options.cityName,
- cityId: options.cityId
- };
- wx.setStorageSync("CHOOSECITY", cityData);
- this.setData({
- currentCity: cityData,
- }, () => {
- console.log("currentCity", this.data.currentCity)
- //设置城市选择数据
- this.loadList(true)
- _this.hotActive();
- _this.newJob();
- _this.schoolPer();
- _this.getExpert();
- _this.getShop();
- _this.getGoodsClassfiy();
- _this.getShopList();
- });
- } else {
- _this.getLocal();
- }
- _this.getAgree()
- },
- toPrivacy() {
- wx.openPrivacyContract({
- success: () => { }, // 打开成功
- fail: () => { }, // 打开失败
- complete: () => { }
- })
- // wx.navigateTo({
- // url: "/pages/privacy/privacy",
- // });
- },
- closeAgree() {
- this.popup2.hidePopup();
- },
- handleAgreePrivacyAuthorization() {
- this.getLocal();
- this.popup2.hidePopup();
- },
- getAgree() {
- wx.getPrivacySetting({
- success: res => {
- // console.log(res, 3333) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
- if (res.needAuthorization) {
- this.popup2.showPopup();
- // 需要弹出隐私协议
- } else {
- // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
- // wx.getUserProfile()
- // wx.chooseMedia()
- // wx.getClipboardData()
- // wx.startRecord()
- }
- },
- fail: () => { },
- complete: () => { }
- })
- },
- onShow() {
- this.openPopup();
- },
- //获取城市信息
- getLocal() {
- const _this = this;
- wx.getFuzzyLocation({
- type: "gcj02",
- isHighAccuracy: true,
- success(res) {
- console.log("经纬度", res);
- const latitude = res.latitude;
- const longitude = res.longitude;
- _this.setData({
- latitude: res.latitude,
- longitude: res.longitude,
- });
- //通过【小程序定位】获取经纬度,在通过第三方sdk获取的地址信息
- _this.pointToAddress(latitude, longitude, function (address) {
- if (address) {
- wx.setStorageSync("CHOOSECITY", {
- cityName: address.city,
- areaName: address.district,
- });
- _this.loadCity();
- }
- });
- console.log("111");
- },
- fail(e) {
- console.log(e);
- _this.loadCity();
- },
- });
- },
- // 定义 pointToAddress 方法
- pointToAddress: function (latitude, longitude, callback) {
- var _this = this;
- // 调用接口
- map.reverseGeocoder({
- location: {
- latitude: latitude,
- longitude: longitude,
- },
- success: function (res) {
- // 解析成功返回地址
- callback(res.result.ad_info);
- },
- fail: function (res) {
- // console.log(res);
- },
- complete: function (res) { },
- });
- },
- //统计积分(每日登录)
- addScore: function () {
- if (!util.getUserId()) {
- return;
- }
- wx.showLoading({
- title: "努力加载中...",
- });
- app._post_form(
- "scoreStu/dailyLogin",
- "", {
- stuId: util.getUserId(),
- },
- function (res) {
- if (res.code === 0) { }
- }
- );
- },
- // 首页banner
- loadImg: function () {
- let _this = this;
- let nowCity = wx.getStorageSync("CHOOSECITY");
- let params = {
- type: "01",
- area: "",
- };
- app._post_form("img/mylist", "application/json", params, function (res) {
- if (res.code == 0) {
- _this.setData({
- imglist: res.data,
- });
- }
- });
- },
- //banner跳转
- imgJump(v) {
- console.log(v);
- console.log(v.currentTarget.dataset.item.jumpAddressType);
- if (v.currentTarget.dataset.item.jumpAddressType == 0) {
- //内部跳转
- wx.navigateTo({
- url: v.currentTarget.dataset.item.linkUrl,
- });
- } else if (v.currentTarget.dataset.item.jumpAddressType == 1) {
- //公众号跳转 'https://www.kujiale.cn/design/3FO4EQWQJF0M/show'
- wx.setStorageSync("gzurl", v.currentTarget.dataset.item.linkUrl);
- wx.navigateTo({
- url: "./gz/gz",
- });
- }
- },
- more(e) {
- console.log(e);
- if (e.currentTarget.dataset.type == "tab") {
- wx.switchTab({
- url: e.currentTarget.dataset.url,
- });
- } else {
- wx.navigateTo({
- url: e.currentTarget.dataset.url,
- });
- }
- },
- popupDetail() {
- this.setData({
- maskShow: false,
- });
- wx.navigateTo({
- url: "/expert/popupdetail/popupdetail",
- });
- },
- changeSwiper(e) {
- let {
- current,
- source
- } = e.detail;
- if (source === "autoplay" || source === "touch") {
- this.setData({
- current: current,
- });
- }
- // this.setData({
- // current: e.detail.current
- // })
- },
- loadCity: function () {
- let _this = this;
- app._post_form("serviceCityList", "", null, function (res) {
- if (res.data.length) {
- //设置城市选择的数据
- let cityData = {
- cityName: "",
- cityId: "",
- // areaName: '',
- // areaId: ''
- };
- // console.log(res.data);
- //设置城市下拉框数据
- let cityListPickerData = res.data;
- let cityListIndex = [];
- //nowCity是之前首页的城市选择下拉框的数据
- let nowCity = wx.getStorageSync("CHOOSECITY");
- if (nowCity) {
- a: for (let i = 0; i < res.data.length; i++) {
- let cityName = res.data[i].name;
- if (nowCity.cityName === cityName) {
- cityData.cityName = res.data[i].name;
- cityData.cityId = res.data[i].cityId;
- cityListIndex.push(i);
- }
- }
- if (cityListIndex.length == 0) {
- cityData.cityName = res.data[0].name;
- cityData.cityId = res.data[0].cityId;
- cityListIndex.push(0);
- }
- }
- else {
- cityData.cityName = res.data[0].name;
- cityData.cityId = res.data[0].cityId;
- cityListIndex = [0, 0];
- }
- //设置城市选择数据
- wx.setStorageSync("CHOOSECITY", cityData);
- //设置城市下拉框数据
- _this.setData({
- cityList: res.data,
- cityListPickerData,
- cityListIndex,
- currentCity: cityData,
- });
- // console.log(_this.data.cityListPickerData);
- setTimeout(function () {
- _this.loadImg();
- _this.hotActive();
- _this.newJob();
- _this.schoolPer();
- _this.getExpert();
- _this.getShop();
- _this.getGoodsClassfiy();
- _this.getShopList();
- // _this.loadList(true);
- }, 300);
- }
- });
- },
- // 查看活动详情
- activeDetail: function (e) {
- if (e.currentTarget.dataset.id) {
- wx.navigateTo({
- url: "/pages/home/index/activityDetail/activityDetail?id=" +
- e.currentTarget.dataset.id,
- });
- }
- },
- // 自定义高度处理
- height() {
- const {
- platform,
- statusBarHeight
- } = wx.getSystemInfoSync();
- // console.log("statusBarHeight======", statusBarHeight);
- let statusBarHeightTop = statusBarHeight;
- let height = statusBarHeight + 4; //ios 24px
- let mH = statusBarHeight + 4;
- if (platform.toLowerCase() == "android") {
- height += 4; //android 28px
- mH += 4;
- }
- height = height + 100;
- // height = height + 38 + 118;
- // 胶囊高度 32px 下边框6px height 状态栏高度
- let then = this
- this.setData({
- statusBarHeightTop: statusBarHeightTop + "px",
- statusBarHeight: statusBarHeight + 88 + "px",
- statusBarMH: mH + "px",
- }, res => {
- // console.log("加载完成======", height);
- // 创建选择器查询
- // const query = wx.createSelectorQuery();
- // console.log("query======", query);
- // 选择 id 为 diy-top 的节点
- wx.createSelectorQuery().in(this).select('#diy-top').boundingClientRect(rect => {
- // console.log("rect===", rect) //这 里有值
- then.setData({
- statusBarHeight: rect.height + "px"
- })
- }).exec();
- });
- },
- loadDictionary() {
- let _this = this;
- app._post_form(
- "bizcatelog/apiSelectBizcatelog/workUnit",
- "",
- null,
- function (res) {
- _this.setData(res);
- }
- );
- },
- PushVipInfo() {
- let _this = this;
- let id = util.getUserId();
- let parm = {
- id,
- };
- app._post_form(
- "member/apiSelectMeberInfo",
- "application/json",
- JSON.stringify(parm),
- function (res) {
- if (res.code === 0) {
- wx.setStorageSync("USER", res.member);
- } else {
- // wx.removeStorageSync("USER");
- wx.clearStorage();
- // wx.reLaunch({
- // url: '/pages/login',
- // })
- wx.switchTab({
- url: "/pages/my/index/index",
- });
- }
- }
- );
- },
- // 获取商品分类
- getGoodsClassfiy() {
- app._get("goodscategory/select", {}, (res) => {
- if (res.code == 0) {
- // const arr = res.list.splice(0, 2);
- this.setData({
- goodsClassfiyList: res.list,
- });
- if (this.data.goodsClassfiyList[0]) {
- // this.getGoodsList0(this.data.goodsClassfiyList[0].id);
- }
- const obj = res.list.find(v => v.name == '联名福利') || '';
- // console.log(obj);
- if (!obj) return
- this.getGoodsList1(obj.id);
- }
- });
- },
- getGoodsList0(categoryId, i) {
- app._get(
- "goods/page", {
- pageSize: 1,
- pageNum: 1,
- categoryId: categoryId,
- },
- (res) => {
- if (res.code == 0) {
- this.setData({
- goodsList0: res.page.list || [],
- });
- }
- }
- );
- },
- getGoodsList1(categoryId) {
- app._get(
- "goods/page", {
- pageSize: 3,
- pageNum: 1,
- categoryId: categoryId,
- },
- (res) => {
- if (res.code == 0) {
- this.setData({
- goodsList1: res.page.list || [],
- });
- }
- }
- );
- },
- toGoodsList(e) {
- let name = e.currentTarget.dataset.name;
- const obj = this.data.goodsClassfiyList.find(v => v.name == name) || '';
- // console.log(obj);
- wx.setStorageSync('classfiyId', obj ? obj.id : '')
- wx.navigateTo({
- url: `/pages/quality/index/index`,
- });
- },
- goodsDetail(e) {
- wx.navigateTo({
- url: `/pages/quality/detail/index?id=${e.currentTarget.dataset.id}`,
- });
- },
- getShopList() {
- let nowCity = wx.getStorageSync("CHOOSECITY");
- app._get(
- "store/list", {
- lon: this.data.longitude,
- lat: this.data.latitude,
- limit: 2,
- },
- (res) => {
- if (res.code == 0) {
- this.setData({
- shopList: res.list || [],
- });
- }
- }
- );
- },
- // tanslateM(value) {
- // let val = value > 1000 ? (value / 1000).toFixed(2) + "KM" : value + "M";
- // return val;
- // },
- // 查看地图
- goLocalNew(e) {
- let that = this;
- let [latitude, longitude] = [
- this.data.shopObj.coordinate.split(",")[0],
- this.data.shopObj.coordinate.split(",")[1],
- ];
- console.log(Number(latitude), Number(longitude));
- wx.openLocation({
- latitude: Number(longitude),
- longitude: Number(latitude),
- name: e.currentTarget.dataset.name,
- address: e.currentTarget.dataset.address,
- success: function () {
- console.log("success");
- },
- });
- },
- callPhoneNew(e) {
- let that = this;
- wx.makePhoneCall({
- phoneNumber: e.currentTarget.dataset.phone,
- });
- },
- // 查看门店详情
- goShopStore(e) {
- let that = this;
- wx.navigateTo({
- url: "/expert/storedetail/storedetail?id=" +
- e.currentTarget.dataset.id +
- "&lon=" +
- that.data.longitude +
- "&lat=" +
- that.data.latitude,
- });
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- var _this = this;
- //强制更新
- setTimeout(() => {
- _this.getLocal();
- }, 200);
- // 处理完成后,终止下拉刷新
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- // this.loadList();
- },
- //重新选择城市
- cityPickerChange(e) {
- // console.log('e.detail.value===>', e.detail.value);
- let cityListIndex = e.detail.value;
- let cityData = {
- cityName: this.data.cityListPickerData[cityListIndex].name,
- cityId: this.data.cityListPickerData[cityListIndex].id,
- // areaName: this.data.cityList[cityListIndex[0]].childRegionList[cityListIndex[1]].name,
- // areaId: this.data.cityList[cityListIndex[0]].childRegionList[cityListIndex[1]].id,
- };
- // console.log('cityData===>', cityData);
- wx.setStorageSync("CHOOSECITY", cityData);
- this.setData({
- cityListIndex,
- currentCity: cityData,
- }, () => {
- //设置城市选择数据
- // this.loadList(true)
- this.hotActive();
- this.newJob();
- this.schoolPer();
- this.getExpert();
- this.getShop();
- this.getGoodsClassfiy();
- this.getShopList();
- });
- },
- cityPickerColumnChange(e) {
- if (e.detail.column == 0) {
- this.setData({
- cityListPickerData: [
- this.data.cityList,
- this.data.cityList[e.detail.value].childRegionList,
- ],
- });
- }
- },
- /**
- * @param {Object} isRefresh 是否刷新,否则就是下一页
- */
- loadList(isRefresh) {
- let that = this;
- if (!isRefresh && this.data.noMore) {
- wx.showToast({
- title: "没有更多了~",
- icon: "none",
- });
- return false;
- }
- let nowCity = wx.getStorageSync("CHOOSECITY");
- if (!nowCity || !nowCity.cityId) {
- return false;
- }
- this.setData({
- listData: isRefresh ? [] : this.data.listData,
- params: {
- ...this.data.params,
- pageNum: isRefresh ? 1 : this.data.params.pageNum + 1,
- city: nowCity.cityId,
- area: nowCity.areaId,
- type: this.data.nameIndex + 1,
- },
- noMore: isRefresh ? false : this.data.noMore,
- });
- wx.showLoading({
- title: "努力加载中...",
- });
- app._post_form(
- "home/mylist",
- "",
- this.data.params,
- function (res) {
- if (res.code == 0) {
- if (
- res.page.list.length > 0 &&
- that.data.listData.length > 0 &&
- res.page.list[0].id == that.data.listData[0].id
- ) {
- return;
- }
- let listData = that.data.listData;
- listData.push(...res.page.list);
- that.setData({
- listData,
- currPage: res.page.currPage,
- totalPage: res.page.totalPage,
- noMore: res.page.totalPage == res.page.currPage,
- });
- }
- },
- function (res) {
- wx.hideLoading();
- }
- );
- },
- onShareAppMessage: function () { },
- onPageScroll: function (e) {
- if (
- e.scrollTop >= 10 &&
- this.data.activeTitle == false
- ) {
- this.setData({
- activeTitle: true,
- });
- }
- if (
- e.scrollTop < 10 &&
- this.data.activeTitle == true
- ) {
- this.setData({
- activeTitle: false,
- });
- }
- },
- });
|