cxmo 1 ano atrás
commit
f33b4e46e8

+ 6 - 0
.env.development

@@ -0,0 +1,6 @@
+# 接口地址http://8.136.199.33:8610/v1   
+VITE_APP_API_URL="http://8.136.199.33:8610/v1"
+# 路由根地址
+VITE_APP_BASE_URL="/"
+# 打包输入文件名
+VITE_APP_OUTDIR="eta_document"

+ 6 - 0
.env.production

@@ -0,0 +1,6 @@
+# 接口地址
+VITE_APP_API_URL="https://mveta.hzinsights.com/v1"
+# 路由根地址
+VITE_APP_BASE_URL="/"
+# 打包输入文件名
+VITE_APP_OUTDIR="eta_document"

+ 6 - 0
.env.test

@@ -0,0 +1,6 @@
+# 接口地址
+VITE_APP_API_URL="http://8.136.199.33:8610/v1"
+# 路由根地址
+VITE_APP_BASE_URL="/"
+# 打包输入文件名
+VITE_APP_OUTDIR="eta_document"

+ 12 - 0
.gitignore

@@ -0,0 +1,12 @@
+/node_modules
+/dist
+/eta_document
+/eta_document.rar
+/eta_document.zip
+/package-lock.json
+
+
+/.vscode
+.DS_Store
+/*.DS_Store
+

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# 弘则 ETA 帮助文档、更新日志项目
+
+### vite + vue

+ 13 - 0
index.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" type="image/x-icon" href="/fa.ico"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title>ETA投研系统</title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.js"></script>
+  </body>
+</html>

+ 26 - 0
package.json

@@ -0,0 +1,26 @@
+{
+  "name": "eta_document",
+  "private": true,
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite --port 3033",
+    "build": "vite build --mode production",
+    "build.test": "vite build --mode test",
+    "preview": "vite preview --port 3034"
+  },
+  "dependencies": {
+    "@element-plus/icons-vue": "^2.0.0-beta.0",
+    "@vueuse/core": "^9.0.0",
+    "axios": "^0.26.0",
+    "element-plus": "^2.0.2",
+    "lodash": "^4.17.21",
+    "normalize.css": "^8.0.1",
+    "vue": "^3.3.4",
+    "vue-router": "^4.0.12"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^4.2.3",
+    "vite": "^4.4.5",
+    "sass": "^1.44.0"
+  }
+}

BIN
public/fa.ico


+ 1 - 0
public/vite.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

+ 12 - 0
src/App.vue

@@ -0,0 +1,12 @@
+<script setup>
+
+
+</script>
+
+<template>
+  <router-view></router-view>
+</template>
+
+<style scoped>
+
+</style>

+ 64 - 0
src/api/index.js

@@ -0,0 +1,64 @@
+import axios from "axios";
+
+let config = {
+  baseURL: import.meta.env.VITE_APP_API_URL,
+  timeout: 10*60 * 1000, // Timeout
+};
+
+const _axios = axios.create(config);
+_axios.interceptors.request.use(
+    /* function (config) {
+      
+      config.headers.Authorization=localStorage.getItem('token')||''
+      return config;
+    }, */
+    function (error) {
+      // Do something with request error
+      return Promise.reject(error);
+    }
+);
+_axios.interceptors.response.use(
+    function (response) {
+      // Do something with response data
+      let data
+      data=response.data
+
+      //错误提示
+      if(response.status!==200){
+        //网络异常
+      }
+      if(!data){
+        //服务器开了个小差
+      }
+      if(data.Ret===408){//token失效
+      }
+      if(data.Ret===403){
+        //data.Msg||'网络异常'
+      }
+  
+      return data;
+    },
+    function (error) {
+      console.log(error);
+      // Do something with response error
+      return Promise.reject(error);
+    }
+);
+
+/**
+ * 导出get请求方法
+ * @url 请求地址
+ * @params get请求参数
+ */
+ export const get = (url, params) => {
+    return _axios.get(url, { params });
+  };
+  
+  /**
+   * 导出post请求方法
+   * @url 请求地址
+   * @params post请求参数
+   */
+  export const post = (url, params) => {
+    return _axios.post(url, params);
+  };

+ 3 - 0
src/assets/css/style.scss

@@ -0,0 +1,3 @@
+.layout-wrap{
+    
+}

BIN
src/assets/img/logo.png


+ 1 - 0
src/assets/vue.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

+ 41 - 0
src/layouts/Index.vue

@@ -0,0 +1,41 @@
+<script setup>
+</script>
+
+<template>
+    <div class="layout-wrap">
+        <div class="header">
+            <div class="logo">
+                <img src="~@/assets/img/logo.png"/>
+            </div>
+            <div class="title">{{ $route.meta.title }}</div>
+            <div class="other"></div>
+        </div>
+        <div class="container">
+            <router-view v-slot="{ Component }">
+                <component :is="Component" :key="$route.fullPath"/>
+            </router-view>
+        </div>
+        
+    </div>
+</template>
+
+<style lang="scss" scoped>
+.layout-wrap{
+    .header{
+        background-color: #fff;
+        height: 60px;
+        box-shadow: 0 3px 6px rgba(0,0,0,.1);
+        display: flex;
+        justify-content:space-between;
+        align-items: center;
+        box-sizing: border-box;
+        padding:0 20px;
+        .logo{
+            width:200px;
+            img{
+                width: 100%;
+            }
+        }
+    }
+}
+</style>

+ 12 - 0
src/main.js

@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import '@/assets/css/style.scss' //公共样式
+import 'normalize.css'
+import App from './App.vue'
+import router from "./router"
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+
+const app = createApp(App)
+app.use(ElementPlus)
+app.use(router)
+app.mount('#app')

+ 43 - 0
src/router/index.js

@@ -0,0 +1,43 @@
+import { createRouter, createWebHistory } from "vue-router";
+const routes=[
+    {
+        path: "/",
+        name: "Layout",
+        redirect:'/update/index',
+        component: ()=>import("@/layouts/Index.vue"),
+        children:[
+            {
+                path:"/help/index",
+                name:"HelpIndex",
+                component: () => import("@/views/help/Index.vue"),
+                meta: { 
+                    title: "帮助中心",
+                },
+            },
+            {
+                path:"/update/index",
+                name:"UpdateIndex",
+                component: () => import("@/views/update/Index.vue"),
+                meta: { 
+                    title: "更新日志",
+                },
+            },
+        ]
+    },
+    {
+		path: "/:pathMatch(.*)",
+		name: "error",
+		component: () => import("@/views/404.vue"),
+		meta: { title: "404" },
+	},
+]
+
+const router = createRouter({
+    history: createWebHistory(import.meta.env.VITE_APP_BASE_URL),
+    routes,
+});
+router.beforeEach((to, from, next) => {
+    document.title = to.meta.title;
+    next();
+});
+export default router;

+ 12 - 0
src/views/404.vue

@@ -0,0 +1,12 @@
+<script setup>
+</script>
+
+<template>
+    <div>
+        404页面
+    </div>
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 12 - 0
src/views/help/Index.vue

@@ -0,0 +1,12 @@
+<script setup>
+</script>
+
+<template>
+    <div>
+        help
+    </div>
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 12 - 0
src/views/update/Index.vue

@@ -0,0 +1,12 @@
+<script setup>
+</script>
+
+<template>
+    <div>
+        update 
+    </div>
+</template>
+
+<style scoped lang="scss">
+
+</style>

+ 23 - 0
vite.config.js

@@ -0,0 +1,23 @@
+import { defineConfig, loadEnv } from "vite";
+import vue from "@vitejs/plugin-vue";
+import path from "path";
+
+// https://vitejs.dev/config/
+export default ({ mode }) =>
+  defineConfig({
+    base: loadEnv(mode, process.cwd()).VITE_APP_BASE_URL, // 若服务器不是将该项目放在根目录的则 需要此设置 和服务器上同名
+    plugins: [
+      vue(),
+    ],
+    resolve: {
+      alias: {
+        "@": path.resolve(__dirname, "./src"),
+      }
+    },
+    build: {
+      outDir: loadEnv(mode, process.cwd()).VITE_APP_OUTDIR,
+    },
+    server:{
+      host:true
+    }
+  });