diff --git a/src/api/api.js b/src/api/api.js index 386ce55..173cc9d 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,7 +1,7 @@ import axios from 'axios'; import router from '../router'; import store from '@/store' -import util from '@/libs/util' +import Util from '@/libs/util' const url = location.host const dev = process.env.NODE_ENV === 'development' // 开发环境 @@ -11,6 +11,9 @@ if (dev) { host = 'http://121.37.12.51/' // 中台测试服 // host = 'https://www.occupationlab.com/' // 正式服 host = 'http://192.168.31.51:9000/' + const ip = localStorage.getItem('localIp') + const ips = ['http://192.168.31.217:9000/', 'http://192.168.31.51:9000/', 'http://121.37.12.51/'] + host = ips[+ip] } // 创建axios实例 const service = axios.create({ @@ -27,15 +30,29 @@ service.interceptors.request.use(config => { // 添加respone拦截器 service.interceptors.response.use( response => { - let res = {}; - res.status = response.status - res.data = response.data; - return res; + const { status, data } = response + if (data.code === 401) { + // 账号互踢 + if (!logouted) { + Util.errorMsg(data.msg.includes('顶') ? '您的账号已在其他设备登录,您已被迫下线!' : '登录过期,请重新登录!') + setTimeout(() => { + store.commit('user/logout') + logouted = 0 + }, 6500) + logouted = 1 + } + } else { + return { + status, + data + } + } + }, error => { if (error.response.status == 401) { if (!logouted) { - util.errorMsg('登录过期,请重新登录') + Util.errorMsg('登录过期,请重新登录') setTimeout(() => { store.commit('user/logout') }, 1500) diff --git a/src/api/http.js b/src/api/http.js index caeeab6..e9431ee 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -48,46 +48,53 @@ export const reportDetail = (reportId) => { }) } export const creditEvaluationInput = data => { - return post(`${host}/judgment/bankCreditEvaluation/creditEvaluationInput`, data) + return post(`/judgment/bankCreditEvaluation/creditEvaluationInput`, data) } export const creditEvaluationDetails = data => { - return post(`${host}/judgment/bankCreditEvaluation/creditEvaluationDetails`, data) + return post(`/judgment/bankCreditEvaluation/creditEvaluationDetails`, data) } export const loanApplicationInput = data => { - return post(`${host}/judgment/bankLoanApplication/loanApplicationInput`, data) + return post(`/judgment/bankLoanApplication/loanApplicationInput`, data) } export const loanApplicationDetails = data => { - return post(`${host}/judgment/bankLoanApplication/loanApplicationDetails`, data) + return get(`/judgment/bankLoanApplication/loanApplicationDetails`, data) } export const creditApplicationInput = data => { - return post(`${host}/judgment/bankCreditApplication/creditApplicationInput`, data) + return post(`/judgment/bankCreditApplication/creditApplicationInput`, data) } export const creditApplicationDetails = data => { - return post(`${host}/judgment/bankCreditApplication/creditApplicationDetails`, data) + return post(`/judgment/bankCreditApplication/creditApplicationDetails`, data) } export const companyLoanList = data => { - return post(`${host}/judgment/bankCompanyLoans/companyLoanList`, data) + return post(`/judgment/bankCompanyLoans/companyLoanList`, data) } export const companyLoanDetails = id => { - return get(`${host}/judgment/bankCompanyLoans/companyLoanDetails?companyLoanId=${id}`) + return get(`/judgment/bankCompanyLoans/companyLoanDetails?companyLoanId=${id}`) } export const loanDisbursement = data => { - return post(`${host}/judgment/bankCompanyLoans/loanDisbursement`, data) + return post(`/judgment/bankCompanyLoans/loanDisbursement`, data) } export const loanCollection = data => { - return post(`${host}/judgment/bankCompanyLoans/loanCollection`, data) + return post(`/judgment/bankCompanyLoans/loanCollection`, data) } export const nonPerformingLoans = data => { - return post(`${host}/judgment/bankCompanyLoans/nonPerformingLoans`, data) + return post(`/judgment/bankCompanyLoans/nonPerformingLoans`, data) } export const badDebtRecognition = data => { - return post(`${host}/judgment/bankCompanyLoans/badDebtRecognition`, data) + return post(`/judgment/bankCompanyLoans/badDebtRecognition`, data) } export const postLoanInvestigationInput = data => { - return post(`${host}/judgment/bankPostLoanInvestigation/postLoanInvestigationInput`, data) + return post(`/judgment/bankPostLoanInvestigation/postLoanInvestigationInput`, data) } export const addExtensionPeriod = data => { - return post(`${host}/judgment/bankCompanyLoans/addExtensionPeriod`, data) + return post(`/judgment/bankCompanyLoans/addExtensionPeriod`, data) +} + +export const batchProcessingCompany = data => { + return post(`/judgment/bankCompanyRepaymentPlan/batchProcessing`, data) +} +export const repaymentPlanCompany = data => { + return post(`/judgment/bankCompanyRepaymentPlan/repaymentPlan`, data) } export const loanContractSave = (data) => { diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index f8701aa..e396131 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -1,20 +1,19 @@ @@ -26,7 +25,9 @@ import Cookie from 'js-cookie' export default { data () { return { + isDev: Setting.isDev, token: util.local.get(Setting.tokenKey), + ip: localStorage.getItem('localIp') ? +localStorage.getItem('localIp') : 0, }; }, mounted () { @@ -61,6 +62,11 @@ export default { sessionStorage.clear() location.href = href }, + + ipChange (val) { + localStorage.setItem('localIp', val) + location.reload() + }, }, watch: { '$route.path': { @@ -81,21 +87,29 @@ export default { \ No newline at end of file diff --git a/src/layouts/home/index.vue b/src/layouts/home/index.vue index a6df327..5c96827 100644 --- a/src/layouts/home/index.vue +++ b/src/layouts/home/index.vue @@ -1,18 +1,18 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/libs/util.js b/src/libs/util.js index 0512eb6..e8f9aaf 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -1,5 +1,5 @@ import cookies from './util.cookies' -import {_local,_session} from './util.db' +import { _local, _session } from './util.db' import { Message } from 'element-ui' const util = { @@ -7,53 +7,53 @@ const util = { local: _local, session: _session, // 传入身份证获取生日 - getBirth(idCard) { + getBirth (idCard) { var birthday = ""; - if(idCard != null && idCard != ""){ - if(idCard.length == 15){ - birthday = "19"+idCard.slice(6,12); - } else if(idCard.length == 18){ - birthday = idCard.slice(6,14); - } - birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-"); + if (idCard != null && idCard != "") { + if (idCard.length == 15) { + birthday = "19" + idCard.slice(6, 12); + } else if (idCard.length == 18) { + birthday = idCard.slice(6, 14); + } + birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-"); //通过正则表达式来指定输出格式为:1990-01-01 - } + } return birthday; }, // new Date('2020-11-12 00:00:00') 在IE下失效,因此把-替换成/ - dateCompatible(date) { + dateCompatible (date) { return date.replace(/\-/g, '/') }, // 日期时间前面补零 - formateTime(num) { + formateTime (num) { return num < 10 ? `0${num}` : num }, //返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" - formatDate(fmt,date) { + formatDate (fmt, date) { var date = date ? date : new Date() - var o = { - "M+" : date.getMonth()+1, //月份 - "d+" : date.getDate(), //日 - "h+" : date.getHours(), //小时 - "m+" : date.getMinutes(), //分 - "s+" : date.getSeconds(), //秒 - "q+" : Math.floor((date.getMonth()+3)/3), //季度 - "S" : date.getMilliseconds() //毫秒 - }; - if(/(y+)/.test(fmt)) { - fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); + var o = { + "M+": date.getMonth() + 1, //月份 + "d+": date.getDate(), //日 + "h+": date.getHours(), //小时 + "m+": date.getMinutes(), //分 + "s+": date.getSeconds(), //秒 + "q+": Math.floor((date.getMonth() + 3) / 3), //季度 + "S": date.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); } - for(var k in o) { - if(new RegExp("("+ k +")").test(fmt)){ - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); - } + for (var k in o) { + if (new RegExp("(" + k + ")").test(fmt)) { + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); + } } - return fmt; + return fmt; }, // 移除数组中指定值 - removeByValue(arr, val) { - let index = arr.indexOf(val) - index>0?arr.splice(i, 1):'' + removeByValue (arr, val) { + let index = arr.indexOf(val) + index > 0 ? arr.splice(i, 1) : '' // for(var i=0; i { - n[attr] = n[attr].replace(/<\/?.+?>/gi,'') + n[attr] = n[attr].replace(/<\/?.+?>/gi, '') }) return list }, // 传入文件名获取文件后缀 - getFileExt(fileName) { + getFileExt (fileName) { return fileName.substring(fileName.lastIndexOf('.') + 1) }, // 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域 - downloadFile(fileName,url) { + downloadFile (fileName, url) { var x = new XMLHttpRequest() x.open("GET", url, true) x.responseType = 'blob' - x.onload=function(e) { - var url = window.URL.createObjectURL(x.response) - var a = document.createElement('a') - a.href = url - a.download = fileName - a.click() + x.onload = function (e) { + var url = window.URL.createObjectURL(x.response) + var a = document.createElement('a') + a.href = url + a.download = fileName + a.click() } x.send() }, // 传入文件名和数据,下载文件 - downloadFileDirect(fileName,data) { + downloadFileDirect (fileName, data) { if ('download' in document.createElement('a')) { // 非IE下载 const elink = document.createElement('a') elink.download = fileName @@ -122,17 +122,87 @@ const util = { } }, // 成功提示 - successMsg(message,duration = 3000) { - return Message.success({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration}) + successMsg (message, duration = 3000) { + return Message.success({ message, showClose: true, offset: (document.documentElement.clientHeight - 40) / 2, duration }) }, // 警告提示 - warningMsg(message,duration = 3000) { - return Message.warning({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration}) + warningMsg (message, duration = 3000) { + return Message.warning({ message, showClose: true, offset: (document.documentElement.clientHeight - 40) / 2, duration }) }, // 错误提示 - errorMsg(message,duration = 3000) { - return Message.error({message,showClose: true,offset: (document.documentElement.clientHeight - 40) / 2,duration}) - }, + errorMsg (message, duration = 3000) { + return Message.error({ message, showClose: true, offset: (document.documentElement.clientHeight - 40) / 2, duration }) + }, + // 授信年限 + creditTerms: [ + { + id: 231, + name: '1年' + }, + { + id: 232, + name: '3年' + }, + { + id: 233, + name: '5年' + }, + { + id: 234, + name: '10年' + }, + ], + // 还款方式 + repaymentMethods: [ + { + id: 235, + name: '等额本金' + }, + { + id: 236, + name: '等额本息' + }, + ], + // 发放方式 + distributionMethods: [ + { + id: 238, + name: '一次性到账' + }, + { + id: 239, + name: '随借随还' + }, + ], + // 担保方式 + guaranteeMethods: [ + { + id: 242, + name: '质押' + }, + { + id: 243, + name: '抵押' + }, + ], + // 贷款期限 + loanTerms: [ + { + pointId: 244, + id: 120, + name: '120个月' + }, + { + pointId: 245, + id: 240, + name: '240个月' + }, + { + pointId: 246, + id: 360, + name: '360个月' + }, + ], } export default util \ No newline at end of file diff --git a/src/pages/manage/list/corporateLoans/application.vue b/src/pages/manage/list/corporateLoans/application.vue index 107b86a..b7765ae 100644 --- a/src/pages/manage/list/corporateLoans/application.vue +++ b/src/pages/manage/list/corporateLoans/application.vue @@ -15,10 +15,10 @@ - + diff --git a/src/pages/manage/list/corporateLoans/apply/creditApplication/index.vue b/src/pages/manage/list/corporateLoans/apply/creditApplication/index.vue index c32517c..b015bad 100644 --- a/src/pages/manage/list/corporateLoans/apply/creditApplication/index.vue +++ b/src/pages/manage/list/corporateLoans/apply/creditApplication/index.vue @@ -38,7 +38,8 @@ - + @@ -238,6 +239,7 @@