销量排行

dev
wylyl22 3 years ago
parent cfae3aa6cd
commit acd9e88539

@ -3,61 +3,34 @@ const app = getApp();
Component({
data: {
imageUrl: getApp().globalData.imageUrl,
// ranking: [
// {
// volume: '12345',
// media: '媒体',
// },
// {
// volume: '12345',
// media: '媒测评',
// },
// {
// volume: '12345',
// media: '媒体测评',
// },
// {
// volume: '12345',
// media: '媒体探测测评',
// },
// {
// volume: '712345',
// media: '媒体测评',
// },
// {
// volume: '1234533',
// media: '媒体测评',
// }
// ],
ranking:[]
},
lifetimes: {
attached() {
app.globalData.request({action: 'getWebsiteHome0528', sType: 'Home', sTimeType: 34}).then(res => {
const arr = []
let a=res
// a.forEach(ele => {
// let obj = {
// title: key,
// num: this.data[key],
// }
// arr.push(obj)
// })
const arr=[]
let data=JSON.stringify(res)
let data2=JSON.parse(data)
for (let index = 0; index < 10; index++) {
let obj={
name:data2.key,
value:data2.value
}
arr.push(obj)
}
// for (let index = 0; index < 10; index++) {
// }
this.setData({
// countYear: data.count_year,
// count6month: data.count_6month,
// countAll: data.count_all,
ranking: a
ranking: arr
})
})
},
},
methods: {
a(){
console.log('111',ranking)
console.log('111',this.arr)
},
}
})

@ -9,15 +9,17 @@
<view class="title2">传播量</view>
</view>
<view>
<view class="rank" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'>
<view class="rank" wx:for="{{ranking}}" wx:key="idx">
<view class="dis_image">
<image class="rank_num" wx:if="{{index === 0}}" src="{{imageUrl}}/img_diyi.png"></image>
<image class="rank_num" wx:if="{{index === 1}}" src="{{imageUrl}}/img_dier.png"></image>
<image class="rank_num" wx:if="{{index === 2}}" src="{{imageUrl}}/img_disan.png"></image>
<view class="num" wx:if="{{index !== 0 &&index !== 1 &&index !== 2 }}">{{index >= 9 ? index + 1 : '0' + (index + 1)}}</view>
</view>
<view class="media">{{item.media}}</view>
<view class="volume">{{item.volume}}</view>
<view class="media">{{item}}</view>
<view class="volume">{{idx}}</view>
</view>
</view>
</view>

@ -1,6 +1,6 @@
// pages/index/Salesranking/Salesranking.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/

@ -1,6 +1,6 @@
// index.js
// 获取应用实例
const app = getApp()
Page({
data: {

Loading…
Cancel
Save