夏滨接入主应用
This commit is contained in:
parent
533b0e4a6f
commit
5ec53f7fd0
@ -1,6 +1,19 @@
|
|||||||
# 开发环境
|
# 开发环境
|
||||||
VITE_PORT = 9000
|
# VITE_PORT = 9530
|
||||||
VITE_APP_NAME = 'digital-agriculture-screen'
|
# 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_TITLE = '政务云数字农业智慧大屏'
|
||||||
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
|
VITE_APP_MIAN_URL = 'http://localhost:9000'
|
||||||
|
VITE_APP_NAME = 'new-digital-agriculture-screen'
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
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_NAME = 'new-digital-agriculture-screen'
|
||||||
VITE_APP_TITLE = '政务云数字农业智慧大屏'
|
# 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_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,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return [
|
return [
|
||||||
{ label: '首页', value: '/v2/home' },
|
{ label: '首页', value: '/new-digital-agriculture-screen/v2/home' },
|
||||||
{ label: '土地资源', value: '/v2/land' },
|
{ label: '土地资源', value: '/new-digital-agriculture-screen/v2/land' },
|
||||||
{ label: '投入品监管', value: '/v2/inputs' },
|
{ label: '投入品监管', value: '/new-digital-agriculture-screen/v2/inputs' },
|
||||||
{ label: '产出品管理', value: '/v2/entities' },
|
{ label: '产出品管理', value: '/new-digital-agriculture-screen/v2/entities' },
|
||||||
// { label: '智慧种植监测', value: 'plant' },
|
// { label: '智慧种植监测', value: 'plant' },
|
||||||
// { label: '智慧养殖监测', value: 'breed' },
|
// { label: '智慧养殖监测', value: 'breed' },
|
||||||
{ label: '生产经营主体', value: '/v2/business' },
|
{ label: '生产经营主体', value: '/new-digital-agriculture-screen/v2/business' },
|
||||||
{ label: '农产品溯源', value: '/v2/trace' },
|
{ label: '农产品溯源', value: '/new-digital-agriculture-screen/v2/trace' },
|
||||||
// { label: '产业预警决策', value: 'early' },
|
// { label: '产业预警决策', value: 'early' },
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
42
src/main.js
42
src/main.js
@ -1,34 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* @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 'virtual:svg-icons-register';
|
||||||
import { createApp, nextTick } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import pinia from './store';
|
import pinia from './store';
|
||||||
import ElementPlus from 'element-plus';
|
import ElementPlus from 'element-plus';
|
||||||
import 'element-plus/dist/index.css';
|
import 'element-plus/dist/index.css';
|
||||||
import 'animate.css';
|
import Avue from '@smallwei/avue';
|
||||||
|
import '@smallwei/avue/lib/index.css';
|
||||||
import './utils/permission';
|
import './utils/permission';
|
||||||
import { registerDirective } from './directives';
|
import { registerDirective } from './directives';
|
||||||
|
import { registerGlobalComponents } from './plugins/globalComponents';
|
||||||
import { registerElIcons } from './plugins/icon';
|
import { registerElIcons } from './plugins/icon';
|
||||||
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
|
import { registerMicroApps } from './plugins/micro';
|
||||||
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'],
|
|
||||||
});
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
nextTick(() => {
|
// 注册 Vue3 Scroll Seamless 组件
|
||||||
registerElIcons(app);
|
// app.component('Vue3ScrollSeamless', vue3ScrollSeamless);
|
||||||
registerDirective(app);
|
app.use(pinia).use(router).use(ElementPlus).use(Avue);
|
||||||
});
|
registerGlobalComponents(app);
|
||||||
app.use(pinia).use(router).use(ElementPlus).use(VueAMap).mount('#app');
|
registerElIcons(app);
|
||||||
|
registerDirective(app);
|
||||||
|
registerMicroApps(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'),
|
// component: () => import('@/views/error/404.vue'),
|
||||||
// hidden: true,
|
// 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',
|
name: 'layout',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/v2/land',
|
redirect: '/new-digital-agriculture-screen/v2/home',
|
||||||
meta: { title: '首页', icon: 'House' },
|
meta: { title: '首页', icon: 'House' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/new-digital-agriculture-screen/v2/home',
|
||||||
|
component: () => import('@/views/home/index.vue'),
|
||||||
|
name: 'home',
|
||||||
|
meta: { title: '首页', icon: '' },
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// ...demoRouters,
|
// ...demoRouters,
|
||||||
v2,
|
v2,
|
||||||
@ -38,9 +46,9 @@ export const constantRoutes = [
|
|||||||
* @Title notFoundRouter(找不到路由)
|
* @Title notFoundRouter(找不到路由)
|
||||||
*/
|
*/
|
||||||
export const notFoundRouter = {
|
export const notFoundRouter = {
|
||||||
path: '/:pathMatch(.*)',
|
path: '/new-digital-agriculture-screen/:pathMatch(.*)',
|
||||||
name: 'notFound',
|
name: 'notFound',
|
||||||
redirect: '/404',
|
redirect: '/new-digital-agriculture-screen/404',
|
||||||
};
|
};
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
@ -2,20 +2,20 @@ import Layout from '@/layouts/index.vue';
|
|||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/demo',
|
path: '/new-digital-agriculture-screen/demo',
|
||||||
name: 'demo',
|
name: 'demo',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/scrollBoard',
|
redirect: '/new-digital-agriculture-screen/scrollBoard',
|
||||||
meta: { title: '案例', icon: 'document' },
|
meta: { title: '案例', icon: 'document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/demo/scrollBoard',
|
path: '/new-digital-agriculture-screen/demo/scrollBoard',
|
||||||
name: 'scrollBoard',
|
name: 'scrollBoard',
|
||||||
component: () => import('@/views/demo/scrollBoard.vue'),
|
component: () => import('@/views/demo/scrollBoard.vue'),
|
||||||
meta: { title: '轮播列表', icon: 'document' },
|
meta: { title: '轮播列表', icon: 'document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/demo/rank',
|
path: '/new-digital-agriculture-screen/demo/rank',
|
||||||
name: 'rank',
|
name: 'rank',
|
||||||
component: () => import('@/views/demo/rank.vue'),
|
component: () => import('@/views/demo/rank.vue'),
|
||||||
meta: { title: '滚动排名列表', icon: 'document' },
|
meta: { title: '滚动排名列表', icon: 'document' },
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
import Layout from '@/layouts/index.vue';
|
import Layout from '@/layouts/index.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
path: '/v2',
|
path: '/new-digital-agriculture-screen',
|
||||||
name: 'v2',
|
name: 'layout',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/v2/home',
|
redirect: '/new-digital-agriculture-screen/v2/home',
|
||||||
meta: { title: '首页', icon: '' },
|
meta: { title: '首页', icon: '' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/v2/home',
|
path: '/new-digital-agriculture-screen/v2/home',
|
||||||
component: () => import('@/views/home/index.vue'),
|
component: () => import('@/views/home/index.vue'),
|
||||||
name: 'home',
|
name: 'home',
|
||||||
meta: { title: '首页', icon: '' },
|
meta: { title: '首页', icon: '' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/v2/land',
|
path: '/new-digital-agriculture-screen/v2/land',
|
||||||
component: () => import('@/views/land/index.vue'),
|
component: () => import('@/views/land/index.vue'),
|
||||||
name: 'land',
|
name: 'land',
|
||||||
meta: { title: '土地资源', icon: '' },
|
meta: { title: '土地资源', icon: '' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/v2/inputs',
|
path: '/new-digital-agriculture-screen/v2/inputs',
|
||||||
name: 'inputs',
|
name: 'inputs',
|
||||||
component: () => import('@/views/inputs/index.vue'),
|
component: () => import('@/views/inputs/index.vue'),
|
||||||
meta: { title: '投入品监管', icon: '' },
|
meta: { title: '投入品监管', icon: '' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/v2/entities',
|
path: '/new-digital-agriculture-screen/v2/entities',
|
||||||
name: 'entities',
|
name: 'entities',
|
||||||
component: () => import('@/views/entities/index.vue'),
|
component: () => import('@/views/entities/index.vue'),
|
||||||
meta: { title: '产出品管理', icon: '' },
|
meta: { title: '产出品管理', icon: '' },
|
||||||
@ -44,13 +44,13 @@ export default {
|
|||||||
// meta: { title: '', icon: '' },
|
// meta: { title: '', icon: '' },
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
path: '/v2/business',
|
path: '/new-digital-agriculture-screen/v2/business',
|
||||||
name: 'business',
|
name: 'business',
|
||||||
component: () => import('@/views/business/index.vue'),
|
component: () => import('@/views/business/index.vue'),
|
||||||
meta: { title: '生产经营主体', icon: '' },
|
meta: { title: '生产经营主体', icon: '' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'trace',
|
path: '/new-digital-agriculture-screen/trace',
|
||||||
name: 'trace',
|
name: 'trace',
|
||||||
component: () => import('@/views/trace/index.vue'),
|
component: () => import('@/views/trace/index.vue'),
|
||||||
meta: { title: '农产品溯源', icon: '' },
|
meta: { title: '农产品溯源', icon: '' },
|
||||||
|
@ -48,7 +48,7 @@ let homeList = reactive([
|
|||||||
title: '数字大屏',
|
title: '数字大屏',
|
||||||
name: 'dataV',
|
name: 'dataV',
|
||||||
linkType: 1,
|
linkType: 1,
|
||||||
url: '/v2/land',
|
url: '/new-digital-agriculture-screen/v2/land',
|
||||||
img: 'images/vsualized/home3.png',
|
img: 'images/vsualized/home3.png',
|
||||||
style: 'right: 20%;bottom:320px;',
|
style: 'right: 20%;bottom:320px;',
|
||||||
imgstyle: 'width:100px;height:100px',
|
imgstyle: 'width:100px;height:100px',
|
||||||
@ -70,6 +70,7 @@ const itemClick = (index) => {
|
|||||||
let val = homeList[index] || null;
|
let val = homeList[index] || null;
|
||||||
if (val && val.url != '') {
|
if (val && val.url != '') {
|
||||||
if (val.linkType == 1) {
|
if (val.linkType == 1) {
|
||||||
|
// router.push({ name: val.url });
|
||||||
router.push({ path: val.url });
|
router.push({ path: val.url });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2022-09-18 21:24:29
|
* @Date: 2022-09-18 21:24:29
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-04-18 15:41:11
|
* @LastEditTime: 2025-02-28 11:04:41
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import vue from '@vitejs/plugin-vue';
|
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 eslintPlugin from 'vite-plugin-eslint';
|
||||||
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
|
||||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||||
@ -23,9 +23,9 @@ import { resolve } from 'path';
|
|||||||
const useDevMode = true;
|
const useDevMode = true;
|
||||||
|
|
||||||
export default defineConfig(({ command, mode }) => {
|
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_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 = {
|
const config = {
|
||||||
base: '/',
|
base: '/new-digital-agriculture-screen/',
|
||||||
build: {
|
build: {
|
||||||
target: 'ESNext',
|
target: 'ESNext',
|
||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
@ -36,6 +36,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
port: VITE_PORT,
|
port: VITE_PORT,
|
||||||
open: true,
|
open: true,
|
||||||
https: false,
|
https: false,
|
||||||
|
origin: 'http://localhost:9530',
|
||||||
headers: {
|
headers: {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
},
|
},
|
||||||
@ -45,11 +46,17 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/apis/, ''),
|
rewrite: (path) => path.replace(/^\/apis/, ''),
|
||||||
},
|
},
|
||||||
|
[VITE_APP_UPLOAD_API]: {
|
||||||
|
target: VITE_APP_UPLOAD_URL,
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve(__dirname, 'src'),
|
'@': resolve(__dirname, 'src'),
|
||||||
|
'#': resolve(__dirname, '../main/src'),
|
||||||
},
|
},
|
||||||
extensions: ['.js', '.vue', '.json', '.ts'],
|
extensions: ['.js', '.vue', '.json', '.ts'],
|
||||||
},
|
},
|
||||||
@ -71,7 +78,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
// qiankun(VITE_APP_NAME, { useDevMode }),
|
qiankun(VITE_APP_NAME, { useDevMode }),
|
||||||
vueSetupExtend(),
|
vueSetupExtend(),
|
||||||
eslintPlugin({
|
eslintPlugin({
|
||||||
include: ['src/**/*.ts', 'src/**/*.vue', 'src/*.ts', 'src/*.vue'],
|
include: ['src/**/*.ts', 'src/**/*.vue', 'src/*.ts', 'src/*.vue'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user