Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ElectricitySheep
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
黄媛媛
ElectricitySheep
Commits
420b73d5
Commit
420b73d5
authored
Aug 06, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
2dd89b74
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
430 additions
and
435 deletions
+430
-435
index.js
src/plug/index.js
+430
-435
No files found.
src/plug/index.js
View file @
420b73d5
...
@@ -3,7 +3,7 @@ export default {
...
@@ -3,7 +3,7 @@ export default {
install
(
Vue
,
options
)
{
install
(
Vue
,
options
)
{
Vue
.
prototype
.
md5
=
md5
;
Vue
.
prototype
.
md5
=
md5
;
//消息成功提示
//消息成功提示
Vue
.
prototype
.
Success
=
function
(
msg
)
{
Vue
.
prototype
.
Success
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
...
@@ -11,7 +11,7 @@ export default {
...
@@ -11,7 +11,7 @@ export default {
});
});
},
},
//错误提示
//错误提示
Vue
.
prototype
.
Error
=
function
(
msg
)
{
Vue
.
prototype
.
Error
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
...
@@ -20,7 +20,7 @@ export default {
...
@@ -20,7 +20,7 @@ export default {
},
},
//一般提示
//一般提示
Vue
.
prototype
.
Info
=
function
(
msg
)
{
Vue
.
prototype
.
Info
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
...
@@ -28,7 +28,7 @@ export default {
...
@@ -28,7 +28,7 @@ export default {
});
});
},
},
//警告提示
//警告提示
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
Vue
.
prototype
.
Warning
=
function
(
msg
)
{
this
.
$message
({
this
.
$message
({
message
:
msg
,
message
:
msg
,
duration
:
2000
,
duration
:
2000
,
...
@@ -36,7 +36,7 @@ export default {
...
@@ -36,7 +36,7 @@ export default {
});
});
},
},
//Confirm
//Confirm
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
Vue
.
prototype
.
Confirm
=
function
(
msg
,
callback
)
{
this
.
$confirm
(
msg
,
"提示"
,
{
this
.
$confirm
(
msg
,
"提示"
,
{
confirmButtonText
:
"确定"
,
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
cancelButtonText
:
"取消"
,
...
@@ -52,27 +52,26 @@ export default {
...
@@ -52,27 +52,26 @@ export default {
});
});
},
},
//域名管理对象
//域名管理对象
Vue
.
prototype
.
domainManager
=
function
()
{
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
''
;
let
domainUrl
=
''
;
// domainUrl = "https://mallapi.oytour.com";
let
javaUrl
=
'http://192.168.2.65:8018'
;
// domainUrl = "https://localhost:5001";
// domainUrl = "http://192.168.2.65";
domainUrl
=
"http://192.168.2.16:8088"
;
domainUrl
=
"http://192.168.2.214:8200"
;
//domainUrl = "https://localhost:5001";
let
locationName
=
window
.
location
.
hostname
;
let
locationName
=
window
.
location
.
hostname
;
if
(
locationName
.
indexOf
(
'testmall.oytour'
)
!==
-
1
)
{
if
(
locationName
.
indexOf
(
'testmall.oytour'
)
!==
-
1
)
{
domainUrl
=
"https://mallapi.oytour.com"
;
domainUrl
=
"https://mallapi.oytour.com"
;
javaUrl
=
"http://property.oytour.com"
;
}
else
if
(
locationName
.
indexOf
(
'oytour'
)
!==
-
1
)
{
}
else
if
(
locationName
.
indexOf
(
'oytour'
)
!==
-
1
)
{
domainUrl
=
"https://mallapi.oytour.com"
;
domainUrl
=
"https://mallapi.oytour.com"
;
javaUrl
=
"http://property.oytour.com"
;
}
}
var
obj
=
{
var
obj
=
{
//主地址npm
//主地址npm
DomainUrl
:
domainUrl
,
DomainUrl
:
domainUrl
,
//资产管理
//资产管理
javaUrl
:
"http://192.168.2.65:8018"
,
javaUrl
:
javaUrl
,
// javaUrl: "http://192.168.2.16:8087",
// javaUrl: "http://property.oytour.com",
//常用提交数据URL
//常用提交数据URL
PostUrl
:
domainUrl
+
"/api/common/post"
,
PostUrl
:
domainUrl
+
"/api/common/post"
,
ImageUrl
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com'
,
ImageUrl
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com'
,
...
@@ -82,7 +81,7 @@ export default {
...
@@ -82,7 +81,7 @@ export default {
return
obj
;
return
obj
;
},
},
//浏览器缓存
//浏览器缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
Vue
.
prototype
.
getLocalStorage
=
function
()
{
var
localStorageData
=
window
.
localStorage
[
"mall_userInfo"
];
var
localStorageData
=
window
.
localStorage
[
"mall_userInfo"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
return
JSON
.
parse
(
localStorageData
);
return
JSON
.
parse
(
localStorageData
);
...
@@ -91,7 +90,7 @@ export default {
...
@@ -91,7 +90,7 @@ export default {
}
}
},
},
//验证只能输入2位小数【负数:isMinus传true】
//验证只能输入2位小数【负数:isMinus传true】
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
,
isMinus
)
{
Vue
.
prototype
.
checkPrice
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
value
=
value
.
replace
(
/
[^\d
.
]
/g
,
""
);
//清除“数字”和“.”以外的字符
...
@@ -109,7 +108,7 @@ export default {
...
@@ -109,7 +108,7 @@ export default {
item
[
filed
]
=
value
;
item
[
filed
]
=
value
;
}
}
//验证只能输入整数【负数:isMinus传true】
//验证只能输入整数【负数:isMinus传true】
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
,
isMinus
)
{
Vue
.
prototype
.
checkInteger
=
function
(
item
,
filed
,
isMinus
)
{
var
value
=
""
+
item
[
filed
];
//转字符串
var
value
=
""
+
item
[
filed
];
//转字符串
var
t
=
value
.
charAt
(
0
);
var
t
=
value
.
charAt
(
0
);
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
value
=
value
.
replace
(
this
.
$commonUtils
.
Regex
.
isInteger
,
""
);
...
@@ -120,11 +119,11 @@ export default {
...
@@ -120,11 +119,11 @@ export default {
item
[
filed
]
=
value
;
item
[
filed
]
=
value
;
},
},
//是否是线上环境【发布时修改为true】
//是否是线上环境【发布时修改为true】
Vue
.
prototype
.
isOnline
=
function
()
{
Vue
.
prototype
.
isOnline
=
function
()
{
return
process
.
env
.
NODE_ENV
!==
'development'
;
return
process
.
env
.
NODE_ENV
!==
'development'
;
},
},
//文件类型数组
//文件类型数组
Vue
.
prototype
.
FileType
=
function
()
{
Vue
.
prototype
.
FileType
=
function
()
{
var
fileTypeJson
=
{
var
fileTypeJson
=
{
//主地址npm
//主地址npm
UserImg
:
"User"
,
//用户相图片
UserImg
:
"User"
,
//用户相图片
...
@@ -135,12 +134,12 @@ export default {
...
@@ -135,12 +134,12 @@ export default {
return
fileTypeJson
;
return
fileTypeJson
;
},
},
//上传文件到云存储
//上传文件到云存储
Vue
.
prototype
.
UploadFileToTencent
=
function
(
path
,
fileObj
,
callback
)
{
Vue
.
prototype
.
UploadFileToTencent
=
function
(
path
,
fileObj
,
callback
)
{
//获取文件扩展名
//获取文件扩展名
var
filename
=
fileObj
.
name
;
var
filename
=
fileObj
.
name
;
var
index
=
filename
.
lastIndexOf
(
"."
);
var
index
=
filename
.
lastIndexOf
(
"."
);
var
suffix
=
filename
.
substr
(
index
);
var
suffix
=
filename
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
let
str
=
''
;
let
str
=
''
;
if
(
this
.
isOnline
())
{
if
(
this
.
isOnline
())
{
str
=
"/Test"
str
=
"/Test"
...
@@ -164,8 +163,8 @@ export default {
...
@@ -164,8 +163,8 @@ export default {
Key
:
newFileName
,
//文件名
Key
:
newFileName
,
//文件名
StorageClass
:
'STANDARD'
,
StorageClass
:
'STANDARD'
,
Body
:
fileObj
,
// 上传文件对象
Body
:
fileObj
,
// 上传文件对象
onProgress
:
function
(
progressData
)
{}
onProgress
:
function
(
progressData
)
{}
},
function
(
err
,
data
)
{
},
function
(
err
,
data
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
var
uploadResult
=
{
var
uploadResult
=
{
resultCode
:
1
,
resultCode
:
1
,
...
@@ -182,14 +181,14 @@ export default {
...
@@ -182,14 +181,14 @@ export default {
});
});
},
},
//公用跳转
//公用跳转
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
Vue
.
prototype
.
CommonJump
=
function
(
path
,
obj
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
name
:
path
,
name
:
path
,
query
:
obj
query
:
obj
});
});
}
}
//公用判断图片地址 判断是否包含http
//公用判断图片地址 判断是否包含http
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
Vue
.
prototype
.
getIconLink
=
function
(
url
)
{
let
str
=
''
let
str
=
''
if
(
url
&&
url
!=
''
)
{
if
(
url
&&
url
!=
''
)
{
if
(
url
.
indexOf
(
'http'
)
!=
-
1
)
{
if
(
url
.
indexOf
(
'http'
)
!=
-
1
)
{
...
@@ -201,7 +200,7 @@ export default {
...
@@ -201,7 +200,7 @@ export default {
}
}
}
}
//HTTP提交数据
//HTTP提交数据
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
""
);
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
""
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
@@ -223,7 +222,7 @@ export default {
...
@@ -223,7 +222,7 @@ export default {
},
faildCall
)
},
faildCall
)
}
}
//获取请求参数
//获取请求参数
Vue
.
prototype
.
GetPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
Vue
.
prototype
.
GetPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
}
...
@@ -273,14 +272,14 @@ export default {
...
@@ -273,14 +272,14 @@ export default {
MallBaseId
:
MallBaseId
,
MallBaseId
:
MallBaseId
,
TenantId
:
TenantId
,
TenantId
:
TenantId
,
EmpId
:
EmpId
,
EmpId
:
EmpId
,
// MiniAppId:
"wxacd9f8cc3480d29e",
MiniAppId
:
"wxacd9f8cc3480d29e"
,
// OpenId:
"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg",
OpenId
:
"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg"
,
// UserId:19992,
// UserId:19992,
}
}
return
postData
return
postData
},
},
//HTTP提交数据资产
//HTTP提交数据资产
Vue
.
prototype
.
assetsApipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
Vue
.
prototype
.
assetsApipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetAssetsPostData
(
cmd
,
msg
,
""
);
var
postData
=
this
.
GetAssetsPostData
(
cmd
,
msg
,
""
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
@@ -301,8 +300,9 @@ export default {
...
@@ -301,8 +300,9 @@ export default {
}
}
},
faildCall
)
},
faildCall
)
}
}
//获取请求参数
//获取请求参数
Vue
.
prototype
.
GetAssetsPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
Vue
.
prototype
.
GetAssetsPostData
=
function
(
cmd
,
msg
,
newCmd
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
}
...
@@ -367,8 +367,9 @@ export default {
...
@@ -367,8 +367,9 @@ export default {
}
}
return
postData
return
postData
},
},
//文件下载
//文件下载
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
newCmd
,
successCall
)
{
Vue
.
prototype
.
GetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
newCmd
,
successCall
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
newCmd
);
var
postData
=
this
.
GetPostData
(
cmd
,
msg
,
newCmd
);
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
@@ -384,10 +385,11 @@ export default {
...
@@ -384,10 +385,11 @@ export default {
document
.
body
.
appendChild
(
link
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
link
.
click
();
successCall
(
res
);
successCall
(
res
);
}).
catch
(
function
(
res
)
{});
}).
catch
(
function
(
res
)
{});
},
},
//调用资产的接口
//调用资产的接口
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
Vue
.
prototype
.
apiJavaPost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
}
...
@@ -404,13 +406,9 @@ export default {
...
@@ -404,13 +406,9 @@ export default {
key
=
this
.
getLocalStorage
().
SecretKey
;
key
=
this
.
getLocalStorage
().
SecretKey
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
TenantId
=
this
.
getLocalStorage
().
TenantId
;
uid
=
this
.
getLocalStorage
().
ERPEmpId
uid
=
this
.
getLocalStorage
().
ERPEmpId
}
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`msg=YXZCGL2020×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
var
md5Str
=
md5
(
`msg=YXZCGL2020×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
// var md5Str = md5(`msg=${encodeMsg}×tamp=${timestamp}&token=${token}&key=${key}`);
var
postData
=
{
var
postData
=
{
"msg"
:
msg
,
"msg"
:
msg
,
"timestamp"
:
timestamp
,
"timestamp"
:
timestamp
,
...
@@ -418,11 +416,9 @@ export default {
...
@@ -418,11 +416,9 @@ export default {
"sign"
:
md5Str
,
"sign"
:
md5Str
,
"MallBaseId"
:
MallBaseId
,
"MallBaseId"
:
MallBaseId
,
"TenantId"
:
TenantId
,
"TenantId"
:
TenantId
,
'uid'
:
uid
'uid'
:
uid
}
}
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
if
(
localStorage
.
g
&&
localStorage
.
g
!=
'undefined'
)
{
// postData.groupId = parseInt(JSON.parse(localStorage.g).i)
postData
.
groupId
=
2
;
postData
.
groupId
=
2
;
}
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
this
.
$http
.
post
(
apiurl
,
postData
,
{
...
@@ -443,6 +439,5 @@ export default {
...
@@ -443,6 +439,5 @@ export default {
}
}
},
faildCall
)
},
faildCall
)
}
}
}
}
}
}
\ 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