Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
uplus-fapai-mp
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2dd3b671
authored
Apr 24, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化请求逻辑,调整组件交互,修复禁用状态处理
1 parent
d0cca6a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
105 deletions
api/request/http.js
components/GLCustForm/GLCustForm.js
components/GLCustForm/GLCustForm.wxml
packageIndex/pages/editOrder/components/FirstStep/FirstStep.js
packageIndex/pages/editOrder/components/SecondStep/SecondStep.js
api/request/http.js
View file @
2dd3b67
import
sign
from
'./sign.js'
import
sign
from
"./sign.js"
;
import
{
// secretKey,
pathEnum
,
domain
,
envIndex
,
}
from
'../env/index'
envIndex
,
}
from
"../env/index"
;
/**接口 */
class
Request
{
get
(
params
,
returnAll
=
false
)
{
return
this
.
request
(
'GET'
,
params
,
returnAll
)
return
this
.
request
(
"GET"
,
params
,
returnAll
);
}
post
(
params
,
returnAll
=
false
)
{
return
this
.
request
(
'POST'
,
params
,
returnAll
)
return
this
.
request
(
"POST"
,
params
,
returnAll
);
}
fetch
(
method
,
data
,
returnAll
=
true
)
{
return
this
.
post
({
return
this
.
post
(
{
method
,
...
data
,
},
returnAll
returnAll
,
);
}
wx_request
({
url
,
method
=
'GET'
,
method
=
"GET"
,
data
=
{},
header
=
{},
dataType
=
'json'
,
responseType
=
"text"
dataType
=
"json"
,
responseType
=
"text"
,
})
{
return
new
Promise
((
resolve
)
=>
{
wx
.
request
({
...
...
@@ -38,99 +39,109 @@ class Request {
dataType
,
responseType
,
success
(
response
)
{
resolve
(
response
.
data
)
}
})
})
resolve
(
response
.
data
)
;
}
,
})
;
})
;
}
reportTrack
(
params
)
{
return
this
.
request
(
'POST'
,
params
,
true
)
return
this
.
request
(
"POST"
,
params
,
true
);
}
request
(
RequestMethods
,
params
,
returnAll
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
showNavigationBarLoading
()
let
header
=
RequestMethods
===
'POST'
?
{
'content-type'
:
'application/json'
}
:
{
'Cache-Control'
:
'no-cache'
}
let
{
token
}
=
wx
.
p
.
storage
.
get
()
||
{}
wx
.
showNavigationBarLoading
();
let
header
=
RequestMethods
===
"POST"
?
{
"content-type"
:
"application/json"
,
}
:
{
"Cache-Control"
:
"no-cache"
,
};
let
{
token
}
=
wx
.
p
.
storage
.
get
()
||
{};
if
(
token
)
{
header
[
'Authorization'
]
=
`Bearer
${
token
}
`
header
[
"Authorization"
]
=
`Bearer
${
token
}
`
;
}
let
projectName
=
params
.
projectName
if
(
!
projectName
)
projectName
=
this
.
getRopProject
()
const
path
=
pathEnum
[
projectName
]
params
=
this
.
getData
(
params
)
let
projectName
=
params
.
projectName
;
if
(
!
projectName
)
projectName
=
this
.
getRopProject
()
;
const
path
=
pathEnum
[
projectName
]
;
params
=
this
.
getData
(
params
)
;
wx
.
request
({
url
:
`
${
domain
}${
path
}${
params
.
method
}
`
,
data
:
params
,
method
:
RequestMethods
,
header
,
dataType
:
'json'
,
responseType
:
'text'
,
dataType
:
"json"
,
responseType
:
"text"
,
success
(
response
)
{
/**业务代码 */
let
{
data
:
{
code
,
message
},
data
}
=
response
if
(
returnAll
)
{
resolve
(
data
)
return
}
if
(
code
==
'401'
)
{
wx
.
hideLoading
()
data
:
{
code
,
message
},
data
,
}
=
response
;
if
(
code
==
"1006"
)
{
wx
.
hideLoading
();
const
thisPage
=
wx
.
p
.
router
.
getPageInstance
(),
options
=
Object
.
keys
(
thisPage
.
options
)
options
=
Object
.
keys
(
thisPage
.
options
)
;
let
currentRoute
=
thisPage
.
route
,
query
=
[]
query
=
[]
;
if
(
options
.
length
)
{
options
.
map
(
key
=>
{
query
.
push
(
`
${
key
}
=
${
thisPage
.
options
[
key
]}
`
)
})
options
.
map
(
(
key
)
=>
{
query
.
push
(
`
${
key
}
=
${
thisPage
.
options
[
key
]}
`
)
;
})
;
}
if
(
query
.
length
)
currentRoute
+=
`?
${
query
.
join
(
'&'
)}
`
wx
.
p
.
storage
.
rm
(
'token'
)
wx
.
p
.
isLogin
=
false
wx
.
p
.
storage
.
rm
(
'userInfo'
)
return
wx
.
p
.
router
.
redirectTo
(
'/pages/Login/Login'
)
if
(
query
.
length
)
currentRoute
+=
`?
${
query
.
join
(
"&"
)}
`
;
wx
.
p
.
storage
.
rm
(
"token"
);
wx
.
p
.
isLogin
=
false
;
wx
.
p
.
storage
.
rm
(
"userInfo"
);
return
wx
.
p
.
router
.
redirectTo
(
"/pages/Login/Login"
);
}
else
{
if
(
code
==
'200'
)
{
resolve
(
data
.
data
)
if
(
returnAll
)
{
resolve
(
data
);
return
;
}
if
(
code
==
"200"
)
{
resolve
(
data
.
data
);
}
else
{
wx
.
showToast
({
title
:
message
||
'系统异常'
,
icon
:
'error'
})
wx
.
p
.
sentry
.
reportError
(
`接口异常:
${
message
}
`
,
{
code
,
message
,
params
})
title
:
message
||
"系统异常"
,
icon
:
"error"
,
});
wx
.
p
.
sentry
.
reportError
(
`接口异常:
${
message
}
`
,
{
code
,
message
,
params
,
});
}
}
},
fail
(
error
)
{
wx
.
hideLoading
()
wx
.
hideLoading
()
;
wx
.
showToast
({
title
:
typeof
error
==
'string'
?
error
:
JSON
.
stringify
(
error
)
||
'系统异常'
,
icon
:
'error'
})
console
.
error
(
`接口异常:`
,
error
)
wx
.
p
.
sentry
.
reportError
(
`接口异常:
${
error
.
message
}
`
,
{
error
,
params
})
reject
(
error
)
title
:
typeof
error
==
"string"
?
error
:
JSON
.
stringify
(
error
)
||
"系统异常"
,
icon
:
"error"
,
});
console
.
error
(
`接口异常:`
,
error
);
wx
.
p
.
sentry
.
reportError
(
`接口异常:
${
error
.
message
}
`
,
{
error
,
params
,
});
reject
(
error
);
},
complete
()
{
wx
.
stopPullDownRefresh
()
wx
.
hideNavigationBarLoading
()
}
})
})
wx
.
stopPullDownRefresh
()
;
wx
.
hideNavigationBarLoading
()
;
}
,
})
;
})
;
}
getData
(
params
)
{
let
projectName
=
params
.
projectName
if
(
!
projectName
)
projectName
=
this
.
getRopProject
()
else
delete
params
.
projectName
let
projectName
=
params
.
projectName
;
if
(
!
projectName
)
projectName
=
this
.
getRopProject
()
;
else
delete
params
.
projectName
;
// let appKey = '48e5e13229b82c1b4e6e8c96151f0637'
// let secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
// if (secretKey[projectName]) {
...
...
@@ -150,38 +161,38 @@ class Request {
// noSignAttr = params.noSignAttr
// delete params.noSignAttr
// }
params
.
v
=
'1.0.0'
params
.
format
=
'json'
params
.
locale
=
'zh_CN'
params
.
source
=
'uplus-wechat'
params
.
v
=
"1.0.0"
;
params
.
format
=
"json"
;
params
.
locale
=
"zh_CN"
;
params
.
source
=
"uplus-wechat"
;
// params.appKey = appKey
return
params
return
params
;
}
getMock
(
configModule
=
"uplus-fapai-mp"
)
{
const
env
=
{
1
:
"develop"
,
2
:
"test"
,
3
:
"production"
,
4
:
"beta"
,
}[
envIndex
],
configUrl
=
`https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=
${
configModule
}
&env=
${
env
}
`
;
return
new
Promise
((
resolve
)
=>
{
wx
.
request
({
url
:
configUrl
,
data
:
{},
method
:
"GET"
,
header
:
{},
dataType
:
"json"
,
responseType
:
"text"
,
success
(
response
)
{
resolve
(
response
.
data
);
},
});
});
}
getMock
(
configModule
=
"uplus-fapai-mp"
)
{
const
env
=
{
1
:
"develop"
,
2
:
"test"
,
3
:
"production"
,
4
:
"beta"
,
}[
envIndex
],
configUrl
=
`https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=
${
configModule
}
&env=
${
env
}
`
;
return
new
Promise
((
resolve
)
=>
{
wx
.
request
({
url
:
configUrl
,
data
:
{},
method
:
"GET"
,
header
:
{},
dataType
:
"json"
,
responseType
:
"text"
,
success
(
response
)
{
resolve
(
response
.
data
);
},
});
});
}
getRopProject
()
{
const
projectName
=
'vr'
return
projectName
const
projectName
=
"vr"
;
return
projectName
;
}
}
export
default
new
Request
()
\ No newline at end of file
export
default
new
Request
();
components/GLCustForm/GLCustForm.js
View file @
2dd3b67
...
...
@@ -393,6 +393,7 @@ Component({
handleCellClick
(
e
)
{
let
{
target
,
idx
}
=
e
.
currentTarget
.
dataset
;
if
(
target
.
disabled
||
this
.
data
.
disable
)
return
;
switch
(
target
.
type
)
{
case
"brand"
:
this
.
setData
({
...
...
components/GLCustForm/GLCustForm.wxml
View file @
2dd3b67
...
...
@@ -73,7 +73,7 @@
range-key="{{ item.optionLabel }}"
>
<view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" />
<image class="arrow"
wx:if="{{!(item.disabled || disable)}}"
src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{ formData[item.labelName] }}">{{ formData[item.labelName] }}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
...
...
@@ -82,10 +82,10 @@
<block wx:if="{{ item.type == 'region' }}">
<view
class="picker"
bindtap="
showAreaFun
"
bindtap="
{{item.disabled || disable ? '' : 'showAreaFun'}}
"
data-target="{{ item }}"
>
<image class="arrow" src="/components/images/arrow-x.png" />
<image class="arrow"
wx:if="{{!(item.disabled || disable)}}"
src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{ formData[item.labelName] }}">{{ formData[item.labelName] }}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
...
...
@@ -111,6 +111,7 @@
<picker
wx:if="{{ item.type == 'pickerTime' }}"
mode="date"
disabled="{{item.disabled || disable}}"
fields="{{ item.fields || 'day' }}"
value="{{ formData[name] || formData[item.name] }}"
start="{{ item.start || '' }}"
...
...
packageIndex/pages/editOrder/components/FirstStep/FirstStep.js
View file @
2dd3b67
...
...
@@ -43,11 +43,15 @@ Component({
type
:
Boolean
,
value
:
false
,
observer
:
function
(
newVal
)
{
console
.
log
(
'isEdit changed:'
,
newVal
);
const
{
secondObj
}
=
this
.
data
;
if
(
secondObj
&&
secondObj
.
customerFormList
)
{
secondObj
.
customerFormList
.
forEach
((
item
)
=>
{
if
(
item
.
type
&&
item
.
type
!==
'title'
)
{
item
.
disabled
=
!
newVal
;
if
(
item
.
type
===
'brand'
)
{
item
.
haveArrow
=
newVal
;
}
}
});
this
.
setData
({
secondObj
});
...
...
packageIndex/pages/editOrder/components/SecondStep/SecondStep.js
View file @
2dd3b67
...
...
@@ -39,6 +39,24 @@ Component({
formRule
:
constantData
.
formRule
,
},
lifetimes
:
{
attached
()
{
const
newVal
=
this
.
data
.
isEdit
;
const
{
secondObj
}
=
this
.
data
;
if
(
secondObj
&&
secondObj
.
customerFormList
)
{
secondObj
.
customerFormList
.
forEach
((
item
)
=>
{
if
(
item
.
type
&&
item
.
type
!==
'title'
)
{
item
.
disabled
=
!
newVal
;
if
(
item
.
type
===
'pickerTime'
||
item
.
type
===
'region'
||
item
.
type
===
'brand'
)
{
item
.
haveArrow
=
newVal
;
}
}
});
this
.
setData
({
secondObj
});
}
}
},
methods
:
{
getPageData
()
{
let
thisPage
=
wx
.
p
.
router
.
getPageInstance
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment