diff --git a/app.js b/app.js index babcca0..8eb4819 100644 --- a/app.js +++ b/app.js @@ -15,45 +15,35 @@ App({ wx.setStorageSync('logs', logs) // 登录 - wx.login({ - success: res => { - // this.setData({ - // code: res.code - // }) - http("/user/login", "post", { - code: res.code - }).then(res => { - if (res.msg === "未注册!") { - // this.getUserProfile() - wx.showToast({ - title: '您尚未注册,请点击个人头像位置以注册登录', - icon: 'none', - duration: 2000 - }) - } else { - getApp().globalData.token = res.data.token - // this.setData({ - // user_avatar:res.data.user.avatar, - // user_name:res.data.user.name, - // user_tip:'欢迎来到星途~' - // }) - wx.setStorage({ - key: 'user', - data: res.data.user - }) - wx.setStorage({ - key: 'token', - data: res.data.token - }) - // wx.getStorage({ - // key: 'token', - // success (res) { - // } - // }) - } - }) - } - }) + // wx.login({ + // success: res => { + // // this.setData({ + // // code: res.code + // // }) + // http("/user/login", "post", { + // code: res.code + // }).then(res => { + // if (res.msg === "未注册!") { + // // this.getUserProfile() + // wx.showToast({ + // title: '您尚未注册,请点击个人头像位置以注册登录', + // icon: 'none', + // duration: 2000 + // }) + // } else { + // getApp().globalData.token = res.data.token + // wx.setStorage({ + // key: 'user', + // data: res.data.user + // }) + // wx.setStorage({ + // key: 'token', + // data: res.data.token + // }) + // } + // }) + // } + // }) }, globalData: { userInfo: null, diff --git a/images/ic_tuijian@3x.png b/images/ic_tuijian@3x.png new file mode 100644 index 0000000..9baf87c Binary files /dev/null and b/images/ic_tuijian@3x.png differ diff --git a/images/ic_zhuanfa@3x.png b/images/ic_zhuanfa@3x.png new file mode 100644 index 0000000..b9396f5 Binary files /dev/null and b/images/ic_zhuanfa@3x.png differ diff --git a/pages/index/index.js b/pages/index/index.js index c1245f0..13cd145 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -6,6 +6,7 @@ const app = getApp() Page({ data: { cdn:getApp().globalData.cdn, + numlist:[], toplist: [{ url: '/images/ic_bofang@3x.png', title: '总播放量', @@ -22,25 +23,37 @@ Page({ url: '/images/comment@3x.png', title: '总评论数', num: '0' - }], + }, + { + url: '/images/ic_zhuanfa@3x.png', + title: '总转发数', + num: '0' + }, + { + url: '/images/ic_tuijian@3x.png', + title: '总推荐数', + num: '0' + }, + ], rankurl: [ '/images/img_diyi@3x.png', '/images/img_dier@3x.png', '/images/img_disan@3x.png' ], - disranking: [{ - url: '/images/img_diyi@3x.png', - name: '罗森便利店(江安店)', - add: '浙江省宁波市江北区江安路487号绿地中心南区3号楼' - }, { - url: '/images/img_dier@3x.png', - name: '罗森(upark店)', - add: '浙江省宁波市海曙区学院路788号' - }, { - url: '/images/img_disan@3x.png', - name: 'LAWSON罗森(博瑞大厦店)', - add: '浙江省宁波市江北区望山路1-4-111号博瑞大厦' - }], + records:[], + // disranking: [{ + // url: '/images/img_diyi@3x.png', + // name: '罗森便利店(江安店)', + // add: '浙江省宁波市江北区江安路487号绿地中心南区3号楼' + // }, { + // url: '/images/img_dier@3x.png', + // name: '罗森(upark店)', + // add: '浙江省宁波市海曙区学院路788号' + // }, { + // url: '/images/img_disan@3x.png', + // name: 'LAWSON罗森(博瑞大厦店)', + // add: '浙江省宁波市江北区望山路1-4-111号博瑞大厦' + // }], staranking: [{ url: '/images/img_diyi@3x.png', name: '维涅斯', @@ -54,7 +67,9 @@ Page({ name: '希斯拉德', dis: 'LAWSON罗森(博瑞大厦店)' }], - records:[], + rows:[], + page:1, + size:10 }, to(e) { console.log(e.target.dataset.url) @@ -65,10 +80,10 @@ Page({ }, onLoad: function (options) { - wx.setNavigationBarTitle({ - title: '', - success: function (res) {} - }) + // wx.setNavigationBarTitle({ + // title: '', + // success: function (res) {} + // }) wx.setNavigationBarColor({ frontColor: '#ffffff', backgroundColor: '#006BFF', @@ -78,24 +93,54 @@ Page({ } }) this.getrecordslist() + this.RankingList() + this.numlist() }, - + //总数 + numlist(){ + http("/rank/myEffect", "post", { + }).then(res =>{ + this.setData({ + 'toplist[0].num': res.data.playNumSum, + 'toplist[1].num': res.data.commendNum, + 'toplist[2].num': res.data.collectionNum, + 'toplist[3].num': res.data.commentNum, + 'toplist[4].num': res.data.reSendNum, + 'toplist[5].num': res.data.recommendNum + }) + }) + }, + //品牌动态 getrecordslist(){ http("/topicActivity/list", "post", { + showAtIndex:1 }).then(res =>{ this.setData({ - records: res.data.records, + records: res.data.records }) }) }, + //排行榜 + RankingList(){ + http("/rank/list", "post", { + pageNum: this.data.pages, + pageSize:this.data.size, + type:1 + }).then(res =>{ + this.setData({ + rows: res.data.records, + }) + }) + }, + //查看全部 detail(e){ console.log(e) wx.setStorageSync('info', e.currentTarget.dataset.cycle_id) wx.navigateTo({ - url:"/pages/index/subpage/brand/brandDetails/brandDetails" + url:"/pages/index/subpage/brand/brandDetails/brandDetails?id=" }) - + }, /** * 页面相关事件处理函数--监听用户下拉动作 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 42a5580..0b3acf9 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -57,15 +57,15 @@ 经销商 - 2022-5 + {{item.createDate}} - + - - {{item.name}} - {{item.add}} + + {{item.title}} + {{item.subtitle}} @@ -73,15 +73,15 @@ 员工 - 2022-5 + {{item.createDate}} - + - {{item.name}} - {{item.dis}} + {{item.title}} + {{item.subtitle}} diff --git a/pages/index/subpage/brand/brand.js b/pages/index/subpage/brand/brand.js index bd3e0f6..5459577 100644 --- a/pages/index/subpage/brand/brand.js +++ b/pages/index/subpage/brand/brand.js @@ -162,19 +162,45 @@ Page({ }, - /** + /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.onRefresh() + }, + onRefresh:function(){ + //导航条加载动画 + wx.showNavigationBarLoading() + //loading 提示框 + wx.showLoading({ + title: 'Loading...', + }) + console.log("下拉刷新啦"); + setTimeout(function () { + wx.hideLoading(); + wx.hideNavigationBarLoading(); + //停止下拉刷新 + wx.stopPullDownRefresh(); + }, 2000) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { - // console.log('页面上拉触底事件的处理函数') - this.getbrandlist() + // this.getbrandlist() + if (this.data.page === this.data.maxpage) { + wx.showToast({ + title: '到底啦~', + icon: 'none', + duration: 2000 + }) + } else { + this.setData({ + 'page': this.data.page + 1 + }) + this.getdata() + } }, /** diff --git a/pages/index/subpage/brand/brandDetails.js b/pages/index/subpage/brand/brandDetails.js deleted file mode 100644 index cd15f53..0000000 --- a/pages/index/subpage/brand/brandDetails.js +++ /dev/null @@ -1,66 +0,0 @@ -// pages/index/subpage/brand/brandDetails.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/pages/index/subpage/brand/brandDetails.json b/pages/index/subpage/brand/brandDetails.json deleted file mode 100644 index 8835af0..0000000 --- a/pages/index/subpage/brand/brandDetails.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "usingComponents": {} -} \ No newline at end of file diff --git a/pages/index/subpage/brand/brandDetails.wxml b/pages/index/subpage/brand/brandDetails.wxml deleted file mode 100644 index 6cde57d..0000000 --- a/pages/index/subpage/brand/brandDetails.wxml +++ /dev/null @@ -1,2 +0,0 @@ - -pages/index/subpage/brand/brandDetails.wxml diff --git a/pages/index/subpage/brand/brandDetails.wxss b/pages/index/subpage/brand/brandDetails.wxss deleted file mode 100644 index cd89d6f..0000000 --- a/pages/index/subpage/brand/brandDetails.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/index/subpage/brand/brandDetails.wxss */ \ No newline at end of file diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.js b/pages/index/subpage/brand/brandDetails/brandDetails.js index 5842149..b52f57b 100644 --- a/pages/index/subpage/brand/brandDetails/brandDetails.js +++ b/pages/index/subpage/brand/brandDetails/brandDetails.js @@ -14,7 +14,7 @@ Page({ type: 0, records: [], infoObject: {}, - isClick: false, + isCollected:false, // imageUrl:"/pages/index/shortimage/img_xingtue@2x.png" }, back() { @@ -39,29 +39,26 @@ Page({ }) }, - //收藏 - collection(e) { + // 收藏 + add(e) { var that = this - let userId = this.data.infoObject.id + // let userId = this.data.id let referenceId = this.data.infoObject.id - // let referenceId = wx.getStorageSync('referenceId') - let isClick = this.data.isClick - console.log(e) - if (!isClick) { + let isCollected = this.data.isCollected + if (!isCollected) { that.setData({ - isClick: true + isCollected: true }) wx.showToast({ title: '收藏成功', icon: 'none' }) http("/userReference/add", "post", { - userId, + // userId, referenceId }).then(res => { this.setData({ - // userId:e.currentTarget.dataset.cycle_id, - // referenceId:this.id + referenceId }) }) } @@ -79,7 +76,24 @@ Page({ infoObject: wx.getStorageSync('info') }) this.getrecordslist() + //详情 + http("/topicActivity/detail", "post", { + id:this.data.infoObject.id + }).then(res => { + this.setData({ + }) + }) + //点击增加量 + http("/topicActivity/noteHits", "post", { + id:this.data.infoObject.id + }).then(res => { + this.setData({ + 'toplist[0].num': res.data.playNumSum+ 1 + }) + }) + }, + //动态列表 getrecordslist() { http("/topicActivity/list", "post", {}).then(res => { this.setData({ @@ -116,18 +130,43 @@ Page({ }, - /** + /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { - + this.onRefresh() + }, + onRefresh:function(){ + //导航条加载动画 + wx.showNavigationBarLoading() + //loading 提示框 + wx.showLoading({ + title: 'Loading...', + }) + console.log("下拉刷新啦"); + setTimeout(function () { + wx.hideLoading(); + wx.hideNavigationBarLoading(); + //停止下拉刷新 + wx.stopPullDownRefresh(); + }, 2000) }, - /** * 页面上拉触底事件的处理函数 */ onReachBottom() { - + if (this.data.page === this.data.maxpage) { + wx.showToast({ + title: '到底啦~', + icon: 'none', + duration: 2000 + }) + } else { + this.setData({ + 'page': this.data.page + 1 + }) + this.getdata() + } }, /** diff --git a/pages/index/subpage/brand/brandDetails/brandDetails.wxml b/pages/index/subpage/brand/brandDetails/brandDetails.wxml index 8ae4eb7..b1828c7 100644 --- a/pages/index/subpage/brand/brandDetails/brandDetails.wxml +++ b/pages/index/subpage/brand/brandDetails/brandDetails.wxml @@ -33,18 +33,23 @@ 分享 - + 保存 - + + + 保存 + + + @@ -67,7 +72,7 @@ - + diff --git a/pages/index/subpage/ranking/ranking.js b/pages/index/subpage/ranking/ranking.js index a55e4d3..1ad9cbd 100644 --- a/pages/index/subpage/ranking/ranking.js +++ b/pages/index/subpage/ranking/ranking.js @@ -1,48 +1,15 @@ -11// pages/index/subpage/ranking/ranking.js +// pages/index/subpage/ranking/ranking.js +import {http} from '../../../../utils/util' Page({ - /** * 页面的初始数据 */ data: { type: "1", + page:1, title: "经销商排行榜", as: "-500%", - distributor: [ - { - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - },{ - name: "北京福瑞祥云店", - add: "北京市顺义区通顺路", - count: "1200" - }, - ] + records:[], }, typechange(e){ this.data.type = e.target.dataset.type @@ -59,11 +26,25 @@ Page({ delta: 0, }) }, + //排行榜 + RankingList(){ + http("/rank/list", "post", { + pageNum: this.data.pages, + pageSize:this.data.size, + type:1 + }).then(res =>{ + this.setData({ + records: res.data.records, + }) + }) + + }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + this.RankingList() + }, /** diff --git a/pages/index/subpage/ranking/ranking.wxml b/pages/index/subpage/ranking/ranking.wxml index 407b7a5..31d9a64 100644 --- a/pages/index/subpage/ranking/ranking.wxml +++ b/pages/index/subpage/ranking/ranking.wxml @@ -3,7 +3,7 @@ {{title}} - 2022-05-01~2022-06-01 + {{item.records.createDate}} 经销商 @@ -11,7 +11,7 @@ - + @@ -19,16 +19,16 @@ {{index >= 9 ? index + 1 : '0' + (index + 1)}} - {{item.name}} - {{item.add}} + {{item.title}} + {{item.subtitle}} - {{item.count}} + {{item.value}} 传播值 - + @@ -37,11 +37,11 @@ - {{item.name}} - {{item.add}} + {{item.title}} + {{item.subtitle}} - {{item.count}} + {{item.value}} 传播值 \ No newline at end of file diff --git a/pages/quest/subpage/detail/components/effect/effect.wxml b/pages/quest/subpage/detail/components/effect/effect.wxml index b9fd1db..0a95a73 100644 --- a/pages/quest/subpage/detail/components/effect/effect.wxml +++ b/pages/quest/subpage/detail/components/effect/effect.wxml @@ -28,7 +28,7 @@ 0 - 收藏量 + 传播量 @@ -56,7 +56,7 @@ 0 - 收藏量 + 传播量 @@ -102,7 +102,7 @@ 0 - 收藏量 + 传播量 diff --git a/pages/user/subpage/quest/subpage/detail/components/effect/effect.wxml b/pages/user/subpage/quest/subpage/detail/components/effect/effect.wxml index b9fd1db..0a95a73 100644 --- a/pages/user/subpage/quest/subpage/detail/components/effect/effect.wxml +++ b/pages/user/subpage/quest/subpage/detail/components/effect/effect.wxml @@ -28,7 +28,7 @@ 0 - 收藏量 + 传播量 @@ -56,7 +56,7 @@ 0 - 收藏量 + 传播量 @@ -102,7 +102,7 @@ 0 - 收藏量 + 传播量 diff --git a/project.private.config.json b/project.private.config.json index 742204b..4d52bbd 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,5 +1,5 @@ { - "projectname": "xx", + "projectname": "EXEEED", "setting": { "compileHotReLoad": true, "urlCheck": true diff --git a/utils/util.js b/utils/util.js index a3c640b..0e242cd 100644 --- a/utils/util.js +++ b/utils/util.js @@ -19,11 +19,12 @@ const formatNumber = n => { } const http = (url, method, data, isLoading = true) => { - if (isLoading) { + if (false) { wx.showLoading({ title: '加载中' }); } + return new Promise(function (resolve, reject) { if (url === '/user/login' || url === '/user/register') { var header = {} @@ -38,11 +39,10 @@ const http = (url, method, data, isLoading = true) => { url: host + url, method: 'POST', data: data, - header:header, + header: header, success: res => { - if (isLoading) { wx.hideLoading(); - } + console.log(res) if (200 == res.data.code) { resolve(res.data); } else if (10008 === res.data.code && res.data.msg === "未注册!") { @@ -55,7 +55,12 @@ const http = (url, method, data, isLoading = true) => { }) } }, + complete: res => { + wx.hideLoading(); + console.log(res) + }, fail: res => { + console.log(res) wx.hideLoading(); } })