You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
onLaunch: function() {
|
|
|
|
console.log('App Launch');
|
|
|
|
// 调用uni.login方法获取code
|
|
|
|
uni.login({
|
|
|
|
provider:'weixin',
|
|
|
|
success: function(loginRes) {
|
|
|
|
// 打印获取到的code
|
|
|
|
console.log('获取的用户code是:' + loginRes.code);
|
|
|
|
uni.request({
|
|
|
|
url:'',
|
|
|
|
method:'POST'
|
|
|
|
})
|
|
|
|
},
|
|
|
|
fail: function(error) {
|
|
|
|
// 登录失败的回调
|
|
|
|
console.error('登录失败:', error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onShow: function() {
|
|
|
|
console.log('App Show')
|
|
|
|
},
|
|
|
|
onHide: function() {
|
|
|
|
console.log('App Hide')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
|
|
|
@import "uview-ui/index.scss";
|
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
/*每个页面公共css */
|
|
|
|
@import "static/common.css";
|
|
|
|
</style>
|