forked from natuka/web.puabadge.com
Initial commit
This commit is contained in:
commit
84061c9a18
243 files changed
+63148
No files matched your search
@@ -0,0 +1,82 @@
|
||||
<script setup lang="ts">
|
||||
import hello from 'hellojs'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
interface Item {
|
||||
icon: string
|
||||
name: string
|
||||
text: string
|
||||
}
|
||||
|
||||
const logins: Ref<Item[]> = ref([
|
||||
// {
|
||||
// icon: 'microsoft',
|
||||
// name: 'windows',
|
||||
// text: '微软',
|
||||
// },
|
||||
{
|
||||
icon: 'googleplus',
|
||||
name: 'google',
|
||||
text: 'G+',
|
||||
},
|
||||
// {
|
||||
// icon: 'facebook',
|
||||
// name: 'facebook',
|
||||
// text: 'Facebook',
|
||||
// },
|
||||
// {
|
||||
// icon: 'apple',
|
||||
// name: 'apple',
|
||||
// text: 'apple',
|
||||
// },
|
||||
{
|
||||
icon: 'twitter',
|
||||
name: 'twitter',
|
||||
text: 'twitter',
|
||||
},
|
||||
// {
|
||||
// icon: 'wechat',
|
||||
// name: 'wechat',
|
||||
// text: 'wechat',
|
||||
// },
|
||||
])
|
||||
|
||||
function onBtn(item: Item) {
|
||||
console.log('onBtn', item)
|
||||
hello(item.name).login().then(() => {
|
||||
console.log('login success')
|
||||
}, () => {
|
||||
console.log('login failed')
|
||||
})
|
||||
}
|
||||
|
||||
hello.on('auth.login', (auth) => {
|
||||
hello(auth.network).api('/me', 'get').then((r) => {
|
||||
localStorage.setItem(auth.network+':r', JSON.stringify(r))
|
||||
console.log(r, '登录成功获取到用户的信息,调用排队接口')
|
||||
}).catch((e) => {
|
||||
localStorage.setItem(auth.network+':e', JSON.stringify(e))
|
||||
console.log(e)
|
||||
})
|
||||
})
|
||||
|
||||
hello.init({
|
||||
facebook: '1875721406193406',
|
||||
windows: '000000004403AD10',
|
||||
google: '495792315385-mj44iuov1bupumvl6evmmcvag39mi38t.apps.googleusercontent.com',
|
||||
twitter: 'ICw3GtdIivmHPI5qTLD0gZDbN',
|
||||
}, {
|
||||
redirect_uri: './oauth.html',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<van-divider>Loading...</van-divider>
|
||||
<!-- <van-grid :column-num="2">
|
||||
<van-grid-item v-for="(item, i) in logins" :key="i" icon-prefix="iconfont" :icon="item.icon" :text="item.text" @click="onBtn(item)" />
|
||||
</van-grid> -->
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
Reference in new issue
Block a user