2022-02-09 00:23:20 +08:00

82 lines
1.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- <import name="button" src="apex-ui/components/button/index"></import> -->
<template>
<!-- template里只能有一个根节点 -->
<div class="wrapper">
<div class="logo">
<image src="/assets/images/index-logo.svg" />
</div>
<div class="btn-group">
<text class="btn-wx" @click="onWxSignBtnClick">Sign in with WeChat</text>
<!-- class="btn-wx"
value="Sign in with WeChat"
onclick="onWxSignBtnClick"
/> -->
</div>
</div>
</template>
<script>
import router from '@system.router'
const appInitC = new BroadcastChannel('init')
appInitC.onmessage = ({ data }) => {
console.log(`index: received app init message:${data}`);
if (data === 1) {
appInitC.close()
router.replace({
uri: 'pages/Home'
})
}
}
export default {
// 页面级组件的数据模型影响传入数据的覆盖机制private内定义的属性不允许被覆盖
private: {
},
async onWxSignBtnClick() {
API.login()
.then(token => {
appInitC.postMessage(token)
})
},
onInit() {
},
}
</script>
<style lang="less">
.wrapper {
flex-direction: column;
align-items: center;
height: 100%;
.logo {
flex-direction: column;
justify-content: center;
height: 60%;
width: 50%;
}
.btn-group {
flex-direction: column;
width: 50%;
/* margin: 0 auto; */
text {
margin: 16px 0;
padding: 24px;
border-width: 3px;
border-radius: 8px;
text-align: center;
font-size: 32px;
}
.btn-wx {
color: #296c05;
border-color: #296c05;
}
}
}
</style>