Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
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
罗超
confucius
Commits
ba7814f9
Commit
ba7814f9
authored
Nov 12, 2020
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1dbd5f81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
124 additions
and
0 deletions
+124
-0
axios.js
src/boot/axios.js
+2
-0
erpindex.js
src/utils/erpindex.js
+122
-0
No files found.
src/boot/axios.js
View file @
ba7814f9
import
Vue
from
'vue'
import
ElementUI
from
'element-ui'
import
'element-ui/lib/theme-chalk/index.css'
import
Erpindex
from
'../utils/erpindex'
import
axios
from
'axios'
Vue
.
use
(
ElementUI
)
Vue
.
use
(
Erpindex
)
Vue
.
prototype
.
$axios
=
axios
src/utils/erpindex.js
0 → 100644
View file @
ba7814f9
export
default
{
data
:{
loginUser
:
{},
apiurl
:
''
},
install
(
Vue
,
options
){
//ERP本地缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
console
.
log
(
'进入~~~~~~'
)
var
localStorageData
=
window
.
localStorage
[
"userInfo"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
return
JSON
.
parse
(
localStorageData
);
}
else
{
return
null
;
}
},
//HTTP提交数据
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
,
isOnline
)
{
if
(
this
.
$route
.
name
.
indexOf
(
'login'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'clientConfirm'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'confirmationOrderDownLoad'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'PrintPage'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'TravelContractConfirm'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'ViittoContractConfirm'
)
===
-
1
&&
this
.
$route
.
name
.
indexOf
(
'OrderProfitLossList'
)
===
-
1
)
{
let
previousPathInfo
=
{
path
:
this
.
$route
.
name
,
query
:
this
.
$route
.
query
}
localStorage
.
previousPathInfo
=
JSON
.
stringify
(
previousPathInfo
);
}
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
var
apiurl
=
this
.
domainManager
().
PostUrl
;
//酒店接口
if
(
isOnline
)
{
apiurl
=
this
.
domainManager
().
HotelApi
;
}
var
timestamp
=
(
new
Date
()).
valueOf
();
this
.
apiurl
=
apiurl
;
if
(
this
.
$route
.
path
.
toLowerCase
()
==
"/signature"
)
{
this
.
$router
.
push
({
path
:
'/signature'
})
}
else
if
(
this
.
$route
.
path
==
"/clientConfirm"
)
{
let
TCID
=
this
.
$route
.
query
.
TCID
;
let
orderID
=
this
.
$route
.
query
.
orderID
;
this
.
$router
.
push
({
name
:
"clientConfirm"
,
query
:
{
TCID
:
TCID
,
orderID
:
orderID
}
})
}
else
if
(
this
.
$route
.
path
==
"/TravelContractConfirm"
)
{
let
ContractId
=
this
.
$route
.
query
.
ContractId
;
this
.
$router
.
push
({
name
:
"TravelContractConfirm"
,
query
:
{
ContractId
:
ContractId
}
})
}
else
if
(
this
.
$route
.
path
==
"/ViittoContractConfirm"
)
{
let
Id
=
this
.
$route
.
query
.
Id
;
this
.
$router
.
push
({
name
:
"ViittoContractConfirm"
,
query
:
{
Id
:
Id
}
})
}
else
{
if
(
!
localStorage
.
userInfo
&&
localStorage
.
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
,
"cmd"
:
cmd
,
"timestamp"
:
timestamp
,
"token"
:
token
,
"sign"
:
md5Str
,
"languageId"
:
tempLanguage
}
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
)
}
}
}
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