提交 dbb30eca authored 作者: Your Name's avatar Your Name

fix(登录调试): 接口优化

上级 577b1d3b
VITE_DEV_API="/api"
VITE_PRD_API="/"
VITE_PRD_API="/api"
VITE_SYSTEM_NAMR="创新示范绩效评价"
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000/",
"webRoot": "${workspaceFolder}"
}
]
}
\ No newline at end of file
......@@ -17,14 +17,6 @@ export enum BaseRouteRouter {
export const routes: any[] = [
...dataCenter,
{
path: "/",
redirect: DataCenterRouter.DATA_MAP,
},
{
path: "/index",
redirect: DataCenterRouter.DATA_MAP,
},
{
path: BaseRouteRouter.LOGIN,
meta: {
......@@ -43,11 +35,7 @@ export const routes: any[] = [
},
{
path: "/:pathMatch(.*)*",
meta: {
label: "404",
},
name: "404",
component: () => import("@/views/404/index.vue")
redirect: DataCenterRouter.DATA_MAP,
},
]
......
import { Router } from "vue-router"
import { TOKEN_KEY } from "@/utils/enum/token.ts";
import { TOKEN_KEY } from "../utils/enum/token";
import { BaseRouteRouter } from "./index"
const whiteRoutes = ["/login", "/sso"]
export default (router: Router) => {
const token = localStorage.getItem(TOKEN_KEY)
router.beforeEach((to, from, next) => {
const token = localStorage.getItem(TOKEN_KEY)
if (whiteRoutes.includes(to.path)) {
return next()
}
......
export const TOKEN_KEY = "cxsf_echartd_token"
\ No newline at end of file
export const TOKEN_KEY = "cxsf_echarts_token"
\ No newline at end of file
......@@ -32,7 +32,7 @@ const singleLogin = async () => {
if (result) {
postLogin(challenge, ticket).then((res) => {
resolve(true)
resolve(res)
}).catch(() => {
reject()
})
......
<template>
404
</template>
\ No newline at end of file
......@@ -141,11 +141,14 @@ export default defineComponent({
align-items: center;
border-radius: 4px;
.Progress {
flex: 1;
text-align: center;
position: relative;
p {
color: #666666;
position: relative;
left: 80px;
top: 20px;
position: absolute;
top: 10px;
right: 23%;
font-size: 14px;
}
......
......@@ -20,7 +20,7 @@
</div>
</div>
<!-- 环形进度条 -->
<div v-show="false" id="circularEchart" class="circular"></div>
<div v-show="false" id="circularEchartLeft" class="circular"></div>
</div>
</div>
</el-col>
......@@ -48,7 +48,7 @@
</div>
</div>
<!-- 环形进度条 -->
<div id="cirRightEchart" class="circular"></div>
<div id="cirRightEchartRight" class="circular"></div>
</div>
</div>
</el-col>
......@@ -396,8 +396,8 @@ export default defineComponent({
this.mapEcharts = MAP_ECHARTS;
},
initCircularEcharts() {
const dom = document.getElementById("circularEchart");
const domCirRightEchart = document.getElementById("cirRightEchart");
const dom = document.getElementById("circularEchartLeft");
const domCirRightEchart = document.getElementById("cirRightEchartRight");
const cirLeftCharts = echarts.init(dom);
CRI_RIGHT_ECHART = echarts.init(domCirRightEchart);
......
......@@ -23,7 +23,7 @@ import { mapState } from "vuex";
let MAP_ECHARTS = null;
let CITY_ECHARTS = null
const xAxisCountry = ["2018", "2019", "2020", "2021", "2022"];
const xAxisCountry = ["2018", "2019", "2020", "2021"];
// 城市增长率
const xAxisCity = [
......
......@@ -11,8 +11,8 @@ export default {
},
"typeThree": {
seriesData: [{
value: [107.32, 157.51, 172.11],
rate: ["", 42.17, 21.19],
value: [107.32, 157.51, 172.11,129.13],
rate: ["", 42.17, 21.19,30],
}],
cityData: {
value: [48.2, 14.39, 3.07, 6.09, 19.42, 22.78, 4.6, 1.3, 8.6, 5.31, 0.26],
......@@ -21,8 +21,8 @@ export default {
},
"typeTwo": {
seriesData: [{
value: [107.32, 157.51, 172.11],
rate: ["", 42.17, 21.19],
value: [107.32, 157.51, 172.11,129.13],
rate: ["", 42.17, 21.19,30],
}],
cityData: {
value: [32.68, 7.42, 1.36, 3.47, 19.56, 12.5, 1.7, 0.86, 2.61, 2.58, 0.17],
......
......@@ -4,15 +4,15 @@ export default {
name: "国防科工军品收入",
type: "level_1",
echartType: "bar",
growthRate: ["", 42.17, 21.19],
barValue: [107.32, 157.51, 172.11],
growthRate: ["", 42.17, 21.19,30],
barValue: [107.32, 157.51, 172.11,129.13],
},
{
name: "民口单位军品收入",
type: "level_2",
echartType: "bar",
barValue: [71.93, 117.94, 139.15],
growthRate: ["",60,80],
barValue: [71.93, 117.94, 139.15,89.46],
growthRate: ["",60,80,40],
},
],
"typeThree": [
......@@ -20,15 +20,15 @@ export default {
name: "国防科工军品收入",
type: "level_1",
echartType: "bar",
growthRate: ["", 42.17, 21.19],
barValue: [107.32, 157.51, 172.11],
growthRate: ["", 42.17, 21.19,30],
barValue: [107.32, 157.51, 172.11,129.13],
},
{
name: "民口单位军品收入",
type: "level_2",
echartType: "bar",
barValue: [71.93, 117.94, 139.15],
growthRate: ["",60,80],
barValue: [71.93, 117.94, 139.15,89.46],
growthRate: ["",60,80,40],
},
],
"typeTwo": [
......@@ -36,15 +36,15 @@ export default {
name: "国防科工军品收入",
type: "level_1",
echartType: "bar",
growthRate: ["", 42.17, 21.19],
barValue: [107.32, 157.51, 172.11],
growthRate: ["", 42.17, 21.19,30],
barValue: [107.32, 157.51, 172.11,129.13],
},
{
name: "民口单位军品收入",
type: "level_2",
echartType: "bar",
barValue: [71.93, 117.94, 139.15],
growthRate: ["",60,80],
barValue: [71.93, 117.94, 139.15,89.46],
growthRate: ["",60,80,40],
},
],
......
......@@ -73,6 +73,7 @@ import singleLogin from "@/utils/singleLogin/index";
import { TOKEN_KEY } from "@/utils/enum/token";
import { defineComponent } from "vue";
import { getToken, login } from "./service";
import { DataCenterRouter } from "@/route/dataCenter";
export default defineComponent({
name: "Login",
......@@ -112,11 +113,11 @@ export default defineComponent({
this.wstLoading = true;
singleLogin()
.then(async () => {
const { data } = await getToken();
.then(async (res) => {
const { data } = res;
localStorage.setItem(TOKEN_KEY, data);
this.$router.push("/");
this.$router.push(DataCenterRouter.DATA_MAP);
})
.catch(() => {
this.$message.error("身份验证失败");
......@@ -127,12 +128,14 @@ export default defineComponent({
},
handleLogin() {
const loginForm = this.loginForm;
console.log("=====")
login(loginForm.username, loginForm.password)
.then(async (res) => {
const { data } = await getToken();
const { data } = res;
localStorage.setItem(TOKEN_KEY, data);
this.$router.push("/");
this.$router.push(DataCenterRouter.DATA_MAP);
})
.catch((err) => {
this.$message.error("用户名或密码错误!");
......
......@@ -14,7 +14,7 @@ export const getToken = async () => {
* @param password
*/
export const login = async (username: string, password: string) => {
request({
return request({
url: "/user/login?username=" + username + '&password=' + password,
method: "POST",
})
......
......@@ -10,6 +10,7 @@
import singleLogin from "@/utils/singleLogin/index";
import { getToken } from "./service";
import { TOKEN_KEY } from "@/utils/enum/token";
import { DataCenterRouter } from "@/route/dataCenter";
export default {
name: "sso",
......@@ -22,19 +23,17 @@ export default {
created() {
localStorage.removeItem(TOKEN_KEY);
this.wstLogin();
},
mounted() {
},
mounted() {},
methods: {
wstLogin() {
this.wstLoading = true;
singleLogin()
.then(async() => {
const { data } = await getToken();
.then(async (res) => {
const { data } = res;
localStorage.setItem(TOKEN_KEY, data);
this.$router.push("/");
this.$router.push(DataCenterRouter.DATA_MAP);
})
.catch(() => {
this.$message.error("身份验证失败");
......
......@@ -6,16 +6,16 @@ import legacy from "@vitejs/plugin-legacy";
import { resolve } from 'path'
export default defineConfig({
server:{
host:'0.0.0.0',
proxy: { // 配置域名代理
"/api": {
target: "http://192.168.0.100:9064",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
// server:{
// host:'0.0.0.0',
// proxy: { // 配置域名代理
// "/api": {
// target: "http://192.168.0.100:9064",
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ""),
// },
// },
// },
resolve: {
alias: {
'@': resolve('./src')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论