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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import Dialog from '../../../../miniprogram_npm/@vant/weapp/dialog/dialog' ;
const app = getApp ( )
const words = [ ] ;
Component ( {
data : {
mockData : [ ] ,
result : new Array ( 6 ) ,
boxArr : new Array ( 6 ) ,
} ,
methods : {
startCp ( ) {
wx . setStorageSync ( 'brandData' , this . data . boxArr )
wx . navigateTo ( {
url : ` /pages/varComm/pages/brandRatio/index ` ,
} )
} ,
del ( index ) {
console . log ( index ) ;
console . log ( 123 ) ;
} ,
onChange ( event ) {
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
let boxArr = result
boxArr = boxArr . map ( ele => {
return ele != undefined ? JSON . parse ( ele ) : undefined
} )
console . log ( this . data . boxArr ) ;
this . setData ( {
result : result ,
boxArr : boxArr
} ) ;
} ,
} ,
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 ( {
mockData : arr
} )
} )
}
} ,
} )