销量排行

dev
wylyl22 3 years ago
parent cfae3aa6cd
commit acd9e88539

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

@ -9,15 +9,17 @@
<view class="title2">传播量</view> <view class="title2">传播量</view>
</view> </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"> <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 === 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 === 1}}" src="{{imageUrl}}/img_dier.png"></image>
<image class="rank_num" wx:if="{{index === 2}}" src="{{imageUrl}}/img_disan.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 class="num" wx:if="{{index !== 0 &&index !== 1 &&index !== 2 }}">{{index >= 9 ? index + 1 : '0' + (index + 1)}}</view>
</view> </view>
<view class="media">{{item.media}}</view> <view class="media">{{item}}</view>
<view class="volume">{{item.volume}}</view>
<view class="volume">{{idx}}</view>
</view> </view>
</view> </view>
</view> </view>

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

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

Loading…
Cancel
Save