App.vue
1.8 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
<script>
import { getLogin } from '@/services/modules/login.js'
export default {
data() {
return {
uid: '',
start: '',
end: ''
}
},
onLaunch: function(e) {
// this.uid = window.location.href
// this.start = window.location.href.indexOf('uid=')
// this.end = window.location.href.indexOf('&code=')
// this.uid = this.uid ? window.location.href.slice(this.start + 4, this.end) : ''
// if (this.uid) {
// uni.setStorageSync('uid', this.uid)
// }
// if (!e.query.code) {
// window.location.href =
// `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx70f94d685f50c2d5&redirect_uri=${encodeURIComponent(window.location.href)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// } else {
// this.uid = uni.getStorageSync('uid')
// getApp().getLogin(e.query.code, this.uid)
// }
},
// watch: {
// uid: function(newVal, oldVal) {
// this.uid = newVal
// }
// },
methods: {
// async getLogin(code, uid) {
// try {
// const res = await getLogin(code, uid)
// uni.setStorageSync('token', res.data.token)
// console.log('getLogin', res)
// // 保存数据
// } catch (err) {
// uni.showToast({ title: err, icon: 'none' })
// console.log('错误', err)
// }
// },
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-plus/index.scss";
page {
background-color: #000;
font-size: 28rpx;
color: #fff;
}
</style>