-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
69 lines (66 loc) · 1.89 KB
/
app.js
File metadata and controls
69 lines (66 loc) · 1.89 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
/**
* @file app.js
* @author swan
*/
/* globals swan */
App({
data(){},
onLaunch(options) {
// do something when launch
},
onShow(options) {
// do something when show
},
onHide() {
// do something when hide
},
goToDetails(item){
let id = item.currentTarget.dataset.item.id
let classId = item.currentTarget.dataset.item.classid
// console.log('125')
if( item.currentTarget.dataset.id == id ){
return false
}else{
swan.navigateTo({
url: "/pages/details/details?id=" + id
});
}
},
goToList(item){
console.log(item.currentTarget.dataset.item)
if( item.currentTarget.dataset.item == undefined ){
swan.reLaunch({
url: "/pages/home/home"
});
}else{
let id = item.currentTarget.dataset.item.classid
let classname = item.currentTarget.dataset.item.classname
swan.navigateTo({
url: "/pages/list/list?id=" + id + "&name=" + classname
});
}
console.log()
// swan.navigateTo({
// url: "/pages/list/list?id=" + id + "&name=" + classname
// });
},
getTdk(site){
// console.log(site)
let img = (site != undefined && site.img != undefined) ? site.img : ""
if( site != undefined ){
swan.setPageInfo({
title: site.title,
keywords: site.sitekey,
description: site.siteintro,
image: img,
success: function () {
console.log('setPageInfo success');
// console.log(site.banner)
},
fail: function (err) {
console.log('setPageInfo fail', err);
}
})
}
}
});