Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_vedio
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
android
uniapp_vedio
Commits
391cecd1
Commit
391cecd1
authored
May 30, 2024
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
75db8e75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
134 deletions
+138
-134
bookshelf.vue
vedio/components/bookshelf/bookshelf.vue
+107
-97
warehouse.vue
vedio/components/warehouse/warehouse.vue
+27
-27
home.vue
vedio/pages/home.vue
+4
-10
No files found.
vedio/components/bookshelf/bookshelf.vue
View file @
391cecd1
<
template
>
<view>
<c-navi
id=
'navi'
></c-navi>
<book-search-box
id=
'search'
:searchType=
'searchType'
></book-search-box>
<read-time-count-row
id=
'count'
ref=
'timeCount'
@
resize=
'resizeTimeCount'
></read-time-count-row>
<BookshelfList
ref=
'bookList'
:height=
'listHeight'
></BookshelfList>
<c-login></c-login>
</view>
</
template
>
<
script
>
import
BookshelfList
from
"./components/bookshelf-list.vue"
;
import
SystemInfoMixin
from
"../../common/mixins/system-info-mixin.js"
import
{
watchUserInfoChange
,
removeUserInfoChangeWatch
}
from
"../../common/services/userServices.js"
;
import
{
ENUM_SEARCH_TYPE
}
from
"../../static/enums/enum_value"
;
import
{
removeCollectionChangeWatch
,
watchCollectionChange
}
from
"../../common/services"
;
export
default
{
mixins
:
[
SystemInfoMixin
],
components
:
{
BookshelfList
},
data
()
{
return
{
searchType
:
ENUM_SEARCH_TYPE
.
BOOKSHELF
,
listHeight
:
0
};
},
onReady
()
{
<
template
>
<z-paging
style=
"height: 100%;"
>
<c-navi
id=
'navi'
></c-navi>
<book-search-box
id=
'search'
:searchType=
'searchType'
></book-search-box>
<read-time-count-row
id=
'count'
ref=
'timeCount'
@
resize=
'resizeTimeCount'
></read-time-count-row>
<BookshelfList
ref=
'bookList'
:height=
'listHeight'
></BookshelfList>
<c-login></c-login>
</z-paging>
</
template
>
<
script
>
import
BookshelfList
from
"./components/bookshelf-list.vue"
;
import
SystemInfoMixin
from
"../../common/mixins/system-info-mixin.js"
import
{
watchUserInfoChange
,
removeUserInfoChangeWatch
}
from
"../../common/services/userServices.js"
;
import
{
ENUM_SEARCH_TYPE
}
from
"../../static/enums/enum_value"
;
import
{
removeCollectionChangeWatch
,
watchCollectionChange
}
from
"../../common/services"
;
export
default
{
mixins
:
[
SystemInfoMixin
],
components
:
{
BookshelfList
},
data
()
{
return
{
searchType
:
ENUM_SEARCH_TYPE
.
BOOKSHELF
,
listHeight
:
0
};
},
onReady
()
{
this
.
initHeight
();
// 监听用户变动
watchUserInfoChange
((
info
)
=>
{
if
(
info
.
userInfo
)
{
this
.
initData
();
}
},
this
)
// 监听收藏变动
watchCollectionChange
(()
=>
{
this
.
refreshList
();
},
this
);
},
onShow
()
{
// 更新阅读时间统计
this
.
refreshTimeCount
();
},
onUnload
()
{
// 移除监听
removeUserInfoChangeWatch
(
this
);
removeCollectionChangeWatch
(
this
);
},
methods
:
{
show
()
{
this
.
initHeight
();
// 监听用户变动
watchUserInfoChange
((
info
)
=>
{
...
...
@@ -45,66 +68,53 @@
watchCollectionChange
(()
=>
{
this
.
refreshList
();
},
this
);
},
show
(){
},
hide
(){
},
onShow
()
{
// 更新阅读时间统计
this
.
refreshTimeCount
();
},
onUnload
()
{
// 移除监听
removeUserInfoChangeWatch
(
this
);
removeCollectionChangeWatch
(
this
);
},
methods
:
{
resizeTimeCount
()
{
this
.
initHeight
();
},
initData
()
{
this
.
refreshList
();
},
// 初始化刷新
initRefresh
()
{
let
ref
=
this
.
$refs
.
bookList
;
if
(
ref
)
{
ref
.
initRefresh
();
}
},
// 刷新数据列表
refreshList
()
{
let
ref
=
this
.
$refs
.
bookList
;
if
(
ref
)
{
ref
.
refreshList
();
}
},
refreshTimeCount
()
{
let
ref
=
this
.
$refs
.
timeCount
;
if
(
ref
)
{
ref
.
refresh
();
}
},
initHeight
()
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
"#navi"
).
boundingClientRect
();
query
.
select
(
"#search"
).
boundingClientRect
();
query
.
select
(
"#count"
).
boundingClientRect
();
query
.
exec
((
res
)
=>
{
let
result
=
0
;
res
.
forEach
(
item
=>
{
result
=
result
+
item
.
height
;
})
this
.
listHeight
=
this
.
windowHeight
-
result
;
})
},
}
}
</
script
>
<
style
lang=
"scss"
>
hide
()
{
},
resizeTimeCount
()
{
this
.
initHeight
();
},
initData
()
{
this
.
refreshList
();
},
// 初始化刷新
initRefresh
()
{
let
ref
=
this
.
$refs
.
bookList
;
if
(
ref
)
{
ref
.
initRefresh
();
}
},
// 刷新数据列表
refreshList
()
{
let
ref
=
this
.
$refs
.
bookList
;
if
(
ref
)
{
ref
.
refreshList
();
}
},
refreshTimeCount
()
{
let
ref
=
this
.
$refs
.
timeCount
;
if
(
ref
)
{
ref
.
refresh
();
}
},
initHeight
()
{
const
query
=
uni
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
"#navi"
).
boundingClientRect
();
query
.
select
(
"#search"
).
boundingClientRect
();
query
.
select
(
"#count"
).
boundingClientRect
();
query
.
exec
((
res
)
=>
{
let
result
=
0
;
res
.
forEach
(
item
=>
{
result
=
result
+
item
.
height
;
})
this
.
listHeight
=
this
.
windowHeight
-
result
;
})
},
}
}
</
script
>
<
style
lang=
"scss"
>
</
style
>
\ No newline at end of file
vedio/components/warehouse/warehouse.vue
View file @
391cecd1
<
template
>
<
view
>
<
z-paging
style=
"height: 100%;"
>
<c-navi
id=
'navi'
></c-navi>
<book-search-box
id=
'search'
></book-search-box>
<CategoryBar
id=
'category'
:range=
'categorys'
:current=
'currentIndex'
@
change=
'changeCategory'
...
...
@@ -16,7 +16,7 @@
</swiper>
</view>
<c-login></c-login>
</
view
>
</
z-paging
>
</
template
>
<
script
>
...
...
@@ -32,9 +32,9 @@
}
from
"./services/index.js"
import
{
isEmpty
}
from
"../../common/utils/util"
;
import
{
toastMessage
}
from
"../../common/utils/util"
;
import
{
toastMessage
}
from
"../../common/utils/toastUtil.js"
;
export
default
{
mixins
:
[
SystemInfoMixin
],
...
...
@@ -50,22 +50,7 @@
};
},
onLoad
(
options
)
{
setTimeout
(()
=>
{
// 匹配用户直接跳转小说
if
(
options
.
bookId
!=
''
&&
options
.
bookId
!=
undefined
)
{
gotoBookContentPage
(
options
.
bookId
);
}
},
800
);
this
.
getCategoryData
();
if
(
wx
.
setVisualEffectOnCapture
){
wx
.
setVisualEffectOnCapture
({
visualEffect
:
'hidden'
,
success
:(
res
)
=>
{
},
})
}
},
computed
:
{
showEmpty
:
function
()
{
...
...
@@ -100,12 +85,27 @@
deep
:
true
}
},
methods
:
{
show
(){
},
hide
(){
methods
:
{
show
()
{
setTimeout
(()
=>
{
// 匹配用户直接跳转小说
if
(
options
.
bookId
!=
''
&&
options
.
bookId
!=
undefined
)
{
gotoBookContentPage
(
options
.
bookId
);
}
},
800
);
this
.
getCategoryData
();
if
(
wx
.
setVisualEffectOnCapture
)
{
wx
.
setVisualEffectOnCapture
({
visualEffect
:
'hidden'
,
success
:
(
res
)
=>
{
},
})
}
},
hide
()
{
},
readyCategory
()
{
setTimeout
(()
=>
{
...
...
vedio/pages/home.vue
View file @
391cecd1
...
...
@@ -10,7 +10,7 @@
@
click=
"tabChange(0)"
>
<view
style=
"margin: 16rpx 0 11rpx;"
>
<image
v-if=
"currentPage==0"
class=
"tabs-image"
src=
"/static/tab/index_selected.png"
mode=
"heightFix"
>
mode=
"heightFix"
>
</image>
<image
v-else
class=
"tabs-image"
src=
"/static/tab/index_unselected.png"
mode=
"heightFix"
></image>
</view>
...
...
@@ -67,8 +67,8 @@
let
index
=
options
.
index
??
''
if
(
index
!=
''
&&
index
!=
undefined
)
{
this
.
currentPage
=
index
}
}
},
onShow
()
{
try
{
...
...
@@ -97,15 +97,9 @@
loadComponentData
()
{
if
(
this
.
currentPage
==
0
)
{
this
.
$refs
.
index
.
show
();
this
.
$refs
.
recommend
.
hide
();
this
.
$refs
.
user
.
hide
();
}
else
if
(
this
.
currentPage
==
1
)
{
this
.
$refs
.
index
.
hide
();
this
.
$refs
.
recommend
.
show
();
this
.
$refs
.
user
.
hide
();
}
else
if
(
this
.
currentPage
==
2
)
{
this
.
$refs
.
index
.
hide
();
this
.
$refs
.
recommend
.
hide
();
this
.
$refs
.
user
.
show
();
}
}
...
...
@@ -115,7 +109,7 @@
<
style
lang=
"scss"
>
.body
{
height
:
100%
;
height
:
100%
;
background-color
:
white
;
}
</
style
>
\ 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