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
e4366a21
Commit
e4366a21
authored
Apr 23, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
06ca7492
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
103 deletions
+109
-103
index.js
src/plug/index.js
+109
-103
No files found.
src/plug/index.js
View file @
e4366a21
...
@@ -137,11 +137,11 @@ export default {
...
@@ -137,11 +137,11 @@ export default {
var
index
=
filename
.
lastIndexOf
(
"."
);
var
index
=
filename
.
lastIndexOf
(
"."
);
var
suffix
=
filename
.
substr
(
index
);
var
suffix
=
filename
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
());
var
timestamp1
=
Date
.
parse
(
new
Date
());
let
str
=
''
;
let
str
=
''
;
if
(
this
.
isOnline
())
{
if
(
this
.
isOnline
())
{
str
=
"/Test"
str
=
"/Test"
}
}
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
var
newFileName
=
str
+
'/Upload/'
+
path
+
"/"
+
timestamp1
+
""
+
suffix
;
var
uploadMsg
=
{
var
uploadMsg
=
{
Bucket
:
"viitto-1301420277"
,
Bucket
:
"viitto-1301420277"
,
Region
:
"ap-chengdu"
,
Region
:
"ap-chengdu"
,
...
@@ -164,9 +164,9 @@ export default {
...
@@ -164,9 +164,9 @@ export default {
},
function
(
err
,
data
)
{
},
function
(
err
,
data
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
if
(
data
&&
data
.
statusCode
==
200
)
{
var
uploadResult
=
{
var
uploadResult
=
{
resultCode
:
1
,
resultCode
:
1
,
FileName
:
fileObj
.
name
,
FileName
:
fileObj
.
name
,
FileUrl
:
"http://"
+
data
.
Location
FileUrl
:
"http://"
+
data
.
Location
}
}
if
(
callback
)
{
if
(
callback
)
{
callback
(
uploadResult
);
callback
(
uploadResult
);
...
@@ -178,115 +178,121 @@ export default {
...
@@ -178,115 +178,121 @@ 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
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
if
(
msg
==
null
||
msg
==
""
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
msg
=
{}
}
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
timestamp
=
(
new
Date
()).
valueOf
();
this
.
apiurl
=
apiurl
;
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
this
.
$router
.
push
({
path
:
'/login'
})
}
var
token
=
""
;
var
key
=
""
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
token
=
this
.
getLocalStorage
().
Token
;
key
=
this
.
getLocalStorage
().
SecretKey
;
}
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
let
tempLanguage
=
0
;
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
}
}
var
postData
=
{
"msg"
:
msg
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
,
"languageId"
:
tempLanguage
,
"cmd"
:
cmd
,
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
});
}
else
if
(
res
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
);
}
else
{
successCall
(
res
);
}
},
faildCall
)
}
}
Vue
.
prototype
.
JavaGetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
successCall
)
{
var
apiurl
=
this
.
domainManager
().
DomainUrl
+
cmd
;
var
apiurl
=
this
.
domainManager
().
JavaLocalFileStreamDownLoadUrl
+
cmd
;
var
timestamp
=
(
new
Date
()).
valueOf
()
;
var
timestamp
=
(
new
Date
()).
valueOf
()
;
this
.
apiurl
=
apiurl
;
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/login'
path
:
'/login'
})
})
}
}
var
token
=
""
;
var
token
=
""
;
var
key
=
""
;
var
key
=
""
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
var
MallBaseId
=
"0"
;
//小程序ID
token
=
this
.
getLocalStorage
().
Token
;
var
TenantId
=
"0"
;
//商户Id
key
=
this
.
getLocalStorage
().
SecretKey
;
if
(
this
.
getLocalStorage
()
!=
null
)
{
}
token
=
this
.
getLocalStorage
().
Token
;
let
mall_userInfo
=
localStorage
.
mall_userInfo
?
JSON
.
parse
(
localStorage
.
mall_userInfo
)
:
''
;
key
=
this
.
getLocalStorage
().
SecretKey
;
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
MallBaseId
=
this
.
getLocalStorage
().
MallBaseId
;
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
TenantId
=
this
.
getLocalStorage
().
TenantId
;
let
tempLanguage
=
0
;
}
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
if
(
localStorage
.
language
==
"zh-TW"
)
{
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
let
tempLanguage
=
0
;
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
tempLanguage
=
2
;
}
}
var
postData
=
{
"msg"
:
msg
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
,
"languageId"
:
tempLanguage
,
"cmd"
:
cmd
,
"MallBaseId"
:
MallBaseId
,
"TenantId"
:
TenantId
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
}
})
.
then
(
res
=>
{
if
(
res
.
data
.
resultCode
==
10000
||
res
.
data
.
resultCode
==
10001
)
{
this
.
$router
.
push
({
path
:
'/login'
});
}
else
if
(
res
.
resultCode
==
10005
)
{
this
.
$router
.
go
(
-
1
);
}
else
{
successCall
(
res
);
}
}
var
postData
=
{
},
faildCall
)
"msg"
:
msg
,
}
"timestamp"
:
timestamp
,
Vue
.
prototype
.
JavaGetLocalFile
=
function
(
cmd
,
msg
,
fileName
,
successCall
)
{
"token"
:
token
,
var
apiurl
=
this
.
domainManager
().
JavaLocalFileStreamDownLoadUrl
+
cmd
;
"sign"
:
md5Str
,
var
timestamp
=
(
new
Date
()).
valueOf
();
"languageId"
:
tempLanguage
,
if
(
!
localStorage
.
mall_userInfo
&&
localStorage
.
mall_userInfo
!=
""
&&
this
.
$route
.
path
.
toLowerCase
()
!=
"/login"
)
{
"cmd"
:
cmd
,
this
.
$router
.
push
({
}
path
:
'/login'
this
.
$http
.
post
(
apiurl
,
postData
,
{
})
responseType
:
'arraybuffer'
}
}).
then
((
res
)
=>
{
var
token
=
""
;
let
blob
=
new
Blob
([
res
.
data
],
{
var
key
=
""
;
type
:
"application/vnd.ms-excel"
if
(
this
.
getLocalStorage
()
!=
null
)
{
})
token
=
this
.
getLocalStorage
().
Token
;
let
url
=
URL
.
createObjectURL
(
blob
);
key
=
this
.
getLocalStorage
().
SecretKey
;
let
link
=
document
.
createElement
(
'a'
);
}
link
.
href
=
url
;
let
mall_userInfo
=
localStorage
.
mall_userInfo
?
JSON
.
parse
(
localStorage
.
mall_userInfo
)
:
''
;
link
.
setAttribute
(
"download"
,
fileName
);
var
encodeMsg
=
encodeURIComponent
(
JSON
.
stringify
(
msg
)).
toLowerCase
();
document
.
body
.
appendChild
(
link
);
var
md5Str
=
md5
(
`cmd=
${
cmd
}
&msg=
${
encodeMsg
}
×tamp=
${
timestamp
}
&token=
${
token
}
&key=
${
key
}
`
);
link
.
click
();
let
tempLanguage
=
0
;
successCall
(
res
);
if
(
localStorage
.
language
&&
localStorage
.
language
!=
''
)
{
}).
catch
(
function
(
res
)
{});
if
(
localStorage
.
language
==
"zh-TW"
)
{
tempLanguage
=
1
;
}
else
if
(
localStorage
.
language
==
"Japanese"
)
{
tempLanguage
=
2
;
}
}
}
var
postData
=
{
"msg"
:
msg
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
,
"languageId"
:
tempLanguage
,
"cmd"
:
cmd
,
}
this
.
$http
.
post
(
apiurl
,
postData
,
{
responseType
:
'arraybuffer'
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
.
data
],
{
type
:
"application/vnd.ms-excel"
})
let
url
=
URL
.
createObjectURL
(
blob
);
let
link
=
document
.
createElement
(
'a'
);
link
.
href
=
url
;
link
.
setAttribute
(
"download"
,
fileName
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
successCall
(
res
);
}).
catch
(
function
(
res
)
{});
}
}
}
}
}
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