diff --git a/components/indexCom/mediaChild/index.js b/components/indexCom/mediaChild/index.js index 4fa894d..c846a16 100644 --- a/components/indexCom/mediaChild/index.js +++ b/components/indexCom/mediaChild/index.js @@ -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) }, } }) \ No newline at end of file diff --git a/components/indexCom/mediaChild/index.wxml b/components/indexCom/mediaChild/index.wxml index 7364cfc..b8b9719 100644 --- a/components/indexCom/mediaChild/index.wxml +++ b/components/indexCom/mediaChild/index.wxml @@ -9,15 +9,17 @@ 传播量 - + + {{index >= 9 ? index + 1 : '0' + (index + 1)}} - {{item.media}} - {{item.volume}} + {{item}} + + {{idx}} diff --git a/pages/index/Salesranking/Salesranking.js b/pages/index/Salesranking/Salesranking.js index 0936ccc..b46376f 100644 --- a/pages/index/Salesranking/Salesranking.js +++ b/pages/index/Salesranking/Salesranking.js @@ -1,6 +1,6 @@ // pages/index/Salesranking/Salesranking.js +const app = getApp() Page({ - /** * 页面的初始数据 */ diff --git a/pages/index/index.js b/pages/index/index.js index d1d4ced..932d22d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,6 +1,6 @@ // index.js // 获取应用实例 -const app = getApp() + Page({ data: {