new
This commit is contained in:
@@ -51,18 +51,18 @@ const router = new Router({
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
router.beforeEach((to, _, next) => {
|
// router.beforeEach((to, _, next) => {
|
||||||
const loginPage = to.path === '/login'
|
// const loginPage = to.path === '/login'
|
||||||
const signed = store.getters.isLogin
|
// const signed = store.getters.isLogin
|
||||||
if (!loginPage && !signed) {
|
// if (!loginPage && !signed) {
|
||||||
next('/login')
|
// next('/login')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
if (loginPage && signed) {
|
// if (loginPage && signed) {
|
||||||
next('/owner')
|
// next('/home')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
next()
|
// next()
|
||||||
})
|
// })
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
// import app from './app'
|
// import app from './app'
|
||||||
// let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
|
// let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
|
||||||
let baseURL = `${location.protocol}//${location.hostname}:60000/api/`
|
// let baseURL = `${location.protocol}//${location.hostname}:80/api/`
|
||||||
|
let baseURL = `http://server4test.vic.yuanjin.net/v1/`
|
||||||
|
|
||||||
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台,或者让用户在控制台启动时,自己设置一个节点主机。
|
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台,或者让用户在控制台启动时,自己设置一个节点主机。
|
||||||
axios.defaults.baseURL = baseURL
|
axios.defaults.baseURL = baseURL
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import router from '../../router'
|
|||||||
import { i18n } from '../../i18n'
|
import { i18n } from '../../i18n'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import ticCrypto from 'tic.crypto'
|
import ticCrypto from 'tic.crypto'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
|
|
||||||
state: {
|
state: {
|
||||||
mnemonic: '',
|
user: '',
|
||||||
|
passwd: '',
|
||||||
errorMnemonic: '',
|
errorMnemonic: '',
|
||||||
signing: false,
|
signing: false,
|
||||||
renewing: false,
|
renewing: false,
|
||||||
@@ -38,14 +40,14 @@ export default {
|
|||||||
actions: {
|
actions: {
|
||||||
async login({ state, commit }) {
|
async login({ state, commit }) {
|
||||||
commit('updateSign', true)
|
commit('updateSign', true)
|
||||||
const account = (await ticApi.secword2account(state.mnemonic)) || {}
|
let result = await axios.post('admin/in', { name: 'jojo', passwd: '941411d944c479af9a5e9d29d7430722d90a8e34d9585014e2f2c12b21db143d' })
|
||||||
account.mnemonic = state.mnemonic
|
|
||||||
commit('updateSign', false)
|
commit('updateSign', false)
|
||||||
if (await ticApi.isAddress(account.address)) {
|
console.log(result.data)
|
||||||
commit('updateAccount', _.omit(account, 'seckey'), { root: true })
|
if (result.code === 0) {
|
||||||
router.push('/owner')
|
commit('updateAccount', 'xxx', { root: true })
|
||||||
|
router.push('/home')
|
||||||
} else {
|
} else {
|
||||||
commit('updateError', i18n.t('login.errorMnemonic'))
|
commit('updateError', '用户名或密码错误')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async createSecword({ state, commit }) {
|
async createSecword({ state, commit }) {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ import io from 'socket.io-client'
|
|||||||
const { mapState, mapGetters, mapActions, mapMutations } = createNamespacedHelpers('chain')
|
const { mapState, mapGetters, mapActions, mapMutations } = createNamespacedHelpers('chain')
|
||||||
const socketUrl = `ws://${location.hostname}:60000`
|
const socketUrl = `ws://${location.hostname}:60000`
|
||||||
|
|
||||||
Vue.use(VueSocketio, io(socketUrl), store)
|
// Vue.use(VueSocketio, io(socketUrl), store)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Chain',
|
name: 'Chain',
|
||||||
@@ -110,14 +110,14 @@ export default {
|
|||||||
]),
|
]),
|
||||||
...mapGetters([]),
|
...mapGetters([]),
|
||||||
},
|
},
|
||||||
sockets: {
|
// sockets: {
|
||||||
connect() {
|
// connect() {
|
||||||
console.log('socket connected')
|
// console.log('socket connected')
|
||||||
},
|
// },
|
||||||
newBlock(msg) {
|
// newBlock(msg) {
|
||||||
this.addNewBlock(msg)
|
// this.addNewBlock(msg)
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions([
|
...mapActions([
|
||||||
@@ -133,7 +133,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.queryBlockList()
|
// this.queryBlockList()
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="side-menus" :class="{ collapsed: sideCollapsed || !isLogin }">
|
<div class="side-menus" :class="{ collapsed: sideCollapsed || !isLogin }">
|
||||||
<div class="side-title">
|
<div class="side-title">
|
||||||
<img src="../assets/images/logo.png" />
|
<img src="../assets/images/logo.png" />
|
||||||
<span class="white--text">TIME IN CHAIN</span>
|
<span class="white--text">VIC</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="login-page">
|
<div class="login-page">
|
||||||
<img src="../assets/images/logo.png">
|
<img src="../assets/images/logo.png">
|
||||||
|
|
||||||
<h1 class="white--text">{{ $t('login.title') }}</h1>
|
<h1 class="white--text"> VIC后台 </h1>
|
||||||
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
color="secondary"
|
color="secondary"
|
||||||
@@ -10,14 +10,26 @@
|
|||||||
single-line
|
single-line
|
||||||
:error="inputError"
|
:error="inputError"
|
||||||
:error-messages="errorMnemonic"
|
:error-messages="errorMnemonic"
|
||||||
:value="mnemonic"
|
:value="user"
|
||||||
|
:loading="signing"
|
||||||
|
:renewing="renewing"
|
||||||
|
@input="updateMnemonic"
|
||||||
|
label="用户名" />
|
||||||
|
|
||||||
|
<v-text-field
|
||||||
|
color="secondary"
|
||||||
|
dark autofocus
|
||||||
|
single-line
|
||||||
|
:error="inputError"
|
||||||
|
:error-messages="errorMnemonic"
|
||||||
|
:value="passwd"
|
||||||
:loading="signing"
|
:loading="signing"
|
||||||
:renewing="renewing"
|
:renewing="renewing"
|
||||||
@input="updateMnemonic"
|
@input="updateMnemonic"
|
||||||
@keyup.13="login"
|
@keyup.13="login"
|
||||||
:label="$t('login.inputLabel')" />
|
label="密码" />
|
||||||
|
|
||||||
<v-select
|
<!-- <v-select
|
||||||
color="secondary" dark
|
color="secondary" dark
|
||||||
prepend-icon="language"
|
prepend-icon="language"
|
||||||
:value="currentLang"
|
:value="currentLang"
|
||||||
@@ -25,7 +37,7 @@
|
|||||||
:items="supportLangs"
|
:items="supportLangs"
|
||||||
item-value="code"
|
item-value="code"
|
||||||
item-text="label"
|
item-text="label"
|
||||||
/>
|
/> -->
|
||||||
|
|
||||||
<div class="loginSecword">
|
<div class="loginSecword">
|
||||||
<v-btn :loading="signing" dark large color="transparent" @click="login">
|
<v-btn :loading="signing" dark large color="transparent" @click="login">
|
||||||
@@ -35,9 +47,9 @@
|
|||||||
<!-- <v-btn :renewing="renewing" dark large color="transparent" @click="createSecword">
|
<!-- <v-btn :renewing="renewing" dark large color="transparent" @click="createSecword">
|
||||||
{{ $t('login.secwordBtn') }}
|
{{ $t('login.secwordBtn') }}
|
||||||
</v-btn> -->
|
</v-btn> -->
|
||||||
<v-btn :renewing="renewing" dark large color="transparent" @click="createSecword">
|
<!-- <v-btn :renewing="renewing" dark large color="transparent" @click="createSecword">
|
||||||
{{ $t('login.secwordBtn') }}
|
{{ $t('login.secwordBtn') }}
|
||||||
</v-btn>
|
</v-btn> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -58,7 +70,8 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'mnemonic',
|
'user',
|
||||||
|
'passwd',
|
||||||
'errorMnemonic',
|
'errorMnemonic',
|
||||||
'signing',
|
'signing',
|
||||||
'renewing',
|
'renewing',
|
||||||
|
|||||||
Reference in New Issue
Block a user