|
@@ -2,8 +2,8 @@
|
|
|
<div class="header">
|
|
|
<img class="logo" src="../static/img/logo.svg" alt="DeNet" />
|
|
|
<div class="operation">
|
|
|
- <div class="login" @click="twitterAuth">
|
|
|
- <img class="add" src="../static/img/header-add.svg" alt="">
|
|
|
+ <div class="login" @click="login">
|
|
|
+ <img class="add" src="../static/img/header-add.svg" alt="" />
|
|
|
<span>Create NFTs</span>
|
|
|
</div>
|
|
|
<div class="down" @click="install">
|
|
@@ -28,8 +28,31 @@ const timer = ref(0)
|
|
|
const router = useRouter()
|
|
|
|
|
|
const install = () => {
|
|
|
- console.log(333, process.env.NODE_ENV)
|
|
|
- // window.open(`https://chrome.google.com/webstore/detail/denet/inlfbeejfdgkknpiodhemfcokbdgofja`);
|
|
|
+ window.open(`https://chrome.google.com/webstore/detail/denet/inlfbeejfdgkknpiodhemfcokbdgofja`);
|
|
|
+}
|
|
|
+
|
|
|
+const checkInstall = () => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let dom = document.querySelector('#denet_message');
|
|
|
+ if (dom) {
|
|
|
+ resolve(true)
|
|
|
+ } else {
|
|
|
+ reject(false)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const login = () => {
|
|
|
+ checkInstall().then(() => {
|
|
|
+ let userInfo = getStorage(storageKey.userInfo);
|
|
|
+ if (userInfo) {
|
|
|
+ router.push(`/nft/list`)
|
|
|
+ } else {
|
|
|
+ twitterAuth()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ install()
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const twitterAuth = () => {
|
|
@@ -76,11 +99,17 @@ const twitterLogin = (data: { authToken: string, consumerKey: string }) => {
|
|
|
oauthVerifier: verifier
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- let { code, data } = res;
|
|
|
+ let { code, data, msg } = res;
|
|
|
if ( code === 0 ) {
|
|
|
setStorage(storageKey.userInfo, data);
|
|
|
removeStorage(storageKey.verifier);
|
|
|
router.push(`/nft/list`)
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ offset: 100,
|
|
|
+ type: 'error',
|
|
|
+ message: msg,
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -117,6 +146,7 @@ const twitterLogin = (data: { authToken: string, consumerKey: string }) => {
|
|
|
cursor: pointer;
|
|
|
padding: 0 18px;
|
|
|
font-size: 15px;
|
|
|
+ font-weight: 600;
|
|
|
color: #1D9BF0;
|
|
|
margin-right: 19px;
|
|
|
border-radius: 20px;
|
|
@@ -139,6 +169,7 @@ const twitterLogin = (data: { authToken: string, consumerKey: string }) => {
|
|
|
.text {
|
|
|
color: #fff;
|
|
|
font-size: 15px;
|
|
|
+ font-weight: 600;
|
|
|
margin-top: -2px;
|
|
|
}
|
|
|
}
|