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

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

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