Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xgdlapp
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
李苏
xgdlapp
Commits
0dba7be6
Commit
0dba7be6
authored
Aug 10, 2023
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
蒙层
parent
1c905e98
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
77 deletions
+90
-77
App.vue
App.vue
+1
-0
service.js
common/service/service.js
+86
-74
manifest.json
manifest.json
+2
-2
index.vue
pages/dl_cmaterial/index.vue
+1
-1
No files found.
App.vue
View file @
0dba7be6
<
script
>
import
Vue
from
'vue'
import
appUpdate
from
'common/util/appUpdate.js'
...
...
common/service/service.js
View file @
0dba7be6
import
Request
from
'@/common/luch-request/index.js'
import
{
ACCESS_TOKEN
}
from
'@/common/util/constants.js'
import
{
ACCESS_TOKEN
}
from
'@/common/util/constants.js'
import
configService
from
'./config.service.js'
import
tip
from
'@/common/util/tip.js'
;
import
store
from
'@/store/index.js'
;
...
...
@@ -8,11 +10,11 @@ let apiUrl = configService.apiUrl;
const
getTokenStorage
=
()
=>
{
let
token
=
''
try
{
try
{
token
=
uni
.
getStorageSync
(
'Gtoken'
)
}
catch
(
e
)
{
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
"getTokenStorage"
,
token
)
console
.
log
(
"getTokenStorage"
,
token
)
}
return
token
}
...
...
@@ -20,7 +22,8 @@ const getTokenStorage = () => {
const
http
=
new
Request
()
http
.
setConfig
((
config
)
=>
{
/* 设置全局配置 */
http
.
setConfig
((
config
)
=>
{
/* 设置全局配置 */
config
.
baseUrl
=
apiUrl
/* 根域名不同 */
config
.
header
=
{
...
config
.
header
...
...
@@ -38,19 +41,25 @@ http.validateStatus = (statusCode) => {
return
statusCode
===
200
}
http
.
interceptor
.
request
((
config
,
cancel
)
=>
{
/* 请求之前拦截器 */
http
.
interceptor
.
request
((
config
,
cancel
)
=>
{
/* 请求之前拦截器 */
uni
.
showLoading
({
title
:
'加载中...'
,
mask
:
true
// 添加蒙层效果
});
// tip.alert(config.baseUrl)
uni
.
getStorageInfo
({
success
:
function
(
res
)
{
if
(
uni
.
getStorageSync
(
'storage_key'
))
{
config
.
baseUrl
=
uni
.
getStorageSync
(
'storage_key'
);
uni
.
getStorageInfo
({
success
:
function
(
res
)
{
if
(
uni
.
getStorageSync
(
'storage_key'
))
{
config
.
baseUrl
=
uni
.
getStorageSync
(
'storage_key'
);
}
}
})
config
.
header
=
{
...
config
.
header
,
'Gtoken'
:
getTokenStorage
()
'Gtoken'
:
getTokenStorage
()
}
/*
if (!token) { // 如果token不存在,调用cancel 会取消本次请求,但是该函数的catch() 仍会执行
...
...
@@ -61,21 +70,24 @@ uni.getStorageInfo({
})
// 必须使用异步函数,注意
http
.
interceptor
.
response
(
async
(
response
)
=>
{
/* 请求之后拦截器 */
http
.
interceptor
.
response
(
async
(
response
)
=>
{
uni
.
hideLoading
();
/* 请求之后拦截器 */
return
response
},
(
response
)
=>
{
uni
.
hideLoading
();
if
(
response
)
{
let
data
=
response
.
data
const
token
=
uni
.
getStorageSync
(
ACCESS_TOKEN
)
console
.
log
(
"------异常响应------"
,
token
)
console
.
log
(
"------异常响应------"
,
data
)
console
.
log
(
"------异常响应------"
,
token
)
console
.
log
(
"------异常响应------"
,
data
)
switch
(
data
.
status
)
{
case
403
:
tip
.
error
(
'拒绝访问'
);
break
case
500
:
if
(
!
token
||
data
.
message
==
"Token失效,请重新登录"
)
{
let
timeout
=
setTimeout
(
tip
.
alert
(
'登录已过期'
),
1000
);
if
(
!
token
||
data
.
message
==
"Token失效,请重新登录"
)
{
let
timeout
=
setTimeout
(
tip
.
alert
(
'登录已过期'
),
1000
);
store
.
dispatch
(
'Logout'
).
then
(()
=>
{
clearTimeout
(
timeout
)
window
.
location
.
reload
()
...
...
manifest.json
View file @
0dba7be6
...
...
@@ -2,8 +2,8 @@
"name"
:
"wcs"
,
"appid"
:
"__UNI__79C58F0"
,
"description"
:
"徐工道路系统功能"
,
"versionName"
:
"1.0.
4
"
,
"versionCode"
:
10
4
,
"versionName"
:
"1.0.
6
"
,
"versionCode"
:
10
6
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
...
...
pages/dl_cmaterial/index.vue
View file @
0dba7be6
...
...
@@ -5,7 +5,7 @@
<block
slot=
"content"
>
工位叫料
</block>
</cu-custom>
<!-- 添加蒙层 -->
<
orange-fullloading
:loadicon=
'loadicon'
:loadshow=
'loadshow'
bgcolor=
"rgba(128, 128, 128, 0.5)"
:text=
"loadtext"
></orange-fullloading
>
<
!--
<orange-fullloading
:loadicon=
'loadicon'
:loadshow=
'loadshow'
bgcolor=
"rgba(128, 128, 128, 0.5)"
:text=
"loadtext"
></orange-fullloading>
--
>
<view
class=
"cu-bar bg-white solid-bottom"
>
<view
class=
"action"
>
<text
class=
"cuIcon-title text-orange "
></text>
工位列表
...
...
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