-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.vue
More file actions
79 lines (70 loc) · 1.45 KB
/
Copy pathApp.vue
File metadata and controls
79 lines (70 loc) · 1.45 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
78
79
<script>
import sk from '@/common/StoryKeys.js'
import api from '@/common/api.js'
import su from '@/utils/StringUtils.js'
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
// 获取广告
api.post({
}, api.jdList).then(res => {
if (res.code == 200) {
uni.setStorage({
key: sk.shopList,
data: res.data
})
}
})
// 获取ip
api.get({}, api.GET_IP).then(res => {
var ip = su.getIp(res);
console.log(ip);
// 获取ip属地
api.get({
ip: ip
}, api.ipTerritory).then(res => {
console.log("ip属地", res);
if (!su.isBlank(res)&&res.code == 200) {
var ip_Territory = res.country + res.province + res.city + res.isp;
uni.setStorage({
key: sk.ipTerritory,
data: ip_Territory
})
} else {
uni.setStorage({
key: sk.ipTerritory,
data: "中国大陆"
})
uni.setStorage({
key:sk.ip,
data:"未知"
})
}
});
});
// 获取设备信息
const res = uni.getSystemInfoSync();
uni.setStorage({
key: sk.deviceModel,
data: res
})
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style>
/*每个页面公共css */
* {
font-family: "arial, helvetica, sans-serif", "宋体";
padding: 0;
margin: 0;
outline: none;
text-decoration: none;
list-style: none;
}
</style>