Showing
11 changed files
with
150 additions
and
101 deletions
| ... | @@ -80,7 +80,11 @@ | ... | @@ -80,7 +80,11 @@ |
| 80 | color:#6379bb; | 80 | color:#6379bb; |
| 81 | border-bottom:1px solid #ddd; | 81 | border-bottom:1px solid #ddd; |
| 82 | margin:8px 10px 25px 10px; | 82 | margin:8px 10px 25px 10px; |
| 83 | - padding-bottom:5px | 83 | + padding-bottom:5px; |
| 84 | + .formItem { | ||
| 85 | + width: 100%; | ||
| 86 | + max-width: 310px; | ||
| 87 | + } | ||
| 84 | } | 88 | } |
| 85 | 89 | ||
| 86 | /** 表格布局 **/ | 90 | /** 表格布局 **/ | ... | ... |
| 1 | import router from './router' | 1 | import router from './router' |
| 2 | import store from './store' | 2 | import store from './store' |
| 3 | import { Message } from 'element-ui' | 3 | import { Message } from 'element-ui' |
| 4 | -//import NProgress from 'nprogress' | 4 | +import { getToken,setToken } from '@/utils/auth' |
| 5 | -//import 'nprogress/nprogress.css' | ||
| 6 | -import { getToken } from '@/utils/auth' | ||
| 7 | 5 | ||
| 8 | -//NProgress.configure({ showSpinner: false }) | ||
| 9 | 6 | ||
| 10 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] | 7 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] |
| 11 | 8 | ||
| 12 | router.beforeEach((to, from, next) => { | 9 | router.beforeEach((to, from, next) => { |
| 13 | - //NProgress.start() | ||
| 14 | if (getToken()) { | 10 | if (getToken()) { |
| 15 | /* has token*/ | 11 | /* has token*/ |
| 16 | if (to.path === '/login') { | 12 | if (to.path === '/login') { |
| 17 | next({ path: '/' }) | 13 | next({ path: '/' }) |
| 18 | - //NProgress.done() | ||
| 19 | } else { | 14 | } else { |
| 20 | if (store.getters.roles.length === 0) { | 15 | if (store.getters.roles.length === 0) { |
| 21 | // 判断当前用户是否已拉取完user_info信息 | 16 | // 判断当前用户是否已拉取完user_info信息 |
| ... | @@ -26,9 +21,10 @@ router.beforeEach((to, from, next) => { | ... | @@ -26,9 +21,10 @@ router.beforeEach((to, from, next) => { |
| 26 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | 21 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
| 27 | }) | 22 | }) |
| 28 | }).catch(err => { | 23 | }).catch(err => { |
| 29 | - store.dispatch('LogOut').then(() => { | ||
| 30 | Message.error(err) | 24 | Message.error(err) |
| 31 | - next({ path: '/' }) | 25 | + store.dispatch('LogOut').then(() => { |
| 26 | + // next({ path: '/' }) | ||
| 27 | + window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 | ||
| 32 | }) | 28 | }) |
| 33 | }) | 29 | }) |
| 34 | } else { | 30 | } else { |
| ... | @@ -37,16 +33,22 @@ router.beforeEach((to, from, next) => { | ... | @@ -37,16 +33,22 @@ router.beforeEach((to, from, next) => { |
| 37 | } | 33 | } |
| 38 | } else { | 34 | } else { |
| 39 | // 没有token | 35 | // 没有token |
| 36 | + //wsso登录时对后端重定向带来的token进行记录 | ||
| 37 | + let token = location.search.split("token=")[1] | ||
| 38 | + if(token != undefined && token != '' && token != null){ | ||
| 39 | + setToken(token) | ||
| 40 | + next({ path: '/' }) | ||
| 41 | + }else{ | ||
| 40 | if (whiteList.indexOf(to.path) !== -1) { | 42 | if (whiteList.indexOf(to.path) !== -1) { |
| 41 | // 在免登录白名单,直接进入 | 43 | // 在免登录白名单,直接进入 |
| 42 | next() | 44 | next() |
| 43 | } else { | 45 | } else { |
| 44 | - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 | 46 | + window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 |
| 45 | - //NProgress.done() | 47 | + } |
| 46 | } | 48 | } |
| 49 | + | ||
| 47 | } | 50 | } |
| 48 | }) | 51 | }) |
| 49 | 52 | ||
| 50 | router.afterEach(() => { | 53 | router.afterEach(() => { |
| 51 | - //NProgress.done() | ||
| 52 | }) | 54 | }) | ... | ... |
| ... | @@ -106,5 +106,5 @@ export default new Router({ | ... | @@ -106,5 +106,5 @@ export default new Router({ |
| 106 | mode: 'history', // 去掉url中的# | 106 | mode: 'history', // 去掉url中的# |
| 107 | scrollBehavior: () => ({ y: 0 }), | 107 | scrollBehavior: () => ({ y: 0 }), |
| 108 | routes: constantRoutes, | 108 | routes: constantRoutes, |
| 109 | - base: '/iMac' | 109 | + base: '/imacuat' |
| 110 | }) | 110 | }) |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,18 +10,18 @@ const service = axios.create({ | ... | @@ -10,18 +10,18 @@ const service = axios.create({ |
| 10 | // axios中请求配置有baseURL选项,表示请求URL公共部分 | 10 | // axios中请求配置有baseURL选项,表示请求URL公共部分 |
| 11 | //baseURL: process.env.VUE_APP_BASE_API, | 11 | //baseURL: process.env.VUE_APP_BASE_API, |
| 12 | // baseURL: `http://47.103.140.98:7001/IMAC2`, | 12 | // baseURL: `http://47.103.140.98:7001/IMAC2`, |
| 13 | - baseURL: 'https://imacuat.zmd.apac.fedex.com/IMAC2', | 13 | + baseURL: 'https://imacuat.zmd.apac.fedex.com/iMAC', |
| 14 | - // baseURL: 'http://192.168.1.134:18080', | 14 | + // baseURL: 'http://192.168.1.133:7001/IMAC2', |
| 15 | 15 | ||
| 16 | // 超时 | 16 | // 超时 |
| 17 | - timeout: 30000 | 17 | + timeout: 30000, |
| 18 | }) | 18 | }) |
| 19 | // request拦截器 | 19 | // request拦截器 |
| 20 | service.interceptors.request.use(config => { | 20 | service.interceptors.request.use(config => { |
| 21 | // 是否需要设置 token | 21 | // 是否需要设置 token |
| 22 | const isToken = (config.headers || {}).isToken === false | 22 | const isToken = (config.headers || {}).isToken === false |
| 23 | if (getToken() && !isToken) { | 23 | if (getToken() && !isToken) { |
| 24 | - config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 | 24 | + config.headers['Authorization'] = decodeURIComponent(getToken()) // 让每个请求携带自定义token 请根据实际情况自行修改 |
| 25 | } | 25 | } |
| 26 | // get请求映射params参数 | 26 | // get请求映射params参数 |
| 27 | if (config.method === 'get' && config.params) { | 27 | if (config.method === 'get' && config.params) { |
| ... | @@ -58,14 +58,15 @@ service.interceptors.response.use(res => { | ... | @@ -58,14 +58,15 @@ service.interceptors.response.use(res => { |
| 58 | // 获取错误信息 | 58 | // 获取错误信息 |
| 59 | const msg = errorCode[code] || res.data.msg || errorCode['default'] | 59 | const msg = errorCode[code] || res.data.msg || errorCode['default'] |
| 60 | if (code === 301) { | 60 | if (code === 301) { |
| 61 | - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { | 61 | + MessageBox.confirm('登录状态已过期,需重新登录', '系统提示', { |
| 62 | - confirmButtonText: '重新登录', | 62 | + confirmButtonText: '确定', |
| 63 | - cancelButtonText: '取消', | ||
| 64 | type: 'warning' | 63 | type: 'warning' |
| 65 | } | 64 | } |
| 66 | ).then(() => { | 65 | ).then(() => { |
| 67 | - store.dispatch('FedLogOut').then(() => { | 66 | + store.dispatch('LogOut').then(() => { |
| 68 | - location.href = '/index'; | 67 | + // location.href = '/index'; |
| 68 | + window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 | ||
| 69 | + // testsso.ute.apac.fedex.com/iMAC | ||
| 69 | }) | 70 | }) |
| 70 | }); | 71 | }); |
| 71 | } else if (code === 403) { | 72 | } else if (code === 403) { | ... | ... |
| ... | @@ -5,7 +5,7 @@ const mimeMap = { | ... | @@ -5,7 +5,7 @@ const mimeMap = { |
| 5 | xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', | 5 | xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
| 6 | zip: 'application/zip' | 6 | zip: 'application/zip' |
| 7 | } | 7 | } |
| 8 | -const baseUrl = 'https://imacuat.zmd.apac.fedex.com/IMAC2' //uat服务器 | 8 | +const baseUrl = 'https://imacuat.zmd.apac.fedex.com/iMAC' //uat服务器 |
| 9 | // const baseUrl = 'http://47.103.140.98:7001/IMAC2' //阿里云服务器 | 9 | // const baseUrl = 'http://47.103.140.98:7001/IMAC2' //阿里云服务器 |
| 10 | // const baseUrl = 'http://192.168.1.133:7001/IMAC2' //测试服务器 | 10 | // const baseUrl = 'http://192.168.1.133:7001/IMAC2' //测试服务器 |
| 11 | export function downLoadZip(str, filename) { | 11 | export function downLoadZip(str, filename) { |
| ... | @@ -14,36 +14,18 @@ export function downLoadZip(str, filename) { | ... | @@ -14,36 +14,18 @@ export function downLoadZip(str, filename) { |
| 14 | method: 'get', | 14 | method: 'get', |
| 15 | url: url, | 15 | url: url, |
| 16 | responseType: 'blob', | 16 | responseType: 'blob', |
| 17 | - headers: { 'Authorization': getToken() } | 17 | + headers: { 'Authorization': decodeURIComponent(getToken()) } |
| 18 | }).then(res => { | 18 | }).then(res => { |
| 19 | resolveBlob(res, mimeMap.zip) | 19 | resolveBlob(res, mimeMap.zip) |
| 20 | }) | 20 | }) |
| 21 | } | 21 | } |
| 22 | -export function cargoXlsx(str, data) { | 22 | + |
| 23 | - var url = baseUrl + str | ||
| 24 | - return new Promise((resolve,rej)=>{ | ||
| 25 | - axios({ | ||
| 26 | - method: 'post', | ||
| 27 | - url: url, | ||
| 28 | - data: data, | ||
| 29 | - responseType: 'blob', | ||
| 30 | - headers: { 'Authorization': getToken() } | ||
| 31 | - }).then(res => { | ||
| 32 | - if (res.status === 200) { | ||
| 33 | - cargoTableXlsx(res) | ||
| 34 | - } | ||
| 35 | - resolve() | ||
| 36 | - }).catch((err)=>{ | ||
| 37 | - rej(err) | ||
| 38 | - }) | ||
| 39 | - }) | ||
| 40 | -} | ||
| 41 | /** | 23 | /** |
| 42 | * 解析blob响应内容并下载 | 24 | * 解析blob响应内容并下载 |
| 43 | * @param {*} res blob响应内容 | 25 | * @param {*} res blob响应内容 |
| 44 | * @param {String} mimeType MIME类型 | 26 | * @param {String} mimeType MIME类型 |
| 45 | */ | 27 | */ |
| 46 | -export function resolveBlob(res, mimeType) { | 28 | + export function resolveBlob(res, mimeType) { |
| 47 | const aLink = document.createElement('a') | 29 | const aLink = document.createElement('a') |
| 48 | var blob = new Blob([res], { type: mimeType }) | 30 | var blob = new Blob([res], { type: mimeType }) |
| 49 | // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; | 31 | // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; |
| ... | @@ -59,10 +41,31 @@ export function resolveBlob(res, mimeType) { | ... | @@ -59,10 +41,31 @@ export function resolveBlob(res, mimeType) { |
| 59 | document.body.removeChild(aLink); | 41 | document.body.removeChild(aLink); |
| 60 | } | 42 | } |
| 61 | 43 | ||
| 62 | -//货物查询表导出 | 44 | +// excel导出请求 |
| 63 | -export function cargoTableXlsx(val) { | 45 | +export function downLoadXlsx(str, data,fileName) { |
| 46 | + var url = baseUrl + str | ||
| 47 | + return new Promise((resolve,rej)=>{ | ||
| 48 | + axios({ | ||
| 49 | + method: 'post', | ||
| 50 | + url: url, | ||
| 51 | + data: data, | ||
| 52 | + responseType: 'blob', | ||
| 53 | + headers: { 'Authorization': decodeURIComponent(getToken()) } | ||
| 54 | + }).then(res => { | ||
| 55 | + if (res.status === 200) { | ||
| 56 | + cargoTableXlsx(res,fileName) | ||
| 57 | + } | ||
| 58 | + resolve() | ||
| 59 | + }).catch((err)=>{ | ||
| 60 | + rej(err) | ||
| 61 | + }) | ||
| 62 | + }) | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +//excel导出下载 | ||
| 66 | +export function downLoadExcal(val,fileNames) { | ||
| 64 | const aLink = document.createElement('a') | 67 | const aLink = document.createElement('a') |
| 65 | - const fileName = "货物查询表.xlsx" | 68 | + const fileName = fileNames+".xlsx" |
| 66 | aLink.href = URL.createObjectURL(val.data) | 69 | aLink.href = URL.createObjectURL(val.data) |
| 67 | aLink.setAttribute('download', fileName) // 设置下载文件名称 | 70 | aLink.setAttribute('download', fileName) // 设置下载文件名称 |
| 68 | document.body.appendChild(aLink) | 71 | document.body.appendChild(aLink) | ... | ... |
| ... | @@ -288,7 +288,6 @@ | ... | @@ -288,7 +288,6 @@ |
| 288 | }, | 288 | }, |
| 289 | /** 删除 启用 停用按钮操作 */ | 289 | /** 删除 启用 停用按钮操作 */ |
| 290 | handleDeleteorPlayorpause(row, status, statusText) { | 290 | handleDeleteorPlayorpause(row, status, statusText) { |
| 291 | - // debugger | ||
| 292 | //删除前需要停用 | 291 | //删除前需要停用 |
| 293 | if (status === 0 && row.status != '3') { | 292 | if (status === 0 && row.status != '3') { |
| 294 | this.$message({ | 293 | this.$message({ | ... | ... |
| ... | @@ -473,13 +473,11 @@ | ... | @@ -473,13 +473,11 @@ |
| 473 | findFltConditionData() { | 473 | findFltConditionData() { |
| 474 | findFltConditionDataApi().then(response => { | 474 | findFltConditionDataApi().then(response => { |
| 475 | if (response.code == 200) { | 475 | if (response.code == 200) { |
| 476 | - // debugger | ||
| 477 | //航班种类 | 476 | //航班种类 |
| 478 | this.flightKindlist = response.data.flightKind; | 477 | this.flightKindlist = response.data.flightKind; |
| 479 | //航班类型 | 478 | //航班类型 |
| 480 | this.flightTypelist = response.data.flightType; | 479 | this.flightTypelist = response.data.flightType; |
| 481 | //航班状态 | 480 | //航班状态 |
| 482 | - // debugger | ||
| 483 | this.flightStatuslist = response.data.flightStatus; | 481 | this.flightStatuslist = response.data.flightStatus; |
| 484 | 482 | ||
| 485 | } else { | 483 | } else { |
| ... | @@ -657,7 +655,6 @@ | ... | @@ -657,7 +655,6 @@ |
| 657 | submitForm: function() { | 655 | submitForm: function() { |
| 658 | this.$refs["form"].validate(valid => { | 656 | this.$refs["form"].validate(valid => { |
| 659 | if (valid) { | 657 | if (valid) { |
| 660 | - //debugger | ||
| 661 | let formdata = JSON.parse(JSON.stringify(this.form)); | 658 | let formdata = JSON.parse(JSON.stringify(this.form)); |
| 662 | 659 | ||
| 663 | //高价百分比和低价百分比和不可以大于100 | 660 | //高价百分比和低价百分比和不可以大于100 | ... | ... |
| ... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
| 2 | <div class="cargoPage"> | 2 | <div class="cargoPage"> |
| 3 | <el-form | 3 | <el-form |
| 4 | ref="cargoForm" | 4 | ref="cargoForm" |
| 5 | + class="form-header" | ||
| 5 | size="small" | 6 | size="small" |
| 6 | :model="formData" | 7 | :model="formData" |
| 7 | label-position="top" | 8 | label-position="top" |
| ... | @@ -304,17 +305,17 @@ | ... | @@ -304,17 +305,17 @@ |
| 304 | @click="select" | 305 | @click="select" |
| 305 | >查询</el-button | 306 | >查询</el-button |
| 306 | > | 307 | > |
| 307 | - <el-button type="primary" size="small" @click="checks(tableData)" | 308 | + <!-- <el-button type="primary" size="small" @click="checks(tableData)" |
| 308 | >全选/全否</el-button | 309 | >全选/全否</el-button |
| 310 | + > --> | ||
| 311 | + <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(0)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" | ||
| 312 | + >{{downLoadingTip.downloading?downLoadingTip.tip:"导出本页查询结果"}}</el-button | ||
| 309 | > | 313 | > |
| 310 | - <el-button type="primary" size="small" @click="xlse(0)" v-dbClick :disabled="tableData.length==0" :loading="downloading" | 314 | + <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(1)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" |
| 311 | - >导出本页查询结果</el-button | 315 | + >{{downLoadingTip.downloading?downLoadingTip.tip:"导出全部查询结果"}}</el-button |
| 312 | - > | ||
| 313 | - <el-button type="primary" size="small" @click="xlse(1)" v-dbClick :disabled="tableData.length==0" :loading="downloading" | ||
| 314 | - >导出全部查询结果</el-button | ||
| 315 | > | 316 | > |
| 316 | <div class="tips"> | 317 | <div class="tips"> |
| 317 | - <span style="paddingright: 50px">总重量:{{ allWeight }}</span> | 318 | + <span style="paddingRight: 50px">总重量:{{ allWeight }}</span> |
| 318 | <span>总件数:{{ allQty }}</span> | 319 | <span>总件数:{{ allQty }}</span> |
| 319 | </div> | 320 | </div> |
| 320 | </div> | 321 | </div> |
| ... | @@ -362,7 +363,7 @@ | ... | @@ -362,7 +363,7 @@ |
| 362 | 363 | ||
| 363 | <script> | 364 | <script> |
| 364 | import { findConditionData, findCargoData } from "@/api/cargoSelect"; | 365 | import { findConditionData, findCargoData } from "@/api/cargoSelect"; |
| 365 | -import { cargoXlsx } from "@/utils/zipdownload"; | 366 | +import { downLoadXlsx } from "@/utils/zipdownload"; |
| 366 | 367 | ||
| 367 | export default { | 368 | export default { |
| 368 | name:"queryCargo", | 369 | name:"queryCargo", |
| ... | @@ -448,7 +449,10 @@ export default { | ... | @@ -448,7 +449,10 @@ export default { |
| 448 | start: -1, | 449 | start: -1, |
| 449 | valueFormat: "yyyy-MM-dd", | 450 | valueFormat: "yyyy-MM-dd", |
| 450 | tableLoading: false, | 451 | tableLoading: false, |
| 452 | + downLoadingTip:{ | ||
| 453 | + tip:"", | ||
| 451 | downloading:false, | 454 | downloading:false, |
| 455 | + }, | ||
| 452 | totalCount: 0, | 456 | totalCount: 0, |
| 453 | selectTable: [], | 457 | selectTable: [], |
| 454 | flightTime: [], | 458 | flightTime: [], |
| ... | @@ -650,7 +654,7 @@ export default { | ... | @@ -650,7 +654,7 @@ export default { |
| 650 | }, | 654 | }, |
| 651 | // 导出表格 | 655 | // 导出表格 |
| 652 | xlse(page) { | 656 | xlse(page) { |
| 653 | - this.downloading = true; | 657 | + this.downLoadingTip.downloading = true; |
| 654 | let cargoXlse = {title:"货物导出表",cargoConditionDto:{}}; | 658 | let cargoXlse = {title:"货物导出表",cargoConditionDto:{}}; |
| 655 | if(this.formData.customsReceiptStatusId != null && this.formData.customsReceiptStatusId.length < 1){ | 659 | if(this.formData.customsReceiptStatusId != null && this.formData.customsReceiptStatusId.length < 1){ |
| 656 | this.formData.customsReceiptStatusId = null; | 660 | this.formData.customsReceiptStatusId = null; |
| ... | @@ -687,16 +691,35 @@ export default { | ... | @@ -687,16 +691,35 @@ export default { |
| 687 | cargoXlse.cargoConditionDto.limitSize = this.limitSize; | 691 | cargoXlse.cargoConditionDto.limitSize = this.limitSize; |
| 688 | 692 | ||
| 689 | if (page == 0) { | 693 | if (page == 0) { |
| 694 | + this.downLoadingTip.tip = "正在导出本页结果集" | ||
| 690 | cargoXlse.cargoConditionDto.limitStart = this.limitStart; | 695 | cargoXlse.cargoConditionDto.limitStart = this.limitStart; |
| 696 | + downLoadXlsx("/cargo/excel",cargoXlse,"货物查询表").then(()=>{ | ||
| 697 | + this.downLoadingTip.downloading = false; | ||
| 698 | + this.downLoadingTip.tip = "" | ||
| 699 | + }).catch(()=>{ | ||
| 700 | + this.downLoadingTip.downloading = false; | ||
| 701 | + this.downLoadingTip.tip = "" | ||
| 702 | + }) | ||
| 691 | } else { | 703 | } else { |
| 704 | + if(this.totalCount < 100000){ | ||
| 705 | + this.downLoadingTip.tip = "正在导出全部结果集" | ||
| 692 | cargoXlse.cargoConditionDto.limitStart = 0; | 706 | cargoXlse.cargoConditionDto.limitStart = 0; |
| 693 | cargoXlse.cargoConditionDto.limitSize = -1; | 707 | cargoXlse.cargoConditionDto.limitSize = -1; |
| 694 | - } | 708 | + downLoadXlsx("/cargo/excel",cargoXlse,"货物查询表").then(()=>{ |
| 695 | - cargoXlsx("/cargo/excel",cargoXlse).then(()=>{ | 709 | + this.downLoadingTip.downloading = false; |
| 696 | - this.downloading = false; | 710 | + this.downLoadingTip.tip = "" |
| 697 | }).catch(()=>{ | 711 | }).catch(()=>{ |
| 698 | - this.downloading = false; | 712 | + this.downLoadingTip.downloading = false; |
| 713 | + this.downLoadingTip.tip = "" | ||
| 699 | }) | 714 | }) |
| 715 | + }else{ | ||
| 716 | + this.downLoadingTip.downloading = false; | ||
| 717 | + this.$message({ | ||
| 718 | + message: "数据量过大无法导出", | ||
| 719 | + type: "warning", | ||
| 720 | + }); | ||
| 721 | + } | ||
| 722 | + } | ||
| 700 | }, | 723 | }, |
| 701 | //表格格式化 | 724 | //表格格式化 |
| 702 | formatter(row,column,cellValue,index){ | 725 | formatter(row,column,cellValue,index){ |
| ... | @@ -754,8 +777,4 @@ export default { | ... | @@ -754,8 +777,4 @@ export default { |
| 754 | font-size: 14px; | 777 | font-size: 14px; |
| 755 | margin-right: 40px; | 778 | margin-right: 40px; |
| 756 | } | 779 | } |
| 757 | -.formItem { | ||
| 758 | - width:100%; | ||
| 759 | - max-width: 300px; | ||
| 760 | -} | ||
| 761 | </style> | 780 | </style> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | - <div class="login"> | 2 | + <div class="login" :style="display"> |
| 3 | - <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> | 3 | + <el-form |
| 4 | + ref="loginForm" | ||
| 5 | + :model="loginForm" | ||
| 6 | + :rules="loginRules" | ||
| 7 | + class="login-form" | ||
| 8 | + > | ||
| 4 | <h3 class="title">IMAC后台管理系统</h3> | 9 | <h3 class="title">IMAC后台管理系统</h3> |
| 5 | <el-form-item prop="username"> | 10 | <el-form-item prop="username"> |
| 6 | - <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号"> | 11 | + <el-input |
| 7 | - <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> | 12 | + v-model="loginForm.username" |
| 13 | + type="text" | ||
| 14 | + auto-complete="off" | ||
| 15 | + placeholder="账号" | ||
| 16 | + > | ||
| 17 | + <svg-icon | ||
| 18 | + slot="prefix" | ||
| 19 | + icon-class="user" | ||
| 20 | + class="el-input__icon input-icon" | ||
| 21 | + /> | ||
| 8 | </el-input> | 22 | </el-input> |
| 9 | </el-form-item> | 23 | </el-form-item> |
| 10 | <el-form-item prop="password"> | 24 | <el-form-item prop="password"> |
| ... | @@ -15,17 +29,20 @@ | ... | @@ -15,17 +29,20 @@ |
| 15 | placeholder="密码" | 29 | placeholder="密码" |
| 16 | @keyup.enter.native="handleLogin" | 30 | @keyup.enter.native="handleLogin" |
| 17 | > | 31 | > |
| 18 | - <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> | 32 | + <svg-icon |
| 33 | + slot="prefix" | ||
| 34 | + icon-class="password" | ||
| 35 | + class="el-input__icon input-icon" | ||
| 36 | + /> | ||
| 19 | </el-input> | 37 | </el-input> |
| 20 | </el-form-item> | 38 | </el-form-item> |
| 21 | - | ||
| 22 | <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> --> | 39 | <!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> --> |
| 23 | - <el-form-item style="width:100%;marginTop:44px"> | 40 | + <el-form-item style="width: 100%; marginTop: 44px"> |
| 24 | <el-button | 41 | <el-button |
| 25 | :loading="loading" | 42 | :loading="loading" |
| 26 | size="medium" | 43 | size="medium" |
| 27 | type="primary" | 44 | type="primary" |
| 28 | - style="width:100%;" | 45 | + style="width: 100%" |
| 29 | @click.native.prevent="handleLogin" | 46 | @click.native.prevent="handleLogin" |
| 30 | > | 47 | > |
| 31 | <span v-if="!loading">登 录</span> | 48 | <span v-if="!loading">登 录</span> |
| ... | @@ -43,7 +60,7 @@ | ... | @@ -43,7 +60,7 @@ |
| 43 | <script> | 60 | <script> |
| 44 | import { getCodeImg } from "@/api/login"; | 61 | import { getCodeImg } from "@/api/login"; |
| 45 | //import Cookies from "js-cookie"; | 62 | //import Cookies from "js-cookie"; |
| 46 | -import { encrypt, } from '@/utils/jsencrypt' | 63 | +import { encrypt } from "@/utils/jsencrypt"; |
| 47 | 64 | ||
| 48 | export default { | 65 | export default { |
| 49 | name: "Login", | 66 | name: "Login", |
| ... | @@ -54,18 +71,19 @@ export default { | ... | @@ -54,18 +71,19 @@ export default { |
| 54 | loginForm: { | 71 | loginForm: { |
| 55 | username: "root", | 72 | username: "root", |
| 56 | password: "123", | 73 | password: "123", |
| 57 | - rememberMe: false | 74 | + rememberMe: false, |
| 58 | }, | 75 | }, |
| 59 | loginRules: { | 76 | loginRules: { |
| 60 | username: [ | 77 | username: [ |
| 61 | - { required: true, trigger: "blur", message: "用户名不能为空" } | 78 | + { required: true, trigger: "blur", message: "用户名不能为空" }, |
| 62 | ], | 79 | ], |
| 63 | password: [ | 80 | password: [ |
| 64 | - { required: true, trigger: "blur", message: "密码不能为空" } | 81 | + { required: true, trigger: "blur", message: "密码不能为空" }, |
| 65 | - ] | 82 | + ], |
| 66 | }, | 83 | }, |
| 67 | loading: false, | 84 | loading: false, |
| 68 | - redirect: undefined | 85 | + redirect: undefined, |
| 86 | + display: "display:none", | ||
| 69 | }; | 87 | }; |
| 70 | }, | 88 | }, |
| 71 | watch: { | 89 | watch: { |
| ... | @@ -77,50 +95,57 @@ export default { | ... | @@ -77,50 +95,57 @@ export default { |
| 77 | } | 95 | } |
| 78 | }, | 96 | }, |
| 79 | created() { | 97 | created() { |
| 80 | - | ||
| 81 | this.getCookie(); | 98 | this.getCookie(); |
| 82 | }, | 99 | }, |
| 83 | methods: { | 100 | methods: { |
| 84 | - | ||
| 85 | getCookie() { | 101 | getCookie() { |
| 86 | const username = localStorage.getItem("username"); | 102 | const username = localStorage.getItem("username"); |
| 87 | const password = localStorage.getItem("password"); | 103 | const password = localStorage.getItem("password"); |
| 88 | - const rememberMe = localStorage.getItem('rememberMe') | 104 | + const rememberMe = localStorage.getItem("rememberMe"); |
| 89 | this.loginForm = { | 105 | this.loginForm = { |
| 90 | username: username === undefined ? this.loginForm.username : username, | 106 | username: username === undefined ? this.loginForm.username : username, |
| 91 | password: password === undefined ? this.loginForm.password : password, | 107 | password: password === undefined ? this.loginForm.password : password, |
| 92 | - rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) | 108 | + rememberMe: rememberMe === undefined ? false : Boolean(rememberMe), |
| 93 | }; | 109 | }; |
| 94 | }, | 110 | }, |
| 95 | handleLogin() { | 111 | handleLogin() { |
| 96 | - this.$refs.loginForm.validate(valid => { | 112 | + this.$refs.loginForm.validate((valid) => { |
| 97 | if (valid) { | 113 | if (valid) { |
| 98 | this.loading = true; | 114 | this.loading = true; |
| 99 | if (this.loginForm.rememberMe) { | 115 | if (this.loginForm.rememberMe) { |
| 100 | - localStorage.setItem("username", this.loginForm.username, { expires: 30 }); | 116 | + localStorage.setItem("username", this.loginForm.username, { |
| 101 | - localStorage.setItem("password", this.loginForm.password, { expires: 30 }); | 117 | + expires: 30, |
| 102 | - localStorage.setItem('rememberMe', this.loginForm.rememberMe, { expires: 30 }); | 118 | + }); |
| 119 | + localStorage.setItem("password", this.loginForm.password, { | ||
| 120 | + expires: 30, | ||
| 121 | + }); | ||
| 122 | + localStorage.setItem("rememberMe", this.loginForm.rememberMe, { | ||
| 123 | + expires: 30, | ||
| 124 | + }); | ||
| 103 | } else { | 125 | } else { |
| 104 | localStorage.removeItem("username"); | 126 | localStorage.removeItem("username"); |
| 105 | localStorage.removeItem("password"); | 127 | localStorage.removeItem("password"); |
| 106 | - localStorage.removeItem('rememberMe'); | 128 | + localStorage.removeItem("rememberMe"); |
| 107 | } | 129 | } |
| 108 | - this.$store.dispatch("Login", this.loginForm).then(() => { | 130 | + this.$store |
| 109 | - this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); | 131 | + .dispatch("Login", this.loginForm) |
| 110 | - }).catch(() => { | 132 | + .then(() => { |
| 133 | + this.$router.push({ path: this.redirect || "/" }).catch(() => {}); | ||
| 134 | + }) | ||
| 135 | + .catch(() => { | ||
| 111 | this.loading = false; | 136 | this.loading = false; |
| 112 | //this.getCode(); | 137 | //this.getCode(); |
| 113 | }); | 138 | }); |
| 114 | } | 139 | } |
| 115 | }); | 140 | }); |
| 116 | - } | 141 | + }, |
| 117 | - } | 142 | + }, |
| 118 | }; | 143 | }; |
| 119 | </script> | 144 | </script> |
| 120 | 145 | ||
| 121 | <style rel="stylesheet/scss" lang="scss"> | 146 | <style rel="stylesheet/scss" lang="scss"> |
| 122 | .login { | 147 | .login { |
| 123 | - display: flex; | 148 | + display: none; |
| 124 | justify-content: center; | 149 | justify-content: center; |
| 125 | align-items: center; | 150 | align-items: center; |
| 126 | height: 100%; | 151 | height: 100%; | ... | ... |
| 1 | -//version:0.5.2 | ||
| 2 | 'use strict' | 1 | 'use strict' |
| 3 | const path = require('path') | 2 | const path = require('path') |
| 4 | const defaultSettings = require('./src/settings.js') | 3 | const defaultSettings = require('./src/settings.js') |
| ... | @@ -18,7 +17,7 @@ module.exports = { | ... | @@ -18,7 +17,7 @@ module.exports = { |
| 18 | // 部署生产环境和开发环境下的URL。 | 17 | // 部署生产环境和开发环境下的URL。 |
| 19 | // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 | 18 | // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 |
| 20 | // 例如 https://www.FedEx.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.FedEx.vip/admin/,则设置 baseUrl 为 /admin/。 | 19 | // 例如 https://www.FedEx.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.FedEx.vip/admin/,则设置 baseUrl 为 /admin/。 |
| 21 | - publicPath: process.env.NODE_ENV === "production" ? "/iMac/" : "/", | 20 | + publicPath: process.env.NODE_ENV === "production" ? "/imacuat/" : "/", |
| 22 | // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) | 21 | // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) |
| 23 | outputDir: 'dist', | 22 | outputDir: 'dist', |
| 24 | // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) | 23 | // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) |
| ... | @@ -35,7 +34,7 @@ module.exports = { | ... | @@ -35,7 +34,7 @@ module.exports = { |
| 35 | proxy: { | 34 | proxy: { |
| 36 | // detail: https://cli.vuejs.org/config/#devserver-proxy | 35 | // detail: https://cli.vuejs.org/config/#devserver-proxy |
| 37 | [process.env.VUE_APP_BASE_API]: { | 36 | [process.env.VUE_APP_BASE_API]: { |
| 38 | - target: `https://imacuat.zmd.apac.fedex.com/IMAC2`, | 37 | + target: `https://imacuat.zmd.apac.fedex.com/iMAC`, |
| 39 | // target: `http://47.103.140.98:7001/IMAC2`, | 38 | // target: `http://47.103.140.98:7001/IMAC2`, |
| 40 | // target: `http://192.168.1.134:18080`, | 39 | // target: `http://192.168.1.134:18080`, |
| 41 | changeOrigin: true, | 40 | changeOrigin: true, | ... | ... |
-
Please register or login to post a comment