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.

115 lines
3.2 KiB

3 years ago
const app = getApp();
// Page({
// data: {
// recommandBrand: [],
// },
// onShow() {
// this.getTabBar().init();
// this.getData();
// },
// getData() {
// //页面数据
// wx.showToast({
// title: '加载中',
// icon: 'loading',
// duration: 30000
// })
// app.globalData.request({
// action: 'getUserBrand',
// token: 't%2BrswgjvzGM=',
// }).then(res => {
// console.log(res)
// // let arr = [];
// // for (let i = 65; i <= 90; i++) {
// // arr.push({
// // name: String.fromCharCode(i),
// // data: []
// // });
// // }
// // for(let i of res){
// // for(let j of arr){
// // if(i.firstword == j.name){
// // j.data.push(i)
// // }
// // }
// // }
// // let newArr = [];
// // let obj = {};
// // for (var i = 0; i < res.length; i++) {
// // if (!obj[res[i].brandid]) {
// // newArr.push(res[i])
// // obj[res[i].brandid] = true
// // }
// // }
// // this.setData({
// // mockData:arr,
// // navData: newArr,
// // sourceData: newArr
// // })
// setTimeout(() => {
// wx.hideToast();
// }, 1000)
// })
// },
// toBrandInsight() {
// wx.navigateTo({
// url: "/pages/insight/pages/brandInsight/index"
// })
// },
// })
Component({
3 years ago
data: {
3 years ago
recommandBrand: [],
brandList: [],
brandForm: {
brand: ''
}
3 years ago
},
3 years ago
methods: {
toBrandInsight(e) {
let id = e.currentTarget.dataset.id; //获取点击的id
3 years ago
wx.setStorageSync('sBrand', id);
wx.navigateTo({
url: "/pages/insight/pages/brandInsight/index"
})
3 years ago
},
handlerSearch(value) {
}
3 years ago
},
3 years ago
lifetimes: {
attached() {
//页面数据
app.globalData.request({
action: 'getUserBrand',
token: 't%2BrswgjvzGM=',
}).then(res => {
let arr = []
for (let i = 65; i <= 90; i++) {
arr.push({
name: String.fromCharCode(i),
data: []
});
}
for(let i of res){
for(let j of arr){
if(i.firstword == j.name){
j.data.push(i)
}
}
}
this.setData({
brandList:arr
});
});
//推荐品牌
app.globalData.request({
action: 'getRecommendSeries',
token: 't%2BrswgjvzGM=',
}).then(res => {
3 years ago
console.log(res)
3 years ago
});
},
3 years ago
},
})