From 5504d2e478b6f986f73a2b3b54d05fe8f2a3bb2f Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Wed, 13 Jan 2021 11:51:32 +0800 Subject: [PATCH] no message --- pages/api/moment.js | 4 +++- pages/api/ztb.js | 8 ++++++++ pages/index/index.js | 21 ++++++++++++++++++--- pages/index/index.wxml | 2 +- pages/mall/index/index.js | 23 +++++++---------------- pages/mall/price-index/index.js | 13 +++++-------- 6 files changed, 42 insertions(+), 29 deletions(-) diff --git a/pages/api/moment.js b/pages/api/moment.js index ae97bf3..a94340c 100644 --- a/pages/api/moment.js +++ b/pages/api/moment.js @@ -32,6 +32,7 @@ const likeMoment = (params) => mPost(`/information-center/article-reply/like-or- const likeComment = (params) => mPost(`/information-center/article-reply/like-or-cancel/reply`, params, mconfig) // /article-reply/reply 评论 const commentMoment = (params) => mPost(`/information-center/article-reply/reply`, params, mconfig) +const getCategoryPrice = (params) => mGet(`/information-center/getPaperCategoryPrice`, params, mconfig) export { mconfig, @@ -46,5 +47,6 @@ export { getCommentList, likeMoment, likeComment, - commentMoment + commentMoment, + getCategoryPrice } \ No newline at end of file diff --git a/pages/api/ztb.js b/pages/api/ztb.js index 5ddb0f0..f9572a7 100644 --- a/pages/api/ztb.js +++ b/pages/api/ztb.js @@ -12,6 +12,9 @@ const zconfig = { const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, zconfig) ///user/get/base-info基本信息 const getBaseInfo = () => mGet(`/recycle-service/user/get/base-info`, null, zconfig) +const getPopupInfo = () => mGet(`/recycle-service/popup/get/popup`, null, zconfig) +const getBannerList = (type) => mGet(`/recycle-service/banner/get/banner-list/${type}`, null, zconfig) +const getSuccessNotices = () => mPost(`/recycle-service/get/recently-order-success-list`, null, zconfig) // /get/all-paper-mill 获取全部纸厂列表 const getAllFactoryList = () => mGet(`/recycle-service/get/all-paper-mill`, null, zconfig) // /get/paper-mill-paper-category-price-list 获取纸厂品类价格信息列表 @@ -80,10 +83,15 @@ const confirmBidding = (params) => mPost(`/recycle-service/confirm/bidding`, par const cancelBidding = (id) => mPost(`/recycle-service/cancel/bidding-activity/${id}`, null, zconfig) const getMyBidding = (id) => mGet(`/recycle-service/get/my-bidding/${id}`, null, zconfig) + + export { zconfig, loginToken, getBaseInfo, + getPopupInfo, + getBannerList, + getSuccessNotices, getAllFactoryList, getFactoryPrice, getFactoryCity, diff --git a/pages/index/index.js b/pages/index/index.js index 851c44e..bc6c148 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,7 +1,8 @@ import { config, getUserInfo} from "../api/user" -import { zconfig, loginToken } from "../api/ztb" +import { zconfig, loginToken, getPopupInfo } from "../api/ztb" import { mconfig } from "../api/moment" -const event = require('../../utils/event.js') +const util = require('../../utils/util') +const event = require('../../utils/event') const storage = require('../../utils/storage') const app = getApp() @@ -108,6 +109,11 @@ Page({ if(this.data.path){ wx.navigateTo({ url: this.data.path }) } + getPopupInfo().then(result => { + if(result.data){ + this.setData({ landInfo: result.data }) + } + }) return } loginToken({loginToken: app.globalData.token}).then(result => { @@ -119,14 +125,23 @@ Page({ if(this.data.path){ wx.navigateTo({ url: this.data.path }) } + getPopupInfo().then(result => { + if(result.data){ + this.setData({ landInfo: result.data }) + } + }) // event.emit('EventMessage', { what: 888, desc: 'Logined' }) }).catch(err => { - console.log(err) wx.hideLoading() this.onResume() if(this.data.path){ wx.navigateTo({ url: this.data.path }) } + getPopupInfo().then(result => { + if(result.data){ + this.setData({ landInfo: result.data }) + } + }) }) }, onResume: function(){ diff --git a/pages/index/index.wxml b/pages/index/index.wxml index a9c83a8..d318933 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -28,7 +28,7 @@ - diff --git a/pages/mall/index/index.js b/pages/mall/index/index.js index 8734569..c078262 100644 --- a/pages/mall/index/index.js +++ b/pages/mall/index/index.js @@ -1,6 +1,5 @@ // pages/message/index.js -import { getFactoryPrice, getProductList, getMiniProxyList } from "../../api/ztb" -const request = require('../../../utils/request') //导入模块 +import { getFactoryPrice, getProductList, getMiniProxyList, getBannerList, getSuccessNotices } from "../../api/ztb" const event = require('../../../utils/event') const util = require('../../../utils/util') const app = getApp() @@ -63,8 +62,11 @@ Component({ this.onRefreshList() } this.data.firstShow = true - if(!this.data.noticeList.length){ - this.fetchBannerList() + if(!this.data.bannerList.length){ + getBannerList(1).then(result => { + this.setData({ bannerList: result.data }) + }).catch(err => { + }) } if(!this.data.noticeList.length){ this.fetchNoticeList() @@ -130,22 +132,12 @@ Component({ this.fetchAgentList() } }, - fetchBannerList: function(){ - // /banner/get/banner-list/{type} 获取banner - request.get('/recycle-service/banner/get/banner-list/1').then(result => { - //成功回调 - this.setData({ bannerList: result.data }) - }).catch(err => { - }) - }, fetchNoticeList: function(){ if (this.data.loopRequesting) { return } this.data.loopRequesting = true - // /get/recently-order-success-list获取最近成交订单的列表 - request.post('/recycle-service/get/recently-order-success-list').then(result => { - //成功回调 + getSuccessNotices().then(result => { this.data.loopRequesting = false this.data.noticeList = [] if(result.data && result.data.length){ @@ -155,7 +147,6 @@ Component({ this.setData({noticeList: this.data.noticeList}) } }).catch(err => { - //异常回调 this.data.loopRequesting = false }) }, diff --git a/pages/mall/price-index/index.js b/pages/mall/price-index/index.js index 4e7c9f8..810efbf 100644 --- a/pages/mall/price-index/index.js +++ b/pages/mall/price-index/index.js @@ -1,10 +1,10 @@ // pages/moment/price/index.js -const request = require('../../../utils/request') //导入模块 +import { getCategoryPrice } from "../../api/moment" const util = require('../../../utils/util') const math = require('../../../utils/math') const storage = require('../../../utils/storage') -const event = require('../../../utils/event.js') -var wxCharts = require('../../../utils/wxcharts.js') +const event = require('../../../utils/event') +var wxCharts = require('../../../utils/wxcharts') const app = getApp() var lineChart = null const colors = ['#FF4229', '#FFAD2A', '#297BFF', '#29FF46', '#AD29FF'] @@ -56,9 +56,7 @@ Page({ } else { this.setData({ requesting: true }) } - // /recycle-service/get/paper-mill-received-weight-list/on-today - request.get('/information-center/getPaperCategoryPrice').then(result => { - //成功回调 + getCategoryPrice().then(result => { if (result.data.records.length) { var respList = result.data.records let nowList = `orderList[${this.data.orderList.length}]` @@ -106,8 +104,7 @@ Page({ if(!util.isEmpty(cateIds)){ this.data.idList = cateIds } - request.get('/information-center/getPaperCategoryPrice', {idList: this.data.idList}).then(result => { - //成功回调 + getCategoryPrice({idList: this.data.idList}).then(result => { if(result.data.length <= 0){ return }