This commit is contained in:
chaosBreaking
2019-10-07 20:20:46 +08:00
parent cc76ad9940
commit e80be6375d
5 changed files with 21 additions and 32 deletions

2
.gitignore vendored
View File

@@ -20,3 +20,5 @@ yarn-error.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw* *.sw*
configSec.js

View File

@@ -1,8 +0,0 @@
module.exports={
// 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置:
// sslType: 'greenlock',
// sslDomainList: [''],
// sslKey: '/etc/letsencrypt/live/test.bittic.net/privkey.pem', // ssl key file,
// sslCert: '/etc/letsencrypt/live/test.bittic.net/fullchain.pem', // ssl cert file,
// sslCA: '/etc/letsencrypt/live/test.bittic.net/bundle.crt', // ssl ca file,
}

View File

@@ -32,14 +32,6 @@ const router = new Router({
path: 'network', path: 'network',
component: Network, component: Network,
}, },
{
path: 'chain',
component: Chain,
},
{
path: 'market',
component: Market,
},
{ {
path: '*', path: '*',
redirect: 'owner', redirect: 'owner',
@@ -49,18 +41,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('/home') next('/home')
// return return
// } }
// next() next()
// }) })
export default router export default router

View File

@@ -2,7 +2,7 @@ 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}:80/api/` // let baseURL = `${location.protocol}//${location.hostname}:80/api/`
let baseURL = `http://localhost:80/v1/` let baseURL = `https://server.vic.yuanjin.net/v1/`
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台或者让用户在控制台启动时自己设置一个节点主机。 // 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台或者让用户在控制台启动时自己设置一个节点主机。
axios.defaults.baseURL = baseURL axios.defaults.baseURL = baseURL

View File

@@ -5,6 +5,7 @@ import _ from 'lodash'
import ticCrypto from 'tic.crypto' import ticCrypto from 'tic.crypto'
import axios from 'axios' import axios from 'axios'
import * as Ticrypto from 'tic.crypto' import * as Ticrypto from 'tic.crypto'
import { tokenSec } from '../../../configSec'
export default { export default {
namespaced: true, namespaced: true,
@@ -46,10 +47,12 @@ export default {
actions: { actions: {
async login({ state, commit }) { async login({ state, commit }) {
console.log(state)
commit('updateSign', true) commit('updateSign', true)
const passwd = Ticrypto.hash(state.passwd) const passwd = Ticrypto.hash(state.passwd)
let result = await axios.post('admin/in', { name: state.username, passwd }) const ts = Date.now()
const path = '/admin/in'
const sig = ticCrypto.hash(ts + path + tokenSec, { hasher: 'md5' })
let result = await axios.post('admin/in', { name: state.username, passwd }, { headers: { ts, sig } })
commit('updateSign', false) commit('updateSign', false)
if (result.data.code === 0) { if (result.data.code === 0) {
commit('updateAccount', result.data.data, { root: true }) commit('updateAccount', result.data.data, { root: true })