Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨炀
/
ztx_wx_gzt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5bd03939
authored
2023-10-31 09:46:49 +0800
by
杨炀
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
c3c91799
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
156 additions
and
116 deletions
common/request.js
config.js
pages/group/detail.vue
pages/group/list.vue
pages/index/index.vue
pages/personalVip/detail.vue
pages/personalVip/vipList.vue
common/request.js
View file @
5bd0393
import
config
from
'@/config.js'
import
{
h5LoginAuto
h5LoginAuto
}
from
'./login'
const
excludeUrls
=
[
'pages/index/login'
,
'pages/index/register'
]
// 获取Token
function
getToken
()
{
try
{
const
token
=
uni
.
getStorageSync
(
'token'
)
if
(
token
)
{
return
token
}
else
{
return
''
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
try
{
const
token
=
uni
.
getStorageSync
(
'token'
)
if
(
token
)
{
return
token
}
else
{
return
''
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
// 获取请求头
function
getHeaders
()
{
const
token
=
getToken
()
const
header
=
{
'Authorization'
:
token
,
'Content-Type'
:
'application/json'
// 根据自己的数据类型
// "Content-Type":"application/x-www-form-urlencoded",
}
return
header
const
token
=
getToken
()
const
header
=
{
'Authorization'
:
token
,
'Content-Type'
:
'application/json'
// 根据自己的数据类型
// "Content-Type":"application/x-www-form-urlencoded",
}
return
header
}
const
request
=
function
(
req
)
{
req
.
method
=
req
.
method
.
toUpperCase
()
if
(
!
[
'GET'
,
'POST'
,
'PUT'
,
'DELETE'
].
includes
(
req
.
method
))
{
uni
.
showToast
({
title
:
`暂不支持的请求方式:
${
req
.
method
}
`
,
icon
:
'none'
})
return
}
if
(
req
.
method
===
'GET'
)
{
if
(
!
req
.
params
)
{
req
.
params
=
{}
}
req
.
params
.
pageNum
=
req
.
params
.
pageNum
||
1
req
.
params
.
pageSize
=
req
.
params
.
pageSize
||
50
}
req
.
method
=
req
.
method
.
toUpperCase
()
if
(
!
[
'GET'
,
'POST'
,
'PUT'
,
'DELETE'
].
includes
(
req
.
method
))
{
uni
.
showToast
({
title
:
`暂不支持的请求方式:
${
req
.
method
}
`
,
icon
:
'none'
})
return
}
// if (req.method == 'POST' && !req.hideLoding) {
// uni.showLoading({
// title: '提交中...'
// })
// }
if
(
req
.
method
===
'GET'
)
{
if
(
!
req
.
params
)
{
req
.
params
=
{}
}
req
.
params
.
pageNum
=
req
.
params
.
pageNum
||
1
req
.
params
.
pageSize
=
req
.
params
.
pageSize
||
50
}
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
url
:
config
.
baseUrl_api
+
req
.
url
,
method
:
req
.
method
,
data
:
req
.
params
,
header
:
getHeaders
()
}).
then
(
res
=>
{
switch
(
res
.
statusCode
)
{
case
200
:
const
data
=
res
.
data
||
{}
if
(
data
.
code
===
200
||
data
.
pageData
?.
code
===
200
)
{
resolve
(
data
)
}
else
if
(
req
.
url
.
indexOf
(
'getMemberCountInfo'
)
>
-
1
)
{
resolve
(
data
)
}
else
{
if
(
!
excludeUrls
.
includes
(
req
.
url
))
{
if
(
data
.
msg
){
uni
.
showModal
({
content
:
data
.
msg
,
success
:
function
(
res
)
{
}
})
}
uni
.
hideLoading
()
// uni.showToast({
// title: data.msg,
// icon: 'none',
// duration: 3000
// })
}
// if (req.method == 'POST' && !req.hideLoding) {
// uni.showLoading({
// title: '提交中...'
// })
// }
// 登录超时
if
(
data
.
code
===
60002
||
data
.
code
===
60001
)
{
uni
.
redirectTo
({
url
:
'/pages/index/login'
})
}
else
if
(
data
.
code
===
401
)
{
h5LoginAuto
()
.
then
(()
=>
{
uni
.
hideLoading
()
uni
.
redirectTo
({
url
:
getCurrentPages
()[
getCurrentPages
()
.
length
-
1
].
$page
.
fullPath
})
})
.
catch
(()
=>
{
uni
.
showToast
({
title
:
'服务异常,请稍后重试'
,
icon
:
'none'
})
})
}
reject
(
res
)
}
break
default
:
reject
(
res
)
}
}).
catch
(
res
=>
{
reject
(
res
)
}).
finally
(()
=>
{
// if (req.method == 'POST' && !req.hideLoding) {
// uni.hideLoading()
// }
})
})
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
url
:
config
.
baseUrl_api
+
req
.
url
,
method
:
req
.
method
,
data
:
req
.
params
,
header
:
getHeaders
()
}).
then
(
res
=>
{
switch
(
res
.
statusCode
)
{
case
200
:
const
data
=
res
.
data
||
{}
if
(
data
.
code
===
200
||
data
.
pageData
?.
code
===
200
)
{
resolve
(
data
)
}
else
if
(
req
.
url
.
indexOf
(
'getMemberCountInfo'
)
>
-
1
)
{
resolve
(
data
)
}
else
{
if
(
!
excludeUrls
.
includes
(
req
.
url
))
{
if
(
data
.
msg
)
{
// uni.showModal({
// content: data.msg,
// success: function(res) {
// }
// })
uni
.
showToast
({
title
:
data
.
msg
,
icon
:
'none'
,
duration
:
3000
})
}
uni
.
hideLoading
()
}
// 登录超时
if
(
data
.
code
===
60002
||
data
.
code
===
60001
)
{
uni
.
redirectTo
({
url
:
'/pages/index/login'
})
}
else
if
(
data
.
code
===
401
)
{
h5LoginAuto
()
.
then
(()
=>
{
uni
.
hideLoading
()
uni
.
redirectTo
({
url
:
getCurrentPages
()[
getCurrentPages
()
.
length
-
1
].
$page
.
fullPath
})
})
.
catch
(()
=>
{
uni
.
showToast
({
title
:
'服务异常,请稍后重试'
,
icon
:
'none'
})
})
}
reject
(
res
)
}
break
default
:
reject
(
res
)
}
}).
catch
(
res
=>
{
reject
(
res
)
}).
finally
(()
=>
{
// if (req.method == 'POST' && !req.hideLoding) {
// uni.hideLoading()
// }
})
})
}
export
default
request
export
default
request
\ No newline at end of file
...
...
config.js
View file @
5bd0393
...
...
@@ -4,7 +4,7 @@
// staging
// const baseUrl_api = "http://22yidpjzjifv.ngrok.xiaomiqiu123.top/stage-api/";
const
baseUrl_api
=
"http://192.168.1.
95
:8787"
;
const
baseUrl_api
=
"http://192.168.1.
11
:8787"
;
export
default
{
baseUrl_api
...
...
pages/group/detail.vue
View file @
5bd0393
<
template
>
<view>
<!-- 机构会员 -->
<!-- 机构会员 -->
<view
class=
"searchbar"
>
<uni-easyinput
placeholderStyle=
"font-size:30rpx"
:input-border=
"false"
prefixIcon=
"search"
v-model=
"query.name"
placeholder=
"搜索会员名称"
@
blur=
"getList"
@
clear=
"getList"
>
</uni-easyinput>
</view>
<view
class=
"wBox"
>
<!-- 成员 -->
<view
class=
"userlist"
>
<view
class=
"item"
v-for=
"n in list"
>
<view
class=
"item"
v-for=
"n in list"
@
click=
"goDetail(n)"
>
<view
class=
"photobox"
>
<view
class=
"colorful"
>
{{
n
.
name
?.
slice
(
0
,
1
)
}}
</view>
</view>
...
...
@@ -78,6 +83,11 @@
list
.
value
=
res
.
rows
total
.
value
=
res
.
total
})
}
function
goDetail
(
n
){
uni
.
navigateTo
({
url
:
`/pages/personalVip/detail?perId=
${
n
.
perId
}
`
})
}
</
script
>
...
...
@@ -87,5 +97,21 @@
right
:
20
rpx
;
font-size
:
26
rpx
;
color
:
#999
;
}
.searchbar
{
display
:
flex
;
align-items
:
center
;
padding
:
25
rpx
;
box-sizing
:
border-box
;
:deep(.uni-easyinput
.uni-easyinput__content)
{
border-radius
:
35
rpx
;
border
:
none
;
height
:
70
rpx
;
}
:deep
(
.uni-easyinput__content-input
)
{
font-size
:
26
rpx
;
}
}
</
style
>
\ No newline at end of file
...
...
pages/group/list.vue
View file @
5bd0393
...
...
@@ -7,7 +7,7 @@
</uni-easyinput>
</view>
<view
class=
"vipData"
>
<view>
共
<text>
{{
forms
?.
total
}}
</text>
人
</view>
<view>
共
计
<text>
{{
forms
?.
total
}}
</text>
</view>
<view>
有效会员
<text>
{{
forms
?.
effective
}}
</text></view>
<view>
过期会员
<text>
{{
forms
?.
expired
}}
</text></view>
<view>
即将过期会员
<text>
{{
forms
?.
soon
}}
</text></view>
...
...
@@ -73,10 +73,14 @@
})
function
getList
()
{
uni
.
showLoading
({
title
:
'加载中'
})
console
.
log
(
current
.
value
,
currentTabName
.
value
,
query
.
value
.
dType
)
api
.
getGroupVipList
(
query
.
value
).
then
(
res
=>
{
infoList
.
value
=
res
.
rows
total
.
value
=
res
.
total
total
.
value
=
res
.
total
uni
.
hideLoading
()
})
}
function
getGroupInfo
(){
...
...
pages/index/index.vue
View file @
5bd0393
...
...
@@ -417,5 +417,6 @@
}
:deep
(
.uni-section
.uni-section-header
)
{
padding
:
0
30
rpx
;
}
}
</
style
>
\ No newline at end of file
...
...
pages/personalVip/detail.vue
View file @
5bd0393
<
template
>
<view
class=
"mainbox"
>
<view
class=
"photobox"
>
<image
class=
"photo"
v-if=
"form.photo"
:src=
"
config.baseUrl_api +
form.photo"
mode=
'widthFix'
></image>
<image
class=
"photo"
v-if=
"form.photo"
:src=
"form.photo"
mode=
'widthFix'
></image>
<view
class=
"colorful"
v-else
>
{{
form
.
name
?.
slice
(
0
,
1
)
}}
</view>
</view>
<uni-list>
...
...
@@ -49,6 +49,9 @@
if
(
form
.
value
.
cityId
){
getRegionsList
(
form
.
value
.
cityId
)
}
if
(
form
.
photo
&&
form
.
photo
.
indexOf
(
'http'
)
==-
1
){
form
.
photo
=
config
.
baseUrl_api
+
form
.
photo
}
})
})
function
getRegionsList
(
cityId
){
...
...
pages/personalVip/vipList.vue
View file @
5bd0393
...
...
@@ -15,7 +15,7 @@
<image
class=
"icon"
v-else
src=
"@/static/member/dx.png"
/>
</view>
<view
class=
"photobox"
>
<image
class=
"photo"
v-if=
"n.photo"
:src=
"
config.baseUrl_api+
n.photo"
mode=
'aspectFill'
></image>
<image
class=
"photo"
v-if=
"n.photo"
:src=
"n.photo"
mode=
'aspectFill'
></image>
<view
class=
"colorful"
v-else
>
{{
n
.
name
.
slice
(
0
,
1
)
}}
</view>
</view>
<view
@
click=
"handleInfo(n)"
>
...
...
@@ -83,7 +83,12 @@
function
getList
()
{
api
.
selectPageList
(
queryParams
.
value
).
then
(
res
=>
{
list
.
value
=
res
.
rows
list
.
value
=
res
.
rows
for
(
var
l
of
list
.
value
){
if
(
l
.
photo
&&
l
.
photo
.
indexOf
(
'http'
)
==-
1
){
l
.
photo
=
config
.
baseUrl_api
+
l
.
photo
}
}
total
.
value
=
res
.
total
})
}
...
...
Write
Preview
Styling with
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