diff --git a/package.json b/package.json index cef346e..bd76555 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,15 @@ "echarts": "^4.2.1", "element-ui": "2.15.13", "file-saver": "^2.0.5", + "html2canvas": "^1.4.1", "js-cookie": "2.2.0", + "jspdf": "^2.5.1", "less-loader": "^5.0.0", "moment": "^2.29.2", "normalize.css": "7.0.0", "nprogress": "0.2.0", "path-to-regexp": "2.4.0", + "print-js": "^1.6.0", "qrcodejs2": "^0.0.2", "tinymce": "^5.10.7", "view-design": "^4.7.0", diff --git a/src/api/h5/index.js b/src/api/h5/index.js index 120cd3b..6a45c64 100644 --- a/src/api/h5/index.js +++ b/src/api/h5/index.js @@ -1,8 +1,33 @@ import request from "@/utils/request"; -export function login () { +export function login (params) { return request({ url: '/api/mobile/user/login', + method: 'get', + params + }) +} + +export function userInfo (params) { + return request({ + url: '/api/mobile/user/userinfo', + method: 'get', + params + }) +} +export function sendSms (params) { + return request({ + url: '/api/mobile/user/send_sms', + method: 'get', + params + }) +} + +export function updateLog (params) { + return request({ + url: '/api/mobile/user/update_log', + method: 'get', + params }) } diff --git a/src/permission.js b/src/permission.js index b91d764..5919bdb 100644 --- a/src/permission.js +++ b/src/permission.js @@ -18,7 +18,7 @@ router.beforeEach(async(to, from, next) => { document.title = getPageTitle(to.meta.title) // determine whether the user has logged in - const hasToken = getToken() + let hasToken = getToken() if (whiteList.indexOf(to.path) !== -1) { // in the free login whitelist, go directly @@ -41,18 +41,22 @@ router.beforeEach(async(to, from, next) => { try { // get user info // note: roles must be a object array! such as: ['admin'] or ,['developer','editor'] - const { roles } = await store.dispatch('user/getInfo') + if (!/^\/h5.*/.test(to.path)) { + const { roles } = await store.dispatch('user/getInfo') - // generate accessible routes map based on roles - const accessRoutes = await store.dispatch('permission/generateRoutes', roles) - - //console.log(accessRoutes) - // dynamically add accessible routes - router.addRoutes(accessRoutes) + // generate accessible routes map based on roles + const accessRoutes = await store.dispatch('permission/generateRoutes', roles) + //console.log(accessRoutes) + // dynamically add accessible routes + router.addRoutes(accessRoutes) + next({ ...to, replace: true }) + } else { + next(); + } // hack method to ensure that addRoutes is complete // set the replace: true, so the navigation will not leave a history record - next({ ...to, replace: true }) + } catch (error) { console.log(error) // remove token and go to login page to re-login diff --git a/src/router/index.js b/src/router/index.js index e83d5de..b0d3032 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -85,7 +85,7 @@ export const constantRoutes = [ ], }, { - path: "/h5", + path: "/h5/index", component: () => import("@/views/h5/index.vue"), meta: { title: "首页", @@ -99,7 +99,11 @@ export const constantRoutes = [ title: "登录", }, hidden: true - } + }, + { + path: '/h5', + redirect: '/h5/index' + }, ]; /** diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 5decf12..bd35223 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -17,7 +17,8 @@ const getDefaultState = () => { token: getToken(), name: '', avatar: '', - roles: [] + roles: [], + user: {}, } } @@ -38,7 +39,7 @@ const mutations = { }, SET_ROLES: (state, roles) => { state.roles = roles - } + }, } const actions = { diff --git a/src/utils/auth.js b/src/utils/auth.js index 5bf5a01..7e6c587 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -1,18 +1,18 @@ import Cookies from 'js-cookie' import router from '@/router' -const TokenKey = 'difficult_employee_query_token' -const TokenKsy_h5 = 'difficult_employee_query_token_h5' +const TokenKey = 'difficult_employee_token' +const TokenKsy_h5 = 'difficult_employee_token_h5' export function getToken() { - let flag = /^\/h5.*/.test(router.currentRoute.path) + let flag = /\/h5.*/.test(window.location.href) return Cookies.get(flag ? TokenKsy_h5 : TokenKey) } export function setToken(token) { - let flag = /^\/h5.*/.test(router.currentRoute.path) + let flag = /\/h5.*/.test(window.location.href) return Cookies.set(flag ? TokenKsy_h5 : TokenKey, token) } export function removeToken() { - let flag = /^\/h5.*/.test(router.currentRoute.path) + let flag = /\/h5.*/.test(window.location.href) return Cookies.remove(flag ? TokenKsy_h5 : TokenKey) } diff --git a/src/views/h5/index.vue b/src/views/h5/index.vue index 98b6b2f..a47e16d 100644 --- a/src/views/h5/index.vue +++ b/src/views/h5/index.vue @@ -1,17 +1,151 @@ diff --git a/src/views/h5/login/component/loginPanel.vue b/src/views/h5/login/component/loginPanel.vue index c923366..8d4b95d 100644 --- a/src/views/h5/login/component/loginPanel.vue +++ b/src/views/h5/login/component/loginPanel.vue @@ -1,7 +1,7 @@ @@ -141,18 +248,69 @@ export default { position: relative; + &-border { + border: .5px solid #333; + } + @mixin h1 { + font-weight: 900; + font-size: 2em; + text-align: center; + } + @mixin h2 { + font-weight: 500; + font-size: 1.2em; + text-align: center; + } + @mixin text { + font-size: 1.1em; + } & > div { position: absolute; } .no { + @include h2; transform: translate(20px,20px); } .qrcode { transform: translate(0px,20px); - right: 20px + right: 20px; + text-align: center; + } + .title { + @include h1; + transform: translate(-50%,0); + left: 50%; + top: 23%; + } + .text { + @include text; + word-spacing: 4px; + letter-spacing: 1px; + top: 36%; + padding: 0 5em; + text-indent: 2em; + line-height: 3; + + & > span { + text-decoration: underline; + } + } + .stay { + @include text; + line-height: 2; + text-align: right; + + padding-top: 2em; + padding-right: 1em; } } } +.reduction { + transform: translateX(-50%); + position: fixed; + left: 50%; + bottom: 60px; +} .bottom-panel { height: 50px; background: rgba(55,55,55,.6); diff --git a/src/views/record/index.vue b/src/views/record/index.vue index 254cd07..f74699f 100644 --- a/src/views/record/index.vue +++ b/src/views/record/index.vue @@ -335,12 +335,13 @@ export default { }; }, methods: { - toPrint (row) { + toPrint (row,isChild = false) { console.log(row); const url = this.$router.resolve({ path: '/print', query: { - d: window.btoa(`id=${row.id}`) + bm: window.btoa(row.bianma), + isChild } }) window.open(url.href)