list.js
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const navStyle = 'background-color: transparent;'
import { devMixin } from '~/mixins/index'
Page({
behaviors: [devMixin],
/**
* 页面的初始数据
*/
data: {
navStyle: 'background-color: transparent;'
},
navbarReady(e) {
console.log(e)
let {
height
} = e.detail
this.setData({
top: height
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if(wx.getStorageSync('device_info')){
const devList = wx.getStorageSync('device_info')
this.setData({devList})
}
this.getUserCarList()
},
init(){
this.getUserCarList()
},
getUserCarList() {
wx.p.api.mineApi.getUserCarList().then(({
code,
data
}) => {
this.setData({
carFlag: true
})
if (code == '0') {
let carInfo = null
data.map(e => {
if (e.carTypeName) carInfo = e
})
this.setData({
carInfo
})
}
})
},
setUp(e) {
const {index} = e.currentTarget.dataset
const {devList} = this.data
const selectItem = devList[index]
console.log(selectItem)
devList.splice(index,1)
devList.unshift(selectItem)
wx.setStorageSync('device_info', devList)
this.setData({
devList
})
},
goto(e) {
let {
url,
item,
name
} = e.currentTarget.dataset
let path = 'index'
if (name) path = name
console.log(`/packageMine/pages/${url}/${path}/${path}`);
wx.p.router.go(`/packageMine/pages/${url}/${path}/${path}`, item)
},
})