You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
4.0 KiB

3 years ago
// index.js
// 获取应用实例
3 years ago
import {http,formatTime} from '../../utils/util'
3 years ago
import {cdn}from '../../utils/config'
3 years ago
const app = getApp()
Page({
data: {
3 years ago
cdn:getApp().globalData.cdn,
3 years ago
numlist:[],
3 years ago
toplist: [{
url: '/images/ic_bofang@3x.png',
title: '总播放量',
3 years ago
num: '0'
3 years ago
}, {
url: '/images/ic_dianzan@3x.png',
title: '总点赞数',
3 years ago
num: '0'
3 years ago
}, {
url: '/images/collection@3x.png',
title: '总收藏数',
3 years ago
num: '0'
3 years ago
}, {
url: '/images/comment@3x.png',
title: '总评论数',
3 years ago
num: '0'
3 years ago
},
{
url: '/images/ic_zhuanfa@3x.png',
title: '总转发数',
num: '0'
},
{
url: '/images/ic_tuijian@3x.png',
title: '总推荐数',
num: '0'
},
],
3 years ago
rankurl: [
'/images/img_diyi@3x.png',
'/images/img_dier@3x.png',
'/images/img_disan@3x.png'
],
3 years ago
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号博瑞大厦'
// }],
3 years ago
staranking: [{
url: '/images/img_diyi@3x.png',
name: '维涅斯',
dis: '罗森便利店(江安店)'
}, {
url: '/images/img_dier@3x.png',
name: '爱梅特赛尔克',
dis: '罗森(upark店)'
}, {
url: '/images/img_disan@3x.png',
name: '希斯拉德',
dis: 'LAWSON罗森(博瑞大厦店)'
3 years ago
}],
3 years ago
rows:[],
page:1,
size:10
3 years ago
},
to(e) {
console.log(e.target.dataset.url)
wx.navigateTo({
url: e.target.dataset.url
})
},
onLoad: function (options) {
3 years ago
// wx.setNavigationBarTitle({
// title: '',
// success: function (res) {}
// })
3 years ago
wx.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#006BFF',
animation: {
duration: 400,
timingFunc: 'easeIn'
}
})
3 years ago
this.getrecordslist()
3 years ago
this.RankingList()
this.numlist()
3 years ago
},
3 years ago
//总数
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
})
})
},
//品牌动态
3 years ago
getrecordslist(){
http("/topicActivity/list", "post", {
3 years ago
showAtIndex:1
3 years ago
}).then(res =>{
this.setData({
3 years ago
records: res.data.records
3 years ago
})
})
3 years ago
let date = formatTime(new Date())
console.log(date)
http("/rank/list", "post", {
dateTime: date
}).then(res =>{
})
3 years ago
},
3 years ago
//排行榜
RankingList(){
http("/rank/list", "post", {
pageNum: this.data.pages,
pageSize:this.data.size,
type:1
}).then(res =>{
this.setData({
rows: res.data.records,
})
})
},
//查看全部
3 years ago
detail(e){
console.log(e)
wx.setStorageSync('info', e.currentTarget.dataset.cycle_id)
wx.navigateTo({
3 years ago
url:"/pages/index/subpage/brand/brandDetails/brandDetails?id="
3 years ago
})
3 years ago
3 years ago
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.onRefresh()
},
onRefresh:function(){
//导航条加载动画
wx.showNavigationBarLoading()
//loading 提示框
wx.showLoading({
title: 'Loading...',
})
console.log("下拉刷新啦");
3 years ago
this.getrecordslist()
setTimeout(function () {
wx.hideLoading();
wx.hideNavigationBarLoading();
//停止下拉刷新
wx.stopPullDownRefresh();
}, 2000)
},
3 years ago
})