Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CRM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
CRM
Commits
ebc43452
Commit
ebc43452
authored
Apr 24, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
307aa2fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
64 deletions
+55
-64
index.js
src/plugins/index.js
+55
-64
No files found.
src/plugins/index.js
View file @
ebc43452
...
...
@@ -6,14 +6,18 @@ export default {
apiurl
:
''
},
install
(
Vue
,
options
)
{
Vue
.
prototype
.
isOnline
=
function
()
{
Vue
.
prototype
.
isOnline
=
function
()
{
return
process
.
env
.
NODE_ENV
!==
'development'
;
},
//域名管理对象
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
"http://192.168.10.2:8098"
Vue
.
prototype
.
domainManager
=
function
()
{
//CRM API
let
domainUrl
=
""
;
domainUrl
=
"http://192.168.10.2:8098"
;
//domainUrl = "http://localhost:5003";
let
locationName
=
window
.
location
.
hostname
;
let
domainPostUrl
=
"http://192.168.10.2:8083"
//旅游ERPApi
let
domainPostUrl
=
"http://192.168.10.214"
if
(
this
.
isOnline
())
{
if
(
window
.
location
.
host
.
indexOf
(
'fcrmyx.oytour.com'
)
!=
-
1
)
{
domainUrl
=
"http://crm.oytour.com"
...
...
@@ -47,7 +51,7 @@ export default {
};
return
obj
;
},
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
successCall
)
{
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
successCall
)
{
var
apiurl
=
this
.
domainManager
().
LocalFileStreamDownLoadUrl
;
var
timestamp
=
(
new
Date
()).
valueOf
();
if
(
!
localStorage
.
userInfo
&&
localStorage
.
userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
...
...
@@ -83,10 +87,10 @@ export default {
document
.
body
.
appendChild
(
link
);
link
.
click
();
successCall
(
res
);
}).
catch
(
function
(
res
)
{});
}).
catch
(
function
(
res
)
{});
},
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun
Vue
.
prototype
.
moneyFormat
=
function
(
value
)
{
Vue
.
prototype
.
moneyFormat
=
function
(
value
)
{
let
nStr
=
Number
(
value
).
toFixed
(
2
)
nStr
+=
''
;
let
x
=
nStr
.
split
(
'.'
);
...
...
@@ -99,7 +103,7 @@ export default {
return
x1
+
x2
;
},
//消息成功提示
Vue
.
prototype
.
Success
=
function
(
msg
)
{
Vue
.
prototype
.
Success
=
function
(
msg
)
{
this
.
$message
({
message
:
msg
,
duration
:
2000
,
...
...
@@ -107,7 +111,7 @@ export default {
});
},
//错误提示
Vue
.
prototype
.
Error
=
function
(
msg
)
{
Vue
.
prototype
.
Error
=
function
(
msg
)
{
this
.
$message
({
message
:
msg
,
duration
:
2000
,
...
...
@@ -116,7 +120,7 @@ export default {
},
//一般提示
Vue
.
prototype
.
Info
=
function
(
msg
)
{
Vue
.
prototype
.
Info
=
function
(
msg
)
{
this
.
$message
({
message
:
msg
,
duration
:
2000
,
...
...
@@ -124,7 +128,7 @@ export default {
});
},
//警告提示
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
this
.
$message
({
message
:
msg
,
duration
:
2000
,
...
...
@@ -132,7 +136,7 @@ export default {
});
},
//Confirm
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
this
.
$confirm
(
msg
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
...
...
@@ -152,7 +156,7 @@ export default {
//type : m_filt 填充 m_w 宽度固定 高度不固定 m_h 高度固定 宽度不固定
// w : 宽
// h : 高
Vue
.
prototype
.
compressImg
=
function
(
path
,
type
,
w
,
h
)
{
Vue
.
prototype
.
compressImg
=
function
(
path
,
type
,
w
,
h
)
{
let
url
=
this
.
domainManager
().
UploadUrl
;
let
poise
=
'width='
;
w
=
w
?
w
:
''
...
...
@@ -164,14 +168,14 @@ export default {
}
return
path
.
split
(
'?'
)[
0
]
+
'?width='
+
w
;
}
//打开新窗口连接
Vue
.
prototype
.
OpenNewUrl
=
function
(
URL
)
{
if
(
URL
!=
''
)
{
window
.
open
(
'http://'
+
URL
,
'_blank'
);
}
//打开新窗口连接
Vue
.
prototype
.
OpenNewUrl
=
function
(
URL
)
{
if
(
URL
!=
''
)
{
window
.
open
(
'http://'
+
URL
,
'_blank'
);
}
//HTTP提交数据
Vue
.
prototype
.
apipost2
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
}
//旅游ERP接口
Vue
.
prototype
.
apipost2
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
...
...
@@ -218,7 +222,7 @@ export default {
}
},
faildCall
)
}
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
...
...
@@ -234,13 +238,11 @@ export default {
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
postData
=
{
"msg"
:
msg
,
// "cmd": cmd,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
}
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
// postData.groupId = parseInt(JSON.parse(localStorage.g).i)
postData
.
groupId
=
2
;
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
...
@@ -261,7 +263,7 @@ export default {
}
},
faildCall
)
},
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
...
...
@@ -270,8 +272,7 @@ export default {
this
.
apiurl
=
apiurl
;
var
token
=
""
;
var
key
=
""
;
// let userInfo = localStorage.userInfo ? JSON.parse(localStorage.userInfo) : ''
// let uid = userInfo.accountId ? userInfo.accountId : 0
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
token
;
key
=
this
.
getLocalStorage
().
secretKey
;
...
...
@@ -286,7 +287,7 @@ export default {
"sign"
:
md5Str
}
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
// postData.groupId = parseInt(JSON.parse(localStorage.g).i)
postData
.
groupId
=
2
;
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
...
@@ -297,11 +298,11 @@ export default {
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
// if (window.location.href.indexOf('IntegralMall') === -1 && window.location.href.indexOf('productDetail') === -1) {
this
.
$router
.
push
({
path
:
'/login'
})
// }
path
:
'/login'
})
}
else
if
(
res
.
data
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
)
}
else
{
...
...
@@ -312,16 +313,8 @@ export default {
}
},
faildCall
)
},
Vue
.
prototype
.
getAction
=
function
(
actionId
,
lineId
)
{
// if(actionId==1){
// console.log("浏览签证产品",actionId)
// }
// if(actionId==7){
// console.log("浏览跟团游",actionId)
// }
// if(actionId==9){
// console.log("浏览跟团游下单",actionId)
// }
Vue
.
prototype
.
getAction
=
function
(
actionId
,
lineId
)
{
let
msg
=
{};
msg
.
actionId
=
actionId
;
if
(
lineId
)
{
...
...
@@ -331,7 +324,6 @@ export default {
this
.
Travelload
=
false
;
if
(
res
.
data
.
resultCode
==
1
)
{
}
else
{
this
.
Error
(
res
.
data
.
message
);
}
...
...
@@ -339,28 +331,28 @@ export default {
}
//验证只能输入2位小数
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
"$1$2.$3"
);
//只能输入两个小数
if
(
value
.
indexOf
(
"."
)
<
0
&&
value
!=
""
)
{
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value
=
parseFloat
(
value
);
}
item
[
filed
]
=
value
;
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
}
else
{
value
=
item
[
filed
].
toString
();
}
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
\.{2,}
/g
,
"."
);
//只保留第一个. 清除多余的
value
=
value
.
replace
(
"."
,
"$#$"
)
.
replace
(
/
\.
/g
,
""
)
.
replace
(
"$#$"
,
"."
);
value
=
value
.
replace
(
/^
(\-)
*
(\d
+
)\.(\d\d)
.*$/
,
"$1$2.$3"
);
//只能输入两个小数
if
(
value
.
indexOf
(
"."
)
<
0
&&
value
!=
""
)
{
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
value
=
parseFloat
(
value
);
}
//验证只能输入整数
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
)
{
item
[
filed
]
=
value
;
}
//验证只能输入整数
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
)
{
var
value
=
""
;
if
(
typeof
item
[
filed
]
==
"string"
)
{
value
=
item
[
filed
];
...
...
@@ -370,6 +362,5 @@ export default {
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
item
[
filed
]
=
value
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment