jwyu 3 年之前
當前提交
2ab4df68c5
共有 21 個文件被更改,包括 429 次插入0 次删除
  1. 3 0
      .env.development
  2. 3 0
      .env.product
  3. 3 0
      .env.test
  4. 27 0
      .gitignore
  5. 2 0
      README.md
  6. 13 0
      index.html
  7. 23 0
      package.json
  8. 二進制
      public/favicon.ico
  9. 10 0
      src/App.vue
  10. 59 0
      src/api/http.js
  11. 二進制
      src/assets/leftNav/activity-s.png
  12. 二進制
      src/assets/logo.png
  13. 24 0
      src/layout/Index.vue
  14. 108 0
      src/layout/component/Aside.vue
  15. 14 0
      src/main.js
  16. 37 0
      src/router/index.js
  17. 78 0
      src/style/global.scss
  18. 0 0
      src/views/404.vue
  19. 5 0
      src/views/activity/List.vue
  20. 3 0
      src/views/workBench/Index.vue
  21. 17 0
      vite.config.js

+ 3 - 0
.env.development

@@ -0,0 +1,3 @@
+VITE_APP_API_URL="http://advisoryadmin.brilliantstart.cn/xcx_h5"
+VITE_APP_BASE_URL="/"
+VITE_APP_OUTDIR="dist"

+ 3 - 0
.env.product

@@ -0,0 +1,3 @@
+VITE_APP_API_URL="https://details.hzinsights.com"
+VITE_APP_BASE_URL="/hz"
+VITE_APP_OUTDIR="productDir"

+ 3 - 0
.env.test

@@ -0,0 +1,3 @@
+VITE_APP_API_URL="http://advisoryadmin.brilliantstart.cn/xcx_h5"
+VITE_APP_BASE_URL="/hz"
+VITE_APP_OUTDIR="testDir"

+ 27 - 0
.gitignore

@@ -0,0 +1,27 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+productDir
+testDir
+*.local
+package-lock.json
+
+# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+# 弘则研报小程序PC版
+

+ 13 - 0
index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <link rel="icon" href="/favicon.ico" />
+    <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.js"></script>
+  </body>
+</html>

+ 23 - 0
package.json

@@ -0,0 +1,23 @@
+{
+  "name": "vue3-admin-tem",
+  "private": true,
+  "version": "0.0.0",
+  "scripts": {
+    "dev": "vite",
+    "build": "vite build --mode product",
+    "build.test": "vite build --mode test",
+    "preview": "vite preview --port 3001"
+  },
+  "dependencies": {
+    "axios": "^0.26.0",
+    "element-plus": "^2.0.2",
+    "normalize.css": "^8.0.1",
+    "vue": "^3.2.25",
+    "vue-router": "^4.0.12"
+  },
+  "devDependencies": {
+    "@vitejs/plugin-vue": "^2.2.0",
+    "vite": "^2.8.0",
+    "sass": "^1.44.0"
+  }
+}

二進制
public/favicon.ico


+ 10 - 0
src/App.vue

@@ -0,0 +1,10 @@
+<script setup>
+import zhCn from 'element-plus/lib/locale/lang/zh-cn'
+</script>
+
+<template>
+  <el-config-provider :locale="zhCn">
+    <router-view />
+  </el-config-provider>
+</template>
+

+ 59 - 0
src/api/http.js

@@ -0,0 +1,59 @@
+"use strict";
+import axios from "axios";
+
+// Full config:  https://github.com/axios/axios#request-config
+// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
+// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
+// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
+
+// 请求数
+console.log(import.meta.env.VITE_APP_API_UR);
+let config = {
+  baseURL: import.meta.env.VITE_APP_API_UR,
+  timeout: 10*60 * 1000, // Timeout
+  // withCredentials: true, // Check cross-site Access-Control
+};
+
+const _axios = axios.create(config);
+
+_axios.interceptors.request.use(
+  function (config) {
+    // Do something before request is sent
+    return config;
+  },
+  function (error) {
+    // Do something with request error
+    return Promise.reject(error);
+  }
+);
+
+// Add a response interceptor
+_axios.interceptors.response.use(
+  function (response) {
+    // Do something with response data
+
+    return response.data;
+  },
+  function (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);
+};

二進制
src/assets/leftNav/activity-s.png


二進制
src/assets/logo.png


+ 24 - 0
src/layout/Index.vue

@@ -0,0 +1,24 @@
+<script setup>
+import Aside from './component/Aside.vue'
+</script>
+
+<template>
+  <div class="layout-wrap">
+    <el-container style="width: 100%; height: 100%">
+        <Aside></Aside>
+        <el-container>
+            <el-main>
+                <router-view />
+            </el-main>
+        </el-container>
+    </el-container>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+.layout-wrap {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+}
+</style>

+ 108 - 0
src/layout/component/Aside.vue

@@ -0,0 +1,108 @@
+<script setup>
+import { reactive, ref, watch } from "vue";
+import { useRoute } from "vue-router";
+const route = useRoute();
+
+let activePath = ref("/activity/list");
+watch(
+  () => route.path,
+  (to) => {
+    activePath.value = to;
+  },
+  {
+    immediate: true,
+  }
+);
+
+const menuList = reactive([
+  {
+    MenuId: 1,
+    name: "报告及活动",
+    path: "/activity/list",
+    icon_path: new URL('../../assets/leftNav/activity-s.png', import.meta.url).href,
+    children: null,
+  },
+]);
+</script>
+
+<template>
+  <el-aside width="166px" class="aside-wrap">
+    <div class="logo-box flex-row-col-center">
+      <img src="@/assets/logo.png" alt="logo" class="logo" />
+      <span>弘则研报</span>
+    </div>
+    <el-menu router :default-active="activePath" unique-opened background-color="#DAB37C" text-color="#ffffff" active-text-color="#ffffff" class="el-menu-wrap">
+      <template v-for="menu in menuList">
+        <el-menu-item :index="menu.path" :key="menu.id" v-if="!menu.children">
+          <img class="menu-icon" :src="menu.icon_path" alt="" />
+          <span class="menu-text">{{ menu.name }}</span>
+        </el-menu-item>
+        <el-sub-menu :index="menu.MenuId + ''" :key="menu.MenuId" v-else>
+          <template #title>
+            <img class="menu-icon" :src="menu.icon_path" alt="" />
+            <span class="menu-text">{{ menu.name }}</span>
+          </template>
+          <el-menu-item v-for="child in menu.children" :key="child.MenuId" :index="child.path" style="text-align: center">
+            {{ child.name }}
+          </el-menu-item>
+        </el-sub-menu>
+      </template>
+    </el-menu>
+  </el-aside>
+</template>
+
+
+<style lang="scss" scoped>
+.aside-wrap {
+  padding-top: 103px;
+  background-color: #fff;
+  position: relative;
+  border-right:1px solid #F2F2F2;
+  &::-webkit-scrollbar {
+    width: 0;
+  }
+}
+.logo-box {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 73px;
+  z-index: 99;
+  text-align: center;
+  background-color: #fff;
+  border-bottom: 1px solid #F2F2F2;
+  .logo {
+    width: 32px;
+    margin-right: 8px;
+  }
+  span{
+    font-size: 18px;
+    font-weight: bold;
+  }
+}
+
+.el-menu-wrap {
+  width: 100%;
+  border: none;
+}
+.el-menu-item.is-active {
+  background-color: rgba(253, 184, 99, 0.1) !important;
+}
+.menu-icon {
+  width: 20px;
+  height: 20px;
+  margin-right: 20px;
+  vertical-align: middle;
+}
+.menu-text {
+  display: inline-block;
+  vertical-align: middle;
+  font-size: 15px;
+}
+ul,
+li {
+  box-sizing: border-box;
+  display: block;
+}
+</style>

+ 14 - 0
src/main.js

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

+ 37 - 0
src/router/index.js

@@ -0,0 +1,37 @@
+import { createRouter, createWebHistory } from "vue-router";
+
+const routes=[
+  {
+    path: "/",
+    name: "Layout",
+    redirect:'/activity/list',
+    component: ()=>import("@/layout/Index.vue"),
+  },
+
+  {
+    path: "/activity",
+    name: "Activity",
+    component: () => import("@/layout/Index.vue"),
+    meta: {
+      title:"报告及活动"
+    },
+    children: [
+      {
+        path: "list",
+        name: "ActivityList",
+        component: () => import("@/views/activity/List.vue"),
+        meta: {
+          title: "报告及活动"
+        },
+      },
+    ]
+  },
+
+]
+
+const router=createRouter({
+  history:createWebHistory(import.meta.env.VITE_APP_BASE_URL),
+  routes
+})
+
+export default router

+ 78 - 0
src/style/global.scss

@@ -0,0 +1,78 @@
+// 全局样式
+html,
+body,
+#app {
+  width: 100%;
+  height: 100%;
+  font-size: 15px;
+  color: #333;
+  min-width: 1150px;
+}
+
+div{
+    box-sizing: border-box;
+}
+
+ul,
+li {
+  list-style-type: none;
+  margin: 0;
+  padding: 0;
+}
+
+a{
+  text-decoration: none;
+}
+
+.flex {
+  display: flex;
+}
+.flex-row-center {
+  display: flex;
+  justify-content: center;
+}
+.flex-col-center {
+  display: flex;
+  align-items: center;
+}
+.flex-row-col-center {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.bg-white {
+  background-color: #fff;
+}
+.box-shadow {
+  border: 1px solid #ececec;
+  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.05);
+  border-radius: 4px;
+}
+
+img{
+  image-rendering: -moz-crisp-edges; 
+  image-rendering: -o-crisp-edges; 
+  image-rendering: -webkit-optimize-contrast; 
+  image-rendering: crisp-edges; 
+  -ms-interpolation-mode: nearest-neighbor;
+}
+
+// 清除浮动
+.clear-float::after {
+  content: "";
+  height: 0;
+  line-height: 0;
+  display: block;
+  visibility: hidden;
+  clear: both;
+}
+
+// 全局滚动条样式
+::-webkit-scrollbar{
+  width: 10px;
+  background-color: rgba(0, 0, 0, 0.05);
+}
+::-webkit-scrollbar-thumb{
+  background: #7a7a7a;
+  border-radius: 5px;
+}

+ 0 - 0
src/views/404.vue


+ 5 - 0
src/views/activity/List.vue

@@ -0,0 +1,5 @@
+<template>
+    <div class="activity-list-page">
+        activity-list
+    </div>
+</template>

+ 3 - 0
src/views/workBench/Index.vue

@@ -0,0 +1,3 @@
+<template>
+    <div>workbench</div>
+</template>

+ 17 - 0
vite.config.js

@@ -0,0 +1,17 @@
+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
+  },
+})