Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
million
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
viitto
million
Commits
5da167b9
Commit
5da167b9
authored
Jun 23, 2020
by
zhengke
Browse files
Options
Browse Files
Download
Plain Diff
no message
parents
cf6e7188
c597d335
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
1 deletion
+81
-1
quasar.conf.js
quasar.conf.js
+1
-1
axios.js
src/boot/axios.js
+12
-0
utils.js
src/boot/utils.js
+68
-0
No files found.
quasar.conf.js
View file @
5da167b9
...
@@ -21,9 +21,9 @@ module.exports = function( /* ctx */ ) {
...
@@ -21,9 +21,9 @@ module.exports = function( /* ctx */ ) {
// --> boot files are part of "main.js"
// --> boot files are part of "main.js"
// https://quasar.dev/quasar-cli/cli-documentation/boot-files
// https://quasar.dev/quasar-cli/cli-documentation/boot-files
boot
:
[
boot
:
[
'i18n'
,
'i18n'
,
'axios'
,
'axios'
,
"utils"
],
],
ssr
:
{
ssr
:
{
pwa
:
true
,
pwa
:
true
,
...
...
src/boot/axios.js
View file @
5da167b9
import
Vue
from
'vue'
import
Vue
from
'vue'
import
axios
from
'axios'
import
axios
from
'axios'
import
md5
from
'js-md5'
Vue
.
prototype
.
$axios
=
axios
Vue
.
prototype
.
$axios
=
axios
export
default
({
app
})
=>
{
// Set i18n instance on app
app
.
axios
=
axios
}
export
{
axios
}
src/boot/utils.js
0 → 100644
View file @
5da167b9
import
Vue
from
'vue'
import
axios
from
'axios'
import
md5
from
'js-md5'
//域名管理对象
Vue
.
prototype
.
domainManager
=
function
()
{
let
domainUrl
=
''
;
domainUrl
=
"http://127.0.0.1"
;
let
locationName
=
window
.
location
.
hostname
;
if
(
locationName
.
indexOf
(
'testerp.oytour'
)
!==
-
1
)
{
domainUrl
=
"http://testapi.oytour.com"
;
}
else
if
(
locationName
.
indexOf
(
'oytour'
)
!==
-
1
)
{
domainUrl
=
"http://reborn.oytour.com"
;
}
var
obj
=
{
//主地址
DomainUrl
:
domainUrl
,
//常用提交数据URL
PostUrl
:
domainUrl
+
"/api/common/post"
,
};
return
obj
;
}
//HTTP提交数据
Vue
.
prototype
.
apipost
=
function
(
cmd
,
msg
,
successCall
,
faildCall
)
{
if
(
msg
==
null
||
msg
==
""
)
{
msg
=
{}
}
var
timestamp
=
(
new
Date
()).
valueOf
();
var
apiurl
=
this
.
domainManager
().
PostUrl
;
var
token
=
""
;
var
key
=
""
;
var
tempLanguage
=
0
;
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
}
`
);
var
postData
=
{
msg
:
msg
,
cmd
:
cmd
,
timestamp
:
timestamp
,
token
:
token
,
sign
:
md5Str
,
languageId
:
tempLanguage
}
this
.
$axios
.
post
(
apiurl
,
postData
,
{
headers
:
{
'Content-Type'
:
'application/json'
,
'Referer-Viitto'
:
this
.
$route
.
path
}
})
.
then
(
res
=>
{
successCall
(
res
);
},
faildCall
)
}
//获取缓存
Vue
.
prototype
.
getLocalStorage
=
function
()
{
var
localStorageData
=
window
.
localStorage
[
"b2bUser"
];
if
(
localStorageData
!==
undefined
&&
localStorageData
!=
'undefined'
)
{
return
JSON
.
parse
(
localStorageData
);
}
else
{
return
null
;
}
}
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