Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shellteo committed Dec 26, 2018
1 parent b4e4815 commit 96cef10
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 168 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>vuedex</title>
<title>Tron Produce ٩(๑•̀ω•́๑)۶</title>
</head>
<body>
<noscript>
<strong>We're sorry but vuedex doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but Tron Produce doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
Expand Down
100 changes: 15 additions & 85 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,89 +1,28 @@
<template>
<div id="app">
<el-container>
<CryptoHeader></CryptoHeader>
<el-header class="page-header" style="height: auto;">
<AppHeader></AppHeader>
</el-header>
<router-view></router-view>
<el-footer style="background-color: #0C071C;height: auto;">
<CryptoFooter></CryptoFooter>
<AppFooter></AppFooter>
</el-footer>
</el-container>
</div>
</template>

<script>
//import api from '@/util/api'
import CryptoHeader from './components/layout/CryptoHeader'
import CryptoFooter from './components/layout/CryptoFooter'
import API from '@/api'
import util from '@/util/util'
import AppHeader from './components/layout/AppHeader'
import AppFooter from './components/layout/AppFooter'
export default {
name: 'app',
components: {
CryptoHeader,
CryptoFooter
AppHeader,
AppFooter
},
mounted() {
/*window.addEventListener('load', () => {
if (typeof tronPay !== 'undefined') {
tronWeb = tronPay.tronWeb || tronWeb
if (tronWeb.isTronPay && tronWeb.ready) {
this.$store.commit('updateLogin', true)
let address = window.tronWeb.defaultAddress.hex;
API.login({
address: address,
sign: ''
}).then(res => {
console.log(res);
});
/!*window.tronWeb.trx.getAccount(address).then((res) => {
console.log(res);
})*!/
} else {
this.$notify({
title: '提示',
message: '波场钱包请先解锁',
duration: 0
});
this.$store.commit('updateLogin', false)
}
} else {
this.$notify({
title: '提示',
message: '请先安装波场钱包插件',
duration: 0
});
this.$store.commit('updateLogin', false)
}
})*/
/*const waitForGlobal = async () => {
if (window.tronWeb) {
const tronWeb = window.tronWeb
const nodes = await tronWeb.isConnected()
const connected = !Object.entries(nodes).map(([key, value]) => {
if (!value) {
console.error(`Error: ${key} is not connected`)
}
return value
}).includes(false)
if (connected) {
console.log('connected')
} else {
console.error('Error: TRON node is not connected')
console.error('wait for tronLink')
setTimeout(async () => {
await waitForGlobal()
}, 100)
}
} else {
console.error('wait for tronLink')
setTimeout(async () => {
await waitForGlobal()
}, 100)
}
};
waitForGlobal().then()*/
window.onload = () => {
if (!window.tronWeb) {
this.$notify({
Expand All @@ -104,11 +43,11 @@
} else {
this.$store.commit('updateLogin', true)
let address = window.tronWeb.defaultAddress.hex;
API.login({
this.API.login({
address: address
}).then(res => {
if (res.code === 0) {
util.setCookie('access_token', res.data.access_token);
this.util.setCookie('access_token', res.data.access_token);
}
});
window.tronWeb.trx.getAccount(address).then((res) => {
Expand All @@ -117,19 +56,6 @@
}
}
}
/*api.setTronWeb(window.tronWeb)
api.contract.allOf(1).call().then(resp => {
console.log(resp)
})
api.contract.ownerOf(1).call().then(resp => {
console.log(resp)
})
api.contract.tokenExists(1).call().then(resp => {
console.log(resp)
})*/
},
methods: {
}
Expand All @@ -142,7 +68,11 @@
margin: 0;
background-color: $bgColor;
}
.page-header {
position: relative;
width: $innerWidth;
margin: 0 auto;
}
.fixed-width {
max-width: $fixedWidth;
padding: 20px;
Expand Down
36 changes: 12 additions & 24 deletions src/components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
<div class="idol">
<div class="card-body" @click="toDetail">
<div class="heart-icon-container" @click.stop>
<!--<img class="heart-img" alt="" @click.stop="like">-->
<font-awesome-icon :icon="['far', 'heart']" class="heart-icon" v-if="idol.IsLike === 0" @click.stop="like"/>
<font-awesome-icon :icon="['fas', 'heart']" class="heart-icon" v-if="idol.IsLike === 1" @click.stop="unlike"/>
<font-awesome-icon :icon="['far', 'heart']" v-if="idol.IsLike === 0" @click.stop="like"/>
<font-awesome-icon :icon="['fas', 'heart']" v-if="idol.IsLike === 1" @click.stop="unlike"/>
</div>
<div class="body-top">
<span>{{idol.NickName}}</span>
</div>
<div class="image-inner">
<img :src="IMG_SERVER + idol.Pic" class="avatar-img">
<img :src="CONFIG.IMG_SERVER + idol.Pic" class="avatar-img">
</div>
<div class="body-middle">
<span>第{{idol.Genes}}世代 · R</span>
Expand All @@ -26,10 +25,6 @@
</template>

<script>
import API from '@/api'
import config from '@/api/config'
import KittyCore from '@/util/KittyCore.json'
import util from '@/util/util'
export default {
name: 'Card',
props: {
Expand All @@ -54,7 +49,6 @@
},
data() {
return {
IMG_SERVER: config.IMG_SERVER
}
},
mounted() {
Expand All @@ -66,15 +60,22 @@
})
},
like() {
API.like({tokenId: this.idol.TokenId}).then(res => {
this.API.like({tokenId: this.idol.TokenId}).then(res => {
if (res.code === 0) {
console.log(res);
this.idol.IsLike = 1;
} else {
this.$notify({
type: 'error',
title: '温馨提示',
message: '点赞失败',
duration: 2000
});
}
})
},
unlike() {
API.unlike({tokenId: this.idol.TokenId}).then(res => {
this.API.unlike({tokenId: this.idol.TokenId}).then(res => {
if (res.code === 0) {
console.log(res);
this.idol.IsLike = 0;
Expand All @@ -87,8 +88,6 @@
contract.getuint256(1).call().then(resp => {
console.log(resp)
})*/
const signMessage = await window.tronWeb.trx.sign(util.strToHex('tron idol'));
console.log(signMessage);
/*contract.teststore().send({
shouldPollResponse: true,
callValue: 2000000000,
Expand All @@ -103,17 +102,6 @@
<style lang="scss" scoped>
$border-color: #656DF2;
$width: 150px;
/*.heart-img {
width: 16px;
height: auto;
content: url("../assets/heart.svg");
}
.heart-img:hover {
content: url("../assets/heart-fill.svg");
}*/
.heart-icon:hover {
color: $bgColor;
}
.idol {
position: relative;
font-size: 14px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@
</template>

<script>
export default {
name: 'CryptoFooter',
data() {
return {
LangOptions: [{
value: 'en',
label: 'English'
}, {
value: 'zh',
label: '简体中文'
}, {
value: 'zh_tw',
label: '繁體中文'
}],
lang: 'zh'
export default {
name: 'AppFooter',
data() {
return {
LangOptions: [{
value: 'en',
label: 'English'
}, {
value: 'zh',
label: '简体中文'
}, {
value: 'zh_tw',
label: '繁體中文'
}],
lang: 'zh'
}
},
mounted() {
},
methods: {
langChange(lang) {
this.$i18n.locale = lang;
}
}
}
},
mounted() {
},
methods: {
langChange(lang) {
this.$i18n.locale = lang;
}
}
}
</script>

<style lang="scss" scoped>
Expand Down Expand Up @@ -111,10 +111,11 @@ export default {
</style>
<style lang="scss">
.langContainer .el-input__inner {
background-color: rgb(12, 7, 28)!important;
background-color: rgb(12, 7, 28) !important;
color: #BDBDBD;
border: none;
}
.langContainer .el-select {
border-bottom: 1px solid #BDBDBD;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-header class="page-header" style="height: auto;">
<div>
<div class="line">
<img src="@/assets/line1@2x.png" alt="" style="width: 100%">
</div>
Expand Down Expand Up @@ -29,15 +29,13 @@
<div v-if="!isLoginIn" class="menuItem" @click="login">登录</div>
</div>
</div>
</el-header>
</div>
</template>

<script>
import API from '@/api'
import { mapState } from 'vuex'
import util from '@/util/util'
export default {
name: 'CryptoHeader',
name: 'AppHeader',
data() {
return {
currentPage: 'market'
Expand All @@ -51,30 +49,39 @@
async login() {
if (!window.tronWeb) {
this.$notify({
title: '提示',
message: '请先安装波场钱包插件',
duration: 0
type: 'info',
title: '温馨提示',
message: '请先安装波场钱包插件'
});
this.$store.commit('updateLogin', false)
} else {
if (!window.tronWeb.ready) {
this.$notify({
title: '提示',
message: '波场钱包请先解锁',
duration: 0
type: 'info',
title: '温馨提示',
message: '请先安装波场钱包插件'
});
this.$store.commit('updateLogin', false)
} else {
this.$notify({
type: 'success',
title: '温馨提示',
message: '登录成功'
});
this.$store.commit('updateLogin', true)
let address = window.tronWeb.defaultAddress.hex;
this.API.login({
address: address
}).then(res => {
if (res.code === 0) {
this.util.setCookie('access_token', res.data.access_token);
}
});
}
}
const sign = await util.signMessage('tron idol');
console.log(sign, window.tronWeb);
API.login({
address: window.tronWeb.defaultAddress.base58,
sign
}).then(res => {
console.log(res);
})
},
register() {
API.register({
this.API.register({
address: 'TVjmtiAVdbox9LYtZ7eu8Bq7mHJFZCZ3dg',
name: 'chenhao',
sign: 'eff7d5dba32b4da32d9a67a519434d3f'
Expand Down
Loading

0 comments on commit 96cef10

Please sign in to comment.