Commit 69e484e6 by 展昭

对接数据,修改对接方法.

parent 92743715
VUE_APP_OIDC_CONFIG = '{ "authority": "http://106.120.107.150:5000", "client_id": "teamix-personal-center-web-pc", "client_secret": "123456", "redirect_uri": "http://localhost:8080/callback.html", "response_type": "id_token token", "scope": "openid workapps.client api.workapps.user","post_logout_redirect_uri":"http://localhost:8080", "silent_redirect_uri": "http://localhost:8080/silent-renew.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true,"loadUserInfo":true }' VUE_APP_OIDC_CONFIG = '{ "authority": "http://106.120.107.150:5000", "client_id": "teamix-personal-center-web-pc", "client_secret": "123456", "redirect_uri": "http://localhost:8080/callback.html", "response_type": "id_token token", "scope": "openid workapps.client api.workapps.user","post_logout_redirect_uri":"http://localhost:8080", "silent_redirect_uri": "http://localhost:8080/silent-renew.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true,"loadUserInfo":true }'
VUE_APP_BASE_URL= "http://organization.test.hrs100.cn:18080/" VUE_APP_BASE_URL= http://organization.test.hrs100.cn:18080
VUE_APP_USERINFO_URL=http://106.120.107.145:7778/v1/qqxb/user/api
# https开关 # https开关
VUE_APP_OPEN_HTTPS=false VUE_APP_OPEN_HTTPS=false
VUE_APP_OIDC_CONFIG = '{ "authority": "https://passport.teammix.com", "client_id": "qqxb-activity-web-mobile", "client_secret": "qqxb#teammix#2019", "redirect_uri": "https://invite.activity.h5.hrs100.com/callback.html", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"https://invite.activity.h5.hrs100.com", "silent_redirect_uri": "https://invite.activity.h5.hrs100.com/silent-renew-oidc.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }' VUE_APP_OIDC_CONFIG = '{ "authority": "https://passport.teammix.com", "client_id": "qqxb-activity-web-mobile", "client_secret": "qqxb#teammix#2019", "redirect_uri": "https://invite.activity.h5.hrs100.com/callback.html", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"https://invite.activity.h5.hrs100.com", "silent_redirect_uri": "https://invite.activity.h5.hrs100.com/silent-renew-oidc.html", "automaticSilentRenew": true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }'
#VUE_APP_API_BASEURL = 'https://apiplus.qinqinxiaobao.com/v1/qqxb/user/api' VUE_APP_USERINFO_URL="";
VUE_APP_OIDC_CONFIG = '{ "authority": "http://106.120.107.150:5000", "client_id": "qqxb-activity-web-mobile", "client_secret": "123456", "redirect_uri": "http://106.120.107.150:7774/callback.html", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"http://106.120.107.150:7774", "silent_redirect_uri": "http://106.120.107.150:7774/silent-renew-oidc.html", "automaticSilentRenew": true,"automaticSilentSignin":true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }' VUE_APP_OIDC_CONFIG = '{ "authority": "http://106.120.107.150:5000", "client_id": "qqxb-activity-web-mobile", "client_secret": "123456", "redirect_uri": "http://106.120.107.150:7774/callback.html", "response_type": "id_token token", "scope": "workapps.client api.workapps.user api.workapps.org api.workapps.open openid","post_logout_redirect_uri":"http://106.120.107.150:7774", "silent_redirect_uri": "http://106.120.107.150:7774/silent-renew-oidc.html", "automaticSilentRenew": true,"automaticSilentSignin":true,"accessTokenExpiringNotificationTime":60,"filterProtocolClaims":true,"loadUserInfo":true }'
#VUE_APP_API_BASEURL = 'http://106.120.107.145:7778/v1/qqxb/user/api' VUE_APP_BASE_URL= http://organization.test.hrs100.cn:18080
VUE_APP_USERINFO_URL=http://106.120.107.145:7778/v1/qqxb/user/api
...@@ -16,7 +16,7 @@ export default [ ...@@ -16,7 +16,7 @@ export default [
component: () => import("@/views/SelectIdentity.vue"), component: () => import("@/views/SelectIdentity.vue"),
meta: { meta: {
title: '身份选择', title: '身份选择',
requiresAuth: false requiresAuth: true
} }
}, },
{ {
......
...@@ -3,6 +3,7 @@ import store from '@/store'; ...@@ -3,6 +3,7 @@ import store from '@/store';
import { EmployeeInterface } from '@/services/employee/employeeService'; import { EmployeeInterface } from '@/services/employee/employeeService';
import urls from '@/utils/urls'; import urls from '@/utils/urls';
/** /**
* 员工服务类 * 员工服务类
*/ */
...@@ -42,13 +43,8 @@ class EmployeeService implements EmployeeInterface { ...@@ -42,13 +43,8 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public async getUserInfo(params: any): Promise<any> { public async getUserInfo(params: any): Promise<any> {
console.log(this.header); const url = urls.userInfoUrl + `/userAuthDetails`;
// let result = await request.get("http://qinqinxiaobao.com", "", this.header); return request.postWithAuthHeader(url, params, this.header)
// console.log(result);
return {
id: 1,
name: "333"
}
} }
/** /**
...@@ -56,7 +52,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -56,7 +52,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getWorkInfoList(params: any): Promise<any> { public getWorkInfoList(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/work`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/work`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -66,7 +62,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -66,7 +62,7 @@ class EmployeeService implements EmployeeInterface {
*/ */
public getWorkInfoDetail(params: any): Promise<any> { public getWorkInfoDetail(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/work/detail`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/work/detail`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -75,7 +71,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -75,7 +71,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getPersonInfo(params: any): Promise<any> { public getPersonInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/info`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/info`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -84,7 +80,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -84,7 +80,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public savePersonInfo(params: any): Promise<any> { public savePersonInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/info`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/info`;
return request.post(url, params, this.header) return request.post(url, params, this.header)
} }
...@@ -93,7 +89,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -93,7 +89,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getContactInfo(params: any): Promise<any> { public getContactInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/contact/info`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/contact/info`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -102,7 +98,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -102,7 +98,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public saveContactInfo(params: any): Promise<any> { public saveContactInfo(params: any): Promise<any> {
let url = `/api/user/contact/${params.edId}/info`; let url = urls.employeeUrl + `/api/user/contact/${params.edId}/info`;
return request.post(url, params, this.header) return request.post(url, params, this.header)
} }
...@@ -111,7 +107,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -111,7 +107,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getSocialInfo(params: any): Promise<any> { public getSocialInfo(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/unit/relation`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/unit/relation`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -120,7 +116,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -120,7 +116,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public saveSocialInfo(params: any): Promise<any> { public saveSocialInfo(params: any): Promise<any> {
let url = `/api/user/employee/unit/relation/save`; let url = urls.employeeUrl + `/api/user/employee/unit/relation/save`;
return request.post(url, params, this.header) return request.post(url, params, this.header)
} }
...@@ -129,7 +125,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -129,7 +125,7 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getWageCardInfo(params: any): Promise<any> { public getWageCardInfo(params: any): Promise<any> {
let url = `/api/user/contact/${params.edId}/salary/card/info`; let url = urls.employeeUrl + `/api/user/contact/${params.edId}/salary/card/info`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -138,7 +134,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -138,7 +134,7 @@ class EmployeeService implements EmployeeInterface {
* @params params * @params params
*/ */
public saveWageCardInfo(params: any): Promise<any> { public saveWageCardInfo(params: any): Promise<any> {
let url = `/api/user/contact/salary/card/info`; let url = urls.employeeUrl + `/api/user/contact/salary/card/info`;
return request.post(url, params, this.header) return request.post(url, params, this.header)
} }
...@@ -147,17 +143,17 @@ class EmployeeService implements EmployeeInterface { ...@@ -147,17 +143,17 @@ class EmployeeService implements EmployeeInterface {
* @param params 请求参数 * @param params 请求参数
*/ */
public getEduExperience(params: any): Promise<any> { public getEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/education`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/education`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
/** /**
* 获取教育信息详细 * 获取教育信息详细
* @param params * @param params
*/ */
public getEduExperienceDetial(params: any): Promise<any> { public getEduExperienceDetial(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/education/detial`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/education/detial`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -166,7 +162,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -166,7 +162,7 @@ class EmployeeService implements EmployeeInterface {
* @param params * @param params
*/ */
public addEduExperience(params: any): Promise<any> { public addEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/edu/info`; let url = urls.employeeUrl + `/api/user/employee/edu/info`;
return request.post(url, params, this.header) return request.post(url, params, this.header)
} }
...@@ -175,7 +171,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -175,7 +171,7 @@ class EmployeeService implements EmployeeInterface {
* @param params * @param params
*/ */
public updateEduExperience(params: any): Promise<any> { public updateEduExperience(params: any): Promise<any> {
let url = `/api/user/employee/edu/info`; let url = urls.employeeUrl + `/api/user/employee/edu/info`;
return request.put(url, params, this.header) return request.put(url, params, this.header)
} }
...@@ -184,7 +180,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -184,7 +180,7 @@ class EmployeeService implements EmployeeInterface {
* @param params * @param params
*/ */
public getTechnologyExperience(params: any): Promise<any> { public getTechnologyExperience(params: any): Promise<any> {
let url = `/api/user/employee/${params.edId}/expertise/info`; let url = urls.employeeUrl + `/api/user/employee/${params.edId}/expertise/info`;
return request.get(url, params, this.header) return request.get(url, params, this.header)
} }
...@@ -193,7 +189,7 @@ class EmployeeService implements EmployeeInterface { ...@@ -193,7 +189,7 @@ class EmployeeService implements EmployeeInterface {
* @param params * @param params
*/ */
public updateTechnologyExperience(params: any): Promise<any> { public updateTechnologyExperience(params: any): Promise<any> {
let url = `/api/user/employee/expertise/info`; let url = urls.employeeUrl + `/api/user/employee/expertise/info`;
return request.put(url, params, this.header) return request.put(url, params, this.header)
} }
......
...@@ -4,7 +4,6 @@ import { ResponseData } from '@/types/index'; ...@@ -4,7 +4,6 @@ import { ResponseData } from '@/types/index';
let http: AxiosInstance | any; let http: AxiosInstance | any;
http = axios.create({ http = axios.create({
baseURL: process.env.VUE_APP_BASE_URL,
timeout: 60000, timeout: 60000,
}); });
......
...@@ -37,6 +37,23 @@ class Request { ...@@ -37,6 +37,23 @@ class Request {
/** /**
* *
* POST 请求
* @param url 请求链接
* @param params 请求参数
* @param headers 请求头信息
*/
public postWithAuthHeader(url: string, params: any = {}, headers: any = {}) {
let options: any = {};
if (headers) {
options.headers = headers;
}
return new Promise((resolve, reject) => {
resolve(http.post(`${url}?${GetCommonPms(true)}`, params, options));
})
}
/**
*
* PUT 请求 * PUT 请求
* @param url 请求链接 * @param url 请求链接
* @param params 请求参数 * @param params 请求参数
......
...@@ -3,500 +3,508 @@ ...@@ -3,500 +3,508 @@
* @param tel 手机号 * @param tel 手机号
*/ */
export function isTel(tel: string) { export function isTel(tel: string) {
return /^1\d{10}$/.test(tel); return /^1\d{10}$/.test(tel);
} }
/** /**
* 验证邮箱 * 验证邮箱
* @param email 邮箱 * @param email 邮箱
*/ */
export function isEmail(email: string) { export function isEmail(email: string) {
return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email); return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email);
} }
/** /**
* 验证密码格式(8-16位,数字和英文字母的组合) * 验证密码格式(8-16位,数字和英文字母的组合)
* @param password 密码 * @param password 密码
*/ */
export function isPassWord(password: string) { export function isPassWord(password: string) {
// console.log(password); // console.log(password);
return /^(?=.*?[0-9])(?=.*?[A-Za-z])[0-9A-Za-z]{8,16}$/.test(password); return /^(?=.*?[0-9])(?=.*?[A-Za-z])[0-9A-Za-z]{8,16}$/.test(password);
} }
/** /**
* 验证银行卡号 * 验证银行卡号
* @param banknum 银行卡号 * @param banknum 银行卡号
*/ */
export function isBankNum(banknum: string) { export function isBankNum(banknum: string) {
return /^([1-9]{1})(\d{15}|\d{18})$/.test(banknum); return /^([1-9]{1})(\d{15}|\d{18})$/.test(banknum);
} }
/** /**
* 验证身份证号 * 验证身份证号
* @param id 身份证号 * @param id 身份证号
*/ */
export function isIdCard(id: string) { export function isIdCard(id: string) {
return /^\d{6}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$/.test(id); return /^\d{6}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$/.test(id);
} }
/** /**
* 模糊手机号 * 模糊手机号
* @param mobile 手机号 * @param mobile 手机号
*/ */
export function fuzzyMobile(mobile: string) { export function fuzzyMobile(mobile: string) {
let mobileFront = mobile.slice(0, 3); let mobileFront = mobile.slice(0, 3);
let mobileEnd = mobile.slice(7); let mobileEnd = mobile.slice(7);
return mobileFront + '****' + mobileEnd; return mobileFront + '****' + mobileEnd;
} }
/** /**
* 模糊邮箱 * 模糊邮箱
* @param email 邮箱 * @param email 邮箱
*/ */
export function fuzzyEmail(email: string) { export function fuzzyEmail(email: string) {
let emailFront = email.slice(0, 1); let emailFront = email.slice(0, 1);
let index = email.indexOf('@'); let index = email.indexOf('@');
let emailEnd = email.slice(index); let emailEnd = email.slice(index);
return emailFront + '****' + emailEnd; return emailFront + '****' + emailEnd;
} }
/** /**
* 姓名格式化为‘'*' + 尾字’ * 姓名格式化为‘'*' + 尾字’
* @param name 姓名 * @param name 姓名
*/ */
export function fuzzyName(name: string) { export function fuzzyName(name: string) {
// console.log(name); // console.log(name);
return '*' + name.slice(-1); return '*' + name.slice(-1);
} }
/** /**
* 身份证号格式化为‘首1+'******'+尾1’ * 身份证号格式化为‘首1+'******'+尾1’
* @param idnum 身份证 * @param idnum 身份证
*/ */
export function fuzzyIdNum(idnum: string) { export function fuzzyIdNum(idnum: string) {
if (idnum === "") { if (idnum === "") {
return ""; return "";
}
return (idnum || "").slice(0, 1) + '****************' + (idnum || "").slice(-1);
} }
return (idnum || "").slice(0, 1) + '****************' + (idnum || "").slice(-1);
/** }
* 银行卡号格式化为‘首4+'******'+尾4’
* @param banknunm 银行卡号 /**
*/ * 银行卡号格式化为‘首4+'******'+尾4’
export function fuzzyBankNum(banknunm: string) { * @param banknunm 银行卡号
if (banknunm === "") { */
return ""; export function fuzzyBankNum(banknunm: string) {
} if (banknunm === "") {
return (banknunm || "").slice(0, 4) + '********' + (banknunm || "").slice(-4); return "";
} }
return (banknunm || "").slice(0, 4) + '********' + (banknunm || "").slice(-4);
/** }
* 获取性别
* @param sex 性别数字 /**
*/ * 获取性别
export function gender(sex: number) { * @param sex 性别数字
let genderArr = ['', '男', '女']; */
if (sex > 0) { export function gender(sex: number) {
return genderArr[sex]; let genderArr = ['', '男', '女'];
} else { if (sex > 0) {
return ''; return genderArr[sex];
} } else {
return '';
} }
}
/**
* 获取认证方式 /**
* @param value 认证关键字 * 获取认证方式
*/ * @param value 认证关键字
export function authMethod(value: string) { */
let bankArray: { [key: string]: string } = { export function authMethod(value: string) {
"MANUAL": "手动认证", let bankArray: { [key: string]: string } = {
"TWO": "二要素认证", "MANUAL": "手动认证",
"BANK_FOUR": "四要素认证", "TWO": "二要素认证",
"MOBILE_THREE": "三要素认证" "BANK_FOUR": "四要素认证",
}; "MOBILE_THREE": "三要素认证"
};
for (let k in bankArray) {
if (k === value) { for (let k in bankArray) {
return bankArray[k]; if (k === value) {
} return bankArray[k];
} }
return "";
} }
return "";
/** }
* 检测字符串是否为空
* @param value 字符串 /**
*/ * 检测字符串是否为空
export function isNullOrEmpty(value: string) { * @param value 字符串
if (value === null || value === undefined || value === "") { */
return false; export function isNullOrEmpty(value: string) {
} if (value === null || value === undefined || value === "") {
return true; return false;
} }
return true;
/** }
* 节流调用
* @param this 当前调用对象 /**
* @param fn 是我们需要包装的事件回调 * 节流调用
* @param delay 是时间间隔的阈值 * @param this 当前调用对象
*/ * @param fn 是我们需要包装的事件回调
export function throttle(this: any, fn: Function, delay: number) { * @param delay 是时间间隔的阈值
// last为上一次触发回调的时间, timer是定时器 */
let last = 0, timer: any = null; export function throttle(this: any, fn: Function, delay: number) {
// last为上一次触发回调的时间, timer是定时器
// 将throttle处理结果当作函数返回 let last = 0, timer: any = null;
return () => {
// 保留调用时的this上下文 // 将throttle处理结果当作函数返回
let context = this; return () => {
// 保留调用时传入的参数 // 保留调用时的this上下文
let args = this.arguments; let context = this;
// 记录本次触发回调的时间 // 保留调用时传入的参数
let now = +new Date(); let args = this.arguments;
// 记录本次触发回调的时间
// 判断上次触发的时间和本次触发的时间差是否小于时间间隔的阈值 let now = +new Date();
if (now - last < delay) {
// 如果时间间隔小于我们设定的时间间隔阈值,则为本次触发操作设立一个新的定时器 // 判断上次触发的时间和本次触发的时间差是否小于时间间隔的阈值
clearTimeout(timer); if (now - last < delay) {
timer = setTimeout(function () { // 如果时间间隔小于我们设定的时间间隔阈值,则为本次触发操作设立一个新的定时器
last = now; clearTimeout(timer);
fn.apply(context, args); timer = setTimeout(function () {
}, delay);
} else {
// 如果时间间隔超出了我们设定的时间间隔阈值,那就不等了,无论如何要反馈给用户一次响应
last = now; last = now;
fn.apply(context, args); fn.apply(context, args);
} }, delay);
}; } else {
} // 如果时间间隔超出了我们设定的时间间隔阈值,那就不等了,无论如何要反馈给用户一次响应
last = now;
fn.apply(context, args);
/**
* 字符串转16进制
* @param s 字符串
*/
function bin2hex(s: string) {
var i,
l,
o = "",
n;
s += "";
for (i = 0, l = s.length; i < l; i++) {
n = s.charCodeAt(i).toString(16)
o += n.length < 2 ? "0" + n : n;
} }
return o; };
} }
/**
* 获取画布 /**
*/ * 字符串转16进制
function getCanvas() { * @param s 字符串
var canvas = document.createElement("canvas"); */
var ctx = canvas.getContext("2d"); function bin2hex(s: string) {
ctx!.fillStyle = "#f60"; var i,
ctx!.fillRect(125, 1, 62, 20); l,
var b64 = canvas.toDataURL().replace("data:image/png;base64,", ""); o = "",
var bin = atob(b64); n;
var crc = bin2hex(bin.slice(-16, -12)); s += "";
return crc; for (i = 0, l = s.length; i < l; i++) {
n = s.charCodeAt(i).toString(16)
o += n.length < 2 ? "0" + n : n;
} }
return o;
/** }
* 获取系统信息
*/ /**
function getOsInfo() { * 获取画布
var userAgent = navigator.userAgent.toLowerCase(); */
var name = "Unknown"; function getCanvas() {
var version = "Unknown"; var canvas = document.createElement("canvas");
if (userAgent.indexOf("win") > -1) { var ctx = canvas.getContext("2d");
name = "Windows"; ctx!.fillStyle = "#f60";
if (userAgent.indexOf("windows nt 5.0") > -1) { ctx!.fillRect(125, 1, 62, 20);
version = "Windows 2000"; var b64 = canvas.toDataURL().replace("data:image/png;base64,", "");
} else if ( var bin = atob(b64);
userAgent.indexOf("windows nt 5.1") > -1 || var crc = bin2hex(bin.slice(-16, -12));
userAgent.indexOf("windows nt 5.2") > -1 return crc;
) { }
version = "Windows XP";
} else if (userAgent.indexOf("windows nt 6.0") > -1) { /**
version = "Windows Vista"; * 获取系统信息
} else if ( */
userAgent.indexOf("windows nt 6.1") > -1 || function getOsInfo() {
userAgent.indexOf("windows 7") > -1 var userAgent = navigator.userAgent.toLowerCase();
) { var name = "Unknown";
version = "Windows 7"; var version = "Unknown";
} else if ( if (userAgent.indexOf("win") > -1) {
userAgent.indexOf("windows nt 6.2") > -1 || name = "Windows";
userAgent.indexOf("windows 8") > -1 if (userAgent.indexOf("windows nt 5.0") > -1) {
) { version = "Windows 2000";
version = "Windows 8"; } else if (
} else if (userAgent.indexOf("windows nt 6.3") > -1) { userAgent.indexOf("windows nt 5.1") > -1 ||
version = "Windows 8.1"; userAgent.indexOf("windows nt 5.2") > -1
} else if ( ) {
userAgent.indexOf("windows nt 6.2") > -1 || version = "Windows XP";
userAgent.indexOf("windows nt 10.0") > -1 } else if (userAgent.indexOf("windows nt 6.0") > -1) {
) { version = "Windows Vista";
version = "Windows 10"; } else if (
} else { userAgent.indexOf("windows nt 6.1") > -1 ||
version = "Unknown"; userAgent.indexOf("windows 7") > -1
} ) {
} else if (userAgent.indexOf("iphone") > -1) { version = "Windows 7";
name = "Iphone";
} else if (userAgent.indexOf("mac") > -1) {
name = "Mac";
} else if ( } else if (
userAgent.indexOf("x11") > -1 || userAgent.indexOf("windows nt 6.2") > -1 ||
userAgent.indexOf("unix") > -1 || userAgent.indexOf("windows 8") > -1
userAgent.indexOf("sunname") > -1 ||
userAgent.indexOf("bsd") > -1
) { ) {
name = "Unix"; version = "Windows 8";
} else if (userAgent.indexOf("linux") > -1) { } else if (userAgent.indexOf("windows nt 6.3") > -1) {
if (userAgent.indexOf("android") > -1) { version = "Windows 8.1";
name = "Android" } else if (
} else { userAgent.indexOf("windows nt 6.2") > -1 ||
name = "Linux"; userAgent.indexOf("windows nt 10.0") > -1
} ) {
version = "Windows 10";
} else {
version = "Unknown";
}
} else if (userAgent.indexOf("iphone") > -1) {
name = "Iphone";
} else if (userAgent.indexOf("mac") > -1) {
name = "Mac";
} else if (
userAgent.indexOf("x11") > -1 ||
userAgent.indexOf("unix") > -1 ||
userAgent.indexOf("sunname") > -1 ||
userAgent.indexOf("bsd") > -1
) {
name = "Unix";
} else if (userAgent.indexOf("linux") > -1) {
if (userAgent.indexOf("android") > -1) {
name = "Android"
} else { } else {
name = "Unknown"; name = "Linux";
} }
// var os = new Object(); } else {
// os.name = name; name = "Unknown";
// os.version = version;
return version;
//document.write("系统:" + os.name + "版本:" + os.name)
} }
// var os = new Object();
/** // os.name = name;
* 获取浏览器信息 // os.version = version;
*/ return version;
function getBrowerInfo() { //document.write("系统:" + os.name + "版本:" + os.name)
var Browser: any = }
Browser ||
(function (window) { /**
var document = window.document, * 获取浏览器信息
navigator = window.navigator, */
agent = navigator.userAgent.toLowerCase(), function getBrowerInfo() {
//IE8+支持.返回浏览器渲染当前文档所用的模式 var Browser: any =
//IE6,IE7:undefined.IE8:8(兼容模式返回7).IE9:9(兼容模式返回7||8) Browser ||
//IE10:10(兼容模式7||8||9) (function (window) {
IEMode = (<any>document).documentMode, var document = window.document,
//chorme navigator = window.navigator,
chrome = (<any>window).chrome || false, agent = navigator.userAgent.toLowerCase(),
System = { //IE8+支持.返回浏览器渲染当前文档所用的模式
//user-agent //IE6,IE7:undefined.IE8:8(兼容模式返回7).IE9:9(兼容模式返回7||8)
agent: agent, //IE10:10(兼容模式7||8||9)
//是否为IE IEMode = (<any>document).documentMode,
isIE: /trident/.test(agent), //chorme
//Gecko内核 chrome = (<any>window).chrome || false,
isGecko: agent.indexOf("gecko") > 0 && agent.indexOf("like gecko") < 0, System = {
//webkit内核 //user-agent
isWebkit: agent.indexOf("webkit") > 0, agent: agent,
//是否为标准模式 //是否为IE
isStrict: document.compatMode === "CSS1Compat", isIE: /trident/.test(agent),
//是否支持subtitle //Gecko内核
supportSubTitle: function () { isGecko: agent.indexOf("gecko") > 0 && agent.indexOf("like gecko") < 0,
return "track" in document.createElement("track"); //webkit内核
}, isWebkit: agent.indexOf("webkit") > 0,
//是否支持scoped //是否为标准模式
supportScope: function () { isStrict: document.compatMode === "CSS1Compat",
return "scoped" in document.createElement("style"); //是否支持subtitle
}, supportSubTitle: function () {
return "track" in document.createElement("track");
//获取IE的版本号 },
ieVersion: function () { //是否支持scoped
var rMsie = /(msie\s|trident.*rv:)([\w.]+)/; supportScope: function () {
var ma = window.navigator.userAgent.toLowerCase() return "scoped" in document.createElement("style");
var match = rMsie.exec(ma); },
try {
return match![2]; //获取IE的版本号
} catch (e) { ieVersion: function () {
return IEMode; var rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
} var ma = window.navigator.userAgent.toLowerCase()
}, var match = rMsie.exec(ma);
//Opera版本号 try {
operaVersion: function () { return match![2];
try { } catch (e) {
if ((<any>window).opera) { return IEMode;
return agent.match(/opera.([\d.]+)/)![1];
} else if (agent.indexOf("opr") > 0) {
return agent.match(/opr\/([\d.]+)/)![1];
}
} catch (e) {
return 0;
}
}
};
try {
//浏览器类型(IE、Opera、Chrome、Safari、Firefox)
(<any>System).type = System.isIE
? "IE"
: (<any>window).opera || agent.indexOf("opr") > 0
? "Opera"
: agent.indexOf("chrome") > 0
? "Chrome"
: //safari也提供了专门的判定方式
(<any>window).openDatabase
? "Safari"
: agent.indexOf("firefox") > 0
? "Firefox"
: "unknow";
//版本号
(<any>System).version = ((<any>System).type === "IE") ? System.ieVersion() :
((<any>System).type === "Firefox") ? agent.match(/firefox\/([\d.]+)/)![1] :
((<any>System).type === "Chrome") ? agent.match(/chrome\/([\d.]+)/)![1] :
((<any>System).type === "Opera") ? System.operaVersion() :
((<any>System).type === "Safari") ? agent.match(/version\/([\d.]+)/)![1] :
"0";
//浏览器外壳
(<any>System).shell = function () {
if (agent.indexOf("edge") > 0) {
(<any>System).version = agent.match(/edge\/([\d.]+)/)![1] || (<any>System).version;
return "edge浏览器";
} }
//遨游浏览器 },
if (agent.indexOf("maxthon") > 0) { //Opera版本号
(<any>System).version = agent.match(/maxthon\/([\d.]+)/)![1] || (<any>System).version; operaVersion: function () {
return "傲游浏览器"; try {
if ((<any>window).opera) {
return agent.match(/opera.([\d.]+)/)![1];
} else if (agent.indexOf("opr") > 0) {
return agent.match(/opr\/([\d.]+)/)![1];
}
} catch (e) {
return 0;
} }
//QQ浏览器 }
if (agent.indexOf("qqbrowser") > 0) { };
(<any>System).version = agent.match(/qqbrowser\/([\d.]+)/)![1] || (<any>System).version;
return "QQ浏览器"; try {
//浏览器类型(IE、Opera、Chrome、Safari、Firefox)
(<any>System).type = System.isIE
? "IE"
: (<any>window).opera || agent.indexOf("opr") > 0
? "Opera"
: agent.indexOf("chrome") > 0
? "Chrome"
: //safari也提供了专门的判定方式
(<any>window).openDatabase
? "Safari"
: agent.indexOf("firefox") > 0
? "Firefox"
: "unknow";
//版本号
(<any>System).version = ((<any>System).type === "IE") ? System.ieVersion() :
((<any>System).type === "Firefox") ? agent.match(/firefox\/([\d.]+)/)![1] :
((<any>System).type === "Chrome") ? agent.match(/chrome\/([\d.]+)/)![1] :
((<any>System).type === "Opera") ? System.operaVersion() :
((<any>System).type === "Safari") ? agent.match(/version\/([\d.]+)/)![1] :
"0";
//浏览器外壳
(<any>System).shell = function () {
if (agent.indexOf("edge") > 0) {
(<any>System).version = agent.match(/edge\/([\d.]+)/)![1] || (<any>System).version;
return "edge浏览器";
}
//遨游浏览器
if (agent.indexOf("maxthon") > 0) {
(<any>System).version = agent.match(/maxthon\/([\d.]+)/)![1] || (<any>System).version;
return "傲游浏览器";
}
//QQ浏览器
if (agent.indexOf("qqbrowser") > 0) {
(<any>System).version = agent.match(/qqbrowser\/([\d.]+)/)![1] || (<any>System).version;
return "QQ浏览器";
}
//搜狗浏览器
if (agent.indexOf("se 2.x") > 0) {
return '搜狗浏览器';
}
//Chrome:也可以使用window.chrome && window.chrome.webstore判断
if (chrome && (<any>System).type !== "Opera") {
var external = window.external,
clientInfo = window.clientInformation,
//客户端语言:zh-cn,zh.360下面会返回undefined
clientLanguage = clientInfo.languages;
//猎豹浏览器:或者agent.indexOf("lbbrowser")>0
if (external && 'LiebaoGetVersion' in external) {
return '猎豹浏览器';
} }
//百度浏览器
//搜狗浏览器 if (agent.indexOf("bidubrowser") > 0) {
if (agent.indexOf("se 2.x") > 0) { (<any>System).version = agent.match(/bidubrowser\/([\d.]+)/)![1] ||
return '搜狗浏览器'; agent.match(/chrome\/([\d.]+)/)![1];
return "百度浏览器";
} }
//360极速浏览器和360安全浏览器
//Chrome:也可以使用window.chrome && window.chrome.webstore判断 if (System.supportSubTitle() && typeof clientLanguage === "undefined") {
if (chrome && (<any>System).type !== "Opera") { //object.key()返回一个数组.包含可枚举属性和方法名称
var external = window.external, var storeKeyLen = Object.keys(chrome.webstore).length,
clientInfo = window.clientInformation, v8Locale = "v8Locale" in window;
//客户端语言:zh-cn,zh.360下面会返回undefined return storeKeyLen > 1 ? '360极速浏览器' : '360安全浏览器';
clientLanguage = clientInfo.languages;
//猎豹浏览器:或者agent.indexOf("lbbrowser")>0
if (external && 'LiebaoGetVersion' in external) {
return '猎豹浏览器';
}
//百度浏览器
if (agent.indexOf("bidubrowser") > 0) {
(<any>System).version = agent.match(/bidubrowser\/([\d.]+)/)![1] ||
agent.match(/chrome\/([\d.]+)/)![1];
return "百度浏览器";
}
//360极速浏览器和360安全浏览器
if (System.supportSubTitle() && typeof clientLanguage === "undefined") {
//object.key()返回一个数组.包含可枚举属性和方法名称
var storeKeyLen = Object.keys(chrome.webstore).length,
v8Locale = "v8Locale" in window;
return storeKeyLen > 1 ? '360极速浏览器' : '360安全浏览器';
}
return "Chrome";
} }
return (<any>System).type; return "Chrome";
}; }
return (<any>System).type;
//浏览器名称(如果是壳浏览器,则返回壳名称)
(<any>System).name = (<any>System).shell();
//对版本号进行过滤过处理
// System.version = System.versionFilter(System.version);
} catch (e) { }
return {
client: System
}; };
})(window);
if (Browser.client.name == undefined || Browser.client.name == "") { //浏览器名称(如果是壳浏览器,则返回壳名称)
Browser.client.name = "Unknown"; (<any>System).name = (<any>System).shell();
Browser.client.version = "Unknown"; //对版本号进行过滤过处理
} else if (Browser.client.version == undefined) { // System.version = System.versionFilter(System.version);
Browser.client.version = "Unknown";
} } catch (e) { }
// document.write(Browser.client.name + " " + Browser.client.version); return {
return Browser; client: System
};
})(window);
if (Browser.client.name == undefined || Browser.client.name == "") {
Browser.client.name = "Unknown";
Browser.client.version = "Unknown";
} else if (Browser.client.version == undefined) {
Browser.client.version = "Unknown";
} }
// document.write(Browser.client.name + " " + Browser.client.version);
/** return Browser;
* 获取公共参数 }
*/
export function GetCommonPms() { /**
const v = "1.0.1"; * 获取公共参数
const did = getCanvas(); */
const dh = getOsInfo(); export function GetCommonPms(special: boolean = false) {
const BrowerInfo = getBrowerInfo(); const v = "1.0.1";
const db = BrowerInfo.client.name; const did = getCanvas();
const dv = BrowerInfo.client.version; const dh = getOsInfo();
const BrowerInfo = getBrowerInfo();
const db = BrowerInfo.client.name;
const dv = BrowerInfo.client.version;
if (!special) {
const t = new Date().getTime(); const t = new Date().getTime();
const pms = `v=${v}&&did=${did}&&dh=${dh}&&db=${db}&&dv=${dv}&&dm=&&lat=&&lng=&&t=${t}`; const pms = `v=${v}&&did=${did}&&dh=${dh}&&db=${db}&&dv=${dv}&&dm=&&lat=&&lng=&&t=${t}`;
return pms; return pms;
} else {
const pms = `v=${v}&&did=${did}&&dh=${dh}&&db=${db}&&dv=${dv}&&dm=&&lat=&&lng=&&t=`;
return pms;
} }
/**
* 判断是否是移动端
*/ }
export function isMobileBrowser() {
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { /**
return true; * 判断是否是移动端
} */
return false; export function isMobileBrowser() {
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
return true;
} }
return false;
function padLeftZero(str: string) { }
return ('00' + str).substr(str.length)
function padLeftZero(str: string) {
return ('00' + str).substr(str.length)
}
/**
* 时间转换成字符串
* @param date 时间
* @param fmt 转换格式
*/
export function formatDate(date: Date, fmt = 'yyyy-MM-dd hh:mm:ss') {
if (!date) {
return "";
} }
if (typeof date === 'string') {
/** date = new Date(date);
* 时间转换成字符串
* @param date 时间
* @param fmt 转换格式
*/
export function formatDate(date: Date, fmt = 'yyyy-MM-dd hh:mm:ss') {
if (!date) {
return "";
}
if (typeof date === 'string') {
date = new Date(date);
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o: any = {
'M+': date.getMonth() + 1,
'd+': date.getDate(),
'h+': date.getHours(),
'm+': date.getMinutes(),
's+': date.getSeconds()
}
for (let k in o) {
let str = o[k] + '';
if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
} }
if (/(y+)/.test(fmt)) {
/** fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
* 获取当前所在系统 }
*/ let o: any = {
export function CheckPlatform() { 'M+': date.getMonth() + 1,
if (/Win/i.test(navigator.platform)) { 'd+': date.getDate(),
return "PC-WINDOWS"; 'h+': date.getHours(),
} else if (/Mac/i.test(navigator.platform)) { 'm+': date.getMinutes(),
return "PC-MAC"; 's+': date.getSeconds()
} else if (/android/.test(navigator.userAgent)) { }
return "ANDROID"; for (let k in o) {
} else if (/Linux/i.test(navigator.platform)) { let str = o[k] + '';
return "ANDROID"; if (new RegExp(`(${k})`).test(fmt)) {
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.platform)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
return "IOS";
} else {
return "";
} }
} }
\ No newline at end of file return fmt;
}
/**
* 获取当前所在系统
*/
export function CheckPlatform() {
if (/Win/i.test(navigator.platform)) {
return "PC-WINDOWS";
} else if (/Mac/i.test(navigator.platform)) {
return "PC-MAC";
} else if (/android/.test(navigator.userAgent)) {
return "ANDROID";
} else if (/Linux/i.test(navigator.platform)) {
return "ANDROID";
} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.platform)) {
return "IOS";
} else {
return "";
}
}
\ No newline at end of file
...@@ -8,10 +8,10 @@ class Urls { ...@@ -8,10 +8,10 @@ class Urls {
*/ */
employeeUrl: String = process.env.VUE_APP_BASE_URL; employeeUrl: String = process.env.VUE_APP_BASE_URL;
// /** /**
// * 认证中心 * 获取用户信息
// */ */
// tokenUrl: String = process.env.VUE_APP_LOGIN_URL; userInfoUrl: String = process.env.VUE_APP_USERINFO_URL;
} }
......
...@@ -27,14 +27,28 @@ ...@@ -27,14 +27,28 @@
<script lang='ts'> <script lang='ts'>
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
@Component @Component({
components: {}
})
export default class SelectIdentity extends Vue { export default class SelectIdentity extends Vue {
private id_no: string = "";
private toFlex(): void { private toFlex(): void {
this.$router.push({ name: "FlexEmployee" }); this.$router.push({ name: "FlexEmployee", query: { id_no: this.id_no } });
} }
private toIndex(): void { private toIndex(): void {
this.$router.push({ name: "Index" }); this.$router.push({ name: "Index", query: { id_no: this.id_no } });
}
created() {
this.$server.EmployeeService.getUserInfo({}).then(res => {
if (res.data && res.data.uthStatus && res.data.uthStatus > 2) {
this.id_no = res.data.personalIdCardNo;
} else {
//TODO: 跳转到实名认证
}
});
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment