add metemask-login connect local
This commit is contained in:
parent
c021e6ce48
commit
e6b3e08387
4
.env
4
.env
@ -1,3 +1,3 @@
|
||||
VUE_APP_API_HOST=10.0.235.4:9000
|
||||
VUE_APP_TITLE=包管理系统
|
||||
VUE_APP_API_HOST=127.0.0.1:8000
|
||||
VUE_APP_TITLE=管理平台
|
||||
VUE_APP_TITLE_EN=PROJECT PACKAGE MANAGER
|
@ -8,8 +8,6 @@ import {
|
||||
import { Table, TableColumn } from "view-design";
|
||||
import Events from "@/utils/Events";
|
||||
import { TableExportCsvParams } from "view-design/types/table";
|
||||
import { stringify } from "postcss";
|
||||
import Project from "@/views/home/pages/project/project";
|
||||
|
||||
|
||||
@Component
|
||||
|
@ -2,104 +2,16 @@
|
||||
* 前台地址
|
||||
*/
|
||||
export default class Url {
|
||||
static readonly WORK_LOGIN : string = 'work/login'
|
||||
static readonly LOGIN : string = "login";
|
||||
static readonly GET_NONCE : string = 'get-nonce'
|
||||
static readonly METAMASK_LOGIN : string = 'metamask-login'
|
||||
static readonly LOGOUT : string = "logout";
|
||||
// TODO 菜单
|
||||
static readonly MENUS : string = "menu";
|
||||
static readonly DELETE_MENU : string = "menu/%d";
|
||||
static readonly SHOW_MENU : string = "menu/%d";
|
||||
static readonly UPDATE_MENU : string = "menu/%d";
|
||||
// TODO 用户
|
||||
static readonly USERS : string = "user";
|
||||
static readonly DISABLE_USER : string = 'user/%d';
|
||||
static readonly ENABLE_USER : string = "user/start/%d";
|
||||
static readonly SHOW_USER : string = 'user/%d';
|
||||
static readonly UPDATE_USER : string = 'user/%d';
|
||||
static readonly UPDATE_USERNAME : string = 'user/update_name/%d';
|
||||
|
||||
|
||||
static readonly MY_MENUS : string = "my_menu";
|
||||
static readonly MY_POWER : string = "my_power";
|
||||
static readonly MY_PROJECT : string = "my_project";
|
||||
static readonly UPDATE_MY_NAME : string = "update/my/name";
|
||||
|
||||
|
||||
// TODO 权限
|
||||
static readonly POWER : string = "power";
|
||||
static readonly SHOW_POWER : string = "power/%d";
|
||||
static readonly UPDATE_POWER : string = "power/%d";
|
||||
static readonly DELETE_POWER : string = "power/%d";
|
||||
|
||||
// TODO 权限组
|
||||
static readonly POWER_GROUP : string = "power_group";
|
||||
static readonly SHOW_POWER_GROUP : string = "power_group/%d";
|
||||
static readonly UPDATE_POWER_GROUP : string = "power_group/%d";
|
||||
static readonly DELETE_POWER_GROUP : string = "power_group/%d";
|
||||
|
||||
// TODO 项目
|
||||
static readonly PROJECT : string = 'project';
|
||||
static readonly SHOW_PROJECT : string = "project/%d";
|
||||
static readonly UPDATE_PROJECT : string = "project/%d";
|
||||
static readonly DELETE_PROJECT : string = "project/%d";
|
||||
|
||||
static readonly WATCH_PROJECT : string = "project/watch/%d";
|
||||
static readonly UN_WATCH_PROJECT : string = "project/watch/%d";
|
||||
static readonly SHOW_PROJECT_ITEM : string = "project_item/%d";
|
||||
static readonly DElETE_PROJECT_ITEM : string = "project_item/%d";
|
||||
static readonly DElETE_PROJECT_PRODUCT : string = "project_product/%d";
|
||||
static readonly UPDATE_PROJECT_PRODUCT : string = "project_product/%d";
|
||||
static readonly SHOW_PROJECT_PRODUCT : string = "project_product/%d";
|
||||
static readonly DOWNLOAD_PROJECT_PRODUCT : string = "project_product/download/%d";
|
||||
static readonly SHOW_PRODUCT_Log : string = "show_log/%d";
|
||||
static readonly SHOW_DOWNLOAD_IP : string = "product/download_ip/%d";
|
||||
static readonly DOWNLOAD_IP : string = "download_ip";
|
||||
static readonly DELETE_DOWNLOAD_IP : string = "download_ip/%d";
|
||||
static readonly UPDATE_DOWNLOAD_IP : string = "download_ip/%d";
|
||||
|
||||
|
||||
//TODO 用户分配
|
||||
static readonly ALLOT_MENT : string = 'allot_menu/%d';
|
||||
static readonly ALLOT_POWER : string = 'allot_power/%d';
|
||||
static readonly ALLOT_PROJECT : string = 'allot_project/%d';
|
||||
|
||||
|
||||
//TODO 自动化(设备)
|
||||
static readonly DEVICE : string = 'device';
|
||||
static readonly UPLOAD_IMAGE : string = 'device/upload_pic';
|
||||
static readonly DELETE_DEVICE : string = 'device/%d';
|
||||
static readonly UPDATE_DEVICE : string = 'device/%d';
|
||||
|
||||
//TODO 自动化(脚本)
|
||||
static readonly SCRIPT : string = 'script';
|
||||
static readonly UPLOAD_SCRIPT : string = 'script/upload';
|
||||
static readonly UPDATE_SCRIPT : string = 'script/%d';
|
||||
static readonly DELETE_SCRIPT : string = 'script/%d';
|
||||
static readonly DOWNLOAD_SCRIPT : string = 'script/download/%d';
|
||||
|
||||
//TODO 自动化(脚本集)
|
||||
static readonly SCRIPT_COLLECTION : string = 'collection';
|
||||
static readonly UPDATE_SCRIPT_COLLECTION : string = 'collection/%d';
|
||||
static readonly DELETE_SCRIPT_COLLECTION : string = 'collection/%d';
|
||||
static readonly DOWNLOAD_SCRIPT_COLLECTION : string = 'collection/download/%d';
|
||||
|
||||
//TODO 自动化(任务)
|
||||
static readonly TASK : string = 'task';
|
||||
static readonly UPDATE_TASK : string = 'task/%d';
|
||||
static readonly DELETE_TASK : string = 'task/%d';
|
||||
static readonly TASK_LOG : string = 'task_log';
|
||||
static readonly TASK_DEFAULT_STATUS_CHANGE : string = 'task/set_default/%d'
|
||||
static readonly TASK_REPORT : string = 'task_report/%d'
|
||||
|
||||
//TODO 自动化(数据仓库)
|
||||
static readonly DATA :string = 'data'
|
||||
static readonly DELETE_DATA :string = 'data/%d'
|
||||
|
||||
//TODO 首页
|
||||
static readonly OVERVIEW : string = 'overview'
|
||||
static readonly OVERVIEW_SCRIPT : string = 'overview_scripts'
|
||||
static readonly OVERVIEW_PRODUCT : string = 'overview_products'
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,14 +39,14 @@ instance.interceptors.response.use(
|
||||
)
|
||||
export const Http_getNonce = (params) =>
|
||||
instance({
|
||||
url: 'https://market.cebg.games/webapp/index.php?c=Market&a=getNonce',
|
||||
url: 'http://127.0.0.1:8000/api/get-nonce',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
|
||||
export const Http_login = (data) =>
|
||||
instance({
|
||||
url: 'https://market.cebg.games/webapp/index.php?c=Market&a=auth',
|
||||
method: 'get',
|
||||
url: 'http://127.0.0.1:8000/api/metamask-login',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
@ -7,58 +7,6 @@ export interface MenuInterface {
|
||||
children? : MenuInterface[]
|
||||
}
|
||||
|
||||
export interface PowerInterface {
|
||||
id? : number;
|
||||
name : string;
|
||||
pid : number;
|
||||
controller : string;
|
||||
action : string;
|
||||
children? : PowerInterface[]
|
||||
}
|
||||
|
||||
export interface PowerGroupInterface {
|
||||
id? : number;
|
||||
name : string;
|
||||
}
|
||||
|
||||
export interface ProjectInterface {
|
||||
name : string;
|
||||
tapd_id : any;
|
||||
id? : number;
|
||||
}
|
||||
|
||||
export interface ProjectItemInterface {
|
||||
id? : number;
|
||||
name : string;
|
||||
type : string;
|
||||
}
|
||||
|
||||
export interface ProjectProductInterface {
|
||||
id? : number;
|
||||
name : string;
|
||||
commit_message : string;
|
||||
days : number;
|
||||
download_times : number;
|
||||
build_result?: string;
|
||||
state ?: boolean;
|
||||
}
|
||||
export interface ProjectProductLogInterface {
|
||||
id? : number;
|
||||
userName : string;
|
||||
addTime : any;
|
||||
productName : string;
|
||||
days : number;
|
||||
content : string
|
||||
}
|
||||
|
||||
export interface ProductIpsInterface {
|
||||
id? : number;
|
||||
project_item_id ?: number;
|
||||
server_ip :string;
|
||||
created_at ?: string;
|
||||
old_ip ?: string;
|
||||
}
|
||||
|
||||
export interface UserInterface {
|
||||
id? : number;
|
||||
username : string;
|
||||
|
@ -13,7 +13,7 @@ import '@/icons'
|
||||
|
||||
Http.store = store;
|
||||
Http.router = router;
|
||||
Http.baseUri = '/rest/'
|
||||
Http.baseUri = '/api/'
|
||||
Vue.prototype.$http = Http;
|
||||
Vue.config.devtools = process.env.NODE_ENV !== 'production';
|
||||
// Vue.config.devtools = true;
|
||||
|
@ -1,87 +0,0 @@
|
||||
.boxx{
|
||||
margin: 0 0 18px 20px;
|
||||
font-size: 40px
|
||||
}
|
||||
.demo-split1{
|
||||
height: 450px;
|
||||
|
||||
}
|
||||
.demo-split-pane1{
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
.demo-split{
|
||||
height: 680px;
|
||||
margin-top: 50px;
|
||||
background-color: #FFFFFF;
|
||||
|
||||
}
|
||||
.demo-split-pane{
|
||||
padding: 10px;
|
||||
//border: 1px solid red;
|
||||
}
|
||||
.demo-split-pane.no-padding{
|
||||
height: 680px;
|
||||
padding: 0;
|
||||
}
|
||||
.tag{
|
||||
background-color: #374151;
|
||||
color: white;
|
||||
padding: 8px 100px 8px 20px;
|
||||
|
||||
}
|
||||
|
||||
.arrow1 {
|
||||
padding: 15px 0;
|
||||
margin-left: 20px;
|
||||
&-wrap {
|
||||
//margin: 0 auto;
|
||||
width: 120px;
|
||||
height: 34px;
|
||||
background-image: linear-gradient(to right, #227190 , #63c7ed);
|
||||
color: #FFFFFF;
|
||||
line-height: 34px;
|
||||
text-align: start;
|
||||
position: relative;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -34px;
|
||||
border: 17px solid transparent;
|
||||
border-left: 17px solid #63c7ed;
|
||||
}
|
||||
}
|
||||
}
|
||||
.arrow2 {
|
||||
padding: 15px 0;
|
||||
margin-left: 20px;
|
||||
&-wrap {
|
||||
//margin: 0 auto;
|
||||
width: 180px;
|
||||
height: 34px;
|
||||
background-image: linear-gradient(to right, #008B8B , #7FFFD4);
|
||||
color: #FFFFFF;
|
||||
line-height: 34px;
|
||||
text-align: start;
|
||||
position: relative;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -34px;
|
||||
border: 17px solid transparent;
|
||||
border-left: 17px solid #7FFFD4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.progress:hover:before{
|
||||
content:attr(content);
|
||||
background:#585e6b;
|
||||
color:#fff;
|
||||
padding:.8em 1em;
|
||||
position:absolute;
|
||||
bottom: -35px;
|
||||
border-radius: 5px;
|
||||
margin-left:30%;
|
||||
|
||||
}
|
@ -9,184 +9,58 @@ import {
|
||||
import HomeParent from "@/views/home/Common/HomeParent";
|
||||
import CustomPage from "@/components/page.vue";
|
||||
import SvgIcon from '@/components/SvgIcon.vue'
|
||||
import * as echarts from 'echarts'
|
||||
import { TableColumn } from "view-design"
|
||||
|
||||
|
||||
@Component({
|
||||
components : {
|
||||
SvgIcon
|
||||
SvgIcon,CustomPage
|
||||
}
|
||||
})
|
||||
export default class Home extends HomeParent {
|
||||
name : string = 'home'
|
||||
public scriptList :any = [{ script_name: undefined, date: undefined,content:undefined}];
|
||||
public projectList :any = [{ product_name: undefined, date: undefined}]
|
||||
public myChart;
|
||||
public cardProductData:object = {
|
||||
product_count_trashed:undefined,
|
||||
product_today:undefined,
|
||||
day_rate:undefined,
|
||||
day_icon:undefined,
|
||||
week_rate:undefined,
|
||||
week_icon:undefined,
|
||||
public noDataText = '没有数据的提示语'
|
||||
public List :any = []
|
||||
public columns: TableColumn[] = [{
|
||||
width: 80,
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
}, {
|
||||
title: "名称",
|
||||
key: "name"
|
||||
}, {
|
||||
title: "TAPD",
|
||||
key: "tapd_id"
|
||||
}, {
|
||||
title: "操作",
|
||||
slot: "operation"
|
||||
}]
|
||||
|
||||
public total: number = 0;
|
||||
public search: { page: number, size: number , keywords? : string } = {
|
||||
page: 1, size: 10 , keywords : ""
|
||||
}
|
||||
public cardScriptData:object = {
|
||||
script_week:undefined,
|
||||
use_rate:undefined
|
||||
}
|
||||
public cardTaskData:object = {
|
||||
day_rate:undefined,
|
||||
task_count:undefined,
|
||||
task_month_sum:undefined
|
||||
}
|
||||
public userNumber:number=0;
|
||||
|
||||
public created() {
|
||||
// this._getData()
|
||||
// this._getScriptLog()
|
||||
// this._getProductLog()
|
||||
this.List = [
|
||||
{id:1,name:'tom',tapd_id:10086},
|
||||
{id:2,name:'jam',tapd_id:10086},
|
||||
{id:3,name:'any',tapd_id:10086},
|
||||
{id:4,name:'som',tapd_id:10086},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
private createChart(data) {
|
||||
this.myChart = echarts.init(this.$refs['myChart'] as HTMLCanvasElement);
|
||||
this.myChart.setOption(this.option(data));
|
||||
this.myChart.on('updateAxisPointer', (event)=> {
|
||||
const xAxisInfo = event.axesInfo[0];
|
||||
if (xAxisInfo) {
|
||||
const dimension = xAxisInfo.value + 1;
|
||||
this.myChart.setOption({
|
||||
series: {
|
||||
id: 'pie',
|
||||
label: {
|
||||
formatter: '{b}: {@[' + dimension + ']} ({d}%)'
|
||||
},
|
||||
encode: {
|
||||
value: dimension,
|
||||
tooltip: dimension
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public shortcut(str){
|
||||
this._push({name:str})
|
||||
}
|
||||
|
||||
private option(data) {
|
||||
return {
|
||||
legend: {},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
showContent: false
|
||||
},
|
||||
dataset: {
|
||||
source: data
|
||||
},
|
||||
xAxis: { type: 'category' },
|
||||
yAxis: { gridIndex: 0 },
|
||||
grid: { top: '55%' },
|
||||
series: [
|
||||
{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
seriesLayoutBy: 'row',
|
||||
emphasis: { focus: 'series' }
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
seriesLayoutBy: 'row',
|
||||
emphasis: { focus: 'series' }
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
seriesLayoutBy: 'row',
|
||||
emphasis: { focus: 'series' }
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
seriesLayoutBy: 'row',
|
||||
emphasis: { focus: 'series' }
|
||||
},
|
||||
{
|
||||
type: 'pie',
|
||||
id: 'pie',
|
||||
radius: '30%',
|
||||
center: ['50%', '25%'],
|
||||
emphasis: {
|
||||
focus: 'self'
|
||||
},
|
||||
label: {
|
||||
formatter: '{b}: {@2012} ({d}%)'
|
||||
},
|
||||
encode: {
|
||||
itemName: 'product',
|
||||
value: '2012',
|
||||
tooltip: '2012'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
private _getData():void{
|
||||
this.$http.get(Url.OVERVIEW).then((res)=>{
|
||||
this.createChart(res.data.recent_task_logs)
|
||||
|
||||
this.cardProductData = this.alterProduct(res.data.card_data.product)
|
||||
this.cardTaskData = this.alterTask(res.data.card_data.task)
|
||||
this.cardScriptData = this.alterScript(res.data.card_data.script)
|
||||
this.userNumber = res.data.card_data.user
|
||||
|
||||
}).catch((msg:string)=>{
|
||||
this.error(msg)
|
||||
})
|
||||
}
|
||||
|
||||
private _getScriptLog():void{
|
||||
this.$http.get(Url.OVERVIEW_SCRIPT).then((res)=>{
|
||||
this.scriptList = res.data
|
||||
}).catch((msg:string)=>{
|
||||
this.error(msg)
|
||||
})
|
||||
}
|
||||
|
||||
private _getProductLog():void{
|
||||
this.$http.get(Url.OVERVIEW_PRODUCT).then((res)=>{
|
||||
this.projectList = res.data
|
||||
}).catch((msg:string)=>{
|
||||
this.error(msg)
|
||||
})
|
||||
}
|
||||
|
||||
private alterProduct(data):object{
|
||||
return {
|
||||
product_count_trashed:data.product_count_trashed,
|
||||
product_today:data.product_today,
|
||||
day_rate:data.product_yesterday==0?'(昨日无构建)':Math.abs(Math.floor(((parseInt(data.product_today)-parseInt(data.product_yesterday)) / parseInt(data.product_yesterday ))*100))+'%',
|
||||
day_icon:parseInt(data.product_today) > parseInt(data.product_yesterday)?1:2,
|
||||
week_rate:Math.abs(Math.floor(((parseInt(data.product_current_week)-parseInt(data.product_last_week)) / parseInt(data.product_last_week ))*100))+'%',
|
||||
week_icon:parseInt(data.product_current_week) > parseInt(data.product_last_week)?1:2,
|
||||
}
|
||||
}
|
||||
|
||||
private alterTask(data):object{
|
||||
return {
|
||||
task_count:data.task_count,
|
||||
task_month_sum:data.task_month_sum,
|
||||
day_rate:Math.abs(Math.floor((parseInt(data.task_end_sum)/ parseInt(data.task_logs_sum ))*100))
|
||||
}
|
||||
}
|
||||
|
||||
private alterScript(data):object{
|
||||
return {
|
||||
script_week:data.script_week,
|
||||
use_rate:Math.abs(Math.floor((parseInt(data.script_used)/ parseInt(data.script_count ))*100))+'%'
|
||||
}
|
||||
}
|
||||
}
|
@ -1,184 +1,20 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- <project-list is-my-project></project-list>-->
|
||||
<div>
|
||||
<div class="space-x-5 my-2 h-11">
|
||||
<Input v-model="search.keywords" class="w-80 " clearable placeholder="请输入项目名称"></Input>
|
||||
<Button type="primary" icon="ios-search-outline" :loading="loading">搜索</Button>
|
||||
</div>
|
||||
<custom-page :data-list="List" :page.sync="search.page" :page-size.sync="search.size"
|
||||
:total="total" row-key="id" :columns="columns" :no-data-text="noDataText">
|
||||
|
||||
|
||||
<div class="demo-split1">
|
||||
<Split v-model="0.5" mode="vertical">
|
||||
<div slot="top" class="demo-split-pane1">
|
||||
<Row>
|
||||
<Col span="5" style="margin-left: 20px">
|
||||
<Card >
|
||||
<p slot="title" style="font-weight: bold;">构建量</p>
|
||||
<p slot="extra"><Icon type="ios-keypad" style="font-size: 24px;color: #36cfc9"/></p>
|
||||
<p > <span style="font-size: 28px">{{cardProductData.product_today}}</span>
|
||||
<Tag type="border" color="success" style="width: 20px;float: right"> <span style="margin-left: -5px">日</span></Tag></p>
|
||||
<p>
|
||||
<span>日同比 {{cardProductData.day_rate}}
|
||||
<Icon type="md-arrow-dropup" color="#19be6b" v-if="cardProductData.day_icon==1"/>
|
||||
<Icon type="md-arrow-dropdown" color="#ed4014" v-else/>
|
||||
</span> 
|
||||
<span>周同比 {{cardProductData.week_rate}}
|
||||
<Icon type="md-arrow-dropup" color="#19be6b" v-if="cardProductData.week_icon==1"/>
|
||||
<Icon type="md-arrow-dropdown" color="#ed4014" v-else/>
|
||||
</span>
|
||||
</p>
|
||||
<div style="border-top: 1px solid #e8eaec;margin: 10px -16px 0 -16px;">
|
||||
<div style="height:24px;padding-top:10px;display: flex;justify-content: space-between;">
|
||||
<span style="margin-left: 10px">总构建量</span>
|
||||
<span style="margin-right: 10px">{{cardProductData.product_count_trashed}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="5" offset="1">
|
||||
<Card >
|
||||
<p slot="title" style="font-weight: bold;">任务量</p>
|
||||
<p slot="extra"><Icon type="ios-clipboard" style="font-size: 24px;color: #ff7a45" /></p>
|
||||
<p>
|
||||
<span style="font-size: 28px">{{cardTaskData.task_month_sum}}</span>
|
||||
<Tag type="border" color="primary" style="width: 20px;float: right"> <span style="margin-left: -5px">月</span></Tag>
|
||||
</p>
|
||||
<Progress :percent="cardTaskData.day_rate" hide-info class="progress" :content="'已完成'+cardTaskData.day_rate+'%'"/>
|
||||
<div style="border-top: 1px solid #e8eaec;margin: 10px -16px 0 -16px;">
|
||||
<div style="height:24px;padding-top:10px;display: flex;justify-content: space-between;">
|
||||
<span style="margin-left: 10px">总任务数</span>
|
||||
<span style="margin-right: 10px">{{cardTaskData.task_count}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="5" offset="1">
|
||||
<Card >
|
||||
<p slot="title" style="font-weight: bold;">脚本数</p>
|
||||
<p slot="extra"><Icon type="logo-python" style="font-size: 24px;color: #47cb89"></Icon></p>
|
||||
<p>
|
||||
<span style="font-size: 28px">{{cardScriptData.script_week}}</span>
|
||||
<Tag type="border" color="error" style="width: 20px;float: right"> <span style="margin-left: -5px">周</span></Tag>
|
||||
</p>
|
||||
<p> </p>
|
||||
<div style="border-top: 1px solid #e8eaec;margin: 10px -16px 0 -16px;">
|
||||
<div style="height:24px;padding-top:10px;display: flex;justify-content: space-between;">
|
||||
<span style="margin-left: 10px">使用率</span>
|
||||
<span style="margin-right: 10px">{{cardScriptData.use_rate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
<Col span="5" offset="1">
|
||||
<Card >
|
||||
<p slot="title" style="font-weight: bold;">用户量</p>
|
||||
<p slot="extra"><Icon type="ios-people" style="font-size: 24px;color: #57a3f3"/></p>
|
||||
<p style="font-size: 28px">{{userNumber}}位</p>
|
||||
<p> </p>
|
||||
<div style="border-top: 1px solid #e8eaec;margin: 10px -16px 0 -16px;">
|
||||
<div style="height:24px;padding-top:10px;display: flex;justify-content: space-between;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
<div slot="bottom" class="demo-split-pane1">
|
||||
<div style="margin-top: 50px;display: flex;justify-content: space-around">
|
||||
<Card style="width:120px;border-radius: 5px">
|
||||
<div style="text-align:center" @click="shortcut('my_project')">
|
||||
<div class="boxx"><svg-icon icon-class="project" /></div>
|
||||
<h3>我的项目</h3>
|
||||
</div>
|
||||
</Card>
|
||||
<Card style="width:120px;" >
|
||||
<div style="text-align:center;" @click="shortcut('task')">
|
||||
<div class="boxx"><svg-icon icon-class="task" /></div>
|
||||
<h3>任务中心</h3>
|
||||
</div>
|
||||
</Card>
|
||||
<Card style="width:120px;" >
|
||||
<div style="text-align:center" @click="shortcut('script')">
|
||||
<div class="boxx"><svg-icon icon-class="script" /></div>
|
||||
<h3>脚本市场</h3>
|
||||
</div>
|
||||
</Card>
|
||||
<Card style="width:120px;" >
|
||||
<div style="text-align:center" @click="shortcut('device')">
|
||||
<div class="boxx"><svg-icon icon-class="device" /></div>
|
||||
<h3>设备大全</h3>
|
||||
</div>
|
||||
</Card>
|
||||
<Card style="width:120px;" v-for="item in 4">
|
||||
<div style="text-align:center">
|
||||
<img src="@/assets/image/edit.png" width="40" style="margin-left: 20px"/><br >
|
||||
<h3>尽情期待...</h3>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</Split>
|
||||
</div>
|
||||
<div class="demo-split">
|
||||
<Split v-model="0.5">
|
||||
<div slot="left" class="demo-split-pane no-padding">
|
||||
<Split v-model="0.5" mode="vertical" >
|
||||
<div slot="top" class="demo-split-pane">
|
||||
<section class="arrow1">
|
||||
<div class="arrow1-wrap"><span style="padding-left:22px ">构建动态</span></div>
|
||||
</section>
|
||||
|
||||
<List item-layout="horizontal" size="small">
|
||||
<ListItem v-for="item in projectList">
|
||||
<ListItemMeta :title="item.product_name" />
|
||||
<template slot="action">
|
||||
<li>
|
||||
<span>{{item.date}}</span>
|
||||
</li>
|
||||
</template>
|
||||
</ListItem>
|
||||
<ListItem v-show="projectList.length>=5">
|
||||
<ListItemMeta />
|
||||
<template slot="action">
|
||||
<li>
|
||||
<a href="my_project">更多</a>
|
||||
</li>
|
||||
</template>
|
||||
</ListItem>
|
||||
|
||||
</List>
|
||||
</div>
|
||||
<div slot="bottom" class="demo-split-pane">
|
||||
<section class="arrow2">
|
||||
<div class="arrow2-wrap"><span style="padding-left:22px ">脚本动态</span></div>
|
||||
</section>
|
||||
<List item-layout="horizontal" size="small">
|
||||
<ListItem v-for="item in scriptList">
|
||||
<ListItemMeta :title="item.content" />
|
||||
<template slot="action">
|
||||
<li>
|
||||
<span>{{item.date}}</span>
|
||||
</li>
|
||||
</template>
|
||||
</ListItem>
|
||||
<ListItem v-show="scriptList.length>=5">
|
||||
<ListItemMeta />
|
||||
<template slot="action">
|
||||
<li>
|
||||
<a href="auto-test/script">更多</a>
|
||||
</li>
|
||||
</template>
|
||||
</ListItem>
|
||||
</List>
|
||||
</div>
|
||||
</Split>
|
||||
</div>
|
||||
<div slot="right" class="demo-split-pane">
|
||||
<p style="text-align: center;font-size: 20px;font-weight: bolder;margin-top: 15px">任务执行情况</p>
|
||||
<div ref="myChart" style="width: 800px; height:550px;margin-top:40px" ></div>
|
||||
</div>
|
||||
</Split>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<template slot="operation" slot-scope="{row}">
|
||||
<div class="space-x-2">
|
||||
<Button type="success" >查看</Button>
|
||||
<Button type="error" >删除</Button>
|
||||
</div>
|
||||
</template>
|
||||
</custom-page>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./home.ts"></script>
|
||||
<style lang="less" src="./home.less" scoped></style>
|
||||
<script src="./home.ts"></script>
|
@ -11,6 +11,7 @@ import HomeParent, { BreadItem } from "@/views/home/Common/HomeParent";
|
||||
import { EVENT_TYPE, MenuInterface, ProjectInterface } from "@/views/home/Common/Types";
|
||||
import { Route, RouteRecord } from "vue-router";
|
||||
import { Menu } from "view-design";
|
||||
import store from "@/views/home/store";
|
||||
|
||||
|
||||
|
||||
@ -51,53 +52,16 @@ export default class Layout extends HomeParent {
|
||||
public onDropdownEvent(name: string): void {
|
||||
switch (name) {
|
||||
case "logout" : this.logout();break;
|
||||
case "updateName" : this.updateName();break;
|
||||
// case "updateName" : this.updateName();break;
|
||||
}
|
||||
}
|
||||
|
||||
public logout() {
|
||||
this.$http.get(Url.LOGOUT).then(res => {
|
||||
this._push('/login')
|
||||
});
|
||||
store.commit('del_token')
|
||||
this.goPage("login");
|
||||
}
|
||||
|
||||
public updateName(){
|
||||
let self = this;
|
||||
this.$Modal.confirm({
|
||||
title:"修改昵称",
|
||||
render: function(h) {
|
||||
return h('Input', {
|
||||
props: {
|
||||
value: self.$store.getters.user.name,
|
||||
autofocus: true,
|
||||
placeholder: 'Please enter your name...'
|
||||
},
|
||||
on: {
|
||||
input: (val) => {
|
||||
this.value = val;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onOk :function() {
|
||||
self.onVisibleChange(true)
|
||||
if (!this.value || this.value == self.$store.getters.user.name || this.value == '') {
|
||||
return;
|
||||
}
|
||||
let data = {name:this.value};
|
||||
self.$http.put(Url.UPDATE_MY_NAME,data).then(res=>{
|
||||
self.success('修改成功',()=>{
|
||||
self.$store.getters.user.name = res.data.name
|
||||
let obj = JSON.parse(window.localStorage.getItem('home'));
|
||||
obj.user.user.name = res.data.name
|
||||
window.localStorage.setItem('home',JSON.stringify(obj));
|
||||
})
|
||||
}).catch((err)=>{
|
||||
self.error(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 跳转页面时关闭dropdown
|
||||
@ -117,24 +81,20 @@ export default class Layout extends HomeParent {
|
||||
|
||||
|
||||
private _getMyMenu() {
|
||||
this.myMenus = [
|
||||
{id:1,name:'用户管理',url:'/user',children:[
|
||||
{id:2,name:'用户列表',url:'/user/list',children:[]},
|
||||
{id:3,name:'用户权限',url:'/user/node',children:[]},
|
||||
{id:4,name:'用户菜单',url:'/user/menu',children:[]},
|
||||
]},
|
||||
{id:5,name:'表格',url:'/table',children:[
|
||||
{id:6,name:'普通表格',url:'/table/base',children:[]},
|
||||
{id:7,name:'复杂表格',url:'/table/complex',children:[]},
|
||||
]}
|
||||
]
|
||||
this.myMenus = [
|
||||
{id:1,name:'用户管理',url:'/user',children:[
|
||||
{id:2,name:'用户列表',url:'/user/list',children:[]},
|
||||
{id:3,name:'用户权限',url:'/user/node',children:[]},
|
||||
{id:4,name:'用户菜单',url:'/user/menu',children:[]},
|
||||
]},
|
||||
{id:5,name:'表格',url:'/table',children:[
|
||||
{id:6,name:'普通表格',url:'/table/base',children:[]},
|
||||
{id:7,name:'复杂表格',url:'/table/complex',children:[]},
|
||||
]}
|
||||
]
|
||||
}
|
||||
|
||||
private _getMyProject() {
|
||||
this.$http.get(Url.MY_PROJECT).then(res => {
|
||||
this.myProject = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private _parseTreeData(list: any[]) {
|
||||
return list.map((item: any) => {
|
||||
|
@ -1,53 +1,53 @@
|
||||
<template>
|
||||
<div class="layout w-screen h-screen bg-white" >
|
||||
<Sider :style="{position: 'fixed', height: '100vh', left: 0, overflow: 'auto'}" width="300" class="bg-white" style="margin-top: -2px">
|
||||
<h2 class="text-3xl italic pl-8 text-center " style="height: 80px;line-height: 80px;">系统</h2>
|
||||
<Menu width="300">
|
||||
<Submenu :name="item.id" v-for="item in myMenus" :key="item.id" accordion >
|
||||
<template slot="title">
|
||||
<span v-if="item.children.length>0">{{item.name}}</span>
|
||||
<router-link v-else :to="item.url">{{item.name}}</router-link>
|
||||
</template>
|
||||
<MenuItem :name="sonChildren.id" v-for="sonChildren in item.children" :key="sonChildren.id"
|
||||
:to="sonChildren.url">
|
||||
{{sonChildren.name}}
|
||||
</MenuItem>
|
||||
</Submenu>
|
||||
</Menu>
|
||||
</Sider>
|
||||
<div class="layout w-screen h-screen bg-white" >
|
||||
<Sider :style="{position: 'fixed', height: '100vh', left: 0, overflow: 'auto'}" width="300" class="bg-white" style="margin-top: -2px">
|
||||
<h2 class="text-3xl italic text-center " style="height: 80px;line-height: 80px;">管理品台</h2>
|
||||
<Menu width="300">
|
||||
<Submenu :name="item.id" v-for="item in myMenus" :key="item.id" accordion >
|
||||
<template slot="title">
|
||||
<span v-if="item.children.length>0">{{item.name}}</span>
|
||||
<router-link v-else :to="item.url">{{item.name}}</router-link>
|
||||
</template>
|
||||
<MenuItem :name="sonChildren.id" v-for="sonChildren in item.children" :key="sonChildren.id"
|
||||
:to="sonChildren.url">
|
||||
{{sonChildren.name}}
|
||||
</MenuItem>
|
||||
</Submenu>
|
||||
</Menu>
|
||||
</Sider>
|
||||
|
||||
<div style="margin-left:300px ">
|
||||
<div style="height: 66px;box-shadow: 0 2px 3px 2px rgba(0,0,0,.1);line-height: 66px">
|
||||
<div style="float: left;margin-left: 25px">
|
||||
<Breadcrumb params="params" >
|
||||
<BreadcrumbItem :to="route.route.fullPath" :key="route.href"
|
||||
v-for="route in routes" class="text-base "><span class="text-current ">{{route.name}}</span></BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</div>
|
||||
|
||||
<div class="pr-8 text-current" style="float: right">
|
||||
<Dropdown ref="dropdown" trigger="custom" @on-click="onDropdownEvent" :visible="visible">
|
||||
<a href="javascript:void(0)" @click="onVisibleChange">
|
||||
<Icon class="text-4xl " type="ios-contacts"/>
|
||||
<!-- <span>{{this.$store.getters.user.name}}</span>-->
|
||||
<Icon type="ios-arrow-down"></Icon>
|
||||
</a>
|
||||
<DropdownMenu slot="list" >
|
||||
|
||||
<DropdownItem name="updateName" class="text-black hover:text-white hover:bg-gray-700" >修改昵称</DropdownItem>
|
||||
<DropdownItem name="logout" class="text-black hover:text-white hover:bg-gray-700" >退出</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="p-4 overflow-y-auto lg:h-(screen-14)" >
|
||||
<router-view ></router-view>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-left:300px ">
|
||||
<div style="height: 66px;box-shadow: 0 2px 3px 2px rgba(0,0,0,.1);line-height: 66px">
|
||||
<div style="float: left;margin-left: 25px">
|
||||
<Breadcrumb params="params" >
|
||||
<BreadcrumbItem :to="route.route.fullPath" :key="route.href"
|
||||
v-for="route in routes" class="text-base "><span class="text-current ">{{route.name}}</span></BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
</div>
|
||||
|
||||
<div class="pr-8 text-current" style="float: right">
|
||||
<Dropdown ref="dropdown" trigger="custom" @on-click="onDropdownEvent" :visible="visible">
|
||||
<a href="javascript:void(0)" @click="onVisibleChange">
|
||||
<Icon class="text-4xl " type="ios-contacts"/>
|
||||
<!-- <span>{{this.$store.getters.user.name}}</span>-->
|
||||
<Icon type="ios-arrow-down"></Icon>
|
||||
</a>
|
||||
<DropdownMenu slot="list" >
|
||||
|
||||
<DropdownItem name="updateName" class="text-black hover:text-white hover:bg-gray-700" >修改昵称</DropdownItem>
|
||||
<DropdownItem name="logout" class="text-black hover:text-white hover:bg-gray-700" >退出</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="p-4 overflow-y-auto lg:h-(screen-14)" >
|
||||
<router-view ></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./layout.ts"></script>
|
||||
|
@ -90,10 +90,10 @@
|
||||
margin-left: 7px;
|
||||
}
|
||||
}
|
||||
.slideSty .slide-verify {
|
||||
margin: 13px auto 0 auto;
|
||||
width: 350px !important;
|
||||
}
|
||||
.slideSty .slide-verify {
|
||||
margin: 13px auto 0 auto;
|
||||
width: 350px !important;
|
||||
}
|
||||
.slideSty .slide-verify-slider {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
@ -32,72 +32,51 @@ declare let window: Window
|
||||
}
|
||||
})
|
||||
export default class Login extends HomeParent {
|
||||
@Action('Login') Login;
|
||||
public context : ActionContext<UserState, any>
|
||||
// @Action('Login') Login
|
||||
|
||||
public provider:any
|
||||
public web3:Web3
|
||||
public chainId:number
|
||||
public account:string
|
||||
public nonce:string
|
||||
public isLogin:boolean
|
||||
|
||||
public async btn(){
|
||||
if (!this.$store.getters.step){
|
||||
try {
|
||||
public created(){
|
||||
if (store.state.token){
|
||||
this.isLogin = true
|
||||
}else {
|
||||
this.isLogin = false
|
||||
}
|
||||
}
|
||||
|
||||
public async doLogin(){
|
||||
// let apiHost = process.env.NODE_ENV !== 'production' ? process.env.VUE_APP_API_HOST : document.location.host;
|
||||
// let scheme = document.location.protocol;
|
||||
// console.log(scheme + "//" + apiHost);return
|
||||
if (!this.isLogin){
|
||||
try{
|
||||
await this.connect()
|
||||
await this.checkNance()
|
||||
} catch (err) {
|
||||
Message({
|
||||
message: err.message,
|
||||
type: 'error',
|
||||
duration: 5 * 1000
|
||||
duration: 3 * 1000,
|
||||
})
|
||||
Promise.reject(err)
|
||||
}
|
||||
}else {
|
||||
Message({
|
||||
message: '已经登录过了!',
|
||||
type: 'warning',
|
||||
duration:2*1000,
|
||||
onClose:()=>{
|
||||
this.goPage('home')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public get accessToken(): string {
|
||||
let token: string = this.$route.query.access_token as string;
|
||||
return token;
|
||||
}
|
||||
|
||||
public rules: object = {
|
||||
username: [{required: true, trigger: 'blur', message: "请输入登录名"}],
|
||||
password: [{required: true, trigger: 'blur', message: "请输入登录密码"}],
|
||||
}
|
||||
|
||||
public created() {
|
||||
// if(!this.accessToken) {
|
||||
// this._getData();
|
||||
// }
|
||||
}
|
||||
|
||||
private _getData(): void {
|
||||
this.$http.get(Url.WORK_LOGIN).then(res => {
|
||||
window["WwLogin"]({
|
||||
id: "loginPage",
|
||||
goto: res.data
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// public doLogin(): void {
|
||||
// let form: Form = this.$refs["login"] as Form;
|
||||
// form.validate((valid: boolean) => {
|
||||
// if (!valid) {
|
||||
// return;
|
||||
// }
|
||||
// // this.Login(this.form).then((user) => {
|
||||
// // this.goPage("home");
|
||||
// // }).catch((msg: string) => {
|
||||
// // this.error(msg);
|
||||
// // })
|
||||
// });
|
||||
// }
|
||||
private async login( account, chainId, nonce) {
|
||||
nonce += ''
|
||||
const tips = 'This signature is only used for verify your account'
|
||||
@ -134,21 +113,26 @@ export default class Login extends HomeParent {
|
||||
net_id: chainId
|
||||
}
|
||||
const res:any = await Http_login(authData)
|
||||
if (!res.errcode && res.token) {
|
||||
store.commit('set_token',res.token)
|
||||
console.log(store.getters)
|
||||
if (res.code == 200) {
|
||||
store.commit('set_token',res.data.token)
|
||||
this.goPage("home");
|
||||
}
|
||||
}
|
||||
private async checkNance() {
|
||||
try {
|
||||
// store.commit('del_nonce');return
|
||||
let nonce = store.getters.nonce
|
||||
if (!nonce) {
|
||||
let params = {account:this.account, net_id:this.chainId}
|
||||
// await this.$http.get(Url.GET_NONCE,params).then(res => {
|
||||
// console.log(res.data)
|
||||
// })
|
||||
const res:any = await Http_getNonce(params);
|
||||
store.commit('set_nonce',res.nonce)
|
||||
this.nonce = res.nonce
|
||||
// console.log('@@@',res)
|
||||
store.commit('set_nonce',res.data)
|
||||
this.nonce = res.data
|
||||
}
|
||||
this.login(this.account,this.chainId,this.nonce)
|
||||
this.login(this.account,this.chainId,store.getters.nonce)
|
||||
} catch (err) {
|
||||
Promise.reject(err)
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="login">
|
||||
<div class="w-full h-3/5 flex items-center justify-center align-middle">系统</div>
|
||||
<div class="w-full flex justify-center align-middle">
|
||||
<div class=" rounded-xl" @click="btn">
|
||||
<div class=" rounded-xl" @click="doLogin">
|
||||
<svg-icon icon-class="login" style="width: 100px;height: 100px;cursor:pointer"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,26 +12,29 @@ const routes : Array<RouteConfig> = [
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
base : "/dashboard/",
|
||||
// base : "/dashboard/",
|
||||
mode : "history",
|
||||
routes,
|
||||
})
|
||||
|
||||
function setTitle(title : string) : void {
|
||||
window.document.title = title;
|
||||
window.document.title = '管理平台';
|
||||
}
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
LoadingBar.start();
|
||||
let title : string = process.env.VUE_APP_TITLE;
|
||||
setTitle(to.meta.title + '-' + title);
|
||||
let token : string = to.query.access_token as string;
|
||||
if (token) {
|
||||
Store.commit(Types.SET_USER_TOKEN, token);
|
||||
next({name : to.name === 'login'? 'home' : to.name})
|
||||
return;
|
||||
if (to.path === '/login') {
|
||||
next();
|
||||
} else {
|
||||
// 从本地存储里获取token
|
||||
let token = Store.state.token as string
|
||||
// 判断token是否为空如果为空则跳转到登录页 如果有则放行
|
||||
if (!token) {
|
||||
next({path:'/login'});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
next();
|
||||
})
|
||||
|
||||
router.afterEach((to, from) => {
|
||||
|
@ -15,7 +15,6 @@ export default new Vuex.Store({
|
||||
getters : {
|
||||
token : (state : StateInterface) => state.user.token,
|
||||
user : (state : StateInterface) => state.user.user,
|
||||
step:state => state.step,
|
||||
nonce:state => state.nonce
|
||||
},
|
||||
modules : {
|
||||
@ -42,13 +41,17 @@ export default new Vuex.Store({
|
||||
state.nonce = nonce
|
||||
// sessionStorage.nonce = nonce
|
||||
},
|
||||
del_nonce(state) {
|
||||
state.nonce = ''
|
||||
// sessionStorage.nonce = nonce
|
||||
},
|
||||
set_token(state, token) {
|
||||
state.token = token
|
||||
sessionStorage.token = token
|
||||
// sessionStorage.token = token
|
||||
},
|
||||
del_token(state) {
|
||||
state.token = ''
|
||||
sessionStorage.removeItem('token')
|
||||
// sessionStorage.removeItem('token')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -9,7 +9,6 @@ const sprintf = require('sprintf-js');
|
||||
export interface UserState {
|
||||
user : UserInterface,
|
||||
token : string | undefined,
|
||||
isLogin : boolean,
|
||||
}
|
||||
|
||||
export default {
|
||||
@ -22,17 +21,15 @@ export default {
|
||||
},
|
||||
actions : {
|
||||
Login(context : ActionContext<UserState, any>, form : any) {
|
||||
return Http.post(Url.LOGIN, form).then((res : ResponseInterface) => {
|
||||
context.commit(Types.SET_USER_INFO, res.data);
|
||||
context.commit(Types.SET_USER_TOKEN, res.data.access_token);
|
||||
return Promise.resolve(res.data);
|
||||
}).catch((err : string) => {
|
||||
return Promise.reject(err);
|
||||
})
|
||||
// return Http.post(Url.LOGIN, form).then((res : ResponseInterface) => {
|
||||
// context.commit(Types.SET_USER_INFO, res.data);
|
||||
// context.commit(Types.SET_USER_TOKEN, res.data.access_token);
|
||||
// return Promise.resolve(res.data);
|
||||
// }).catch((err : string) => {
|
||||
// return Promise.reject(err);
|
||||
// })
|
||||
},
|
||||
getMenus() {
|
||||
// return Http.get()
|
||||
}
|
||||
|
||||
},
|
||||
mutations : {
|
||||
[Types.SET_USER_INFO](state : UserState, user : UserInterface) {
|
||||
@ -40,7 +37,7 @@ export default {
|
||||
},
|
||||
[Types.SET_USER_TOKEN](state : UserState, token : string) {
|
||||
state.token = token;
|
||||
state.isLogin = token.length > 0;
|
||||
// state.isLogin = token.length > 0;
|
||||
},
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user