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.

78 lines
2.2 KiB

3 years ago
import Dialog from '../../../../miniprogram_npm/@vant/weapp/dialog/dialog';
3 years ago
const app = getApp()
const words = [];
Component({
3 years ago
data: {
3 years ago
mockData: [],
3 years ago
result: new Array(6),
boxArr:new Array(6),
3 years ago
},
3 years ago
methods: {
startCp() {
3 years ago
wx.setStorageSync('brandData',this.data.boxArr)
wx.navigateTo({
url: `/pages/varComm/pages/brandRatio/index`,
3 years ago
})
},
3 years ago
del(index){
console.log(index);
console.log(123);
},
3 years ago
onChange(event) {
3 years ago
let result = []
if(this.data.result.at(-1)!=undefined && event.detail.length>6){
Dialog.alert({
title: '提示',
context :this,
message: '至多选择6个品牌',
})
}
for(let i =0;i<event.detail.length;i++){
if(event.detail[i]!=undefined){
result.push(event.detail[i])
}
}
result.length = 6
3 years ago
let boxArr = result
boxArr = boxArr.map(ele=>{
return ele !=undefined ? JSON.parse(ele):undefined
})
console.log(this.data.boxArr);
3 years ago
this.setData({
3 years ago
result: result,
3 years ago
boxArr:boxArr
3 years ago
});
},
3 years ago
},
3 years ago
lifetimes: {
attached() {
3 years ago
//页面数据
3 years ago
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)
}
}
}
3 years ago
this.setData({
mockData:arr
})
3 years ago
})
}
3 years ago
},
3 years ago
})