安全性问题处理:代码版本整理 初始版本1 --提交人:阳华祥

This commit is contained in:
yang.huaxiang
2020-10-27 10:50:12 +08:00
parent 239769d7af
commit b913e73c47
23 changed files with 953 additions and 237 deletions

View File

@@ -56,3 +56,22 @@ export function queryPrivacy(data) {
data
})
}
//注销用户
export function logoutAgent(data) {
return request({
url: getUrl('/customer/account/logoutAgent', 1),
method: 'post',
data
})
}
//登录用户
export function loginTest(data) {
return request({
url: getUrl('/customer/account/login', 1),
method: 'post',
data
})
}

View File

@@ -1,4 +1,5 @@
import utilsAge from '@/assets/js/utils/age'
import CacheUtils from '@/assets/js/utils/cacheUtils'
/**
* @desc 扩展对象继承
* @param {Object} out 一个或多个对象
@@ -179,7 +180,7 @@ export default {
* @return {*} rs
*/
getStorage(name) {
return this._string2json(window.localStorage[name])
return this._string2json(CacheUtils.getLocItem(name))
},
/**
@@ -187,7 +188,7 @@ export default {
* @param {String} name 名称
*/
setStorage(name, value) {
window.localStorage[name] = this._json2string(value)
CacheUtils.setLocItem(name,this._json2string(value))
},
/**
@@ -195,7 +196,7 @@ export default {
* @param {String} name 名称
*/
delStorage(name) {
window.localStorage.removeItem(name)
CacheUtils.removeLocItem(name)
},
/**
@@ -532,46 +533,49 @@ export default {
insuredDTO = res.orderDTO.insuredDTOs[0]
}
let age = utilsAge.getAge(appntDTO.birthday, new Date())
localStorage.saleInsuredInfo = JSON.stringify({
workcompany: appntDTO.workcompany,
birthday: appntDTO.birthday,
name: appntDTO.name,
sex: appntDTO.sex,
idType: appntDTO.idType,
age,
idNo: appntDTO.idNo,
appntId: appntDTO.appntId,
healthGrade: appntDTO.healthGrade,
lifeGrade: appntDTO.lifeGrade,
mobile: appntDTO.mobile,
occupationName: appntDTO.occupationName,
occupationCode: appntDTO.occupationCode,
// marriage: appntDTO.marriage,
medical: appntDTO.medical,
certiexpiredate: appntDTO.certiexpiredate,
nativeplace: appntDTO.nativeplace
})
CacheUtils.setLocItem('saleInsuredInfo',
JSON.stringify({
workcompany: appntDTO.workcompany,
birthday: appntDTO.birthday,
name: appntDTO.name,
sex: appntDTO.sex,
idType: appntDTO.idType,
age,
idNo: appntDTO.idNo,
appntId: appntDTO.appntId,
healthGrade: appntDTO.healthGrade,
lifeGrade: appntDTO.lifeGrade,
mobile: appntDTO.mobile,
occupationName: appntDTO.occupationName,
occupationCode: appntDTO.occupationCode,
// marriage: appntDTO.marriage,
medical: appntDTO.medical,
certiexpiredate: appntDTO.certiexpiredate,
nativeplace: appntDTO.nativeplace
})
)
if (insuredDTO) {
let insuredPersonAge = utilsAge.getAge(insuredDTO.birthday, new Date())
localStorage.saleInsuredPersonInfo = JSON.stringify({
birthday: insuredDTO.birthday,
name: insuredDTO.name,
sex: insuredDTO.sex,
idType: insuredDTO.idType,
age: insuredPersonAge,
// marriage: insuredDTO.marriage,
relationToAppnt: insuredDTO.relationToAppnt,
medical: insuredDTO.medical,
occupationName: insuredDTO.occupationName,
occupationCode: insuredDTO.occupationCode,
insuredId: insuredDTO.insuredId,
idNo: insuredDTO.idNo,
healthGrade: insuredDTO.healthGrade,
lifeGrade: insuredDTO.lifeGrade,
mobile: insuredDTO.mobile
})
CacheUtils.setLocItem('saleInsuredPersonInfo',
JSON.stringify({
birthday: insuredDTO.birthday,
name: insuredDTO.name,
sex: insuredDTO.sex,
idType: insuredDTO.idType,
age: insuredPersonAge,
// marriage: insuredDTO.marriage,
relationToAppnt: insuredDTO.relationToAppnt,
medical: insuredDTO.medical,
occupationName: insuredDTO.occupationName,
occupationCode: insuredDTO.occupationCode,
insuredId: insuredDTO.insuredId,
idNo: insuredDTO.idNo,
healthGrade: insuredDTO.healthGrade,
lifeGrade: insuredDTO.lifeGrade,
mobile: insuredDTO.mobile
})
)
let [chooseProductCodes, mainRiskCodes, addRiskCodes] = [[], [], []]
if (insuredDTO.riskDTOLst && insuredDTO.riskDTOLst.length > 0) {
insuredDTO.riskDTOLst.forEach(item => {
@@ -583,15 +587,15 @@ export default {
}
})
}
localStorage.mainRiskCodes = JSON.stringify(mainRiskCodes)
localStorage.oldAddRiskCodes = JSON.stringify(addRiskCodes)
localStorage.chooseProductCodes = JSON.stringify(chooseProductCodes)
CacheUtils.setLocItem('mainRiskCodes',JSON.stringify(mainRiskCodes))
CacheUtils.setLocItem('oldAddRiskCodes',JSON.stringify(addRiskCodes))
CacheUtils.setLocItem('chooseProductCodes',JSON.stringify(chooseProductCodes))
} else {
localStorage.mainRiskCodes = ''
localStorage.oldAddRiskCodes = ''
localStorage.chooseProductCodes = ''
CacheUtils.setLocItem('mainRiskCodes','')
CacheUtils.setLocItem('oldAddRiskCodes','')
CacheUtils.setLocItem('chooseProductCodes','')
if (!isProposal) {
localStorage.saleInsuredPersonInfo = ''
CacheUtils.setLocItem('saleInsuredPersonInfo','')
}
}
},

View File

@@ -1,3 +1,4 @@
import CacheUtils from '@/assets/js/utils/cacheUtils'
/**
* @desc 扩展对象继承
* @param {Object} out 一个或多个对象
@@ -117,7 +118,7 @@ export default {
* @return {*} rs
*/
getStorage(name) {
return this._string2json(window.localStorage[name])
return this._string2json(CacheUtils.getLocItem(name))
},
/**
@@ -125,7 +126,7 @@ export default {
* @param {String} name 名称
*/
setStorage(name, value) {
window.localStorage[name] = this._json2string(value)
CacheUtils.setLocItem(name,this._json2string(value))
},
/**
@@ -133,7 +134,7 @@ export default {
* @param {String} name 名称
*/
delStorage(name) {
window.localStorage.removeItem(name)
CacheUtils.removeLocItem(name)
},
/**

View File

@@ -0,0 +1,59 @@
import AESTools from '@/assets/js/utils/cryptoJsUtil'
import configApp from '@/config'
import cacheKeys from './needCacheKey'
export default {
setLocItem: function(key, value) {
const exist = cacheKeys.encodeKeys.find(item => {
return item === key
})
//设置localStorage 值
if (cacheKeys.isAll || exist) {
window.localStorage.setItem(key, AESTools.AESCacheEncrypt(value, configApp.CACHE_ENCRYP))
} else {
window.localStorage.setItem(key, value)
}
},
getLocItem: function(key) {
// 获取localStorage 中值
let value = window.localStorage.getItem(key)
if (value && value != '') {
const exist = cacheKeys.encodeKeys.find(item => {
return item === key
})
if (cacheKeys.isAll || exist) {
return AESTools.AESCacheDecrypt(value, configApp.CACHE_ENCRYP)
}
}
return value
},
removeLocItem: function(key) {
// 获取localStorage 中值
window.localStorage.removeItem(key)
},
setSessionItem: function(key, value) {
//设置sessionStorage 值
const exist = cacheKeys.encodeKeys.find(item => {
return item === key
})
//设置localStorage 值
if (cacheKeys.isAll || exist) {
window.sessionStorage.setItem(key, AESTools.AESCacheEncrypt(value, configApp.CACHE_ENCRYP))
} else {
window.sessionStorage.setItem(key, value)
}
},
getSessionItem: function(key) {
//设置sessionStorage 值
let value = window.sessionStorage.getItem(key)
if (value && value != '') {
const exist = cacheKeys.encodeKeys.find(item => {
return item === key
})
//设置localStorage 值
if (cacheKeys.isAll || exist) {
return AESTools.AESCacheDecrypt(value, configApp.CACHE_ENCRYP)
}
}
return value
}
}

View File

@@ -0,0 +1,47 @@
import CryptoJS from 'crypto-js'
export default {
AESEncrypt: function (data, keys) {//加密
var key = CryptoJS.enc.Hex.parse(keys)
var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF');//偏移量
var encrypted = CryptoJS.AES.encrypt(data, key,
{
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return encrypted.toString();
},
AESDecrypt: function (encrypted, keys) {//解密
var key = CryptoJS.enc.Hex.parse(keys)
var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF');
var decrypted = CryptoJS.AES.decrypt( encrypted, key,
{
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return CryptoJS.enc.Utf8.stringify(decrypted)
},
AESCacheEncrypt: function (data, keys) {//加密 緩存
var key = CryptoJS.enc.Hex.parse(keys)
var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF');//偏移量
var encrypted = CryptoJS.AES.encrypt(data, key,
{
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return encrypted.toString();
},
AESCacheDecrypt: function (encrypted, keys) {//解密 緩存
var key = CryptoJS.enc.Hex.parse(keys)
var iv = CryptoJS.enc.Utf8.parse('0123456789ABCDEF');
var decrypted = CryptoJS.AES.decrypt( encrypted, key,
{
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
return CryptoJS.enc.Utf8.stringify(decrypted)
}
}

View File

@@ -0,0 +1,4 @@
export default {
isAll: false,
encodeKeys: ['']
}

View File

@@ -1,5 +1,6 @@
//权限控制
import router from '@/router'
import CacheUtils from '@/assets/js/utils/cacheUtils'
// import NProgress from 'nprogress' // Progress 进度条
// import 'nprogress/nprogress.css' // Progress 进度条样式
export function permission() {
@@ -11,9 +12,9 @@ export function permission() {
document.title = title
}
//判断是否登录
let token = localStorage.token
let token = CacheUtils.getLocItem('token')
if (!token) {
localStorage.token = ''
CacheUtils.setLocItem('token','')
//无token判断是否需要登录
if (to.meta.auth) {
if (window.WebViewJavascriptBridge) {

View File

@@ -1,5 +1,11 @@
import axios from 'axios'
import AESTools from '@/assets/js/utils/cryptoJsUtil'
import configApp from '@/config'
import { Dialog, Toast } from 'vant'
import dateUtil from "@/assets/js/utils/date-utils";
import MD5 from 'js-md5';
import CacheUtils from '@/assets/js/utils/cacheUtils'
let proposal = [
'/proposal/proposal/list',
'/proposal/proposal/toInsurance',
@@ -107,58 +113,84 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(
config => {
let relativePath = config.url && config.url.split('v1')[1]
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
config => {
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
console.log(config.url.split(configApp.API_VERSION)[0])
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
}
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if(config.url && config.method == 'post' && /api\/$/.test(config.url.split(configApp.API_VERSION)[0])){
if(!config.data || config.data == null){
config.data = {}
}
if(!!config.data && config.data != null){
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密前报文:]",JSON.stringify(config.data))
config.data = {"data": encrypt }
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密后报文:]",config.data)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// 添加请时间戳
let timeStr = new Date().getTime() + '';
config.headers['timeStr'] = timeStr;
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'));
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
config.headers['token'] = window.localStorage.getItem('token')
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
)
// respone拦截器
service.interceptors.response.use(
response => {
const res = response.data
console.log(res, 'res')
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
response => {
console.log(response)
console.log('----------------')
let res = response.data
if(response.config.url && response.config.method == 'post' && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){
if(res.response){// 正常情況返回必有response 节点
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response))
res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD))
console.log("[调用请求解密服务][请求地址:"+response.config.url+"][解密后报文:]",res)
}
}
return Promise.reject(res)
} else {
return response.data.content
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return res.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
)
export default service

View File

@@ -1,6 +1,6 @@
import axios from 'axios'
import { Dialog, Toast } from 'vant'
import CacheUtils from '@/assets/js/utils/cacheUtils'
let sale = ['/sale/order/orderDetail'] //在线投保
// 卡单
@@ -25,7 +25,7 @@ service.interceptors.request.use(
// })
}
config.headers['token'] = window.localStorage.getItem('token')
config.headers['token'] = CacheUtils.getLocItem('token')
// config.headers['token'] = ``
return config
},

View File

@@ -0,0 +1,188 @@
import axios from 'axios'
import AESTools from '@/assets/js/utils/cryptoJsUtil'
import configApp from '@/config'
import { Dialog, Toast } from 'vant'
import CacheUtils from '@/assets/js/utils/cacheUtils'
let proposal = [
'/proposal/proposal/list',
'/proposal/proposal/toInsurance',
'/proposal/proposal/info',
'/proposal/proposal/demo',
'/proposal/proposal/saveOrUpdateProposal',
'/proposal/proposal/updateInsured',
'/proposal/file/getFile',
'/proposal/proposal/deleteProposal'
] //建议书
let sale = [
'/sale/order/orderList',
'/sale/order/saveOrUpdateOrderInfo',
'/sale/order/orderList',
'/sale/order/deleteOrderInfo',
'/sale/product/getDetail',
'/sale/order/saveOrUpdateOrderInfo',
'/sale/order/orderDetail',
'/customer/authcode/loginedSend',
'/uploadImage',
// '/customer/recognition',
'/sale/insure/underWrite',
'/sale/insure/acceptInsurance',
'/app/code/getCodeValue',
'/customer/token',
'/media/ebizSignInfo/sign',
'/sale/receiptSign/submit',
'/sale/order/orderDetail',
'/sale/record/check',
'/ppf/sign',
'/ppf/check',
'/sale/insure/selfToHuman',
'/sale/insure/orderPayStatusQuery'
] //在线投保
let agentEnter = [
'/agent/enter/share',
'/agent/enter/query',
'/agent/enter/saveOrUpdateInfo',
'/agent/enter/queryAll',
'/agent/enter/getImpart',
'/agent/agreement/query',
'/agent/agreement/signAgreement',
'/agent/enter/query',
'/agent/examineApprove/dispose' //入司增员审批
] //入司
let claims = [
`/claim/claimApply/progress`,
`/claim/claimApply/progressDetail`,
`/claim/claimReport/history`,
`/claim/claimApply/apply`,
`/edor/customer/customerList`,
`/edor/customer/customerInfo`,
`/claim/claimApply/query`,
`/claim/claimApply/delete`
]
let survey = [
//'/customer/question/getQuestionnaire', // 代理人下问卷查询 --ok
'/customer/question/getQuestion', // 问卷题库查询
'/customer/question/submit', // 问卷提交
//'/customer/question/shareSubmit', //问卷分享 --ok
//'/customer/question/getTableId', // id 查询 -- ok
'/customer/question/getAgentInfo' // 代理人详情
]
let manpower = [
'/customer/answer/queryList' //DISC性格分析
]
//保全
let preserve = [
'/edor/customer/customerList', //客户搜索
'/edor/policy/policyList', //保单列表
'/edor/edor/queryEdorList' //保全进度查询
]
let productStore = [
'/customer/shop/getShopList', //获取商城列表/详情
'/customer/shop/getShareList' //查询分享轨迹(转发记录)
]
// 卡单
let cardList = []
// 续期
let renewalManage = [
'/renewal/getRenewalList' //续期列表查询
]
let whiteList = [
'/customer/agent/getCustomersList',
...proposal,
...sale,
...agentEnter,
...claims,
...survey,
...manpower,
...productStore,
...preserve,
...renewalManage
]
// 创建axios实例
const service = axios.create({
timeout: 66666666 // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
config => {
let relativePath = config.url && config.url.split('v1')[1]
console.log(config.url.split('v1')[0])
if (whiteList.includes(relativePath)) {
Toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
}
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if(config.url && config.method == 'post' && /api\/$/.test(config.url.split('v1')[0])){
if(!config.data || config.data == null){
config.data = {}
}
if(!!config.data && config.data != null){
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密前报文:]",JSON.stringify(config.data))
config.data = {"data": encrypt }
console.log("[调用请求加密服务][请求地址:"+config.url+"][加密后报文:]",config.data)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// config.headers['token'] = `f0003a753d1d492083248f723ab1b6e9`//TEST测试专用
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
)
// respone拦截器
service.interceptors.response.use(
response => {
console.log(response)
let res = response.data
if(response.config.url && response.config.method == 'post' && /api\/$/.test(response.config.url.split('v1')[0])){
if(res.response){
console.log("[调用请求加密服务][请求地址:"+response.config.url+"][解密前报文:]",JSON.stringify(res.response))
res = AESTools.AESDecrypt(JSON.stringify(res.response),configApp.REQ_PWD)
console.log("[调用请求加密服务][请求地址:"+response.config.url+"][解密后报文:]",JSON.stringify(res))
}
}
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return response.data.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
)
export default service

View File

@@ -5,7 +5,7 @@
*
*/
let apiDomain, imgDomain, assetsUrl, mainUrl, payUrl, zssqUrl // 保融支付的收银台服务地址
let apiDomain, imgDomain, assetsUrl, mainUrl, payUrl, zssqUrl ,REQ_PWD, CACHE_ENCRYP, API_VERSION// 保融支付的收银台服务地址
// 可以多个接口域名,按需添加
console.log('环境:', process.env.VUE_APP_FLAG)
@@ -18,6 +18,9 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = 'http://139.199.50.151'
payUrl = 'https://funduat.e-guofu.com/s3-modules-gateway/embed/gateway.action'
zssqUrl = 'http://139.199.50.151/html/test/index.html#/'
REQ_PWD = '41424344454631323334353637383930'
CACHE_ENCRYP = '41424344454631323334353637383930'
API_VERSION = 'v2'
break
case 'uat':
apiDomain = 'http://115.159.235.59:7000/api/v1' // 国富api
@@ -27,6 +30,9 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = 'http://115.159.235.59'
payUrl = 'https://funduat.e-guofu.com/s3-modules-gateway/embed/gateway.action'
zssqUrl = ''
REQ_PWD = '41424344454631323334353637383930'
CACHE_ENCRYP = '41424344454631323334353637383930'
API_VERSION = 'v2'
break
case 'prd':
apiDomain = 'https://iagentsales.e-guofu.com/api/v1'
@@ -35,6 +41,9 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = 'https://iagentsales.e-guofu.com'
payUrl = 'https://uns3.e-guofu.com/s3-modules-gateway/embed/gateway.action'
zssqUrl = ''
REQ_PWD = '41424344454631323334353637383930'
CACHE_ENCRYP = '41424344454631323334353637383930'
API_VERSION = 'v2'
break
case 'dat':
apiDomain = ''
@@ -44,6 +53,9 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = ''
payUrl = ''
zssqUrl = ''
REQ_PWD = '41424344454631323334353637383930'
CACHE_ENCRYP = '41424344454631323334353637383930'
API_VERSION = 'v2'
break
}
/**
@@ -61,5 +73,8 @@ export default {
assetsUrl,
mainUrl,
payUrl,
zssqUrl //知识社区地址
zssqUrl, //知识社区地址
REQ_PWD, //报文加密密码
CACHE_ENCRYP, //缓存加密密码
API_VERSION //渠道版本
}

View File

@@ -11,6 +11,10 @@ import config from '@/config'
import noMoreClick from '@/directive/noMoreClick'
import vueHashCalendar from 'vue-hash-calendar'
import 'vue-hash-calendar/lib/vue-hash-calendar.css'
import md5 from 'js-md5';
import cryptoJs from 'crypto-js'
import cacheUtils from '@/assets/js/utils/cacheUtils'
import { Cell, CellGroup, DatetimePicker, Popup, Picker, Col, Row, Tab, Tabs, NavBar, Toast, Button, Dialog, Icon, Lazyload } from 'vant'
Vue.use(Cell)
@@ -35,6 +39,9 @@ Vue.use(Lazyload, {
Vue.prototype.$assetsUrl = config.assetsUrl
Vue.prototype.$mainUrl = config.mainUrl
Vue.prototype.$zssqUrl = config.zssqUrl
Vue.prototype.$MD5 = md5
Vue.prototype.$CryptoJs = cryptoJs
Vue.prototype.$CacheUtils = cacheUtils
// 全局 防重复点击
Vue.directive('no-more-click', noMoreClick)

View File

@@ -1,6 +1,6 @@
//定义相关组件
const home = () => import('@/views/app/Home')
const login = () => import('@/views/app/Login')
const loginss = () => import('@/views/app/Login')
const notFound = () => import('@/views/app/404')
const functionList = () => import('@/views/app/FunctionList')
@@ -15,9 +15,9 @@ let arr = [
}
},
{
path: '/login',
name: 'login',
component: login,
path: '/loginss',
name: 'loginss',
component: loginss,
meta: {
title: '登录页'
}

View File

@@ -4,6 +4,7 @@ const userSetting = () => import('@/views/ebiz/my/UserSetting')
const userInfo = () => import('@/views/ebiz/my/UserInfo')
const userIncome = () => import('@/views/ebiz/my/UserIncome')
const PrivacyPolicy = () => import('@/views/ebiz/my/PrivacyPolicy')
const LogoutAgent = () => import('@/views/ebiz/my/LogoutAgent')
export default [
{
@@ -51,5 +52,15 @@ export default [
title: '金掌桂隐私政策',
index: 1
}
},
{
//隐私政策
path: '/my/logoutAgent',
name: 'LogoutAgent',
component: LogoutAgent,
meta: {
title: '注销账户',
index: 1
}
}
]

View File

@@ -36,7 +36,8 @@ export default {
//登录
login()
.then(res => {
localStorage.token = res.token
//localStorage.token = res.token
this.$CacheUtils.setLocItem("token",res.token)
this.$router.push({ path: this.redirect || '/' })
})
.catch(err => {

View File

@@ -7,6 +7,7 @@ import { saveOrUpdateOrderInfo, getAuthCode, getOrderDetail } from '@/api/ebiz/s
import getAreaName from '@/assets/js/utils/get-area-name'
// import idNoCheck from '@/assets/js/utils/idNoCheck'
import { idToData } from './verification'
import CacheUtils from '@/assets/js/utils/cacheUtils'
let relationToInsured = [
{
id: 2,
@@ -37,14 +38,14 @@ export function selectComp(that, index, type = '') {
} else if (index == 3) {
if (type == '1') {
//投保人
localStorage.scanFromInsured = 'true'
CacheUtils.setLocItem('scanFromInsured','true')
} else if (type == '2') {
//被保险人
localStorage.scanFromInsured = 'false'
CacheUtils.setLocItem('scanFromInsured','false')
}
;[that.isScan, title] = [true, '身份证扫描']
} else if (index == 4) {
localStorage.scanFromInsured = 0
CacheUtils.setLocItem('scanFromInsured','0')
;[that.bankisScan, title] = [true, '银行卡扫描']
}
@@ -248,7 +249,7 @@ export function onConfirm(that, value, type) {
if (value.id == 1) {
//获取订单详情
getOrderDetail({
orderNo: localStorage.orderNo
orderNo: CacheUtils.getLocItem('orderNo')
}).then(res => {
if (res.result == 0) {
that.isAppnt = true
@@ -349,7 +350,7 @@ export function onConfirm(that, value, type) {
if (value.id == 1) {
//获取投保人数据
getOrderDetail({
orderNo: localStorage.orderNo
orderNo: CacheUtils.getLocItem('orderNo')
}).then(res => {
if (res.result == 0) {
that.isInsured = true
@@ -690,14 +691,14 @@ export function nextStep(that, type) {
//信息变更
export function infoUpdate(that, type) {
//local 里面是否存有险种信息
let chooseProductCodes = localStorage.chooseProductCodes && JSON.parse(localStorage.chooseProductCodes)
let chooseProductCodes = CacheUtils.getLocItem('chooseProductCodes') && JSON.parse(CacheUtils.getLocItem('chooseProductCodes'))
if (chooseProductCodes && chooseProductCodes.length) {
let flag
switch (type) {
case '1':
{
//取出local中的投被保险人信息
let saleInsuredInfo = JSON.parse(localStorage.saleInsuredInfo)
let saleInsuredInfo = JSON.parse(CacheUtils.getLocItem('saleInsuredInfo'))
//如果 性别, 出生日期, 有无社保, 职业 发生变化
if (that.userInfo.sex != saleInsuredInfo.sex || that.userInfo.birthday != saleInsuredInfo.birthday) {
flag = true
@@ -707,7 +708,7 @@ export function infoUpdate(that, type) {
case '2':
{
//取出local中的被保险人信息
let saleInsuredPersonInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
let saleInsuredPersonInfo = JSON.parse(CacheUtils.getLocItem('saleInsuredPersonInfo'))
//如果 性别, 出生日期, 有无社保, 职业 发生变化
if (
that.userInfo.sex != saleInsuredPersonInfo.sex ||
@@ -732,7 +733,7 @@ export function infoUpdate(that, type) {
confirmButtonColor: '#FFFFFF'
})
.then(() => {
localStorage.from = 'anotherChanged'
CacheUtils.setLocItem('from','anotherChanged')
type == '1' ? that.save('isShow=1') : that.save()
})
.catch(() => {
@@ -755,7 +756,7 @@ export function save(that, type, str) {
orderType: type == '1' ? 'APPNT_ORDER' : 'INSURED_ORDER',
orderDTO: {
orderInfoDTO: {
orderNo: localStorage.orderNo
orderNo: CacheUtils.getLocItem('orderNo')
},
smsCodeDTO: {
smsId: that.sessionId,
@@ -771,7 +772,7 @@ export function save(that, type, str) {
type == '1' ? (params.orderDTO.appntDTO = that.userInfo) : (params.orderDTO.insuredDTOs = [that.userInfo])
saveOrUpdateOrderInfo(params).then(res => {
if (res.result == 0) {
type == '1' ? (localStorage.orderNo = res.orderNo) : (localStorage.isFrom = 'sale')
type == '1' ? (CacheUtils.setLocItem('orderNo', res.orderNo)) : (CacheUtils.setLocItem('isFrom', 'sale'))
//清理计时器
window.clearInterval(that.timeId)
that.timeId = null

View File

@@ -1,5 +1,6 @@
import { productCheck } from '@/api/ebiz/common/common'
import { getCompany } from '@/api/ebiz/sale/sale'
import CacheUtils from '@/assets/js/utils/cacheUtils'
export default {
//投、被保险人年龄对险种的限制
@@ -70,11 +71,11 @@ export default {
},
//获取被保险人信息
getSaleInsuredPersonInfo() {
return localStorage.saleInsuredPersonInfo && JSON.parse(localStorage.saleInsuredPersonInfo)
return CacheUtils.getLocItem('saleInsuredPersonInfo') && JSON.parse(CacheUtils.getLocItem('saleInsuredPersonInfo'))
},
//获取投保人信息
getSaleInsuredInfo() {
return localStorage.saleInsuredInfo && JSON.parse(localStorage.saleInsuredInfo)
return CacheUtils.getLocItem('saleInsuredInfo') && JSON.parse(CacheUtils.getLocItem('saleInsuredInfo'))
},
//获取产品售卖权限列表

View File

@@ -0,0 +1,231 @@
<template>
<div class="insured-info-container">
<van-cell-group>
<van-field
v-model="logoutDTO.mobile"
clearable
required
label="电话号码"
name="联系电话"
placeholder="请输入"
v-validate="'required|mobile'"
:disabled="true"
/>
<van-field v-model="logoutDTO.smsCode" required center label="验证码" clearable placeholder="请输入短信验证码"
@input="validateNext">
<van-button type="danger" slot="button" size="small" @click="getCode" :disabled="codeDisabled"
v-no-more-click="1000">
{{ codeDisabled ? `${countDown}s后重新获取` : '获取验证码' }}
</van-button>
</van-field>
<van-field v-model="logoutDTO.pwd" clearable required type="password" label="密码" name="密码" placeholder="请输入密码"
@input="validateNext"/>
<van-field
v-model="logoutDTO.confirmPwd"
clearable
required
type="password"
label="确认密码"
name="确认密码"
placeholder="请输入密码"
@input="validateNext"
/>
</van-cell-group>
<van-button type="danger" size="large" class="logout_button mt30" :disabled="checkNextDisabled"
@click="logoutAgent">注销账户
</van-button>
<van-dialog v-model="show" title="提示" @confirm="logoutAgentInfo" show-cancel-button>
是否注销用户
</van-dialog>
</div>
</template>
<script>
import {Field, CellGroup, Popup, Picker, Checkbox, Area, Dialog} from 'vant'
import {getAgentInfo, logoutAgent} from '@/api/ebiz/my/my.js'
import {getAuthCode} from '@/api/ebiz/sale/sale'
export default {
name: 'logoutAgent',
components: {
[CellGroup.name]: CellGroup,
[Field.name]: Field,
[Popup.name]: Popup,
[Picker.name]: Picker,
[Checkbox.name]: Checkbox,
[Area.name]: Area,
[Dialog.name]: Dialog
},
data() {
return {
logoutDTO: {
smsId: null,
smsCode: null,
mobile: null,
pwd: null,
confirmPwd: null
},
show: false,
timeId: null, // 计时器ID
countDown: 60, // 倒计时
codeDisabled: true, // 获取验证码按钮是否禁用
branchType: null,
checkNextDisabled: true // 禁用修改
}
},
async mounted() {
this.codeDisabled = false
// 获取代理人信息
const res = await getAgentInfo({'89': '890'})
if (res.result == 0) {
this.branchType = /^N{1}/.test(res.branchType) ? '1' : '0' //res.branchType 以N打头的是内勤 其他是外勤
if (this.branchType == '0') {
this.logoutDTO.mobile = res.phoneNo
this.codeDisabled = false
}
} else {
return this.$toast(res.resultMessage)
}
},
created() {
if (this.$CacheUtils.getLocItem('businessNo') && this.$CacheUtils.getLocItem('claimsClear')) {
this.init()
this.$CacheUtils.getLocItem('claimsClear', '')
} else {
this.$CacheUtils.setLocItem('businessNo', '')
}
},
methods: {
init() {
},
//获取验证码
getCode() {
if (!this.logoutDTO.mobile || this.logoutDTO.mobile == '') {
return this.$toast('代理人信息异常请联系管理员')
}
this.codeDisabled = true
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.logoutDTO.mobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
getAuthCode(data).then(res => {
if (res.result == 0) {
this.logoutDTO.smsId = res.sessionId
this.logoutDTO.smsCode = null
//倒计时
this.timeId = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
window.clearInterval(this.timeId)
this.codeDisabled = false
this.countDown = 60
}
}, 1000)
} else {
this.$toast(res.resultMessage)
}
})
},
//操作下一步按钮状态
validateNext() {
if (!this.logoutDTO.smsCode || this.logoutDTO.smsCode == '') {
this.checkNextDisabled = true
return
}
// 2、判断密码是否一致
if (!this.logoutDTO.pwd || this.logoutDTO.pwd == '') {
this.checkNextDisabled = true
return
}
if (!this.logoutDTO.confirmPwd || this.logoutDTO.confirmPwd == '') {
this.checkNextDisabled = true
return
}
if (this.logoutDTO.pwd.length < 6 || this.logoutDTO.confirmPwd.length < 6) {
this.checkNextDisabled = true
return
}
this.checkNextDisabled = false
return
},
// 注销
logoutAgent() {
// 1、判断计时器
if (!this.codeDisabled) {
return this.$toast('请先获取验证码')
}
//
if (!this.logoutDTO.smsCode || this.logoutDTO.smsCode == '') {
return this.$toast('请输入短信验证码')
}
// 2、判断密码是否一致
if (!this.logoutDTO.pwd || this.logoutDTO.pwd == '') {
return this.$toast('请输入密码')
}
if (!this.logoutDTO.confirmPwd || this.logoutDTO.confirmPwd == '') {
return this.$toast('请输入确认密码')
}
if (!(this.logoutDTO.pwd == this.logoutDTO.confirmPwd)) {
return this.$toast('两次输入密码不一致')
}
this.logoutAgentInfo();
},
logoutAgentInfo() {
let req = {
smsId: this.logoutDTO.smsId,
smsCode: this.logoutDTO.smsCode,
mobile: this.logoutDTO.mobile,
password: this.$MD5(this.logoutDTO.pwd),
confirmPwd: this.$MD5(this.logoutDTO.confirmPwd)
}
// 调用注销接口
logoutAgent(req).then(res => {
this.show =false;
if (res.result == 0) {
this.$toast('用户注销成功')
// 跳转登陆页面
this.$CacheUtils.removeLocItem('token')
EWebBridge.webCallAppInJs('bridge', {flag: 'login'})
} else {
this.$toast(res.resultMessage)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.insured-info-container {
/deep/ .van-checkbox {
margin-left: auto;
}
/deep/ .van-radio {
margin-left: auto;
}
/deep/ .bankCard {
width: 120px;
height: 20px;
line-height: 20px;
border-radius: 10px;
}
.van-cell {
align-items: center;
}
.logout_button {
width: 80%;
margin-left: 10%;
}
}
</style>

View File

@@ -3,8 +3,8 @@
<van-collapse v-model="activeNames" class="active">
<!-- <van-collapse-item name="1" class="pb10 pt10"> -->
<van-cell-group class="pl15 mt10">
<van-cell title="业务员工号" :value="userInfo.jobNo" />
<van-cell title="业务员姓名" :value="userInfo.name" />
<van-cell title="业务员工号" :value="userInfo.encryptionJobNo" />
<van-cell title="业务员姓名" :value="userInfo.encryptionName" />
<van-cell title="性别" :value="userInfo.sex === '1' ? '女' : '男'" />
<van-cell title="证件类型" :value="userInfo.cardType" />
<van-cell title="证件号码" :value="userInfo.cardNoStart" />

View File

@@ -1,4 +1,6 @@
// import utilsAge from '@/assets/js/utils/age'
import CacheUtils from '@/assets/js/utils/cacheUtils'
/**
* @desc 扩展对象继承
* @param {Object} out 一个或多个对象
@@ -179,7 +181,7 @@ export default {
* @return {*} rs
*/
getStorage(name) {
return this._string2json(window.localStorage[name])
return this._string2json(CacheUtils.getLocItem(name))
},
/**
@@ -187,7 +189,7 @@ export default {
* @param {String} name 名称
*/
setStorage(name, value) {
window.localStorage[name] = this._json2string(value)
CacheUtils.setLocItem(name,this._json2string(value))
},
/**
@@ -195,7 +197,7 @@ export default {
* @param {String} name 名称
*/
delStorage(name) {
window.localStorage.removeItem(name)
CacheUtils.removeLocItem(name)
},
/**

View File

@@ -0,0 +1,175 @@
<template>
<div class="insured-info-container">
<van-cell-group>
<van-field
v-model="logoutDTO.mobile"
clearable
required
label="电话号码"
name="联系电话"
placeholder="请输入"
v-validate="'required|mobile'"
:disabled="false"
/>
<van-field v-model="logoutDTO.smsCode" required center label="验证码" clearable placeholder="请输入短信验证码">
<van-button type="danger" slot="button" size="small" @click="getCode" :disabled="codeDisabled" v-no-more-click="1000">
{{ codeDisabled ? `${countDown}s后重新获取` : '获取验证码' }}
</van-button>
</van-field>
<van-field v-model="logoutDTO.pwd" clearable required type="password" label="密码" name="密码" placeholder="请输入密码" />
<van-field v-model="logoutDTO.confirmPwd" clearable required type="password" label="确认密码" name="确认密码" placeholder="请输入密码" />
</van-cell-group>
<van-button type="danger" size="large" class="logout_button mt30" @click="logoutAgent">注销账户</van-button>
</div>
</template>
<script>
import { Field, CellGroup, Popup, Picker, Checkbox, Area } from 'vant'
import { getAgentInfo } from '@/api/ebiz/my/my.js'
import { getAuthCode } from '@/api/ebiz/sale/sale'
import AESTools from '@/assets/js/utils/cryptoJsUtil'
export default {
name: 'logoutAgent',
components: {
[CellGroup.name]: CellGroup,
[Field.name]: Field,
[Popup.name]: Popup,
[Picker.name]: Picker,
[Checkbox.name]: Checkbox,
[Area.name]: Area
},
data() {
return {
logoutDTO: {
smsId: null,
smsCode: null,
mobile: null,
pwd: null,
confirmPwd: null
},
timeId: null, // 计时器ID
countDown: 60, // 倒计时
codeDisabled: true, // 获取验证码按钮是否禁用
branchType: null
}
},
async mounted() {
// 获取代理人信息
this.$CacheUtils.setLocItem('cacheTest', JSON.stringify(this.logoutDTO))
console.log(this.$CacheUtils.getLocItem('cacheTest'))
this.$CacheUtils.setSessionItem('cacheTest1', 'nsjdfi')
console.log(this.$CacheUtils.getSessionItem('cacheTest1'))
const res = await getAgentInfo({ '89': '890' })
console.log(res)
if (res.result == 0) {
this.branchType = /^N{1}/.test(res.branchType) ? '1' : '0' //res.branchType 以N打头的是内勤 其他是外勤
if (this.branchType == '0') {
this.logoutDTO.mobile = res.phoneNo
this.codeDisabled = false
} else {
}
} else {
return this.$toast(res.resultMessage)
}
},
created() {
if (this.$CacheUtils.getLocItem('businessNo') && this.$CacheUtils.getLocItem('claimsClear')) {
this.init()
this.$CacheUtils.setLocItem('claimsClear', '')
} else {
this.$CacheUtils.setLocItem('businessNo', '')
}
},
methods: {
init() {},
//获取验证码
getCode() {
if (this.reportMobile == '') {
return this.$toast('请填写联系电话')
}
this.codeDisabled = true
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.reportMobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
getAuthCode(data).then(res => {
//倒计时
this.timeId = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
window.clearInterval(this.timeId)
this.codeDisabled = false
this.countDown = 60
}
}, 1000)
if (res.result == 0) {
this.logoutDTO.smsId = res.sessionId
this.logoutDTO.smsCode = null
} else {
this.$toast(res.resultMessage)
}
})
},
// 注销
logoutAgent() {
let jj = AESTools.AESEncrypt('中国分红我都i阿萨79热9去 =-0987654321*&……%¥#@!·,》?》《?你啊', '41424344454631323334353637383930')
console.log('jj', jj)
let mm = AESTools.AESDecrypt(jj, '41424344454631323334353637383930')
console.log('mm', mm)
//console.log(this.$MD5(this.logoutDTO.pwd))
/* // 1、判断计时器
if(!codeDisabled){
return this.$toast('请先获取验证码')
}
//
if(!this.logoutDTO.smsCode || this.logoutDTO.pwd == ''){
return this.$toast('请输入短信验证码')
}
// 2、判断密码是否一致
if(!this.logoutDTO.pwd || this.logoutDTO.pwd == ''){
return this.$toast('请输入密码')
}
if(!this.logoutDTO.confirmPwd || this.logoutDTO.confirmPwd == ''){
return this.$toast('请输入确认密码')
}
if(!(this.logoutDTO.pwd == this.logoutDTO.confirmPwd)){
return this.$toast('两次输入密码不一致')
}
*/
}
}
}
</script>
<style lang="scss" scoped>
.insured-info-container {
/deep/ .van-checkbox {
margin-left: auto;
}
/deep/ .van-radio {
margin-left: auto;
}
/deep/ .bankCard {
width: 120px;
height: 20px;
line-height: 20px;
border-radius: 10px;
}
.van-cell {
align-items: center;
}
.logout_button {
width: 80%;
margin-left: 10%;
}
}
</style>