소스 검색

项目初始化

xiebaomin 1 년 전
부모
커밋
c2c35f4b35

+ 27 - 0
.env.development

@@ -0,0 +1,27 @@
+# 文件标记
+NODE_ENV = 'development'
+
+# 网站地址
+LOCALHOSE = 'https://zp-b.caimei365.com'
+
+# 接口api地址
+BASE_URL = 'https://zplma-b.caimei365.com'
+
+# 静态资源文件地址
+STATIC_URL = 'https://static.caimei365.com/www/authentic'
+
+# 采美网
+CIMEI_LOCAL = 'https://www-b.caimei365.com'
+
+# 项目运行地址
+# HOST = "localhost"
+
+# 项目端口号
+# PORT = '8080'
+
+# HTTPS flag
+HTTPS = false
+
+# OSS 上传目录
+# UPLOAD_DIR = 'dev/authFile/'
+UPLOAD_DIR = 'beta/authFile/'

+ 23 - 0
.env.production

@@ -0,0 +1,23 @@
+# 文件标记
+NODE_ENV = 'production'
+
+# 网站地址
+LOCALHOSE = 'https://zp.caimei365.com'
+
+# 接口api地址
+BASE_URL = 'https://zplma.caimei365.com'
+
+# 静态资源文件地址
+STATIC_URL = 'https://static.caimei365.com/www/authentic'
+
+# 采美网
+CIMEI_LOCAL = 'https://www.caimei365.com'
+
+# 项目运行地址
+# HOST = '192.168.2.81'
+
+# HTTPS flag
+HTTPS = false
+
+# OSS 上传目录
+UPLOAD_DIR = 'prod/authFile/'

+ 26 - 0
.env.staging

@@ -0,0 +1,26 @@
+# 文件标记
+NODE_ENV = 'satging'
+
+# 网站地址
+LOCALHOSE = 'https://zp-b.caimei365.com'
+
+# 接口api地址
+BASE_URL = 'https://zplma-b.caimei365.com'
+
+# 静态资源文件地址
+STATIC_URL = 'https://static.caimei365.com/www/authentic'
+
+# 采美网
+CIMEI_LOCAL = 'https://www-b.caimei365.com'
+
+# 项目运行地址
+HOST = '172.31.165.28'
+
+# 项目端口号
+PORT = '8105'
+
+# HTTPS flag
+HTTPS = false
+
+# OSS 上传目录
+UPLOAD_DIR = 'beta/authFile/'

+ 5 - 0
README.md

@@ -1,24 +1,29 @@
 # caimei-distribution-www
 
 ## Project setup
+
 ```
 npm install
 ```
 
 ### Compiles and hot-reloads for development
+
 ```
 npm run serve
 ```
 
 ### Compiles and minifies for production
+
 ```
 npm run build
 ```
 
 ### Lints and fixes files
+
 ```
 npm run lint
 ```
 
 ### Customize configuration
+
 See [Configuration Reference](https://cli.vuejs.org/config/).

+ 17 - 1
babel.config.js

@@ -1,5 +1,21 @@
 module.exports = {
   presets: [
-    '@vue/cli-plugin-babel/preset'
+    '@vue/cli-plugin-babel/preset',
+    ['@babel/preset-env', { modules: false }]
+  ],
+  plugins: [ // 自动按需引入
+    [
+      'import', {
+        libraryName: 'vant',
+        libraryDirectory: 'es',
+        style: true
+      }, 'vant'
+    ],
+    [
+      'component', {
+        libraryName: 'element-ui',
+        styleLibraryName: 'theme-chalk'
+      }
+    ]
   ]
 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 666 - 26
package-lock.json


+ 12 - 3
package.json

@@ -3,12 +3,17 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint"
+    "dev": "vue-cli-service serve",
+    "build:prod": "vue-cli-service build",
+    "lint": "vue-cli-service lint",
+    "build:dev": "vue-cli-service build --mode development"
   },
   "dependencies": {
+    "axios": "^1.5.0",
     "core-js": "^3.6.5",
+    "element-ui": "^2.15.14",
+    "nprogress": "^0.2.0",
+    "vant": "^2.13.0",
     "vue": "^2.6.11",
     "vue-router": "^3.2.0",
     "vuex": "^3.4.0"
@@ -21,6 +26,8 @@
     "@vue/cli-service": "~4.5.19",
     "@vue/eslint-config-standard": "^5.1.2",
     "babel-eslint": "^10.1.0",
+    "babel-plugin-component": "^1.1.1",
+    "babel-plugin-import": "^1.13.8",
     "eslint": "^6.7.2",
     "eslint-plugin-import": "^2.20.2",
     "eslint-plugin-node": "^11.1.0",
@@ -29,6 +36,8 @@
     "eslint-plugin-vue": "^6.2.2",
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
+    "node-sass": "^6.0.1",
+    "sass-loader": "^10.2.0",
     "vue-template-compiler": "^2.6.11"
   }
 }

+ 24 - 22
src/App.vue

@@ -1,32 +1,34 @@
 <template>
   <div id="app">
-    <div id="nav">
-      <router-link to="/">Home</router-link> |
-      <router-link to="/about">About</router-link>
-    </div>
-    <router-view/>
+    <router-view v-slot="{ Component }">
+      <transition name="fade" mode="out-in">
+          <component :is="Component" />
+      </transition>
+    </router-view>
   </div>
 </template>
 
-<style lang="less">
-#app {
-  font-family: Avenir, Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  text-align: center;
-  color: #2c3e50;
+<script>
+export default {
+  data () {
+    return {
+    }
+  },
+  watch: {
+    '$route' (to, from) {}
+  },
+  methods: {}
 }
+</script>
 
-#nav {
-  padding: 30px;
-
-  a {
-    font-weight: bold;
-    color: #2c3e50;
+<style>
+.fade-enter-active,
+.fade-leave-active {
+  transition: opacity 0.5s ease;
+}
 
-    &.router-link-exact-active {
-      color: #42b983;
-    }
-  }
+.fade-enter-from,
+.fade-leave-to {
+  opacity: 0;
 }
 </style>

+ 15 - 0
src/Layout/TabItem/index.vue

@@ -0,0 +1,15 @@
+<template>
+  <div>
+
+  </div>
+</template>
+
+<script>
+export default {
+
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 15 - 0
src/Layout/Tabbar/index.vue

@@ -0,0 +1,15 @@
+<template>
+  <div>
+    <slot />
+  </div>
+</template>
+
+<script>
+export default {
+
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 19 - 0
src/Layout/index.vue

@@ -0,0 +1,19 @@
+<template>
+  <div>
+    <Tabbar>
+      <tab-item></tab-item>
+    </Tabbar>
+  </div>
+</template>
+
+<script>
+import Tabbar from './Tabbar/index'
+import TabItem from './TabItem/index'
+
+export default {
+  components: {
+    Tabbar,
+    TabItem
+  }
+}
+</script>

BIN
src/assets/logo.png


+ 0 - 60
src/components/HelloWorld.vue

@@ -1,60 +0,0 @@
-<template>
-  <div class="hello">
-    <h1>{{ msg }}</h1>
-    <p>
-      For a guide and recipes on how to configure / customize this project,<br>
-      check out the
-      <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
-    </p>
-    <h3>Installed CLI Plugins</h3>
-    <ul>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
-      <li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
-    </ul>
-    <h3>Essential Links</h3>
-    <ul>
-      <li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
-      <li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
-      <li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
-      <li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
-      <li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
-    </ul>
-    <h3>Ecosystem</h3>
-    <ul>
-      <li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
-      <li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
-      <li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
-      <li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
-      <li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
-    </ul>
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'HelloWorld',
-  props: {
-    msg: String
-  }
-}
-</script>
-
-<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style scoped lang="less">
-h3 {
-  margin: 40px 0 0;
-}
-ul {
-  list-style-type: none;
-  padding: 0;
-}
-li {
-  display: inline-block;
-  margin: 0 10px;
-}
-a {
-  color: #42b983;
-}
-</style>

+ 2 - 0
src/main.js

@@ -2,6 +2,8 @@ import Vue from 'vue'
 import App from './App.vue'
 import router from './router'
 import store from './store'
+import '@/plugin/vant'
+import './permission'
 
 Vue.config.productionTip = false
 

+ 24 - 0
src/permission.js

@@ -0,0 +1,24 @@
+import router from './router'
+import NProgress from 'nprogress'
+// import store from './store'
+import 'nprogress/nprogress.css'
+
+NProgress.configure({ showSpinner: false })
+
+// const whiteList = ['/login', '/pwlogin']
+
+router.beforeEach((to, from, next) => {
+  // NProgress.start()
+  next()
+  // if (to.path === '/login') {
+  //  next({ path: '/' })
+  //  NProgress.done()
+  // } else {
+  //  next()
+  //  NProgress.done()
+  // }
+})
+
+router.afterEach(() => {
+  // NProgress.done()
+})

+ 14 - 0
src/plugin/element.js

@@ -0,0 +1,14 @@
+import Vue from 'vue'
+import {
+  Button,
+  Icon,
+  Cell,
+  CellGroup,
+  Loading
+} from 'element-ui'
+
+Vue.use(Button)
+Vue.use(Icon)
+Vue.use(Cell)
+Vue.use(CellGroup)
+Vue.use(Loading)

+ 14 - 0
src/plugin/vant.js

@@ -0,0 +1,14 @@
+import Vue from 'vue'
+import {
+  Button,
+  Icon,
+  Cell,
+  CellGroup,
+  Loading
+} from 'vant'
+
+Vue.use(Button)
+Vue.use(Icon)
+Vue.use(Cell)
+Vue.use(CellGroup)
+Vue.use(Loading)

+ 9 - 9
src/router/index.js

@@ -1,22 +1,22 @@
 import Vue from 'vue'
 import VueRouter from 'vue-router'
-import Home from '../views/Home.vue'
 
 Vue.use(VueRouter)
 
 const routes = [
   {
     path: '/',
-    name: 'Home',
-    component: Home
+    redirect: '/login'
   },
   {
-    path: '/about',
-    name: 'About',
-    // route level code-splitting
-    // this generates a separate chunk (about.[hash].js) for this route
-    // which is lazy-loaded when the route is visited.
-    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
+    path: '/login',
+    name: 'login',
+    component: () => import(/* webpackChunkName: "login" */ '@/views/login/login.vue')
+  },
+  {
+    path: '/pwlogin',
+    name: 'pwlogin',
+    component: () => import(/* webpackChunkName: "register" */ '@/views/pwlogin/pwlogin.vue')
   }
 ]
 

+ 3 - 0
src/store/getter.js

@@ -0,0 +1,3 @@
+export default {
+
+}

+ 3 - 8
src/store/index.js

@@ -1,15 +1,10 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
+import getters from './getter'
 
 Vue.use(Vuex)
 
 export default new Vuex.Store({
-  state: {
-  },
-  mutations: {
-  },
-  actions: {
-  },
-  modules: {
-  }
+  getters,
+  modules: {}
 })

+ 14 - 0
src/store/institution.js

@@ -0,0 +1,14 @@
+// 机构 store
+
+const state = () => ({})
+
+const mutations = {}
+
+const actions = {}
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+}

+ 14 - 0
src/store/user.js

@@ -0,0 +1,14 @@
+// 用户 store
+
+const state = () => ({})
+
+const mutations = {}
+
+const actions = {}
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+}

+ 8 - 0
src/util/http.js

@@ -0,0 +1,8 @@
+import axios from 'axios'
+import Vue from 'vue'
+
+axios.create({
+  baseURL: process.env.BASE_URL
+})
+
+Vue.prototype.$http = axios

+ 0 - 5
src/views/About.vue

@@ -1,5 +0,0 @@
-<template>
-  <div class="about">
-    <h1>This is an about page</h1>
-  </div>
-</template>

+ 0 - 18
src/views/Home.vue

@@ -1,18 +0,0 @@
-<template>
-  <div class="home">
-    <img alt="Vue logo" src="../assets/logo.png">
-    <HelloWorld msg="Welcome to Your Vue.js App"/>
-  </div>
-</template>
-
-<script>
-// @ is an alias to /src
-import HelloWorld from '@/components/HelloWorld.vue'
-
-export default {
-  name: 'Home',
-  components: {
-    HelloWorld
-  }
-}
-</script>

+ 28 - 0
src/views/login/login.vue

@@ -0,0 +1,28 @@
+<template>
+  <div class="login">
+    <van-loading type="spinner" color="blue"/>
+    <van-button type="primary" @click="$router.push('/pwlogin')">按钮</van-button>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'login-index',
+  data () {
+    return {}
+  },
+  mounted () {
+    console.log(process.env.NODE_ENV)
+  },
+  methods: {
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.login {
+  height: 100%;
+  width: 100%;
+  background: yellow;
+}
+</style>

+ 19 - 0
src/views/pwlogin/pwlogin.vue

@@ -0,0 +1,19 @@
+<template>
+  <div class="pwlogin">
+    <van-button type="primary" @click="$router.push('/login')">按钮</van-button>
+  </div>
+</template>
+
+<script>
+export default {
+
+}
+</script>
+
+<style lang="scss" scoped>
+.pwlogin {
+  height: 100%;
+  width: 100%;
+  background: red;
+}
+</style>

+ 6 - 0
vue.config.js

@@ -0,0 +1,6 @@
+module.exports = {
+  publicPath: './',
+  // outputDir: 'dist',
+  // assetsDir: 'static',
+  devServer: {}
+}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.