Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a80b7d874 | |||
a6d04d22ad | |||
5ec53f7fd0 |
@ -1,6 +1,19 @@
|
||||
# 开发环境
|
||||
VITE_PORT = 9000
|
||||
VITE_APP_NAME = 'digital-agriculture-screen'
|
||||
# VITE_PORT = 9530
|
||||
# VITE_APP_NAME = 'new-digital-agriculture-screen'
|
||||
# VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
||||
# VITE_APP_BASE_API = '/apis'
|
||||
# VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||
|
||||
|
||||
# 开发环境
|
||||
VITE_PORT = 9530
|
||||
VITE_MODE = 'DEV'
|
||||
VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
||||
VITE_APP_MIAN = 'daimp-front-main'
|
||||
VITE_APP_MIAN_URL = 'http://localhost:9530'
|
||||
VITE_APP_NAME = 'new-digital-agriculture-screen'
|
||||
VITE_APP_BASE_API = '/apis'
|
||||
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||
VITE_APP_UPLOAD_API = '/uploadApis'
|
||||
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:9300'
|
||||
|
@ -1,5 +1,14 @@
|
||||
# 生产环境
|
||||
VITE_APP_NAME = 'digital-agriculture-screen'
|
||||
VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
||||
# VITE_APP_NAME = 'new-digital-agriculture-screen'
|
||||
# VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
||||
# VITE_APP_BASE_API = '/apis'
|
||||
# VITE_APP_BASE_URL = ''
|
||||
|
||||
VITE_APP_MIAN = 'daimp-front-main'
|
||||
VITE_APP_MIAN_URL = 'http://47.109.205.240:88'
|
||||
VITE_APP_NAME = 'new-digital-agriculture-screen'
|
||||
# 接口
|
||||
VITE_APP_BASE_API = '/apis'
|
||||
VITE_APP_BASE_URL = ''
|
||||
VITE_APP_BASE_URL = ''
|
||||
VITE_APP_UPLOAD_API = '/uploadApis'
|
||||
VITE_APP_UPLOAD_URL = ''
|
||||
|
@ -1,5 +0,0 @@
|
||||
# 测试环境
|
||||
VITE_APP_NAME = 'digital-agriculture-screen'
|
||||
VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
||||
VITE_APP_BASE_API = '/apis'
|
||||
VITE_APP_BASE_URL = ''
|
@ -54,14 +54,14 @@ const props = defineProps({
|
||||
type: Array,
|
||||
default() {
|
||||
return [
|
||||
{ label: '首页', value: '/v2/home' },
|
||||
{ label: '土地资源', value: '/v2/land' },
|
||||
{ label: '投入品监管', value: '/v2/inputs' },
|
||||
{ label: '产出品管理', value: '/v2/entities' },
|
||||
{ label: '首页', value: '/new-digital-agriculture-screen/v2/home' },
|
||||
{ label: '土地资源', value: '/new-digital-agriculture-screen/v2/land' },
|
||||
{ label: '投入品监管', value: '/new-digital-agriculture-screen/v2/inputs' },
|
||||
{ label: '产出品管理', value: '/new-digital-agriculture-screen/v2/entities' },
|
||||
// { label: '智慧种植监测', value: 'plant' },
|
||||
// { label: '智慧养殖监测', value: 'breed' },
|
||||
{ label: '生产经营主体', value: '/v2/business' },
|
||||
{ label: '农产品溯源', value: '/v2/trace' },
|
||||
{ label: '生产经营主体', value: '/new-digital-agriculture-screen/v2/business' },
|
||||
{ label: '农产品溯源', value: '/new-digital-agriculture-screen/v2/trace' },
|
||||
// { label: '产业预警决策', value: 'early' },
|
||||
];
|
||||
},
|
||||
|
38
src/main.js
38
src/main.js
@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: zenghua.wang
|
||||
* @Date: 2024-01-24 17:14:41
|
||||
* @LastEditors: zenghua.wang
|
||||
* @LastEditTime: 2024-03-22 10:11:34
|
||||
*/
|
||||
import 'virtual:svg-icons-register';
|
||||
import { createApp, nextTick } from 'vue';
|
||||
import App from './App.vue';
|
||||
@ -5,30 +12,23 @@ import router from './router';
|
||||
import pinia from './store';
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'animate.css';
|
||||
import Avue from '@smallwei/avue';
|
||||
import '@smallwei/avue/lib/index.css';
|
||||
import './utils/permission';
|
||||
import { registerDirective } from './directives';
|
||||
import { registerElIcons } from './plugins/icon';
|
||||
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
|
||||
import '@vuemap/vue-amap/dist/style.css';
|
||||
|
||||
// 初始化高德地图 API
|
||||
initAMapApiLoader({
|
||||
key: 'c843a50db7157faf295c6fa37c48719f',
|
||||
securityJsCode: 'f09302d3ed65110614bdb26e44717ddf', // 新版key需要配合安全密钥使用
|
||||
version: '2.0',
|
||||
Loca: {
|
||||
version: '2.0',
|
||||
},
|
||||
AMapUI: {
|
||||
plugins: ['misc/PathSimplifier'],
|
||||
},
|
||||
plugins: ['AMap.MapType'],
|
||||
});
|
||||
import { registerDirective } from './directives';
|
||||
import { registerGlobalComponents } from './plugins/globalComponents';
|
||||
import { registerElIcons } from './plugins/icon';
|
||||
import { registerMicroApps } from './plugins/micro';
|
||||
|
||||
const app = createApp(App);
|
||||
// 注册 Vue3 Scroll Seamless 组件
|
||||
// app.component('Vue3ScrollSeamless', vue3ScrollSeamless);
|
||||
// app.use(pinia).use(router).use(ElementPlus).use(Avue);
|
||||
app.use(pinia).use(router).use(ElementPlus).use(Avue).use(VueAMap);
|
||||
nextTick(() => {
|
||||
registerGlobalComponents(app);
|
||||
registerElIcons(app);
|
||||
registerDirective(app);
|
||||
registerMicroApps(app);
|
||||
});
|
||||
app.use(pinia).use(router).use(ElementPlus).use(VueAMap).mount('#app');
|
||||
|
8
src/plugins/globalComponents.js
Normal file
8
src/plugins/globalComponents.js
Normal file
@ -0,0 +1,8 @@
|
||||
import * as components from '../../../main/src/components';
|
||||
|
||||
// 全局注册组件
|
||||
export const registerGlobalComponents = (app) => {
|
||||
Object.keys(components).forEach((key) => {
|
||||
app.component(key, components[key]);
|
||||
});
|
||||
};
|
26
src/plugins/micro.js
Normal file
26
src/plugins/micro.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
||||
|
||||
export const registerMicroApps = async (app) => {
|
||||
const initQiankun = () => {
|
||||
renderWithQiankun({
|
||||
bootstrap() {
|
||||
console.log('bootstrap');
|
||||
},
|
||||
mount(props) {
|
||||
console.log('mount', props);
|
||||
render(props);
|
||||
},
|
||||
update(props) {
|
||||
console.log('update', props);
|
||||
},
|
||||
unmount(props) {
|
||||
console.log('unmount', props);
|
||||
},
|
||||
});
|
||||
};
|
||||
const render = async ({ container }) => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
app.mount(container ? container.querySelector('#app') : '#app');
|
||||
};
|
||||
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
||||
};
|
7
src/plugins/splitpanes.js
Normal file
7
src/plugins/splitpanes.js
Normal file
@ -0,0 +1,7 @@
|
||||
import { Splitpanes, Pane } from 'splitpanes';
|
||||
import 'splitpanes/dist/splitpanes.css';
|
||||
|
||||
export const registerSplitpanes = (app) => {
|
||||
app.component('Splitpanes', Splitpanes);
|
||||
app.component('Pane', Pane);
|
||||
};
|
@ -11,18 +11,26 @@ export const constantRoutes = [
|
||||
// component: () => import('@/views/error/404.vue'),
|
||||
// hidden: true,
|
||||
// },
|
||||
// {
|
||||
// path: '/403',
|
||||
// name: '403',
|
||||
// component: () => import('@/views/error/403.vue'),
|
||||
// hidden: true,
|
||||
// },
|
||||
{
|
||||
path: '/',
|
||||
path: '/new-digital-agriculture-screen/403',
|
||||
name: '403',
|
||||
component: () => import('@/views/error/403.vue'),
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
path: '/new-digital-agriculture-screen',
|
||||
name: 'layout',
|
||||
component: Layout,
|
||||
redirect: '/v2/land',
|
||||
redirect: '/new-digital-agriculture-screen/v2/home',
|
||||
meta: { title: '首页', icon: 'House' },
|
||||
children: [
|
||||
{
|
||||
path: '/new-digital-agriculture-screen/v2/home',
|
||||
component: () => import('@/views/home/index.vue'),
|
||||
name: 'home',
|
||||
meta: { title: '首页', icon: '' },
|
||||
},
|
||||
],
|
||||
},
|
||||
// ...demoRouters,
|
||||
v2,
|
||||
@ -38,9 +46,9 @@ export const constantRoutes = [
|
||||
* @Title notFoundRouter(找不到路由)
|
||||
*/
|
||||
export const notFoundRouter = {
|
||||
path: '/:pathMatch(.*)',
|
||||
path: '/new-digital-agriculture-screen/:pathMatch(.*)',
|
||||
name: 'notFound',
|
||||
redirect: '/404',
|
||||
redirect: '/new-digital-agriculture-screen/404',
|
||||
};
|
||||
|
||||
const router = createRouter({
|
||||
|
@ -2,20 +2,20 @@ import Layout from '@/layouts/index.vue';
|
||||
|
||||
export default [
|
||||
{
|
||||
path: '/demo',
|
||||
path: '/new-digital-agriculture-screen/demo',
|
||||
name: 'demo',
|
||||
component: Layout,
|
||||
redirect: '/scrollBoard',
|
||||
redirect: '/new-digital-agriculture-screen/scrollBoard',
|
||||
meta: { title: '案例', icon: 'document' },
|
||||
children: [
|
||||
{
|
||||
path: '/demo/scrollBoard',
|
||||
path: '/new-digital-agriculture-screen/demo/scrollBoard',
|
||||
name: 'scrollBoard',
|
||||
component: () => import('@/views/demo/scrollBoard.vue'),
|
||||
meta: { title: '轮播列表', icon: 'document' },
|
||||
},
|
||||
{
|
||||
path: '/demo/rank',
|
||||
path: '/new-digital-agriculture-screen/demo/rank',
|
||||
name: 'rank',
|
||||
component: () => import('@/views/demo/rank.vue'),
|
||||
meta: { title: '滚动排名列表', icon: 'document' },
|
||||
|
@ -1,32 +1,32 @@
|
||||
import Layout from '@/layouts/index.vue';
|
||||
|
||||
export default {
|
||||
path: '/v2',
|
||||
name: 'v2',
|
||||
path: '/new-digital-agriculture-screen',
|
||||
name: 'layout',
|
||||
component: Layout,
|
||||
redirect: '/v2/home',
|
||||
redirect: '/new-digital-agriculture-screen/v2/home',
|
||||
meta: { title: '首页', icon: '' },
|
||||
children: [
|
||||
{
|
||||
path: '/v2/home',
|
||||
path: '/new-digital-agriculture-screen/v2/home',
|
||||
component: () => import('@/views/home/index.vue'),
|
||||
name: 'home',
|
||||
meta: { title: '首页', icon: '' },
|
||||
},
|
||||
{
|
||||
path: '/v2/land',
|
||||
path: '/new-digital-agriculture-screen/v2/land',
|
||||
component: () => import('@/views/land/index.vue'),
|
||||
name: 'land',
|
||||
meta: { title: '土地资源', icon: '' },
|
||||
},
|
||||
{
|
||||
path: '/v2/inputs',
|
||||
path: '/new-digital-agriculture-screen/v2/inputs',
|
||||
name: 'inputs',
|
||||
component: () => import('@/views/inputs/index.vue'),
|
||||
meta: { title: '投入品监管', icon: '' },
|
||||
},
|
||||
{
|
||||
path: '/v2/entities',
|
||||
path: '/new-digital-agriculture-screen/v2/entities',
|
||||
name: 'entities',
|
||||
component: () => import('@/views/entities/index.vue'),
|
||||
meta: { title: '产出品管理', icon: '' },
|
||||
@ -44,13 +44,13 @@ export default {
|
||||
// meta: { title: '', icon: '' },
|
||||
// },
|
||||
{
|
||||
path: '/v2/business',
|
||||
path: '/new-digital-agriculture-screen/v2/business',
|
||||
name: 'business',
|
||||
component: () => import('@/views/business/index.vue'),
|
||||
meta: { title: '生产经营主体', icon: '' },
|
||||
},
|
||||
{
|
||||
path: 'trace',
|
||||
path: '/new-digital-agriculture-screen/trace',
|
||||
name: 'trace',
|
||||
component: () => import('@/views/trace/index.vue'),
|
||||
meta: { title: '农产品溯源', icon: '' },
|
||||
|
@ -35,6 +35,11 @@ router.beforeEach(async (to, from, next) => {
|
||||
accessRoutes.forEach((item) => router.addRoute(item));
|
||||
return next({ ...to, replace: true });
|
||||
} else {
|
||||
if (from.path.includes('/new') && to.path.includes('/platform')) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
next();
|
||||
next();
|
||||
}
|
||||
} catch (error) {
|
||||
|
@ -52,7 +52,7 @@ let homeList = reactive([
|
||||
title: '数字大屏',
|
||||
name: 'dataV',
|
||||
linkType: 1,
|
||||
url: '/v2/land',
|
||||
url: '/new-digital-agriculture-screen/v2/land',
|
||||
img: 'images/vsualized/home3.png',
|
||||
style: 'right: 23%;bottom:300px;',
|
||||
imgstyle: 'width:100px;height:100px',
|
||||
@ -78,6 +78,7 @@ const itemClick = (index) => {
|
||||
let val = homeList[index] || null;
|
||||
if (val && val.url != '') {
|
||||
if (val.linkType == 1) {
|
||||
// router.push({ name: val.url });
|
||||
router.push({ path: val.url });
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,12 @@
|
||||
* @Author: zenghua.wang
|
||||
* @Date: 2022-09-18 21:24:29
|
||||
* @LastEditors: zenghua.wang
|
||||
* @LastEditTime: 2025-04-18 15:41:11
|
||||
* @LastEditTime: 2025-02-28 11:04:41
|
||||
*/
|
||||
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
// import qiankun from 'vite-plugin-qiankun';
|
||||
import qiankun from 'vite-plugin-qiankun';
|
||||
import eslintPlugin from 'vite-plugin-eslint';
|
||||
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||
@ -23,9 +23,9 @@ import { resolve } from 'path';
|
||||
const useDevMode = true;
|
||||
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
const { VITE_PORT, VITE_APP_NAME, VITE_APP_BASE_API, VITE_APP_BASE_URL } = loadEnv(mode, process.cwd());
|
||||
const { VITE_APP_MIAN_URL, VITE_PORT, VITE_APP_NAME, VITE_APP_BASE_API, VITE_APP_BASE_URL, VITE_APP_UPLOAD_API, VITE_APP_UPLOAD_URL } = loadEnv(mode, process.cwd());
|
||||
const config = {
|
||||
base: '/',
|
||||
base: '/new-digital-agriculture-screen/',
|
||||
build: {
|
||||
target: 'ESNext',
|
||||
outDir: 'dist',
|
||||
@ -36,6 +36,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
port: VITE_PORT,
|
||||
open: true,
|
||||
https: false,
|
||||
origin: VITE_APP_MIAN_URL,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
@ -45,11 +46,17 @@ export default defineConfig(({ command, mode }) => {
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/apis/, ''),
|
||||
},
|
||||
[VITE_APP_UPLOAD_API]: {
|
||||
target: VITE_APP_UPLOAD_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
'#': resolve(__dirname, '../main/src'),
|
||||
},
|
||||
extensions: ['.js', '.vue', '.json', '.ts'],
|
||||
},
|
||||
@ -71,7 +78,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
// qiankun(VITE_APP_NAME, { useDevMode }),
|
||||
qiankun(VITE_APP_NAME, { useDevMode }),
|
||||
vueSetupExtend(),
|
||||
eslintPlugin({
|
||||
include: ['src/**/*.ts', 'src/**/*.vue', 'src/*.ts', 'src/*.vue'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user