jinhui.wang

Merge branch 'master' into dev

import service from "../utils/request";
import request from '@/utils/request'
export function downLoadTemplate(template) {
......
import service from "../utils/request";
import request from '@/utils/request'
// 查询航班种类
......
let ductLabels = {
let ductLabels = {
"cargoRulesStatus":{
"1":"手动",
"2":"自动"
......
......@@ -85,6 +85,7 @@
.formItem {
width: 100%;
max-width: 310px;
// max-width: 310px;
}
}
......
......@@ -207,7 +207,6 @@ export default {
this.pageNum = this.page;
}
},
mounted() {},
methods: {
nextClick() {
this.$emit("currentChange", {
......@@ -226,7 +225,7 @@ export default {
currentChange(val) {
this.$emit("currentChange", {
page: val,
start: val > 1 ? (val-1) * this.limitSize + 1 : val,
start: val > 1 ? (val-1) * this.limitSize + 1 : val,
});
scrollTo(0, 800);
},
......@@ -245,15 +244,15 @@ export default {
} else if (selection.includes(this.data[row.index])) {
if (!selection.includes(this.data[this.start])) {
this.$refs.tables.toggleRowSelection(this.data[this.start], true);
if(this.selectTable.includes(this.data[this.start])){
if (this.selectTable.includes(this.data[this.start])) {
this.selectTable.push(this.data[this.start]);
}
}
for (i = min; i <= sum + min; i++) {
this.$refs.tables.toggleRowSelection(this.data[i], true);
if(!this.selectTable.includes(this.data[i])){
if (!this.selectTable.includes(this.data[i])) {
this.selectTable.push(this.data[i]);
}
}
}
} else if (!selection.includes(this.data[row.index])) {
this.selectTable.splice(min > 1 ? min - 2 : min, sum + 1);
......@@ -274,7 +273,7 @@ export default {
}
}
}
selection = this.selectTable.sort(this.compare('index','ascending'));
selection = this.selectTable.sort(this.compare("index", "ascending"));
this.$emit("tableSelect", { selection, row });
},
tableSelectAll(selection) {
......
......@@ -22,11 +22,12 @@
trigger="click"
>
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar" />
<img :src="avatar" class="user-avatar">
</div>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item @click.native.stop="drawer = true">个人中心</el-dropdown-item> -->
<el-dropdown-item @click.native="logout">
<router-link to="/user/profile">
</router-link>
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
......
import router from './router'
import store from './store'
import { Message } from 'element-ui'
//import NProgress from 'nprogress'
//import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { getToken,setToken } from '@/utils/auth'
//NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => {
//NProgress.start()
if (getToken()) {
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
//NProgress.done()
} else {
if (store.getters.roles.length === 0) {
// 判断当前用户是否已拉取完user_info信息
......@@ -26,9 +21,10 @@ router.beforeEach((to, from, next) => {
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
})
}).catch(err => {
Message.error(err)
store.dispatch('LogOut').then(() => {
Message.error(err)
next({ path: '/' })
// next({ path: '/' })
window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转
})
})
} else {
......@@ -37,16 +33,22 @@ router.beforeEach((to, from, next) => {
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
//NProgress.done()
//wsso登录时对后端重定向带来的token进行记录
let token = location.search.split("token=")[1]
if(token != undefined && token != '' && token != null){
setToken(token)
next({ path: '/' })
}else{
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转
}
}
}
})
router.afterEach(() => {
//NProgress.done()
})
......
......@@ -42,5 +42,5 @@ module.exports = {
/**
* 版本号
*/
version:'version:1.0.0'
version:'version:1.0.5'
}
......
......@@ -5,178 +5,178 @@
const baseURL = process.env.VUE_APP_BASE_API
// 日期格式化
export function parseTime(time, pattern) {
//debugger
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
// 表单重置
export function resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
// 添加日期范围
export function addDateRange(params, dateRange, propName) {
var search = params;
search.params = {};
if (null != dateRange && '' != dateRange) {
if (typeof (propName) === "undefined") {
search.params["beginTime"] = dateRange[0];
search.params["endTime"] = dateRange[1];
} else {
search.params["begin" + propName] = dateRange[0];
search.params["end" + propName] = dateRange[1];
}
}
return search;
}
// 回显数据字典
export function selectDictLabel(datas, value) {
var actions = [];
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + value)) {
actions.push(datas[key].dictLabel);
return true;
}
})
return actions.join('');
}
// 回显数据字典(字符串数组)
export function selectDictLabels(datas, value, separator) {
var actions = [];
var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator);
Object.keys(value.split(currentSeparator)).some((val) => {
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator);
}
})
})
return actions.join('').substring(0, actions.join('').length - 1);
}
// 通用下载方法
export function download(fileName) {
window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
}
// 字符串格式化(%s )
export function sprintf(str) {
var args = arguments, flag = true, i = 1;
str = str.replace(/%s/g, function () {
var arg = args[i++];
if (typeof arg === 'undefined') {
flag = false;
return '';
}
return arg;
});
return flag ? str : '';
}
// 转换字符串,undefined,null等转化为""
export function praseStrEmpty(str) {
if (!str || str == "undefined" || str == "null") {
return "";
}
return str;
}
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
export function handleTree(data, id, parentId, children) {
let config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (let t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
return tree;
}
//字符串英文转大写,;转英文;
export function upCase(str){
let newStr = str.replace(/;/g,";").toUpperCase();
return newStr;
}
\ No newline at end of file
// 日期格式化
export function parseTime(time, pattern) {
debugger
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
// 表单重置
export function resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
// 添加日期范围
export function addDateRange(params, dateRange, propName) {
var search = params;
search.params = {};
if (null != dateRange && '' != dateRange) {
if (typeof (propName) === "undefined") {
search.params["beginTime"] = dateRange[0];
search.params["endTime"] = dateRange[1];
} else {
search.params["begin" + propName] = dateRange[0];
search.params["end" + propName] = dateRange[1];
}
}
return search;
}
// 回显数据字典
export function selectDictLabel(datas, value) {
var actions = [];
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + value)) {
actions.push(datas[key].dictLabel);
return true;
}
})
return actions.join('');
}
// 回显数据字典(字符串数组)
export function selectDictLabels(datas, value, separator) {
var actions = [];
var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator);
Object.keys(value.split(currentSeparator)).some((val) => {
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator);
}
})
})
return actions.join('').substring(0, actions.join('').length - 1);
}
// 通用下载方法
export function download(fileName) {
window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
}
// 字符串格式化(%s )
export function sprintf(str) {
var args = arguments, flag = true, i = 1;
str = str.replace(/%s/g, function () {
var arg = args[i++];
if (typeof arg === 'undefined') {
flag = false;
return '';
}
return arg;
});
return flag ? str : '';
}
// 转换字符串,undefined,null等转化为""
export function praseStrEmpty(str) {
if (!str || str == "undefined" || str == "null") {
return "";
}
return str;
}
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
export function handleTree(data, id, parentId, children) {
let config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (let t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
return tree;
}
//字符串英文转大写,;转英文;
export function upCase(str){
let newStr = str.replace(/;/g,";").toUpperCase().trim();
return newStr;
}
......
import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
import { Message,MessageBox } from 'element-ui'
import store from '@/store'
import { getToken, setToken } from '@/utils/auth'
import { getToken,setToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
......@@ -54,7 +54,7 @@ service.interceptors.request.use(config => {
// 响应拦截器
service.interceptors.response.use(res => {
if(res.headers['token']){
setToken(decodeURI(res.headers['token']))
setToken(decodeURIComponent(res.headers['token']))
}
// 未设置状态码则默认成功状态
const code = res.data.code || 200;
......@@ -81,7 +81,7 @@ service.interceptors.response.use(res => {
type: 'error'
})
return Promise.reject(new Error(msg))
} else if (code !== 200 && code !== 201 && code !== 202) {
} else if (code !== 200 && code !== 201 && code !== 202 && code !== 603) {
Message({
message: msg,
type: 'error'
......
......@@ -119,7 +119,7 @@ export default {
},
],
},
loading:false,
loading:false
};
},
methods: {
......@@ -133,7 +133,7 @@ export default {
},
//确定配舱
submit() {
this.loading= true;
this.loading = true;
let arr = [];
this.tableData.forEach((item) => {
arr.push(item.id);
......
......@@ -13,10 +13,11 @@
v-model.trim="purposeOfFlightNo"
placeholder="航班号"
@keyup.enter.native="getList"
clearable
></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.status" placeholder="状态">
<el-select v-model="queryParams.status" placeholder="状态" clearable>
<el-option label="有效" value="1"></el-option>
<el-option label="停用" value="3"></el-option>
</el-select>
......@@ -36,12 +37,25 @@
type="primary"
icon="el-icon-plus"
size="mini"
@click="$router.push({ name: 'FlightAllocConfigAdd', params: { handle: 'add' } })"
@click="
$router.push({
name: 'FlightAllocConfigAdd',
params: { handle: 'add' },
})
"
>添加</el-button
>
</div>
</el-form>
<el-table :data="flyList" v-loading="loading" size="small" highlight-current-row border stripe>
<el-table
:data="flyList"
v-loading="loading"
size="small"
highlight-current-row
border
stripe
>
<el-table-column
prop="purposeOfFlightNo"
label="航班号"
......@@ -128,15 +142,13 @@ import {
enableOrDisable,
} from "@/api/destinationFlight";
import { parseTime } from "@/utils/FedEx";
export default {
name:"FlightAllocConfig",
name: "FlightAllocConfig",
data() {
return {
queryParams: {
purposeOfFlightNo: "",
status:"1",
status: "1",
start: 0,
limit: 10,
},
......@@ -194,18 +206,17 @@ export default {
cancelButtonText: "取消",
showCancelButton: true,
type: "warning",
})
.then(()=> {
delFlightId(id)
}).then(() => {
delFlightId(id)
.then((res) => {
this.$message({
message: res.msg,
type: res.code === 200 ? "success" : "warning",
});
this.getList()
this.getList();
})
.catch(() => {});
})
});
}
},
//启用,停用
......@@ -215,9 +226,9 @@ export default {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(()=> {
enableOrDisable(id, status).then((res) => {
}).then(() => {
enableOrDisable(id, status)
.then((res) => {
if (res.code != 200) {
this.msgError(res.msg);
} else {
......@@ -225,23 +236,23 @@ export default {
this.msgSuccess(tip + "成功");
}
})
.catch(()=> {});
})
.catch(() => {});
});
},
},
created() {
this.getList();
},
computed:{
computed: {
purposeOfFlightNo: {
get: function () {
return this.queryParams.purposeOfFlightNo;
},
set: function (val) {
this.queryParams.purposeOfFlightNo = val.toUpperCase()
this.queryParams.purposeOfFlightNo = val.toUpperCase();
},
},
}
},
};
</script>
......
......@@ -503,10 +503,28 @@ export default {
created() {
let handle = this.$route.params.handle;
allDictData().then((response) => {
if (response.code != 200) {
this.$message({
showClose: true,
message: response.msg,
type: "error",
});
return;
}
let dict = response.data;
this.cargoType = dict.cargoType;
this.cargoStatus = dict.cargoStatus;
this.serviceCode = dict.serviceCode.sort((a, b) =>
a.englishName.localeCompare(b.englishName)
);
this.handlingCode = this.sorttodo(dict.handlingCode, "BLANK");
this.subCategory = dict.subCategory;
});
this.routeName = this.$route.name;
this.dataId = this.$route.params.id;
this.handleName = this.$route.params.handle;
this.dictData()
if (handle === "detail") {
this.disable = true;
}
......
<template>
<div>
<el-form class="form-header" :model="queryParams" label-position="right" label-width="auto" size="medium">
<div class="app-container">
<el-form
class="form-header"
:model="queryParams"
label-position="right"
label-width="auto"
size="medium"
>
<el-row>
<el-col :span="6">
<el-form-item label="航班日期从" prop="fltDateStart">
......@@ -87,27 +93,26 @@
</el-switch>
</el-col>
</el-row>
<div style="margin-top:25px">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
type="warning"
:disabled="tableData.length == 0"
@click="xlse()"
:loading="downLoadingTip.downloading"
icon="el-icon-download"
size="mini"
>{{
downLoadingTip.downloading ? downLoadingTip.tip : "导出"
}}</el-button
>
<div style="margin-top: 25px">
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
type="warning"
:disabled="tableData.length == 0"
@click="xlse()"
:loading="downLoadingTip.downloading"
icon="el-icon-download"
size="mini"
>{{
downLoadingTip.downloading ? downLoadingTip.tip : "导出"
}}</el-button
>
</div>
</el-form>
<el-table
......@@ -122,23 +127,27 @@
label="运单号"
align="center"
prop="waybillNo"
width="150"
/>
<el-table-column
:show-overflow-tooltip="true"
label="品牌描述"
align="center"
prop="nameDescription"
width="150"
/>
<el-table-column
label="航班日期"
align="center"
prop="fltDate"
width="150"
/>
<el-table-column label="航班号" align="center" prop="fltNo" width="100"/>
<el-table-column label="航班号" align="center" prop="fltNo" />
<el-table-column
label="航班路线"
align="center"
prop="route"
width="150"
/>
<el-table-column
label="配置航班类型"
......@@ -146,9 +155,9 @@
prop="kindName"
width="130"
/>
<el-table-column label="尺寸" align="center" prop="sizeStr" width="70"/>
<el-table-column label="件数" align="center" prop="qty" width="70"/>
<el-table-column label="实际重量" align="center" prop="actualWeight" width="100"/>
<el-table-column label="尺寸" align="center" prop="sizeStr" />
<el-table-column label="件数" align="center" prop="qty" />
<el-table-column label="实际重量" align="center" prop="actualWeight" />
<el-table-column
label="创建时间"
align="center"
......@@ -255,12 +264,6 @@ export default {
this.tableData = response.data.list;
this.total = response.data.totalCount;
this.loading = false;
if(response.data.list.length == 0){
this.$message({
message: "未查询到数据",
type: "warning",
});
}
} else {
this.msgError(response.msg);
}
......
......@@ -81,7 +81,6 @@
uploadExcel(option) {
//上传excel
const file = option.file;
console.log(option);
this.loading=true;
importcaPreReview(file, this.form.type).then((res) => {
this.loading=false;
......
......@@ -72,7 +72,7 @@ import {
importFlight,
} from "@/api/flightInfoImport";
export default {
name:"FlightInformationImport",
name: "FlightInformationImport",
data() {
return {
flightType: [],
......@@ -125,15 +125,14 @@ export default {
uploadExcel(option) {
//上传excel
const file = option.file;
console.log(option);
importFlight(file, this.form.type).then((res) => {
if (res.code != 200) {
if (res.code == 603) {
this.$alert(res.msg , "提示", {
this.$alert(res.msg, "提示", {
confirmButtonText: "确定",
type: "warning",
});
}else {
} else {
this.$message.error(res.msg);
this.tableData = res.data;
}
......@@ -172,13 +171,6 @@ export default {
},
};
</script>
<style rel="stylesheet/scss" lang="scss">
.upload-demo {
float: right;
}
.el-upload-list {
display: inline-block;
margin-left: 10px;
vertical-align: top;
}
<style>
</style>
\ No newline at end of file
......
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<el-form
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
>
<h3 class="title">IMAC后台管理系统</h3>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<svg-icon
slot="prefix"
icon-class="user"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<el-form-item prop="password">
......@@ -15,17 +29,20 @@
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon
slot="prefix"
icon-class="password"
class="el-input__icon input-icon"
/>
</el-input>
</el-form-item>
<!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
<el-form-item style="width:100%;marginTop:44px">
<el-form-item style="width: 100%; marginTop: 44px">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
style="width: 100%"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
......@@ -43,7 +60,7 @@
<script>
import { getCodeImg } from "@/api/login";
//import Cookies from "js-cookie";
import { encrypt, } from '@/utils/jsencrypt'
import { encrypt } from "@/utils/jsencrypt";
export default {
name: "Login",
......@@ -54,18 +71,18 @@ export default {
loginForm: {
username: "root",
password: "123",
rememberMe: false
rememberMe: false,
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "用户名不能为空" }
{ required: true, trigger: "blur", message: "用户名不能为空" },
],
password: [
{ required: true, trigger: "blur", message: "密码不能为空" }
]
{ required: true, trigger: "blur", message: "密码不能为空" },
],
},
loading: false,
redirect: undefined
redirect: undefined,
};
},
watch: {
......@@ -75,46 +92,53 @@ export default {
},
immediate: true
}
},
},
created() {
this.getCookie();
},
methods: {
getCookie() {
const username = localStorage.getItem("username");
const password = localStorage.getItem("password");
const rememberMe = localStorage.getItem('rememberMe')
const rememberMe = localStorage.getItem("rememberMe");
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : password,
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
localStorage.setItem("username", this.loginForm.username, { expires: 30 });
localStorage.setItem("password", this.loginForm.password, { expires: 30 });
localStorage.setItem('rememberMe', this.loginForm.rememberMe, { expires: 30 });
localStorage.setItem("username", this.loginForm.username, {
expires: 30,
});
localStorage.setItem("password", this.loginForm.password, {
expires: 30,
});
localStorage.setItem("rememberMe", this.loginForm.rememberMe, {
expires: 30,
});
} else {
localStorage.removeItem("username");
localStorage.removeItem("password");
localStorage.removeItem('rememberMe');
localStorage.removeItem("rememberMe");
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
//this.getCode();
});
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(() => {});
})
.catch(() => {
this.loading = false;
//this.getCode();
});
}
});
}
}
},
},
};
</script>
......
<template>
<div></div>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div></div>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file