Bläddra i källkod

vite 版本切换

huangxingxing 1 år sedan
förälder
incheckning
fe71f85802

+ 56 - 0
.eslintrc.cjs

@@ -0,0 +1,56 @@
+// eslint配置,用于校验代码
+module.exports = {
+    // env指定环境 支持的环境: browser node commonjs es6 es2016~es2022...
+    // 环境很多,详情查看文档https://zh-hans.eslint.org/docs/latest/use/configure/language-options
+    "env": {
+        "browser": true,
+        "es2021": true,
+        "node": true,
+    },
+    // 使用插件配置
+    "extends": [
+        "eslint:recommended",
+        "plugin:vue/vue3-essential",
+        "plugin:@typescript-eslint/recommended"
+    ],
+    // "overrides": [
+    //     {
+    //         "env": {
+    //             "node": true
+    //         },
+    //         "files": [
+    //             ".eslintrc.{js,cjs}"
+    //         ],
+    //         "parserOptions": {
+    //             "sourceType": "script"
+    //         }
+    //     }
+    // ],
+    // 配置支持的js语言选项
+    "parserOptions": {
+        "ecmaVersion": "latest",
+        "sourceType": "module",
+        "parser": "@typescript-eslint/parser"
+    },
+    // eslint第三方插件配置
+    "plugins": [
+        "vue",
+        "@typescript-eslint"
+    ],
+    // eslint规则配置,还有很多规则配置项,在官网查看 https://eslint.org/docs/latest/rules/
+    "rules": {
+        '@typescript-eslint/no-var-requires': 0, //解决报错:Require statement not part of import statement.
+        'vue/multi-word-component-names': 'off', //关闭组件命名规则校验
+        // => 前后有空格
+        "arrow-spacing": [
+            2,
+            {
+                before: true,
+                after: true,
+            },
+        ],
+        "block-spacing": [2, "always"],
+        // 对象字面量项尾是否有逗号
+        "comma-dangle": [2, "always-multiline"],
+    }
+}

+ 8 - 0
.prettierignore

@@ -0,0 +1,8 @@
+.DS_Store
+node_modules
+dist
+/src/assets/*
+dist-ssr
+
+**/*.svg
+**/*.sh

+ 15 - 0
.prettierrc.cjs

@@ -0,0 +1,15 @@
+//.prettierrc.cjs
+module.exports = {
+    printWidth: 80, //一行的字符数,如果超过会进行换行,默认为80
+    singleAttributePerLine: false, //每行强制换行,只能使用单个属性
+    tabWidth: 2, // 一个 tab 代表几个空格数,默认为 2 个
+    useTabs: false, //是否使用 tab 进行缩进,默认为false,表示用空格进行缩减
+    singleQuote: false, // 字符串是否使用单引号,默认为 false,使用双引号
+    semi: false, // 行尾是否添加分号,默认为true
+    trailingComma: 'none', //行使用逗号分隔 可选值: es5 none all
+    bracketSpacing: true, // 对象大括号直接是否有空格,默认为 true,效果:{ a: 1 }
+    endOfLine: 'auto', // 文本文件中的行结束方式 可选值: lf crlf cr auto
+    jsxBracketSameLine: false, // 在jsx中把'>' 是否单独放一行
+    vueIndentScriptAndStyle: false, // <script>Vue 文件中的代码和标签是否缩进<style>。
+    arrowParens: "always", // 箭头函数的括号
+}

+ 13 - 0
index.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" href="/assets/logo.png" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <title></title>
+  </head>
+  <body>
+    <div id="app"></div>
+    <script type="module" src="/src/main.ts"></script>
+  </body>
+</html>

+ 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>

+ 48 - 0
src/api/login.ts

@@ -0,0 +1,48 @@
+import instance from "@/utils/request";
+
+//一般情况下,接口类型会放到一个文件
+// 下面两个TS接口,表示要传的参数
+interface ReqLogin {
+    name: string
+    paw: string
+}
+
+interface ReqStatus {
+    id: string
+    navStatus: string
+}
+
+
+// Res是返回的参数,T是泛型,需要自己定义,返回对数统一管理***
+type Res<T> = Promise<ItypeAPI<T>>;
+// 一般情况下响应数据返回的这三个参数,
+// 但不排除后端返回其它的可能性,
+interface ItypeAPI<T> {
+    data: T,//请求的数据,用泛型
+    msg: string | null // 返回状态码的信息,如请求成功等
+    code: number //返回后端自定义的200,404,500这种状态码
+}
+
+
+// post请求 ,没参数
+export const LogoutAPI = (): Res<null> => instance.post("/admin/logout");
+
+// post请求,有参数,如传用户名和密码
+export const loginAPI = (data: ReqLogin): Res<string> =>
+    instance.post("/admin/login", data);
+
+// post请求 ,没参数,但要路径传参
+export const StatusAPI = (data: ReqStatus): Res<null> =>
+    instance.post(`/productCategory?ids=${data.id}&navStatus=${data.navStatus}`);
+
+
+//  get请求,没参数,
+export const FlashSessionListApi = (): Res<null> =>
+    instance.get("/flashSession/list");
+
+// get请求,有参数,路径也要传参  (也可能直接在这写类型,不过不建议,大点的项目会维护一麻烦)
+export const ProductCategoryApi = (params: { parentId: number }): Res<any> =>
+    instance.get(`/productCategory/list/${params.parentId}`, {params});
+
+// get请求,有参数,(如果你不会写类型也可以使用any,不过不建议,因为用了之后 和没写TS一样)
+export const AdminListAPI = (params: any): Res<any> => instance.get("/admin/list", {params});

+ 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>

+ 70 - 0
src/auto-import.d.ts

@@ -0,0 +1,70 @@
+/* eslint-disable */
+/* prettier-ignore */
+// @ts-nocheck
+// noinspection JSUnusedGlobalSymbols
+// Generated by unplugin-auto-import
+export {}
+declare global {
+  const EffectScope: typeof import('vue')['EffectScope']
+  const computed: typeof import('vue')['computed']
+  const createApp: typeof import('vue')['createApp']
+  const customRef: typeof import('vue')['customRef']
+  const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
+  const defineComponent: typeof import('vue')['defineComponent']
+  const effectScope: typeof import('vue')['effectScope']
+  const getCurrentInstance: typeof import('vue')['getCurrentInstance']
+  const getCurrentScope: typeof import('vue')['getCurrentScope']
+  const h: typeof import('vue')['h']
+  const inject: typeof import('vue')['inject']
+  const isProxy: typeof import('vue')['isProxy']
+  const isReactive: typeof import('vue')['isReactive']
+  const isReadonly: typeof import('vue')['isReadonly']
+  const isRef: typeof import('vue')['isRef']
+  const markRaw: typeof import('vue')['markRaw']
+  const nextTick: typeof import('vue')['nextTick']
+  const onActivated: typeof import('vue')['onActivated']
+  const onBeforeMount: typeof import('vue')['onBeforeMount']
+  const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
+  const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
+  const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
+  const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
+  const onDeactivated: typeof import('vue')['onDeactivated']
+  const onErrorCaptured: typeof import('vue')['onErrorCaptured']
+  const onMounted: typeof import('vue')['onMounted']
+  const onRenderTracked: typeof import('vue')['onRenderTracked']
+  const onRenderTriggered: typeof import('vue')['onRenderTriggered']
+  const onScopeDispose: typeof import('vue')['onScopeDispose']
+  const onServerPrefetch: typeof import('vue')['onServerPrefetch']
+  const onUnmounted: typeof import('vue')['onUnmounted']
+  const onUpdated: typeof import('vue')['onUpdated']
+  const provide: typeof import('vue')['provide']
+  const reactive: typeof import('vue')['reactive']
+  const readonly: typeof import('vue')['readonly']
+  const ref: typeof import('vue')['ref']
+  const resolveComponent: typeof import('vue')['resolveComponent']
+  const shallowReactive: typeof import('vue')['shallowReactive']
+  const shallowReadonly: typeof import('vue')['shallowReadonly']
+  const shallowRef: typeof import('vue')['shallowRef']
+  const toRaw: typeof import('vue')['toRaw']
+  const toRef: typeof import('vue')['toRef']
+  const toRefs: typeof import('vue')['toRefs']
+  const toValue: typeof import('vue')['toValue']
+  const triggerRef: typeof import('vue')['triggerRef']
+  const unref: typeof import('vue')['unref']
+  const useAttrs: typeof import('vue')['useAttrs']
+  const useCssModule: typeof import('vue')['useCssModule']
+  const useCssVars: typeof import('vue')['useCssVars']
+  const useLink: typeof import('vue-router')['useLink']
+  const useRoute: typeof import('vue-router')['useRoute']
+  const useRouter: typeof import('vue-router')['useRouter']
+  const useSlots: typeof import('vue')['useSlots']
+  const watch: typeof import('vue')['watch']
+  const watchEffect: typeof import('vue')['watchEffect']
+  const watchPostEffect: typeof import('vue')['watchPostEffect']
+  const watchSyncEffect: typeof import('vue')['watchSyncEffect']
+}
+// for type re-export
+declare global {
+  // @ts-ignore
+  export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
+}

+ 17 - 0
src/components.d.ts

@@ -0,0 +1,17 @@
+/* eslint-disable */
+/* prettier-ignore */
+// @ts-nocheck
+// Generated by unplugin-vue-components
+// Read more: https://github.com/vuejs/core/pull/3399
+export {}
+
+declare module 'vue' {
+  export interface GlobalComponents {
+    HelloWorld: typeof import('./components/HelloWorld.vue')['default']
+    'HelloWorld——1': typeof import('./components/HelloWorld——1.vue')['default']
+    MyHome: typeof import('./components/myHome.vue')['default']
+    NavigateBar: typeof import('./components/layout/NavigateBar.vue')['default']
+    RouterLink: typeof import('vue-router')['RouterLink']
+    RouterView: typeof import('vue-router')['RouterView']
+  }
+}

+ 31 - 0
src/main.ts

@@ -0,0 +1,31 @@
+import { createApp } from 'vue'
+import './style.css'
+import App from './App.vue'
+
+//1、route
+import router from '@/router/index'
+
+
+//2、pinia
+import pinia from '@/store'
+
+//3、element-plus
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+import './style/index.css' // 引入整个Element样式
+import "normalize.css/normalize.css";//重置样式
+import '@/js/lindex.js'
+//4、引入echarts
+import * as echarts from 'echarts'
+
+const app = createApp(App)
+
+//1、route
+app.use(router)
+//2、pinia
+app.use(pinia)
+//3、element-plus
+app.use(ElementPlus)
+//4、放入全局
+app.config.globalProperties.$echarts = echarts
+app.mount('#app')

+ 21 - 0
src/router/index.ts

@@ -0,0 +1,21 @@
+import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";
+const router = createRouter({
+    history: createWebHashHistory(),
+    routes: [
+       
+        {
+            path: '/myHome',
+           // name:'zhuye',
+            component: () => import('@/components/myHome.vue') // 这是路由的籁加载,也可以其他方式
+        },
+        {
+           path: '/myDemo',
+           name:'MyDemo',
+            component: () => import('@/view/myDemo.vue') // 这是路由的籁加载,也可以其他方式
+        },
+                  
+   
+    ]
+})
+
+export default router;

+ 8 - 0
src/store/index.ts

@@ -0,0 +1,8 @@
+import { createPinia } from 'pinia'
+
+import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
+
+const pinia = createPinia()
+
+pinia.use(piniaPluginPersistedstate)
+export default pinia

+ 19 - 0
src/store/modules/demo.ts

@@ -0,0 +1,19 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+const useDemoStore = defineStore('demo', () => {
+    const counter = ref(0)
+    const increment = () => {
+        counter.value++
+    }
+    return {
+        counter,
+        increment
+    }
+}, {
+    persist: {
+        key: 'aaa',
+        storage: sessionStorage
+    }
+})
+export default useDemoStore

+ 80 - 0
src/style.css

@@ -0,0 +1,80 @@
+:root {
+  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
+  line-height: 1.5;
+  font-weight: 400;
+
+  color-scheme: light dark;
+  color: rgba(255, 255, 255, 0.87);
+  background-color: #242424;
+
+  font-synthesis: none;
+  text-rendering: optimizeLegibility;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  -webkit-text-size-adjust: 100%;
+}
+
+a {
+  font-weight: 500;
+  color: #646cff;
+  text-decoration: inherit;
+}
+a:hover {
+  color: #535bf2;
+}
+
+body {
+  margin: 0;
+  display: flex;
+  place-items: center;
+  min-width: 320px;
+  min-height: 100vh;
+}
+
+h1 {
+  font-size: 3.2em;
+  line-height: 1.1;
+}
+
+button {
+  border-radius: 8px;
+  border: 1px solid transparent;
+  padding: 0.6em 1.2em;
+  font-size: 1em;
+  font-weight: 500;
+  font-family: inherit;
+  background-color: #1a1a1a;
+  cursor: pointer;
+  transition: border-color 0.25s;
+}
+button:hover {
+  border-color: #646cff;
+}
+button:focus,
+button:focus-visible {
+  outline: 4px auto -webkit-focus-ring-color;
+}
+
+.card {
+  padding: 2em;
+}
+
+#app {
+  max-width: 1280px;
+  margin: 0 auto;
+  padding: 2rem;
+  text-align: center;
+}
+
+@media (prefers-color-scheme: light) {
+  :root {
+    color: #213547;
+    background-color: #ffffff;
+  }
+  a:hover {
+    color: #747bff;
+  }
+  button {
+    background-color: #f9f9f9;
+  }
+}

+ 237 - 0
src/utils/request.ts

@@ -0,0 +1,237 @@
+import axios from 'axios';
+import store from '@/store'
+import { getToken } from '@/utils/token';
+import { DES3 } from '@/utils/3des';
+import router from '@/router/index'
+import { ElMessage } from '../utils/message.js'
+import { Caegw_ProUrl,Caegw_LogUrl } from '@/settings' ;// 引入settings.js
+
+let Message = new ElMessage()
+
+const requestList = []; // 请求列表
+const CancelToken = axios.CancelToken;
+let sources = {};
+let successCode = '000000000' | '0000000';//成功编码
+
+//axios配置
+//全局的 axios 默认值:指定将被用在各个请求的配置默认值
+axios.defaults.timeout = 20000;//设置超时时间
+axios.defaults.baseURL = "/api";// `baseURL` 将自动加在 `url` 前面,除非 `url` 是一个绝对 URL。它可以通过设置一个 `baseURL` 便于为 axios 实例的方法传递相对 URL
+//axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;//根据项目需要配置
+//axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';//设置请求头的类型
+axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';//设置请求头的类型
+// 添加请求拦截器
+axios.interceptors.request.use(config => {
+  const request = JSON.stringify(config.url) + (!!config.data ? JSON.stringify(config.data) : JSON.stringify(config.params))
+  config.cancelToken = new CancelToken((cancel) => {
+    sources[request] = cancel
+  })
+  //判断请求是否已存在请求列表,避免重复请求,将当前请求添加进请求列表数组;
+  if (requestList.includes(request)) {
+    // console.log(request)
+    // sources[request]('取消重复请求')
+    // requestList.splice(requestList.findIndex(item => item === request), 1)
+    requestList.push(request)
+  } else {
+    requestList.push(request)
+  }
+
+  //因本项目部分请求需要重复获取所以不用去重
+  // requestList.push(request)
+
+
+  // 登录控制中根据本地是否存在token判断用户的登录情况,
+  // 但即使token存在,也有可能token是过期的,所以在每次的请求头中携带token,
+  // 后台根据携带的token判断用户的登录情况,并返回给我们对应的状态码,
+  // 而后我们可以在响应拦截器中,根据状态码进行一些统一的操作。
+
+  //本项目不用请求头判断而是在报文体中发送token
+  // let token = store.getters.token || getToken();
+  // token && (config.headers.Authorization = token);
+  return config;
+}, error => Promise.reject(error));
+
+
+// 添加响应拦截器
+axios.interceptors.response.use(res => {
+  const request = JSON.stringify(res.config.url) + (!!res.config.data ? JSON.stringify(res.config.data) : JSON.stringify(res.config.params))
+  requestList.splice(requestList.findIndex(item => item === request), 1)
+  if (res.status === 200) {
+    let { data } = res
+    if (data.returnCode == successCode) {
+      return Promise.resolve(data)
+    } else {
+      if (data.returnMsg === '系统没有登录或会话超时!') {
+        store.dispatch('user/changeState', {
+          key: 'token',
+          value: ''
+        })
+        store.dispatch('user/changeState', {
+          key: 'name',
+          value: ''
+        })
+        store.dispatch('user/changeState', {
+          key: 'userId',
+          value: ''
+        })
+        store.dispatch('user/changeState', {
+          key: 'loginStatus',
+          value: false
+        })
+        MessageBox.confirm('系统没有登录或会话超时, 是否登录?', '提示', {
+          confirmButtonText: '登录',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            MessageBox.close()
+            // window.location.hash = "/login/index";
+            // window.location.href = "#/login/index";
+            // router.replace(`/login/index`)
+             // this.$router.replace('/login/index')
+             let logUrl = window.location.protocol+"//"+window.location.host+"/"+Caegw_LogUrl;
+             // console.log(logUrl);
+             window.location.href=logUrl
+          })
+          .catch(() => {
+            Message.info('已取消!')
+            MessageBox.close()
+          })
+      }
+      return Promise.reject(data)
+    }
+  } else {
+    return Promise.reject(res)
+  }
+}, err => {
+  const { res } = err;
+  if (res) {
+    // 请求已发出,但是不在2xx的范围
+    requestList.length = 0;
+    errorHandle(res.status, res.data.message);
+    return Promise.reject(res);
+  } else {
+    console.log(err)
+    if (err.message == '取消上传') {
+      return Promise.reject('cancel')
+    }
+    // 处理断网的情况
+    // eg:请求超时或断网时,更新network状态,可在app.vue中控制着一个全局的断网提示组件的显示隐藏
+    if (err.message == '取消重复请求') {
+      // console.log(err)
+    } else {
+      let error = err.message.indexOf('timeout') != -1 ? { returnMsg: '请求超时' } : { returnMsg: '网络通讯异常' };
+      requestList.splice(requestList.findIndex(item => item === request), 1)
+      return Promise.reject(error)
+    }
+  }
+});
+
+//完善请求url
+function getUrl(channelNo = 'service') {
+  let url = ''
+  if (channelNo == 'service') {
+    url = '/TransServlet'
+  } else if (channelNo == 'manager') {
+    url = '/managersvr/TransServlet'
+  }
+  return url
+}
+
+//配置上行报文公共包头
+function getParams(params, channelNo) {
+ // params['clientToken'] = "11112";
+  params['clientToken'] = "e47b87eec69545559d1e81e56626da68";
+  let userId ='5f06c8bc77234f969d13e160b54c27e3';
+  // let userId = store.getters.userId;
+  // if (userId) {
+  params['userId'] = userId;
+  // }
+  params['channelNo'] = channelNo;
+  return params;
+}
+
+// 请求
+const request = (params, channelNo = 'service', method = 'post') => {
+  let url = getUrl(channelNo);//完善请求url
+  params = getParams(params, channelNo);//配置上行报文公共包头
+  return new Promise((resolve, reject) => {
+    if (method == 'post') {//'http://192.168.131:8187/TransServlet'
+      axios.post(url, params).then(res => {
+        resolve(res)
+      }).catch(err => {
+        // Message.error(err.returnMsg)
+        reject(err)
+      })
+    } else if (method == 'get') {
+      axios.get(url, { params }).then(res => {
+        resolve(res)
+      }).catch(err => {
+        // Message.error(err.returnMsg)
+        reject(err)
+      })
+    }
+  })
+}
+
+// 文件上传
+const uploadFile = (params, channelNo = 'service', callback1) => {
+  let config = {
+    timeout: 60000,
+    headers: { "Content-Type": "multipart/form-data" },
+    onUploadProgress: progressEvent => {
+      //属性lengthComputable主要表明总共需要完成的工作量和已经完成的工作是否可以被测量,如果lengthComputable为false,就获取不到progress.total和progress.loaded
+      if (progressEvent.lengthComputable) {
+        let loaded = progressEvent.loaded
+        let total = progressEvent.total
+        // let progress = Math.floor((loaded / total) * 100) > 1 ? Math.floor((loaded / total) * 100) : 1;
+        // console.log('上传进度 ' + progress + '%');
+        // callback1(progress)
+        
+      }
+    }
+  }
+  let url = getUrl(channelNo);//完善请求url
+  params.append("clientToken", store.getters.token || getToken());
+  params.append("userId", store.getters.userId);
+  params.append("channelNo", channelNo);//配置上行报文公共包头
+  console.log(params);
+  return new Promise((resolve, reject) => {
+    axios.post(url, params, config).then(res => {
+      resolve(res)
+    }).catch(err => {
+      if (err != 'cancel') {
+        Message.error(err.returnMsg)
+      }
+      reject(err)
+    })
+  })
+}
+
+// 获取图片验证码
+const getCode = (channelNo = 'service') => {
+  let rand = Math.random();
+  let token = store.getters.token || getToken();
+  return process.env.VUE_APP_BASE_API + getUrl(channelNo) + '?transCode=HM0000&randomKey=' + rand + '&clientToken=' + token;
+}
+
+// 获取图片Url
+const getImage = (id, channelNo = 'server') => {
+  let token = store.getters.token || getToken();
+  return process.env.VUE_APP_BASE_API + getUrl(channelNo) + "?transCode=B00022&clientToken=" + token + "&id=" + id;
+}
+
+//加密密码
+const enPassword = (password) => {
+  let token = store.getters.token || getToken();
+  return DES3.encrypt(token, password);
+}
+
+export {
+  request,
+  uploadFile,
+  getCode,
+  getImage,
+  enPassword,
+  sources
+}

+ 25 - 0
src/views/about/index.vue

@@ -0,0 +1,25 @@
+<template>
+    <div>
+        <h1>About Page</h1>
+        <h3>counter: {{ counter }}</h3>
+        <el-button type="danger" @click="add">计数</el-button>
+    </div>
+</template>
+
+<script setup lang="ts">
+import useDemoStore from '@/store/modules/demo'
+import { storeToRefs } from 'pinia'
+
+const demoStore = useDemoStore()
+const {counter} = storeToRefs(demoStore)
+const add = () => {
+    demoStore.increment()
+}
+</script>
+
+<style scoped>
+button {
+    color: cornflowerblue;
+    font-size: 30px;
+}
+</style>

+ 64 - 0
src/views/dashboard/index.vue

@@ -0,0 +1,64 @@
+<template>
+    <div id='myChart' style='width:300px; height:300px;position: absolute;'></div>
+</template>
+
+<script>
+import {defineComponent, toRefs, reactive, onMounted} from 'vue'
+import * as echarts from 'echarts'
+
+export default defineComponent({
+    name: 'Histogram',
+    setup() {
+        const state = reactive({
+            option: {
+                grid: {
+                    top: '4%',
+                    left: '2%',
+                    right: '4%',
+                    bottom: '0%',
+                    containLabel: true,
+                },
+                xAxis: [
+                    {
+                        type: 'category',
+                        data: ["芳草地国际", "实验小学", "白家庄小学", "外国语小学", "师范学校附属", "望京东园"],
+                        axisTick: {
+                            alignWithLabel: true,
+                        },
+                    },
+                ],
+                yAxis: [
+                    {
+                        type: 'value',
+                    },
+                ],
+                series: [
+                    {
+                        name: '学校',
+                        type: 'bar',
+                        barWidth: '40%',
+                        data: [260, 680, 360, 460, 150, 320],
+                    },
+                ],
+            },
+        })
+        const initeCharts = () => {
+            let myChart = echarts.init(document.getElementById('myChart'))
+            // 绘制图表
+            myChart.setOption(state.option)
+        }
+
+        onMounted(() => {
+            initeCharts()
+        })
+
+        return {
+            ...toRefs(state),
+        }
+    },
+})
+</script>
+
+<style scoped>
+
+</style>

+ 44 - 0
src/views/dialog/index.vue

@@ -0,0 +1,44 @@
+<template>
+    <el-button text @click="dialogVisible = true">
+        click to open the Dialog
+    </el-button>
+
+    <el-dialog
+            v-model="dialogVisible"
+            title="Tips"
+            width="30%"
+            :before-close="handleClose"
+    >
+        <span>This is a message</span>
+        <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="dialogVisible = false">Cancel</el-button>
+        <el-button type="primary" @click="dialogVisible = false">
+          Confirm
+        </el-button>
+      </span>
+        </template>
+    </el-dialog>
+</template>
+
+<script lang="ts" setup>
+import { ref } from 'vue'
+import { ElMessageBox } from 'element-plus'
+
+const dialogVisible = ref(false)
+
+const handleClose = (done: () => void) => {
+    ElMessageBox.confirm('Are you sure to close this dialog?')
+        .then(() => {
+            done()
+        })
+        .catch(() => {
+            // catch error
+        })
+}
+</script>
+<style scoped>
+.dialog-footer button:first-child {
+    margin-right: 10px;
+}
+</style>

+ 15 - 0
src/views/home/index.vue

@@ -0,0 +1,15 @@
+<template>
+    <div>
+        <h1>Home Page</h1>
+    </div>
+</template>
+
+<script>
+export default {
+    name: "index"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 0
src/vite-env.d.ts

@@ -0,0 +1 @@
+/// <reference types="vite/client" />

+ 47 - 0
tsconfig.json

@@ -0,0 +1,47 @@
+{
+  "compilerOptions": {
+    "target": "ES2020",
+    "useDefineForClassFields": true,
+    "module": "ESNext",
+    "lib": [
+      "ES2020",
+      "DOM",
+      "DOM.Iterable"
+    ],
+    "skipLibCheck": true,
+    /* Bundler mode */
+    "moduleResolution": "bundler",
+    "allowImportingTsExtensions": true,
+    "resolveJsonModule": true,
+    "isolatedModules": true,
+    "noEmit": true,
+    "jsx": "preserve",
+    /* Linting */
+    "strict": true,
+    "noUnusedLocals": true,
+    "noUnusedParameters": true,
+    "noFallthroughCasesInSwitch": true,
+    // 配置@别名 start
+    "baseUrl": ".",
+    "paths": {
+      "@/*": [
+        "src/*"
+      ],
+      "_c/*": [
+        "src/components/*"
+      ]
+    }
+    // 配置@别名 end
+  },
+  "include": [
+    "src/**/*.ts",
+    "src/**/*.d.ts",
+    "src/**/*.tsx",
+    "src/**/*.vue"
+  ],
+  "references": [
+    {
+      "path": "./tsconfig.node.json"
+    }
+  ]
+}

+ 10 - 0
tsconfig.node.json

@@ -0,0 +1,10 @@
+{
+  "compilerOptions": {
+    "composite": true,
+    "skipLibCheck": true,
+    "module": "ESNext",
+    "moduleResolution": "bundler",
+    "allowSyntheticDefaultImports": true
+  },
+  "include": ["vite.config.ts"]
+}

+ 72 - 0
vite.config.ts

@@ -0,0 +1,72 @@
+import { defineConfig,loadEnv } from 'vite'
+import vue from '@vitejs/plugin-vue'
+
+//1、 导入 path 模块,帮助我们解析路径
+import { resolve } from 'path'
+
+//2-1 自动导入vue中hook reactive ref等
+import AutoImport from 'unplugin-auto-import/vite'
+//2-2 自动导入ui-组件 比如说ant-design-vue  element-plus等
+import Components from 'unplugin-vue-components/vite'
+
+//3、vue3语法糖
+import VueSetupExtend from 'vite-plugin-vue-setup-extend'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+    plugins: [
+        vue(),
+        AutoImport({
+            //安装两行后你会发现在组件中不用再导入ref,reactive等
+            imports: ['vue', 'vue-router'],
+            //存放的位置
+            dts: "src/auto-import.d.ts",
+        }),
+        Components({
+            // 引入组件的,包括自定义组件,存放的位置
+            dts: "src/components.d.ts",
+        }),
+        VueSetupExtend(),
+    ],
+
+    //1、 ↓解析配置
+    resolve: {
+        // ↓路径别名
+        alias: {
+            '@': resolve('src')
+        }
+    },
+
+    //代理
+    server: {
+        proxy: {
+            '/api': {
+                // target: 'http://localhost:8081/', // 后端接口地址
+                target: 'http://192.168.0.131:8187/TransServlet',
+                //target: 'http://192.168.0.131:8087/TransServlet',
+                // target: 'https://www.gzchain.org.cn/managersvc/', //后端接口地址
+                secure: false, //接受使用https
+                changeOrigin: true, //允许跨域
+                ws: false, //使用websocket
+                rewrite: (path)=>path.replace(/^\/api/,'')
+              },
+              
+              '/file': {
+                // target: 'http://192.168.0.15:8081/', // 后端接口地址
+                target: 'http://192.168.0.43:2201/',
+                secure: false, //接受使用https
+                changeOrigin: true, //允许跨域
+                ws: false, //使用websocket
+                pathRewrite: { // 路径重写
+                  '^/file': ''
+                }
+              }, '/websokct':{
+                target: 'http://192.168.0.131:8081/',
+               // target: 'http://192.168.0.43:8081/',
+                // target: 'https://www.gzchain.org.cn/managersvc/', //后端接口地址
+                secure: false, //接受使用https
+              },
+              
+        }
+    }
+})