diff --git a/.env.staging b/.env.staging index a8793a0..7e67cdb 100644 --- a/.env.staging +++ b/.env.staging @@ -4,5 +4,7 @@ NODE_ENV = production ENV = 'staging' # base api -VUE_APP_BASE_API = '/stage-api' +VUE_APP_BASE_API=http://jiwei.ali251.langye.net +VUE_APP_UPLOAD_API=http://jiwei.ali251.langye.net/api/admin/upload-file + diff --git a/src/api/h5/form.js b/src/api/h5/form.js index 4521b37..760e419 100644 --- a/src/api/h5/form.js +++ b/src/api/h5/form.js @@ -17,3 +17,57 @@ export function recordStore (data,isLoading=true) { isLoading }) } + +export function getYears (params,isLoading=false) { + return request({ + method: "get", + url: "/api/person/get-years", + params, + isLoading + }) +} + +export function getYearStatistics (params,isLoading=false) { + return request({ + method: "get", + url: "/api/person/get-year-statistics", + params, + isLoading + }) +} + +export function getByCategory (params,isLoading=true) { + return request({ + method: "get", + url: "/api/person/record/get-by-category", + params, + isLoading + }) +} + +export function destroy (data,isLoading=true) { + return request({ + method: "post", + url: "/api/person/record/delete", + data, + isLoading + }) +} + +export function show (params,isLoading=true) { + return request({ + method: "get", + url: "/api/person/record/show", + params, + isLoading + }) +} + +export function save (data,isLoading=true) { + return request({ + method: "post", + url: "/api/person/record/save", + data, + isLoading + }) +} diff --git a/src/api/h5/login.js b/src/api/h5/login.js index 0eb2a50..1dda5e5 100644 --- a/src/api/h5/login.js +++ b/src/api/h5/login.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; -export function login (data,isLoading=true) { +export function login (data,isLoading=false) { return request({ method: "post", url: "/api/person/auth/login", @@ -25,3 +25,11 @@ export function logout () { isLoading: false }) } + +export function getBaseInfo (isLoading=false) { + return request({ + method: "get", + url: "/api/person/get-base-info", + isLoading + }) +} diff --git a/src/router/index.js b/src/router/index.js index ad9288e..eef0a84 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -77,6 +77,8 @@ export const constantRoutes = [{ { path: "/h5", + name: "h5", + redirect: "/h5/index", component: () => import("@/views/h5/index.vue"), hidden: true, children: [ @@ -98,16 +100,13 @@ export const constantRoutes = [{ }, { path: '/h5/login', + name: "h5login", component:() => import("@/views/h5/login/login.vue"), meta: { title: "登录", }, hidden: true }, - { - path: '/h5', - redirect: '/h5/index' - }, ] diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 1f144f4..b2e876a 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -66,8 +66,8 @@ const actions = { username: username.trim(), password: password }).then(res => { - commit('SET_TOKEN_H5', res.access_token) setToken(res.access_token) + commit('SET_TOKEN_H5', res.access_token) resolve(res) }).catch(error => { reject(error) diff --git a/src/utils/request.js b/src/utils/request.js index 525c0a1..a908474 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -5,6 +5,7 @@ import { Loading } from 'element-ui' import store from '@/store' +import route from "@/router" import { getToken } from '@/utils/auth' @@ -30,13 +31,13 @@ service.interceptors.request.use( } // do something before request is sent - if (store.getters.token) { + if (getToken(/\/h5/g.test(route.currentRoute.path))) { // let each request carry token // ['X-Token'] is a custom headers key // please modify it according to the actual situation //config.headers['X-Token'] = getToken(); - config.headers['Authorization'] = "Bearer " + getToken() + config.headers['Authorization'] = "Bearer " + getToken(/\/h5/g.test(route.currentRoute.path)) } return config }, diff --git a/src/views/h5/form/index.vue b/src/views/h5/form/index.vue index 58c7783..84910ea 100644 --- a/src/views/h5/form/index.vue +++ b/src/views/h5/form/index.vue @@ -1,25 +1,58 @@ diff --git a/src/views/h5/form/show.vue b/src/views/h5/form/show.vue new file mode 100644 index 0000000..6c24f05 --- /dev/null +++ b/src/views/h5/form/show.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/views/h5/home/index.vue b/src/views/h5/home/index.vue index e684af3..98a3993 100644 --- a/src/views/h5/home/index.vue +++ b/src/views/h5/home/index.vue @@ -1,287 +1,78 @@ - diff --git a/src/views/h5/index.vue b/src/views/h5/index.vue index f911333..bb72b6a 100644 --- a/src/views/h5/index.vue +++ b/src/views/h5/index.vue @@ -1,6 +1,6 @@ @@ -144,3 +149,12 @@ export default { height: calc(100% - 60px); } + diff --git a/src/views/h5/login/login.vue b/src/views/h5/login/login.vue index 9828729..6f64213 100644 --- a/src/views/h5/login/login.vue +++ b/src/views/h5/login/login.vue @@ -172,11 +172,12 @@ export default { this.$store .dispatch("user/login", this.loginForm) .then(() => { - console.log(this.redirect); - this.$router.push({ - path: this.redirect || "/h5/index", - }); - this.loading = false; + setTimeout(() => { + this.$router.push({ + path: this.redirect || "/h5/index", + }); + this.loading = false; + }, 500) }) .catch(() => { this.loading = false; diff --git a/vue.config.js b/vue.config.js index 8cc5bd0..c682396 100644 --- a/vue.config.js +++ b/vue.config.js @@ -24,7 +24,7 @@ module.exports = { * In most cases please use '/' !!! * Detail: https://cli.vuejs.org/config/#publicpath */ - publicPath: '/admin/', + publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', outputDir: './dist', assetsDir: 'static', css: { @@ -35,10 +35,6 @@ module.exports = { sass:{ prependData: '@import "@/styles/index.scss";' } - }, - extract: { // 打包后css文件名称添加时间戳 - filename: `static/css/[name].${timeStamp}.css`, - chunkFilename: `static/css/chunk.[id].${timeStamp}.css` } }, lintOnSave: process.env.NODE_ENV === 'development', @@ -69,10 +65,6 @@ module.exports = { alias: { '@': resolve('src') } - }, - output: { - filename: `js/[name]-${timeStamp}.js`, - chunkFilename: `js/[name]-${timeStamp}.js` } }, chainWebpack(config) {