Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
U
uni-app-base
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
tangfh
uni-app-base
Commits
1abecd3c
Commit
1abecd3c
authored
May 22, 2023
by
tangfh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+
parent
e057426b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
5 deletions
+44
-5
base-page.vue
pages/template/base-page.vue
+15
-4
base-tab.vue
pages/template/base-tab.vue
+15
-1
constant.js
utils/constant.js
+14
-0
No files found.
pages/template/base-page.vue
View file @
1abecd3c
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<view
class=
"view-tmp1 active"
v-for=
"(item, index) in tab.data"
:index=
"index"
:key=
"index"
<view
class=
"view-tmp1 active"
v-for=
"(item, index) in tab.data"
:index=
"index"
:key=
"index"
:item=
"item"
@
onItemClick=
"onItemClick"
></view>
:item=
"item"
@
onItemClick=
"onItemClick"
></view>
</view>
</view>
<c-
empty
v-if=
"items.length == 0"
@
onEmptyClick=
"onEmptyClick"
></c-empty
>
<c-
status-view
@
onStatusClick=
"onStatusClick"
v-if=
"contentStatus.value"
></c-status-view
>
<uni-load-more
:status=
"loadMoreViewStatus"
:icon-size=
"16"
v-if=
"items.length > 0"
<uni-load-more
:status=
"loadMoreViewStatus"
:icon-size=
"16"
v-if=
"items.length > 0"
:content-text=
"loadMoreViewContentText"
/>
:content-text=
"loadMoreViewContentText"
/>
</scroll-view>
</scroll-view>
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
loadMoreViewStatus
:
'noMore'
,
loadMoreViewStatus
:
'noMore'
,
page
:
1
,
page
:
1
,
total_page
:
1
,
total_page
:
1
,
loadMoreStatus
:
null
,
contentStatus
:
{},
items
:
[],
items
:
[],
channel
:
"ongoning"
,
channel
:
"ongoning"
,
firstRequest
:
true
firstRequest
:
true
...
@@ -100,11 +102,16 @@
...
@@ -100,11 +102,16 @@
};
};
let
option
=
{
let
option
=
{
isNeedShowLoading
:
false
isNeedShowLoading
:
false
};
};
util
.
request
(
url
,
param
,
this
.
requestCallback
,
this
.
requestComplete
,
option
);
util
.
request
(
url
,
param
,
option
,
{
success
:
this
.
requestCallback
,
fail
:
this
.
requestFail
,
complete
:
this
.
requestComplete
});
},
},
requestCallback
(
res
)
{
requestCallback
(
res
)
{
if
(
res
.
statusCode
!=
200
)
{
if
(
res
.
data
.
code
>
0
)
{
this
.
contentStatus
==
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
ERROR
:
null
;
return
;
return
;
}
}
let
data
=
res
.
data
.
data
;
let
data
=
res
.
data
.
data
;
...
@@ -124,6 +131,10 @@
...
@@ -124,6 +131,10 @@
this
.
items
=
this
.
items
.
concat
(
list
);
this
.
items
=
this
.
items
.
concat
(
list
);
}
}
}
}
this
.
contentStatus
=
this
.
items
.
length
==
0
?
constant
.
CONTENT_STATUS
.
EMPTY
:
{};
},
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
},
},
requestComplete
()
{
requestComplete
()
{
if
(
this
.
refresherTriggered
)
{
if
(
this
.
refresherTriggered
)
{
...
...
pages/template/base-tab.vue
View file @
1abecd3c
...
@@ -178,7 +178,11 @@
...
@@ -178,7 +178,11 @@
let
option
=
{
let
option
=
{
isNeedShowLoading
:
false
isNeedShowLoading
:
false
};
};
util
.
request
(
url
,
param
,
this
.
requestCallback
,
null
,
option
);
util
.
request
(
url
,
param
,
option
,
{
success
:
this
.
requestCallback
,
fail
:
this
.
requestFail
,
complete
:
this
.
requestComplete
});
},
},
requestCallback
(
res
)
{
requestCallback
(
res
)
{
var
tab
=
this
.
tabList
[
this
.
tabIndex
];
var
tab
=
this
.
tabList
[
this
.
tabIndex
];
...
@@ -205,6 +209,16 @@
...
@@ -205,6 +209,16 @@
})
})
this
.
tabList
[
this
.
tabIndex
].
data
=
this
.
tabList
[
this
.
tabIndex
].
data
.
concat
(
data
.
list
);
this
.
tabList
[
this
.
tabIndex
].
data
=
this
.
tabList
[
this
.
tabIndex
].
data
.
concat
(
data
.
list
);
},
},
requestFail
(
res
,
status
)
{
this
.
contentStatus
=
status
;
},
requestComplete
()
{
if
(
this
.
refresherTriggered
)
{
this
.
refresherTriggered
=
false
;
}
this
.
firstRequest
=
false
;
uni
.
hideLoading
()
},
onLoadMore
(
e
)
{
onLoadMore
(
e
)
{
var
_this
=
this
;
var
_this
=
this
;
_this
.
loadMoreViewShow
=
true
;
_this
.
loadMoreViewShow
=
true
;
...
...
utils/constant.js
View file @
1abecd3c
...
@@ -39,6 +39,19 @@ const C_POP_DIRECTIONS = {
...
@@ -39,6 +39,19 @@ const C_POP_DIRECTIONS = {
bottom
:
"bottom"
,
//最底部
bottom
:
"bottom"
,
//最底部
}
}
const
CONTENT_STATUS
=
{
EMPTY
:
{
value
:
"empty"
,
icon
:
"../../static/icon_no_data.webp"
,
tip
:
"暂无内容~"
},
ERROE
:
{
value
:
"error"
,
icon
:
"../../static/com_icon_error.png"
,
tip
:
"服务器开小差,请稍后再试~"
}
}
export
default
{
export
default
{
// KEY
// KEY
KEY_USER
,
KEY_USER
,
...
@@ -46,6 +59,7 @@ export default {
...
@@ -46,6 +59,7 @@ export default {
KEY_SESSION_ID
,
KEY_SESSION_ID
,
SECRET_KEY
,
SECRET_KEY
,
BASE_URL
,
BASE_URL
,
CONTENT_STATUS
,
LOAD_STATUS
,
LOAD_STATUS
,
LOAD_TEXTS
,
LOAD_TEXTS
,
LOOP
,
LOOP
,
...
...
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