Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
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
和慭琛
take_order
Commits
bbe47c40
Commit
bbe47c40
authored
Feb 23, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit-combine
parent
a3f57b0b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
9 deletions
+40
-9
http.interceptor.js
take-order/common/http.interceptor.js
+20
-6
main.js
take-order/main.js
+4
-1
sign-contract.vue
take-order/pages/settle/sign-contract.vue
+6
-1
util.js
take-order/utils/util.js
+10
-1
No files found.
take-order/common/http.interceptor.js
View file @
bbe47c40
//免登录接口
//免登录接口
import
util
from
'@/utils/util.js'
let
noLoginUrl
=
[
let
noLoginUrl
=
[
'/addons/cms/wxapp.user/getworkertype'
,
'/addons/cms/wxapp.user/getworkertype'
,
'/api/cmstag/tagListByType'
,
'/api/cmstag/tagListByType'
,
...
@@ -59,6 +60,7 @@ const getSessionId = function(vm) {
...
@@ -59,6 +60,7 @@ const getSessionId = function(vm) {
// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token
// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的
import
globalUrl
from
'@/common/base_url.js'
import
globalUrl
from
'@/common/base_url.js'
const
app
=
getApp
()
const
install
=
(
Vue
,
vm
)
=>
{
const
install
=
(
Vue
,
vm
)
=>
{
// let url = 'https://fa.yunya.com'
// let url = 'https://fa.yunya.com'
let
apiBaseUrl
=
globalUrl
.
codeUrl
.
apiBaseUrl
;
// 故障码apiuri
let
apiBaseUrl
=
globalUrl
.
codeUrl
.
apiBaseUrl
;
// 故障码apiuri
...
@@ -84,8 +86,20 @@ const install = (Vue, vm) => {
...
@@ -84,8 +86,20 @@ const install = (Vue, vm) => {
// // vm.$u.route('/pages/login/wxlogin');
// // vm.$u.route('/pages/login/wxlogin');
// return false;
// return false;
// }
// }
config
.
header
.
token
=
vm
.
vuex_token
||
'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b'
;
const
reg
=
/
\?\w
+/
;
config
.
header
.
Authorization
=
vm
.
vuex_token
||
'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b'
;
console
.
log
(
util
,
'util'
)
let
token
=
util
.
getToken
()
if
(
!
token
){
vm
.
$u
.
route
(
'/pages/login/wxlogin'
);
}
// const token = app && app.globalData && app.globalData.token || ''
if
(
reg
.
test
(
config
.
url
)){
config
.
url
+=
'&access-token='
+
token
}
else
{
config
.
url
+=
'?access-token='
+
token
}
// config.header.token = vm.vuex_token || 'RTOKENe56f873b5823477fa2e15572f8fa7eb3a5fb6f7b';
config
.
header
.
Authorization
=
token
// 临时测试 token -- 开发环境
// 临时测试 token -- 开发环境
// if (apiUrl == 'http://fa.yunya.com') {
// if (apiUrl == 'http://fa.yunya.com') {
// config.header.token = '0edjXh5micAR3Lf1tkNtObcUtLMdiVGCVOxlkca_PyTi0CFdyo5kF3TMdSEO8wBDHJh8CwDOTCfzvpLeavzLNg';
// config.header.token = '0edjXh5micAR3Lf1tkNtObcUtLMdiVGCVOxlkca_PyTi0CFdyo5kF3TMdSEO8wBDHJh8CwDOTCfzvpLeavzLNg';
...
@@ -98,10 +112,10 @@ const install = (Vue, vm) => {
...
@@ -98,10 +112,10 @@ const install = (Vue, vm) => {
// if(config.method=='POST'){
// if(config.method=='POST'){
// config.data['__token__'] = vm.vuex__token__;
// config.data['__token__'] = vm.vuex__token__;
// }
// }
if
(
config
.
url
.
indexOf
(
apiBaseUrl
)
>=
0
){
//
if(config.url.indexOf(apiBaseUrl)>=0){
// 快查相关页面临时参数
//
// 快查相关页面临时参数
config
.
header
[
'Authorize'
]
=
vm
.
vuex_token
;
//
config.header['Authorize'] = vm.vuex_token;
}
//
}
return
config
;
return
config
;
}
}
// 响应拦截,判断状态码是否通过
// 响应拦截,判断状态码是否通过
...
...
take-order/main.js
View file @
bbe47c40
...
@@ -7,6 +7,8 @@ Vue.use(uView);
...
@@ -7,6 +7,8 @@ Vue.use(uView);
Vue
.
config
.
productionTip
=
false
Vue
.
config
.
productionTip
=
false
App
.
mpType
=
'app'
App
.
mpType
=
'app'
// let vuexStore = require('@/store/$u.mixin.js')
// Vue.mixin(vuexStore)
const
app
=
new
Vue
({
const
app
=
new
Vue
({
...
App
...
App
...
@@ -15,7 +17,8 @@ app.$mount()
...
@@ -15,7 +17,8 @@ app.$mount()
// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
import
httpInterceptor
from
'@/common/http.interceptor.js'
import
httpInterceptor
from
'@/common/http.interceptor.js'
Vue
.
use
(
httpInterceptor
,
app
)
Vue
.
use
(
httpInterceptor
,
app
)
// http接口API抽离,免于写url或者一些固定的参数
// http接口API抽离,免于写url或者一些固定的参数
import
httpApi
from
'@/common/http.api.js'
import
httpApi
from
'@/common/http.api.js'
...
...
take-order/pages/settle/sign-contract.vue
View file @
bbe47c40
...
@@ -228,7 +228,8 @@
...
@@ -228,7 +228,8 @@
return
;
return
;
}
}
this
.
info
=
res
.
data
.
record
this
.
info
=
res
.
data
.
record
this
.
baseInfo
.
name
=
this
.
info
.
name
// this.baseInfo.name = this.info.name
this
.
baseInfo
.
id
=
this
.
info
.
id
console
.
log
(
this
.
info
,
'res'
)
console
.
log
(
this
.
info
,
'res'
)
return
true
return
true
},
},
...
@@ -238,6 +239,10 @@
...
@@ -238,6 +239,10 @@
const
params
=
{
const
params
=
{
...
baseInfo
,
...
baseInfo
,
}
}
console
.
log
(
params
.
pay_type
,
'params.pay_type'
)
if
(
params
.
pay_type
===
'alipay'
){
params
.
bank_site
=
'支付宝'
}
const
res
=
this
.
$u
.
api
.
checkSettleSignInfo
(
params
)
const
res
=
this
.
$u
.
api
.
checkSettleSignInfo
(
params
)
if
(
res
.
status
!=
200
)
{
if
(
res
.
status
!=
200
)
{
uni
.
showToast
({
uni
.
showToast
({
...
...
take-order/utils/util.js
View file @
bbe47c40
...
@@ -2,6 +2,14 @@ var t = function(t) {
...
@@ -2,6 +2,14 @@ var t = function(t) {
return
(
t
=
t
.
toString
())[
1
]
?
t
:
"0"
+
t
;
return
(
t
=
t
.
toString
())[
1
]
?
t
:
"0"
+
t
;
};
};
const
getToken
=
function
(){
const
app
=
getApp
()
let
token
=
app
&&
app
.
globalData
&&
app
.
globalData
.
token
||
''
if
(
!
token
){
token
=
uni
.
getStorageSync
(
'token'
)
}
return
token
}
module
.
exports
=
{
module
.
exports
=
{
formatTime
:
function
(
n
)
{
formatTime
:
function
(
n
)
{
var
e
=
n
.
getFullYear
(),
r
=
n
.
getMonth
()
+
1
,
o
=
n
.
getDate
(),
i
=
n
.
getHours
(),
u
=
n
.
getMinutes
(),
a
=
n
.
getSeconds
();
var
e
=
n
.
getFullYear
(),
r
=
n
.
getMonth
()
+
1
,
o
=
n
.
getDate
(),
i
=
n
.
getHours
(),
u
=
n
.
getMinutes
(),
a
=
n
.
getSeconds
();
...
@@ -22,5 +30,6 @@ module.exports = {
...
@@ -22,5 +30,6 @@ module.exports = {
return
e
>
0
&&
(
o
=
60
*
(
o
=
"0"
+
t
.
substring
(
e
))
+
""
,
2
==
n
?
(
e
=
o
.
indexOf
(
"."
))
>
0
&&
(
i
=
"0"
+
o
.
substring
(
e
),
return
e
>
0
&&
(
o
=
60
*
(
o
=
"0"
+
t
.
substring
(
e
))
+
""
,
2
==
n
?
(
e
=
o
.
indexOf
(
"."
))
>
0
&&
(
i
=
"0"
+
o
.
substring
(
e
),
o
=
o
.
substring
(
0
,
e
),
e
=
(
i
=
60
*
i
+
""
).
indexOf
(
"."
),
i
=
i
.
substring
(
0
,
e
+
4
),
o
=
o
.
substring
(
0
,
e
),
e
=
(
i
=
60
*
i
+
""
).
indexOf
(
"."
),
i
=
i
.
substring
(
0
,
e
+
4
),
i
=
parseFloat
(
i
).
toFixed
(
0
))
:
1
==
n
&&
(
o
=
parseFloat
(
o
).
toFixed
(
6
))),
2
==
n
?
r
+
"°"
+
o
+
"′"
+
i
+
"″"
:
1
==
n
?
r
+
"°"
+
o
+
"′"
:
void
0
;
i
=
parseFloat
(
i
).
toFixed
(
0
))
:
1
==
n
&&
(
o
=
parseFloat
(
o
).
toFixed
(
6
))),
2
==
n
?
r
+
"°"
+
o
+
"′"
+
i
+
"″"
:
1
==
n
?
r
+
"°"
+
o
+
"′"
:
void
0
;
}
},
getToken
};
};
\ 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