diff --git a/app.js b/app.js index 0deeeec..2f82eb3 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ // 顶部操作栏高度 this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (this.globalData.isIos ? 4 : 0) let windowHeight = e.windowHeight * (750 / e.windowWidth) - + this.globalData.customHeight = this.globalData.CustomBar * (750 / e.windowWidth) let safeBottom = e.windowHeight - e.safeArea.bottom if(safeBottom > e.windowHeight){ safeBottom = 34 diff --git a/app.json b/app.json index 6108d20..3a84a68 100644 --- a/app.json +++ b/app.json @@ -9,6 +9,7 @@ "pages/home/setting/index", "pages/home/authory/index", "pages/home/certificate/index", + "pages/home/city-select/index", "pages/home/idcard/index", "pages/home/info/index", "pages/home/tab1/index", diff --git a/colorui/main.wxss b/colorui/main.wxss index 5bebb19..8bef11f 100644 --- a/colorui/main.wxss +++ b/colorui/main.wxss @@ -987,7 +987,7 @@ button.icon.lg { .cu-custom .cu-bar { min-height: 0px; - padding-right: 220rpx; + padding-right: 212rpx; z-index: 99; /* box-shadow: 0rpx 0rpx 0rpx; */ box-shadow: 0 -1rpx 2rpx rgba(0, 0, 0, 0.01) diff --git a/pages/agent/fragment/index.js b/pages/agent/fragment/index.js new file mode 100644 index 0000000..3158f92 --- /dev/null +++ b/pages/agent/fragment/index.js @@ -0,0 +1,135 @@ +// pages/agent/index/index.js +import { getFactoryPrice, getFactoryCity, hasActivity } from "../../api/ztb" +const app = getApp() + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.safeFragmentHeight - 190, + CustomBar: app.globalData.CustomBar, + kg: app.globalData.kg, + loading: true, + requesting: false, + finished: false, + tabList: [], + tabIndex: 0, + cateList: [], + scrolled: false, + top: 0, + orderList: [], + form: { + cityId: '', + enableSalesAgent: 1, + pageNum: 1, + pageSize:15, + listType: 0 + }, + triggered: false, + firstShow: false, + hasActivity: false + }, + lifetimes: { + // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 + attached: function () { + + if(app.globalData.userInfo){ + hasActivity().then(result => { + this.setData({ hasActivity: result.data }) + }) + } + } + }, + methods: { + onRestart: function(){ + if (!this.data.firstShow) { + this.setData({ height: app.globalData.safeFragmentHeight - 190, kg: app.globalData.kg }) + this.fetchRegionList() + this.fetchPapersList() + } + this.data.firstShow = true + }, + toAbility: function(){ + wx.navigateTo({ url: '/pages/agent/ability/index' }) + }, + fetchRegionList: function () { + getFactoryCity().then(result => { + //成功回调 + this.data.cateList = [{ cityId: '', cityName: '全部' }].concat(result.data) + for (let index = 0; index < this.data.cateList.length; index++) { + this.data.tabList.push(this.data.cateList[index].cityName) + } + this.setData({ tabList: this.data.tabList, scrolled: this.data.cateList.length >= 5 }) + }) + }, + onTabChange: function ({ detail }) { + if (this.data.tabIndex == Number(detail.index)) { + return + } + this.data.tabIndex = Number(detail.index) + this.data.form.cityId = this.data.cateList[this.data.tabIndex].cityId + this.onRefreshList() + }, + // 下拉刷新... + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ orderList: [], tabIndex: this.data.tabIndex, ['form.pageNum']: 1, loading: true, finished: false }) + this.fetchPapersList() + }, + // 获取特价列表 + fetchPapersList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getFactoryPrice(this.data.form).then(result => { + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = result.data.current + var finished = result.data.current >= result.data.pages + if (this.data.form.pageNum == 1) { + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + top: 0, + finished, + requesting: false, + loading: false + }) + } else { + this.setData({ + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + finished, + requesting: false, + loading: false + }) + } + } else { + this.setData({ requesting: false, finished: true, loading: false, }) + } + }).catch(err => { + //异常回调 + this.setData({ requesting: false, finished: true, loading: false, }) + }) + }, + goattentionIndex: function () { + wx.navigateTo({ url: '/pages/home/attentionPaperList/index' }) + } + } + +}) \ No newline at end of file diff --git a/pages/agent/fragment/index.json b/pages/agent/fragment/index.json new file mode 100644 index 0000000..5130038 --- /dev/null +++ b/pages/agent/fragment/index.json @@ -0,0 +1,14 @@ +{ + "component": true, + "usingComponents": { + "wux-skeleton": "/components/skeleton/index", + "wux-skeleton-avatar": "/components/skeleton-avatar/index", + "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", + "wux-button": "/components/button/index", + "refresh-view": "/components/refresher/index", + "wux-tabi": "/components/tabi/index", + "wux-image": "/components/image/index", + "wux-divider": "/components/divider/index", + "agent-item": "/pages/agent/agent-item/index" + } +} \ No newline at end of file diff --git a/pages/agent/fragment/index.wxml b/pages/agent/fragment/index.wxml new file mode 100644 index 0000000..546a257 --- /dev/null +++ b/pages/agent/fragment/index.wxml @@ -0,0 +1,41 @@ + + + + 交易 + + + + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + + + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/pages/agent/fragment/index.wxss b/pages/agent/fragment/index.wxss new file mode 100644 index 0000000..14f8cb0 --- /dev/null +++ b/pages/agent/fragment/index.wxss @@ -0,0 +1 @@ +/* pages/agent/index/index.wxss */ \ No newline at end of file diff --git a/pages/article/fragment/index.js b/pages/article/fragment/index.js new file mode 100644 index 0000000..034a2f5 --- /dev/null +++ b/pages/article/fragment/index.js @@ -0,0 +1,163 @@ +// pages/message/index.js +import { getFactoryPrice, getProductList, getMiniProxyList, getBannerList, getSuccessNotices } from "../../api/ztb" +const event = require('../../../utils/event') +const util = require('../../../utils/util') +const app = getApp() + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.safeFragmentHeight - 100, + kg: app.globalData.kg, + stickyTop: app.globalData.CustomBar, + firstShow: false, + banning: true, + bannerList: [], + noticeList: [], + iconList: [ + { icon: '/assets/image/ico_trade.png', badge: 0, name: '特价专区' }, + { icon: '/assets/image/ico_purchase.png', badge: 0, name: '采购商品' }, + { icon: '/assets/image/ico_agent.png', badge: 0, name: '我要代卖' }, + { icon: '/assets/image/ico_index.png', badge: 0, name: '价格指数' }, + { icon: '/assets/image/ico_price.png', badge: 0, name: '实时价格' }, + { icon: '/assets/image/ico_queue.png', badge: 0, name: '车辆排队' } + ], + tabList: [ '代卖', '卖废纸', '买废纸' ], + tabIndex: 0, + loading: true, + requesting: false, + finished: false, + form: { pageNum: 1 }, + orderList: [1, 2, 3, 5] + }, + lifetimes: { + // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 + attached: function () { + event.on('EventMessage', this, this.onEvent) + }, + detached: function () { + event.remove('EventMessage', this) + } + }, + methods: { + onRestart: function () { + if(!this.data.firstShow){ + this.setData({ + height: app.globalData.safeFragmentHeight - 100, + kg: app.globalData.kg, + stickyTop: app.globalData.CustomBar, + StatusBar: app.globalData.StatusBar || 40, + customHeight: app.globalData.customHeight, + CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 80), + firstShow: true + }) + this.fetchAgentList() + } + this.data.firstShow = true + if(!this.data.bannerList.length){ + getBannerList(1).then(result => { + this.setData({ bannerList: result.data }) + }).catch(err => { + }) + } + if(!this.data.noticeList.length){ + this.fetchNoticeList() + } + }, + onEvent: function (message) { + console.log('mall>>index>>onEvent', message) + if (message.what == 10 && app.globalData.isVIP == 1) { + // this.setData({ token: app.globalData.token }) + // this.onRefreshList() + } else if(message.what == 1001){ + this.setData({ kg: app.globalData.kg }) + } else if(message.what == 888){ + this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false }) + this.fetchAgentList() + } + }, + chooseCity: function(){ + var that = this + console.log('chooseCity>>>') + wx.navigateTo({ + url: `/pages/home/city-select/index?type=1`, + events: { + onCallback: (data) => { + + } + } + }) + }, + searchList: function(){ + + }, + postList: function(){ + + }, + tapBanner: function(e){ + var item = this.data.bannerList[e.currentTarget.dataset.index] + if(item.redirectInfo.targetView == 'showH5'){ + util.navigateTo('/pages/html/html/index?link=' + item.redirectInfo.params.id + '?title=' + item.title) + return + } + util.navigateTarget(item.redirectInfo) + }, + onTabChange: function({detail}){ + if(this.data.tabIndex == Number(detail.index)){ + return + } + this.fetchAgentList() + }, + fetchNoticeList: function(){ + if (this.data.loopRequesting) { + return + } + this.data.loopRequesting = true + getSuccessNotices().then(result => { + this.data.loopRequesting = false + this.data.noticeList = [] + if(result.data && result.data.length){ + for (let index = 0; index < result.data.length; index++) { + this.data.noticeList.push(result.data[index].msg) + } + this.setData({noticeList: this.data.noticeList}) + } + }).catch(err => { + this.data.loopRequesting = false + }) + }, + //*************************************************fetchAgentList************************************************// + // 获取特价列表 + fetchAgentList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getFactoryPrice(this.data.form).then(result => { + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = result.data.current + var finished = result.data.current >= result.data.pages + this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) + } else { + this.setData({ requesting: false, finished: true, loading: false }) + } + }).catch(err => { + //异常回调 + this.setData({ requesting: false, finished: true, loading: false }) + }) + } + } + +}) \ No newline at end of file diff --git a/pages/article/fragment/index.json b/pages/article/fragment/index.json new file mode 100644 index 0000000..19d318c --- /dev/null +++ b/pages/article/fragment/index.json @@ -0,0 +1,14 @@ +{ + "component": true, + "usingComponents": { + "wux-tabi": "/components/tabi/index", + "wux-skeleton": "/components/skeleton/index", + "wux-skeleton-avatar": "/components/skeleton-avatar/index", + "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", + "wux-image": "/components/image/index", + "refresh-view": "/components/refresher/index", + "wux-sticky": "/components/sticky/index", + "wux-divider": "/components/divider/index", + "information-item": "/pages/article/information-item/index" + } +} \ No newline at end of file diff --git a/pages/article/fragment/index.wxml b/pages/article/fragment/index.wxml new file mode 100644 index 0000000..9c523a4 --- /dev/null +++ b/pages/article/fragment/index.wxml @@ -0,0 +1,96 @@ + + + + + + + 广州 + + + + + 输入纸名/品名/纸厂/规格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 最新资讯 + + 更多 + + + + + 【预测】8月26日湖南衡山新金龙纸业废纸 + 09-07 + + + 【预测】8月26日湖南衡山新金龙纸业废纸 + 09-07 + + + 【预测】8月26日湖南衡山新金龙纸业废纸 + 09-07 + + + + + + 价格比一比 + + 更多 + + + + + + + + + + + + + + + + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + \ No newline at end of file diff --git a/pages/article/fragment/index.wxss b/pages/article/fragment/index.wxss new file mode 100644 index 0000000..59a53a2 --- /dev/null +++ b/pages/article/fragment/index.wxss @@ -0,0 +1,39 @@ +.top-bg{ + background-image: linear-gradient(127deg, rgba(0,122,255,0.67) 0%, rgba(13,100,227,0.95) 100%); +} + +.mian-list{ + background-color: #f9f9f9; + border-radius: 24rpx 24rpx 0 0; + margin-top: -24rpx; + padding: 0 24rpx; +} + +.banner{ + border-radius: 16rpx; +} + +.banner-left{ + margin-left: 24rpx; + border-radius: 16rpx; +} + +.item-content { + background: rgba(255, 255, 255, 1); + padding:32rpx +} + +.tui-swiper { + margin-left: 8rpx; + font-size: 26rpx; + height: 60rpx; + flex: 1; +} + +.tui-news-item { + line-height: 28rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #555; +} \ No newline at end of file diff --git a/pages/article/information-item/index.js b/pages/article/information-item/index.js new file mode 100644 index 0000000..bdfc86d --- /dev/null +++ b/pages/article/information-item/index.js @@ -0,0 +1,18 @@ +// pages/stock/index.js +const util = require('../../../utils/util') + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + properties: { + item: { type: Object, value: null }, + mclick: { type: Boolean, value: true } + }, + methods: { + lookItem: function(e){ + util.navigateTo('/pakageInfo/pages/article/detail/index?id=' + this.data.item.id) + } + } +}) \ No newline at end of file diff --git a/pages/article/information-item/index.json b/pages/article/information-item/index.json new file mode 100644 index 0000000..5925a9b --- /dev/null +++ b/pages/article/information-item/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "wux-image": "/components/image/index", + "sudoku-image": "/components/sudoku-image/index", + "fold-text": "/components/fold-text/index", + "wux-tag": "/components/tag/index" + } +} \ No newline at end of file diff --git a/pages/article/information-item/index.wxml b/pages/article/information-item/index.wxml new file mode 100644 index 0000000..f20edcf --- /dev/null +++ b/pages/article/information-item/index.wxml @@ -0,0 +1,18 @@ + + + + 一级纸 东莞金洲 + 2021年9月14日 13:47:17 + + + + 2560 + + + 当前价 + + + +20 + 较上次 + + \ No newline at end of file diff --git a/pages/article/information-item/index.wxss b/pages/article/information-item/index.wxss new file mode 100644 index 0000000..17a4676 --- /dev/null +++ b/pages/article/information-item/index.wxss @@ -0,0 +1,23 @@ +/* pages/main/index.wxss */ +.image-load { + width: 50px; + height: 50px; + display: flex; + align-items: center; + justify-content: center; + border-radius: 50rpx; +} +.bottomViewRightImg { + width: 290rpx; + height: 200rpx; + overflow: hidden; +} +.bottomViewRight { + width: 290rpx; + height: 200rpx !important; + overflow: hidden; +} +.imgZt{ + display: flex; + justify-content: flex-start; +} \ No newline at end of file diff --git a/pages/home/city-select/index.js b/pages/home/city-select/index.js new file mode 100644 index 0000000..3a2f5e8 --- /dev/null +++ b/pages/home/city-select/index.js @@ -0,0 +1,17 @@ +// pages/home/about/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + } +}) \ No newline at end of file diff --git a/pages/home/city-select/index.json b/pages/home/city-select/index.json new file mode 100644 index 0000000..1c10f0f --- /dev/null +++ b/pages/home/city-select/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "wux-cell-group": "/components/cell-group/index", + "wux-cell": "/components/cell/index" + } +} \ No newline at end of file diff --git a/pages/home/city-select/index.wxml b/pages/home/city-select/index.wxml new file mode 100644 index 0000000..89822b6 --- /dev/null +++ b/pages/home/city-select/index.wxml @@ -0,0 +1,10 @@ + + + 关于纸通宝 + + + + + + + \ No newline at end of file diff --git a/pages/home/city-select/index.wxss b/pages/home/city-select/index.wxss new file mode 100644 index 0000000..5b09acd --- /dev/null +++ b/pages/home/city-select/index.wxss @@ -0,0 +1 @@ +/* pages/home/about/index.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 67609b1..ab2d8b4 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -9,11 +9,13 @@ const app = getApp() Page({ data: { - TabList: [{ index: 0, value: 'article', badge: 0, name: '情报' }, - { index: 1, value: 'mall', badge: 0, name: '交易' }, - { index: 2, value: 'home', badge: 0, name: '我的' } + TabList: [ + { index: 0, value: 'article', badge: 0, name: '情报' }, + { index: 1, value: 'mall', badge: 0, name: '行情' }, + { index: 2, value: 'agent', badge: 0, name: '交易' }, + { index: 3, value: 'home', badge: 0, name: '我的' } ], - pageIndex: 1, + pageIndex: 0, safeBottom: app.globalData.safeBottom, inited: false, path: null, diff --git a/pages/index/index.json b/pages/index/index.json index 4315329..eb31f7e 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,7 +1,8 @@ { "usingComponents": { "mall": "/pages/mall/index/index", - "article": "/pages/article/newInfo/index", + "article": "/pages/article/fragment/index", + "agent": "/pages/agent/fragment/index", "home": "/pages/home/index/index", "wux-image": "/components/image/index", "wux-popup": "/components/popup/index" diff --git a/pages/index/index.wxml b/pages/index/index.wxml index f915e99..13760d5 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -8,7 +8,10 @@ - + + + + diff --git a/pages/index/index.wxs b/pages/index/index.wxs index 322012b..5c9faee 100644 --- a/pages/index/index.wxs +++ b/pages/index/index.wxs @@ -9,12 +9,17 @@ function tabImage(tabIndex, index) { return '/assets/image/icon_trans_blue.png' } return '/assets/image/icon_trans_gray.png' - } else if (index == 2) { + } else if (index == 2) { if(tabIndex == index){ return '/assets/image/icon_self_blue.png' } return '/assets/image/icon_self_gray.png' - } + } else if (index == 3) { + if(tabIndex == index){ + return '/assets/image/icon_self_blue.png' + } + return '/assets/image/icon_self_gray.png' + } return '' } diff --git a/pages/mall/index/index.wxml b/pages/mall/index/index.wxml index 8646078..9e31bb8 100644 --- a/pages/mall/index/index.wxml +++ b/pages/mall/index/index.wxml @@ -19,7 +19,7 @@ - + {{item}}