-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
56 lines (53 loc) · 1 KB
/
App.vue
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
<script>
export default {
onLaunch() {},
globalData: {
openId: ''
},
onShareAppMessage() {
return {
title: '猪猪地图',
path: '/pages/lists/lists',
imageUrl: '/static/icon.png'
}
},
methods: {
/** 登录 */
login() {
uni.showLoading()
return uni.login({ provider: 'weixin' }).then(({ code }) => {
if (!code)
return Promise.reject()
return uniCloud.callFunction({
name: 'login',
data: { code }
})
}).then((res) => {
this.globalData.openId = res.result.openId
uni.hideLoading()
}).catch(() => {
uni.showToast({
icon: 'error',
title: '登录失败'
})
})
}
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import '@/uni_modules/uni-scss/index.scss';
/* #ifndef APP-NVUE */
@import '@/static/customicons.css';
// 设置整个项目的背景色
page {
background-color: #f5f5f5;
}
/* #endif */
.example-info {
font-size: 14px;
color: #333;
padding: 10px;
}
</style>