Commit f24b4a70 authored by 左玲玲's avatar 左玲玲 😬

1723

parent 900a8b1a
<script setup>
const store=useStore();
const router = useRouter();
const route = useRoute();
const { proxy } = getCtx();
// watch(()=>proxy.$tState.adaptiveConfig.chartCounter,(val,old)=>{
// // console.log("$tStateWatch",val);
// })
import { tokens, queryCurrentUser } from "@/api/api";
const store = useStore();
const envMode = process.env.NODE_ENV;
onMounted(async () => {
if (envMode == "development") {
let resToken = await tokens();
await localStorage.setItem("TOKENES", resToken.access_token);
let userInfo = await queryCurrentUser();
if (userInfo) {
store.commit('CHANGE_USER', {
currentUser: userInfo?.data?.data ?? {}
});
}
} else {
let userInfo = await queryCurrentUser();
if (userInfo) {
store.commit('CHANGE_USER', {
currentUser: userInfo?.data?.data ?? {}
});
}
}
onMounted(()=>{
})
</script>
<template>
<div id="root-techui" :class="`root-BG lang-${store.state.lang}`" >
<div id="root-techui" :class="`root-BG lang-${store.state.lang}`">
<router-view></router-view>
</div>
</template>
......
import { http,fetchLocl} from "./request"
//接口demo
export const httpGetMap = (url,params) => { return fetchLocl("get",url+params)}
// export const loginApi = params => { return http("post",'/test/ste/', params)}
// export const httpGaugeTriple = params => { return http("get",'/static/tempData/gaugeTriple.json', params)}
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-10 08:54:29
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 14:48:08
* @FilePath: \vue3portal\src\api\api.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import request from "./request";
//获取token
export async function tokens(params) {
return request(`mesc/oauth/token?grant_type=password&client_id=portal1&client_secret=portal@2022&username=root&password=Nangao@2022`, {
method: 'POST',
data: params,
});
}
//个人信息
export async function queryCurrentUser(params) {
return request('/user/me', {
method: 'POST',
data: params,
});
}
function bodyParse(vals) {
let val = JSON.parse(JSON.stringify(vals));
let res = '';
for (let key in val) {
let mostkey = key,
value = val[key] ? val[key] : '';
res += `&${mostkey}=${value}`;
}
return '?' + res.substr(1);
}
export default bodyParse;
\ No newline at end of file
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-09 13:52:06
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-10 09:19:40
* @FilePath: \iot-platform\portal\src\api\doFetch.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import request from './request';
import bodyParse from './bodyParse';
export async function postFetch({ url, params }) {
return request(url, {
method: 'POST',
data: params,
});
}
export async function getFetchEcharts({ url, params }) {
console.log(url,params);
return request(url +params,{
method: 'GET'
});
}
export async function getFetch({ url, params }) {
return request(url + bodyParse(params),{
method: 'GET'
});
}
export async function getDownload({ url, params }) {
return request(url + bodyParse(params), {
method: 'GET',
responseType: 'blob'
});
}
export async function formFetch({ url, params }) {
return request(url, {
method: 'POST',
data: params,
type: 'form',
});
}
\ No newline at end of file
import axios from 'axios'
import { extend } from 'umi-request';
import { ElMessage, ElNotification } from 'element-plus';
const envMode=process.env.NODE_ENV;
const publicUrl=envMode=='development'?'/':"/api"
const baseUrl = envMode == "development" ? "/mes" : "";
const codeMessage = {
302: '重定向。',
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '用户没有权限(令牌、用户名、密码错误)。',
403: '用户没有得到授权,无法访问当前资源。',
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
500: '服务器发生错误,请检查服务器。',
502: '网关错误。',
503: '服务不可用,服务器暂时过载或维护。',
504: '网关超时。',
};
//清除所有cookie
function clearCookie() {
var cookies = document.cookie.split(";");
// 遍历所有的cookie并删除它们
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
/**
* 封装请求
* @param:{method} String 请求类型,必填
* @param:{url} String 请求地址,必填
* @param:{params} Object 参数参数,非必填
* @returns:Promise {<pending>}
**/
export const http = (method, url, params = {},loading) => {
return new Promise(function(resolve, reject) {
axios({
method: method,
url: publicUrl+url,
headers: {
'Content-Type': 'application/json',
},
data: params,
})
.then(res => {
if(res.status==200){
// if(!res.data.success){
// // showMessage(res.data.errorMessage, "error")
// }else{
// }
resolve(res.data);
}else{
console.error('axiosThen',res)
reject(res);
}
})
.catch(err => {
console.error('axiosCatch',err);
reject(err);
// ElMessage({ message: "提交失败", showClose: true, center: true, duration: 2000, type:'error' });
// !loadingDisable&&hideLoading()
})
})
* 退出登录,并且将当前的 url 保存
*/
const loginOut = () => {
// getFetch({ url: "/logout", params: {} }).then(res => {
// window.location.href = res?.logoutRedirectUrl;
// localStorage.clear();
// })
};
const request = extend({
credentials: 'include', // 默认请求是否带上cookie
});
// request拦截器, 改变url 或 options.
request.interceptors.request.use(async (url, options) => {
let token = localStorage.getItem('TOKENES') ?? "", headers = {};
if (envMode == "development" && url.indexOf("mesc") == -1 && token) {
headers = options.type == 'form' ? {
Authorization: "Bearer " + token
} : {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: "Bearer " + token
}
} else {
headers = options.type == 'form' ? {} : {
'Content-Type': 'application/json',
Accept: 'application/json'
}
}
return {
url: url.indexOf("mesc") > -1 ? envMode == "development" ? url : url.slice(4) : baseUrl + url,
options: { ...options, headers: headers },
};
});
//封装fetch
export const fetchLocl = async(method, url, params)=>{
var opts = {
method,
// headers: {
// 'Accept': 'application/json',
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
// response拦截器, 处理response 错误提示&&权限拦截
request.interceptors.response.use(async (response, options) => {
var reg = new RegExp(".*idp.*nangaoyun.com.*");
if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText;
const { status, url } = response;
if (response?.url.indexOf('api/user_token') == -1 && Object.keys(codeMessage).indexOf(String(response.status)) > -1) {
ElNotification({
message: errorText,
type: 'error',
});
}
if (status == "401") {
clearCookie();
}
if (status == "401" || status == "302") {
// loginOut();
window.location.href = "/";
}
if (reg.exec(url) && reg.exec(url)?.length > 0 && status == 200) {
window.location.href = url;
}
} else if (!response) {
if (response?.url.indexOf('api/user_token') == -1) {
ElNotification({
title: '网络异常',
message: '您的网络发生异常,无法连接服务器',
type: 'error',
});
}
}
if(method=='post'){ opts.body={params} }
return await fetch(url,opts).then((res) => {
return res.json();
})
// .then((res) => { return res; })
// .catch((error) => { console.error(error) })
}
\ No newline at end of file
try {
if (options.responseType == 'blob') {
//下载blob
const data = await response.clone().blob();
if (data.type == 'application/octet-stream') {
const a = document.createElement('a');
a.style.display = 'none';
let temp = response.headers.get('Content-Disposition').split(';')[1].split('=')[1] || '';
let fileDefaultName = decodeURI(temp);
let pathname = localStorage.getItem('curinf')
? JSON.parse(localStorage.getItem('curinf'))
: {};
if (fileDefaultName.indexOf('.png') != -1) {
const blob = new Blob([data], {
type: 'image/png',
});
let blobUrls = window.URL.createObjectURL(blob);
a.href = blobUrls;
a.target = '_black';
a.click();
a.remove();
} else {
let blobUrl = window.URL.createObjectURL(data);
a.download = fileDefaultName || pathname.cname + '.xls';
a.href = blobUrl;
a.click();
a.remove();
}
} else {
const data = await response?.clone()?.json();
// 详情返回的response处理
if (data?.code != '0000') {
ElMessage.closeAll();
data?.msg && ElMessage({
message: data?.msg,
type: 'warning',
})
}
}
} else {
const data = await response.clone().json();
// 详情返回的response处理
if (data?.code != "0000") {
ElMessage.closeAll();
data?.msg && ElMessage({
message: data?.msg,
type: 'warning',
});
}
if (data.code == "0001") {
loginOut();
}
}
} catch (error) {
}
return response;
});
export default request;
.lang-cn .system-name{.ff("cn0");}
.lang-hk .system-name{ font-size: 30px; font-weight: bold;}
.lang-en .system-name{.ff("en0"); font-size: 30px; font-weight: bold;}
\ No newline at end of file
.lang-cn .system-name {
.ff("cn0");
}
.lang-hk .system-name {
font-size: 30px;
font-weight: bold;
}
.lang-en .system-name {
.ff("en0");
font-size: 30px;
font-weight: bold;
}
body {
color: #fff;
}
.rowflex {
display: flex;
align-items: center;
}
.colflex {
display: flex;
flex-direction: column;
}
.set1 {
flex: 1;
}
.set2 {
flex: 2;
}
.set3 {
flex: 3;
}
.swh{
width: 100%;
height: 100%;
}
\ No newline at end of file
......@@ -2,72 +2,125 @@
const route = useRoute();
const router = useRouter();
const store = useStore();
const inited=ref(false)
const nav=[
{label:"Document",path:"http://lite.techui.net/docs"},
{label:"Gtihub",path:"https://github.com/ayin86/techui-vue3-lite"},
{label:"Premium",path:"http://techui.net/docs/"},
]
const inited = ref(false);
const nav = [
{ label: "Document", path: "http://lite.techui.net/docs" },
{ label: "Gtihub", path: "https://github.com/ayin86/techui-vue3-lite" },
{ label: "Premium", path: "http://techui.net/docs/" },
];
const langs=[
{label:"简中",value:"cn"},
{label:"繁中",value:"hk"},
{label:"English",value:"en"},
]
const langs = [
{ label: "简中", value: "cn" },
{ label: "繁中", value: "hk" },
{ label: "English", value: "en" },
];
const goToLink=(item)=>{
const goToLink = (item) => {
window.open(item.path);
}
};
const changLang=(item)=>{
store.state.lang=item.value
if(item.value=='cn'){
const changLang = (item) => {
store.state.lang = item.value;
if (item.value == "cn") {
router.push("/dashboardA-cn");
}else if(item.value=='hk'){
} else if (item.value == "hk") {
router.push("/dashboardA-hk");
}else if(item.value=='en'){
} else if (item.value == "en") {
router.push("/dashboardA-en");
}
}
};
onMounted(() => {
inited.value=true
})
inited.value = true;
});
</script>
<template>
<div :class="`external-wrap ${inited&&'inited'}`" >
<div :class="`external-wrap ${inited && 'inited'}`">
<div class="link-wrap">
<div class="item" @click="goToLink(item)" v-for="item in nav">
{{ item.label }}
{{ item.label }}
</div>
</div>
<div class="lang-switch" >
<div :class="`item ${store.state.lang==item.value?'active':''}`" @click="changLang(item)" v-for="(item,index) in langs">{{item.label}}</div>
<div class="lang-switch">
<div
:class="`item ${store.state.lang == item.value ? 'active' : ''}`"
@click="changLang(item)"
v-for="(item, index) in langs"
>
{{ item.label }}
</div>
</div>
</div>
</template>
<style lang="less">
.external-wrap{.poa; left:40px; top:0; display:flex; z-index: 20;
.link-wrap{ display:flex;
.item{padding:10px; .fc(@bld6); .por; cursor: pointer; .ani;
&:hover{.fc(@cbl5);}
.external-wrap {
.poa;
left: 40px;
top: 0;
display: flex;
z-index: 20;
.link-wrap {
display: flex;
.item {
padding: 10px;
.fc(@bld6);
.por;
cursor: pointer;
.ani;
&:hover {
.fc(@cbl5);
}
}
}
.lang-switch{ display:flex; .por; margin:0 0 0 10px;padding:0 0 0 10px;
&:before{content:""; .bdl(@bld6); .poa; left:0; top:10px; bottom:10px;}
.item{padding:10px; .fc(@bld6); .por; cursor: pointer; .ani;
&:before{.poa; top:0; left:50%; .bdr(0 0 10px 10px); .fixc("x"); width: 0%; opacity: 0; .ani; content:" "; height:5px; .bgc(@cbl6);}
&:hover{.fc(@cbl5);}
&.active{.fc(@cbl3);
&:before{ opacity: 1;}
.lang-switch {
display: flex;
.por;
margin: 0 0 0 10px;
padding: 0 0 0 10px;
&:before {
content: "";
.bdl(@bld6);
.poa;
left: 0;
top: 10px;
bottom: 10px;
}
.item {
padding: 10px;
.fc(@bld6);
.por;
cursor: pointer;
.ani;
&:before {
.poa;
top: 0;
left: 50%;
.bdr(0 0 10px 10px);
.fixc("x");
width: 0%;
opacity: 0;
.ani;
content: " ";
height: 5px;
.bgc(@cbl6);
}
&:hover {
.fc(@cbl5);
}
&.active {
.fc(@cbl3);
&:before {
opacity: 1;
}
}
}
}
&.inited{
.active{
&:before{width: 90%;}
&.inited {
.active {
&:before {
width: 90%;
}
}
}
}
</style>
\ No newline at end of file
</style>
//修改个人信息
export const CHANGE_USER = 'CHANGE_USER'
\ No newline at end of file
<!--
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-10 17:03:11
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 17:23:21
* @FilePath: \vue3portal\src\pages\layouts\components\elsheader.vue
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<template>
<div class="headerbox">
<systemTitleA2 :config="titleconfig">南高数字化云平台</systemTitleA2>
<div class="rowflex headerright">
<el-icon color="#19e5e6" size="24">
<i-ep-user />
</el-icon>
<el-dropdown @command="handleCommand">
<div class="el-dropdown-link">
{{ currentUser?.fullName }}
<el-icon class="el-icon--right" color="#fff">
<i-ep-arrow-down />
</el-icon>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="pwd" :icon="Lock">
修改密码
</el-dropdown-item>
<el-dropdown-item command="logout" :icon="SwitchButton">
退出登录
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<el-dialog v-model="dialogVisible" title="修改密码" width="30%" :before-close="handleClose">
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false">
提交
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ElMessageBox } from 'element-plus'
import { Lock, SwitchButton } from "@element-plus/icons-vue";
import { getFetch } from "@/api/doFetch";
const store = useStore();
let titleconfig = reactive({
width: 1920,
scale: .75
}),
dialogVisible = ref(false);
const currentUser = computed(() => store.state.currentUser);
const loginOut = () => {
getFetch({ url: "/logout", params: {} }).then(res => {
window.location.href = res?.logoutRedirectUrl;
localStorage.clear();
})
};
const handleCommand = (command) => {
if (command == "pwd") {
dialogVisible.value = true;
} else {
store.commit('CHANGE_USER', {
currentUser: {}
});
loginOut();
}
};
const handleClose = () => {
dialogVisible.value = false;
}
// watch(() => dialogVisible.value, (newValue, oldValue) => {
// console.log(newValue, oldValue);
// })
</script>
<style lang="less" scoped>
.headerbox {
display: flex;
align-items: center;
padding: 0 18px;
height: 100%;
justify-content: flex-end;
.headerright {
height: 100%;
gap: 15px
}
.el-dropdown-link {
cursor: pointer;
color: #19e5e6;
display: flex;
align-items: center;
}
}
</style>
\ No newline at end of file
<!--
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-10 15:27:18
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 11:19:18
* @FilePath: \vue3portal\src\pages\layouts\index.vue
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<script setup>
import elsheader from "./components/elsheader.vue";
import "@/assets/less/main.less";
const state=reactive({
APConfig:{
width:1920,
height:974,
userSelect:true,
// chartCount:0
loading:false,
backgroundFillAll:false
}
})
</script>
<template>
<adaptivePanel :config='state.APConfig'>
<div class="colflex swh">
<el-container>
<el-header height="40px" style="padding: 0;">
<elsheader></elsheader>
</el-header>
<el-main style="flex:1;">Main</el-main>
</el-container>
</div>
</adaptivePanel>
</template>
<style lang="less" scoped></style>
\ No newline at end of file
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-09 13:38:59
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-10 09:23:25
* @FilePath: \iot-platform\portal\src\plugins\common.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import "@/assets/less/main.less";
import axios from 'axios'
// import {AyinColor} from "ayin-color"
import {getFetch,getFetchEcharts,getDownload,postFetch,formFetch } from "../api/doFetch";
export default function(app){
window.axios=axios
// app.use(AyinColor)
// const comps=[ ];
// comps.forEach((com,a) => {
// let cona=com.name?com.name:com.__name
// app.component(cona,com);
// });
window.getFetchEcharts=getFetchEcharts;
window.getFetch=getFetch;
window.getDownload=getDownload;
window.postFetch=postFetch;
window.formFetch=formFetch;
}
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-10 15:29:48
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 14:56:30
* @FilePath: \vue3portal\src\router.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import { createRouter, createWebHistory,createWebHashHistory,useRoute } from 'vue-router'
import { ElMessage } from 'element-plus';
import{ defineAsyncComponent } from"vue"
import store from './store'
const router = createRouter({
// history: createWebHistory(),
history: createWebHashHistory(),
......@@ -11,72 +21,36 @@ const router = createRouter({
{
path: "/",
name: "layout",
redirect:"/dashboardA-en",
},
{
path: "/dashboardA-en",
name: "dashboardA-en",
component:()=>import("@/viewsEN/dashboardA/dashboardA-index.vue"),
},
{
path: "/dashboardB-en",
name: "dashboardB-en",
component:()=>import("@/viewsEN/dashboardB/dashboardB-index.vue"),
},
{
path: "/dashboardC-en",
name: "dashboardC-en",
component:()=>import("@/viewsEN/dashboardC/dashboardC-index.vue"),
},
{
path: "/dashboardD-en",
name: "dashboardD-en",
component:()=>import("@/viewsEN/dashboardD/dashboardD-index.vue"),
},
{
path: "/dashboardA-cn",
name: "dashboardA-cn",
component:()=>import("@/viewsCN/dashboardA/dashboardA-index.vue"),
},
{
path: "/dashboardB-cn",
name: "dashboardB-cn",
component:()=>import("@/viewsCN/dashboardB/dashboardB-index.vue"),
redirect:"/home",
},
{
path: "/dashboardC-cn",
name: "dashboardC-cn",
component:()=>import("@/viewsCN/dashboardC/dashboardC-index.vue"),
},
{
path: "/dashboardD-cn",
name: "dashboardD-cn",
component:()=>import("@/viewsCN/dashboardD/dashboardD-index.vue"),
},
{
path: "/dashboardA-hk",
name: "dashboardA-hk",
component:()=>import("@/viewsHK/dashboardA/dashboardA-index.vue"),
},
{
path: "/dashboardB-hk",
name: "dashboardB-hk",
component:()=>import("@/viewsHK/dashboardB/dashboardB-index.vue"),
},
{
path: "/dashboardC-hk",
name: "dashboardC-hk",
component:()=>import("@/viewsHK/dashboardC/dashboardC-index.vue"),
},
{
path: "/dashboardD-hk",
name: "dashboardD-hk",
component:()=>import("@/viewsHK/dashboardD/dashboardD-index.vue"),
},
path: "/home",
name: "首页",
component:()=>import("@/pages/layouts/index.vue"),
}
]
});
/**
* 全局前置路由守卫,每一次路由跳转前都进入这个 beforeEach 函数
*/
router.beforeEach((to, from, next) => {
if (to.path == '/user/login' || to.path == '/user/register') {
// 登录或者注册才可以往下进行
next();
} else {
// 获取 token
const token = localStorage.getItem('TOKENES');
// token 不存在
if (token === null || token === '') {
ElMessage.error('您还没有登录,请先登录');
// next('/');
} else {
next();
}
}
});
export default router;
......
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-11 14:37:08
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 16:37:22
* @FilePath: \vue3portal\src\store.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import { createStore } from 'vuex'
import { useRoute, useRouter } from "vue-router";
import router from '@/router.js'
import { CHANGE_USER } from './mutation-types'
export default createStore({
state: {
lang:"en"
lang: "en",
currentUser: {}
},
mutations: {
[CHANGE_USER](state, payload) {
state.currentUser = payload.currentUser;
}
},
actions: {
},
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangCN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangCN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangCN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangCN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,8 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
colors:{
pin_A:$c.cyl2,
......@@ -373,7 +371,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangCN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangCN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangEN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangEN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangEN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangEN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,8 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
colors:{
pin_A:$c.cyl2,
......@@ -373,7 +371,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangEN.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangEN.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangHK.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangHK.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,9 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
map:{},
......@@ -394,7 +391,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangHK.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangHK.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
......@@ -3,8 +3,6 @@ import { $c } from "ayin-color";
const { proxy } = getCtx();
import symbol from "./map/symbol.json"
import counter from "./map/map-counter.vue"
import {httpGetMap} from "@/api/api.js"
const state=reactive({
colors:{
pin_A:$c.cyl2,
......@@ -373,7 +371,7 @@ state.chartInstance.setOption(state.chartOption,true);
}
onMounted(()=>{
httpGetMap("/static/maps/","shenyangHK.json").then((res)=>{
getFetchEcharts({url:"/static/maps/",params:"shenyangHK.json"}).then((res)=>{
console.log("mapRes",res);
state.chartData.alladcode=res;
state.chartData.geoJson=res;
......
/*
* @Author: zuolingling zuolingling@jsnangao.com
* @Date: 2023-08-10 16:13:33
* @LastEditors: zuolingling zuolingling@jsnangao.com
* @LastEditTime: 2023-08-11 15:48:28
* @FilePath: \vue3portal\vite.config.js
* @Description:
*
* Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
*/
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import path from "path"
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({
server: {
host: '127.0.0.1'
host: '127.0.0.1',
cors: true,
proxy: {
'/mes/': { // 匹配请求路径,localhost:3000/snow
target: 'http://gateway.nangaoyun.com:8000/portal', // 代理的目标地址
changeOrigin: true, // 开发模式,默认的origin是真实的 origin:localhost:3000 代理服务会把origin修改为目标地址
// rewrite target目标地址 + '/abc',如果接口是这样的,那么不用重写
rewrite: (path) => path.replace(/^\/mes/, '') // 路径重写,本项目不需要重写
},
"/mesc/": {
// 要代理的地址
target: "http://gateway.nangaoyun.com:8080", //39:18040 23/mes/ //60 翔
changeOrigin: true,
rewrite: (path) => path.replace(/^\/mesc/, '') // 路径重写,本项目不需要重写
},
}
},
resolve: {
alias:{
"@":path.resolve(__dirname,"src"),
alias: {
"@": path.resolve(__dirname, "src"),
"@static": path.resolve(__dirname, "static"),
"@assets": path.resolve(__dirname, "src/assets"),
"@mixins": path.resolve(__dirname, "src/mixins"),
......@@ -23,18 +53,41 @@ export default defineConfig({
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData:`
additionalData: `
@import "${path.resolve(__dirname, './node_modules/ayin-lessmixins/ayin-lessmixins.less')}";
@import "${path.resolve(__dirname, './node_modules/ayin-color/ayin-color.less')}";
@import "${path.resolve(__dirname, './node_modules/ayin-color/ayin-color-expand.less')}";
`
//引入的less全局变量,来自于开源组件ayin-color和ayin-lessmixins,访问https://www.npmjs.com/package/ayin-color 查看相关信息
//引入的less全局变量,来自于开源组件ayin-color和ayin-lessmixins,访问https://www.npmjs.com/package/ayin-color 查看相关信息
}
}
},
optimizeDeps: {
include:['echarts','ayin-color'],
include: ['echarts', 'ayin-color'],
exclude: ['techui-vue3-lite']
},
plugins: [vue()],
plugins: [
vue(),
AutoImport({
resolvers: [
ElementPlusResolver(),
// 自动导入图标组件
IconsResolver({
prefix: 'Icon',
})
],
}),
Components({
resolvers: [
ElementPlusResolver(),
// 自动注册图标组件
IconsResolver({
enabledCollections: ['ep'],
})
]
}),
Icons({
autoInstall: true,
}),
]
})
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment