Commit c992094b authored by jyx's avatar jyx

代码优化

parent 288e3652
import Book from "../../../common/models/Book"; import Book from "../models/Book.js";
import { import {
getTimeDesc getTimeDesc
} from "../../../common/utils/timeUtil"; } from "../utils/timeUtil";
export default class BookshelfBookItem extends Book { export default class BookshelfBookItem extends Book {
constructor(param) { constructor(param) {
super(param || {}) super(param || {})
const { const {
lastReadTime lastReadTime
} = param || {} } = param || {}
this.lastReadTime = lastReadTime || ""; this.lastReadTime = lastReadTime || "";
this.lastReadTimeDesc = lastReadTime ? getTimeDesc(lastReadTime) : ""; this.lastReadTimeDesc = lastReadTime ? getTimeDesc(lastReadTime) : "";
} }
} }
\ No newline at end of file
...@@ -282,6 +282,14 @@ function getBookBeanPackData(callback) { ...@@ -282,6 +282,14 @@ function getBookBeanPackData(callback) {
url: `//system/bookLegumesType/list`, url: `//system/bookLegumesType/list`,
callback callback
}) })
}
function getCollects(callback) {
apiPOST({
url: "/book/collectList",
data: {},
callback
})
} }
/** /**
...@@ -299,7 +307,8 @@ function buyBookWithBookBean(bookId, callback) { ...@@ -299,7 +307,8 @@ function buyBookWithBookBean(bookId, callback) {
callback callback
}) })
} }
module.exports = { module.exports = {
getCollects,
getOpens, getOpens,
getReadTimeCount, getReadTimeCount,
startCountReadTime, startCountReadTime,
......
<template>
<view class="banneritem">
<swiper :autoplay="true" :interval="2000" :duration="500">
<swiper-item @click="handleBanner" v-for='(item, index) in bannerList' :key='index'>
<image class="banner-img" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_banner_ar.png"
mode="scaleToFill"></image>
</swiper-item>
</swiper>
</view>
</template>
<script>
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js"
import {
watchUserInfoChange,
removeUserInfoChangeWatch
} from "../../common/services/userServices.js";
export default {
mixins: [SystemInfoMixin],
data() {
return {
bannerList: ['', '', '']
};
},
onReady() {
// this.initHeight();
// 监听用户变动
watchUserInfoChange((info) => {
if (info.userInfo) {
this.initData();
}
}, this)
},
onShow() {},
onUnload() {
// 移除监听
removeUserInfoChangeWatch(this);
},
methods: {
show() {
// 监听用户变动
watchUserInfoChange((info) => {
if (info.userInfo) {
this.initData();
}
}, this)
},
handleBanner() {},
hide() {
},
initData() {
this.refreshList();
},
// 刷新数据列表
refreshList() {
}
}
}
</script>
<style lang="scss">
.banneritem {
margin: 20rpx 20rpx 0 20rpx;
height: 260rpx;
.banner-img {
height: 260rpx;
}
}
</style>
\ No newline at end of file
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
.book-list-item { .book-list-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 20rpx 40rpx; padding: 20rpx 20rpx;
.row { .row {
margin-bottom: 20rpx; margin-bottom: 20rpx;
...@@ -173,8 +173,8 @@ ...@@ -173,8 +173,8 @@
} }
.label-color-2 { .label-color-2 {
color: #3d99fd; color: #F1413C;
background: #d8ebff; background: #FEF3F3;
} }
.label-color-3 { .label-color-3 {
...@@ -186,8 +186,8 @@ ...@@ -186,8 +186,8 @@
.cover-box { .cover-box {
.cover { .cover {
width: 150rpx; width: 165rpx;
height: 200rpx; height: 220rpx;
border-radius: 15rpx; border-radius: 15rpx;
} }
} }
......
<template>
<view class="cover-box" @click="tapItem">
<!-- <image v-show="imageError" class="cover" src="/static/images/image_error.png" mode="aspectFill"></image> -->
<image class="cover" v-if="!last" :src="item.avatar" mode="aspectFill"></image>
<image v-else class="cover" src="/static/images/image_error.png" mode="aspectFill"></image>
<view class="title" v-if="!last">
{{item.title}}
</view>
<view class="c-flex_row c-align_center label-box" v-if="!last">
<slot name="footer">
<view class="label label-color-1" v-if='showCategory'>
{{item.categoryName}}
</view>
<view class="label label-color-2" v-for='(label, labelIndex) in item.tagList' :key='labelIndex'>
{{label.name}}
</view>
</slot>
</view>
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: function() {
return {}
}
},
last: {
type: Boolean,
default: false
}
},
data: function() {
return {
imageError: true
}
},
watch: {},
computed: {
showCategory: function() {
return this.item.categoryName
},
showErrorImage: function() {
return this.imageError;
},
hideErrorImage: function() {
return !this.imageError
}
},
methods: {
tapItem() {
this.$emit("tapItem", {
detail: {
data: this.item
}
})
},
loadImage() {
this.imageError = false;
},
errorImage() {
this.imageError = true
}
}
}
</script>
<style lang="scss" scoped>
.cover-box {
display: flex;
flex-direction: column;
.title {
width: 100%;
font-size: 26rpx;
margin-top: 10rpx;
color: #383B3D;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.cover {
width: 100%;
height: 220rpx;
border-radius: 15rpx;
}
}
</style>
\ No newline at end of file
<template>
<scroll-view scroll-y style="height: 100%;">
<book-search-box id='search'></book-search-box>
<Banner></Banner>
<RecommendList ref='recommendList1' :listType="1"></RecommendList>
<RecommendList ref='recommendList2' :listType="2"></RecommendList>
<view style="height: 20rpx;"></view>
</scroll-view>
</template>
<script>
import RecommendList from "../recommend-list/recommend-list.vue";
import Banner from "../banner/banner.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js"
import {
watchUserInfoChange,
removeUserInfoChangeWatch
} from "../../common/services/userServices.js";
export default {
mixins: [SystemInfoMixin],
components: {
RecommendList,
Banner
},
data() {
return {
listHeight: 0
};
},
onReady() {
// this.initHeight();
// 监听用户变动
watchUserInfoChange((info) => {
if (info.userInfo) {
this.initData();
}
}, this)
this.refreshList()
},
onShow() {},
onUnload() {
// 移除监听
removeUserInfoChangeWatch(this);
},
methods: {
show() {
// 监听用户变动
watchUserInfoChange((info) => {
if (info.userInfo) {
this.initData();
}
}, this)
},
hide() {
},
initData() {
this.refreshList();
},
// 刷新数据列表
refreshList() {
let ref2 = this.$refs.recommendList1;
if (ref2) {
ref2.refreshList();
}
let ref = this.$refs.recommendList2;
if (ref) {
ref.refreshList();
}
},
initHeight() {
const query = uni.createSelectorQuery().in(this);
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
<template>
<view class="bookshelf">
<read-time-count-row id='count' ref='timeCount'></read-time-count-row>
<view class="bookitem" v-if="dataList.length>0">
<book-list-item2 class="item" v-for='(item, index) in dataList' :key='index' :item='item'
:last="index>=dataList.length-1" @tapItem='tapItem($event, index)' @close='tapClose($event, index)'>
</book-list-item2>
</view>
<c-shelf-empty v-else></c-shelf-empty>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
getCollects,
} from "../../../common/services/index.js"
import {
gotoBookContentPage
} from '../../../common/services/page-route';
import BookshelfBookItem from '../../../common/models/BookshelfBookItem.js';
import {
collectionBook,
noticeCollectionListChange
} from "../../../common/services/index.js"
export default {
mixins: [common],
props: {
height: {
type: Number,
default: 0
},
},
data: function() {
return {
dataList: [],
}
},
methods: {
refreshList() {
getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
this.refreshTimeCount()
},
refreshTimeCount() {
let ref = this.$refs.timeCount;
if (ref) {
ref.refresh()
}
},
changeData(e) {
this.dataList = e.records.map(item => {
return new BookshelfBookItem(item)
})
this.dataList.push({})
},
tapItem(e, index) {
if (index >= this.dataList.length - 1) {
uni.$emit('goWareHouse')
return
}
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
},
tapClose(e, index) {
let item = e.detail.data;
uni.showModal({
title: "确认移除",
content: `是否确认从书架中移除《${item.title}》`,
success: (res) => {
if (res.confirm) {
collectionBook(false, item.id, (success, data) => {
if (success) {
this.dataList.splice(index, 1)
this.$forceUpdate()
noticeCollectionListChange(item.id, false)
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
.bookshelf {
display: flex;
flex-direction: column;
border-radius: 20rpx;
background-color: white;
margin: 30rpx;
.bookitem {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-left: 20rpx;
.item {
width: 22%;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.item:last-child {
margin-bottom: 0;
margin-right: 0;
}
}
}
</style>
\ No newline at end of file
import {
apiGET,
apiPOST
} from "../../../common/utils/apiRequest.js"
module.exports = {
}
\ No newline at end of file
<template> <template>
<z-paging> <scroll-view scroll-y style="height: 100%;">
<c-navi id='navi'></c-navi> <BookshelfList ref='bookList'></BookshelfList>
<book-search-box id='search' :searchType='searchType'></book-search-box> <RecommendList ref='recommendList'></RecommendList>
<read-time-count-row id='count' ref='timeCount' @resize='resizeTimeCount'></read-time-count-row> <view style="height: 20rpx;"></view>
<BookshelfList ref='bookList' :height='listHeight'></BookshelfList> </scroll-view>
<c-login></c-login>
</z-paging>
</template> </template>
<script> <script>
import BookshelfList from "./components/bookshelf-list.vue"; import BookshelfList from "./components/bookshelf-list.vue";
import RecommendList from "../recommend-list/recommend-list.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js" import SystemInfoMixin from "../../common/mixins/system-info-mixin.js"
import { import {
watchUserInfoChange, watchUserInfoChange,
removeUserInfoChangeWatch removeUserInfoChangeWatch
} from "../../common/services/userServices.js"; } from "../../common/services/userServices.js";
import {
ENUM_SEARCH_TYPE
} from "../../static/enums/enum_value";
import { import {
removeCollectionChangeWatch, removeCollectionChangeWatch,
watchCollectionChange watchCollectionChange
...@@ -25,16 +21,16 @@ ...@@ -25,16 +21,16 @@
export default { export default {
mixins: [SystemInfoMixin], mixins: [SystemInfoMixin],
components: { components: {
BookshelfList BookshelfList,
RecommendList
}, },
data() { data() {
return { return {
searchType: ENUM_SEARCH_TYPE.BOOKSHELF,
listHeight: 0 listHeight: 0
}; };
}, },
onReady() { onReady() {
this.initHeight(); // this.initHeight();
// 监听用户变动 // 监听用户变动
watchUserInfoChange((info) => { watchUserInfoChange((info) => {
if (info.userInfo) { if (info.userInfo) {
...@@ -56,10 +52,8 @@ ...@@ -56,10 +52,8 @@
removeCollectionChangeWatch(this); removeCollectionChangeWatch(this);
}, },
methods: { methods: {
show() { show() {
this.$refs.timeCount.refresh() // this.initHeight();
this.initHeight();
// 监听用户变动 // 监听用户变动
watchUserInfoChange((info) => { watchUserInfoChange((info) => {
if (info.userInfo) { if (info.userInfo) {
...@@ -73,39 +67,23 @@ ...@@ -73,39 +67,23 @@
}, },
hide() { hide() {
},
resizeTimeCount() {
this.initHeight();
}, },
initData() { initData() {
this.refreshList(); this.refreshList();
}, },
// 初始化刷新
initRefresh() {
let ref = this.$refs.bookList;
if (ref) {
ref.initRefresh();
}
},
// 刷新数据列表 // 刷新数据列表
refreshList() { refreshList() {
let ref2 = this.$refs.recommendList;
if (ref2) {
ref2.refreshList();
}
let ref = this.$refs.bookList; let ref = this.$refs.bookList;
if (ref) { if (ref) {
ref.refreshList(); ref.refreshList();
} }
}, },
refreshTimeCount() {
let ref = this.$refs.timeCount;
if (ref) {
ref.refresh();
}
},
initHeight() { initHeight() {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select("#navi").boundingClientRect();
query.select("#search").boundingClientRect();
query.select("#count").boundingClientRect();
query.select("#count").boundingClientRect();
query.exec((res) => { query.exec((res) => {
let result = 0; let result = 0;
res.forEach(item => { res.forEach(item => {
......
<template> <template>
<view> <view class="bookshelf">
<c-list ref='list' :showShelfEmpty="true" flag='bookshelf' :needLogin="true" :height="height" <read-time-count-row id='count' ref='timeCount'></read-time-count-row>
url='/book/collectList' :param="requestParam" @change='changeData' method="POST"> <view class="bookitem" v-if="dataList.length>0">
<book-list-item v-for='(item, index) in dataList' :key='index' :item='item' <book-list-item2 class="item" v-for='(item, index) in dataList' :key='index' :item='item'
@tapItem='tapItem($event, index)' @close='tapClose($event, index)'> :last="index>=dataList.length-1" @tapItem='tapItem($event, index)' @close='tapClose($event, index)'>
<template v-slot:footer> </book-list-item2>
<view class="c-flex_row c-aligns_center"> </view>
<uni-icons type='calendar' size="16" color="#999"></uni-icons> <c-shelf-empty v-else></c-shelf-empty>
<view class="info">
{{item.lastReadTime}} 前阅读过
</view>
</view>
</template>
</book-list-item>
</c-list>
</view> </view>
</template> </template>
<script> <script>
import common from '@/mixins/common';
import {
getCollects,
} from "../../../common/services/index.js"
import { import {
gotoBookContentPage gotoBookContentPage
} from '../../../common/services/page-route'; } from '../../../common/services/page-route';
import {
isEmpty import BookshelfBookItem from '../../../common/models/BookshelfBookItem.js';
} from '../../../common/utils/util';
import BookshelfBookItem from '../models/BookshelfBookItem';
import { import {
collectionBook, collectionBook,
noticeCollectionListChange noticeCollectionListChange
} from "../../../common/services/index.js" } from "../../../common/services/index.js"
export default { export default {
mixins: [common],
props: { props: {
height: { height: {
type: Number, type: Number,
...@@ -41,30 +41,33 @@ ...@@ -41,30 +41,33 @@
dataList: [], dataList: [],
} }
}, },
computed: {
requestParam: function() {
return {}
}
},
methods: { methods: {
initRefresh() {
if (isEmpty(this.dataList)) {
this.refreshList();
}
},
refreshList() { refreshList() {
let ref = this.$refs.list; getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
this.refreshTimeCount()
},
refreshTimeCount() {
let ref = this.$refs.timeCount;
if (ref) { if (ref) {
ref.onPullRefreshing(); ref.refresh()
} }
}, },
changeData(e) { changeData(e) {
console.log(e) this.dataList = e.records.map(item => {
this.dataList = e.detail.data.map(item => {
return new BookshelfBookItem(item) return new BookshelfBookItem(item)
}) })
this.dataList.push({})
}, },
tapItem(e, index) { tapItem(e, index) {
if (index >= this.dataList.length - 1) {
uni.$emit('goWareHouse')
return
}
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis) gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
}, },
tapClose(e, index) { tapClose(e, index) {
...@@ -76,9 +79,9 @@ ...@@ -76,9 +79,9 @@
if (res.confirm) { if (res.confirm) {
collectionBook(false, item.id, (success, data) => { collectionBook(false, item.id, (success, data) => {
if (success) { if (success) {
this.dataList.splice(index, 1); this.dataList.splice(index, 1)
this.$forceUpdate(); this.$forceUpdate()
noticeCollectionListChange(item.id, false); noticeCollectionListChange(item.id, false)
} }
}) })
} }
...@@ -91,9 +94,29 @@ ...@@ -91,9 +94,29 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.info { .bookshelf {
font-size: 26rpx; display: flex;
color: #999; flex-direction: column;
margin-left: 10rpx; border-radius: 20rpx;
background-color: white;
margin: 30rpx;
.bookitem {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-left: 20rpx;
.item {
width: 22%;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.item:last-child {
margin-bottom: 0;
margin-right: 0;
}
}
} }
</style> </style>
\ No newline at end of file
module.exports = {} import {
\ No newline at end of file apiGET,
apiPOST
} from "../../../common/utils/apiRequest.js"
module.exports = {
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
暂未添加到书架 暂未添加到书架
</view> </view>
<view class="empty-button" @click="goWareHouse"> <view class="empty-button" @click="goWareHouse">
去书 去书城看看
</view> </view>
<slot></slot> <slot></slot>
</view> </view>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}; };
}, },
methods: { methods: {
goWareHouse() { goWareHouse() {
uni.$emit('goWareHouse') uni.$emit('goWareHouse')
// uni.switchTab({ // uni.switchTab({
// url: '/pages/warehouse/warehouse' // url: '/pages/warehouse/warehouse'
...@@ -36,20 +36,20 @@ ...@@ -36,20 +36,20 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 800rpx; height: 400rpx;
.empty-title { .empty-title {
color: #999; color: #999;
font-size: 26rpx; font-size: 26rpx;
margin-bottom: 40rpx; margin-bottom: 20rpx;
} }
.empty-button { .empty-button {
font-size: 30rpx; font-size: 30rpx;
border: 1px solid #FECF02;
padding: 10rpx 40rpx; padding: 10rpx 40rpx;
border-radius: 30rpx; border-radius: 30rpx;
color: #FECF02; color: white;
background: linear-gradient(90deg, #F1413C, #FD6864);
} }
} }
</style> </style>
\ No newline at end of file
This diff is collapsed.
<template> <template>
<view class="c-flex_row c-aligns_center c-justify_between read-time-count-row"> <view class="c-flex_row c-aligns_center c-justify_between read-time-count-row">
<view class="c-flex_column c-aligns_center"> <view class="c-flex_row c-aligns_center">
<view class="title"> <view class="title">
今日阅读时间 今日<br>已读
</view> </view>
<view class="value" v-if='count.count'> <!-- <view class="value" v-if='count.count'> -->
<view class="count" v-if='count.hour'> <view class="value">
<view class="count-value">{{count.hour}}</view> <view class="count">
<view class="count-unit">小时</view> <view class="count-value">{{count.hour ?count.hour:'00'}}</view>
</view> <view class="count-unit">h</view>
<view class="count" v-if='count.minute'> </view>
<view class="count-value">{{count.minute}}</view> <view class="count">
<view class="count-unit">分钟</view> <view class="count-value">{{count.minute?count.minute:'00'}}</view>
</view> <view class="count-unit">m</view>
<view class="count" v-if='count.second'> </view>
<view class="count-value">{{count.second}}</view> <view class="count">
<view class="count-unit"></view> <view class="count-value">{{count.second?count.second:'00'}}</view>
</view> <view class="count-unit">s</view>
</view> </view>
<view class="value" v-else> </view>
<view class="count"> <!-- <view class="value" v-else>
<view class="count-value" style="color: #ffffff00;"> <view class="count">
0 <view class="count-value" style="color: #ffffff00;">
</view> 0
<view class="count-unit"> </view>
尚未开始 <view class="count-unit">
</view> 尚未开始
</view> </view>
</view> </view>
</view> </view> -->
<view class="c-flex_column c-aligns_center"> </view>
<slot name="right"></slot> <view class="c-flex_column c-aligns_center">
</view> <slot name="right"></slot>
</view> </view>
</template> </view>
</template>
<script>
import ReadCount from '../../common/models/ReadCount'; <script>
import { import ReadCount from '../../common/models/ReadCount';
getReadTimeCount import {
} from '../../common/services'; getReadTimeCount
export default { } from '../../common/services';
name: "read-time-count-row", export default {
props: {}, name: "read-time-count-row",
data() { props: {},
return { data() {
count: { return {
count: 1, count: {
hour: 0, count: 1,
minute: 0, hour: 0,
second: 0 minute: 0,
} second: 0
}; }
}, };
mounted() { },
this.refresh(); mounted() {
}, this.refresh();
methods: { },
refresh() { methods: {
this.count = new ReadCount({ refresh() {
count: getReadTimeCount() this.count = new ReadCount({
}) count: getReadTimeCount()
this.$nextTick(() => { })
this.$emit("resize"); this.$nextTick(() => {
}) this.$emit("resize");
}, })
} },
} }
</script> }
</script>
<style lang="scss">
.read-time-count-row { <style lang="scss">
padding: 20rpx 40rpx; .read-time-count-row {
padding: 20rpx;
.title {
font-size: 28rpx; .title {
color: #333; width: 80rpx;
margin-bottom: 20rpx; font-size: 30rpx;
} color: #000000;
margin-right: 15rpx;
.value { }
display: flex;
flex-direction: row; .value {
align-items: center; display: flex;
flex-direction: row;
.count {
display: flex; .count {
flex-direction: row; position: relative;
margin-right: 10rpx; margin-right: 15rpx;
font-size: 24rpx; font-size: 24rpx;
color: #333; background-color: #FEF3F3;
border-radius: 10rpx;
.count-value { width: 90rpx;
color: #007aff; height: 90rpx;
font-size: 38rpx; color: #000000;
font-weight: 700;
height: 40rpx; .count-value {
line-height: 40rpx; position: absolute;
} top: 50%;
left: 50%;
.count-unit { transform: translate(-50%, -50%);
margin-left: 8rpx; color: #000000;
height: 40rpx; font-size: 46rpx;
line-height: 40rpx; font-weight: 700;
} }
}
} .count-unit {
} position: absolute;
right: 8rpx;
bottom: 8rpx;
}
}
}
}
</style> </style>
\ No newline at end of file
<template>
<view class="recommendlist">
<view class="booklabel">
<view class="title">{{title}}</view>
<view class="change" @click="refreshList">换一换</view>
</view>
<view class="rowitem" v-if="listType==0||listType==2">
<book-list-item2 class="item" v-for='(item, index) in dataList' :key='index' :item='item'
@tapItem='tapItem($event, index)'>
</book-list-item2>
</view>
<view class="columnitem" v-else-if="listType==1">
<book-list-item :item='dataList[0]' :showClose='false'>
</book-list-item>
<view class="rowitem">
<book-list-item2 class="item" :item='item' v-if="index!=0" v-for='(item, index) in dataList'
:key='index' @tapItem='tapItem($event, index)'>
</book-list-item2>
</view>
</view>
<view class="columnitem" v-else-if="listType==3">
<book-list-item class="item" v-for='(item, index) in dataList' :key='index' :item='item'
@tapItem='tapItem($event, index)' :showClose='false'>
</book-list-item>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
getCollects,
} from "../../common/services/index.js"
import {
gotoBookContentPage
} from '../../common/services/page-route.js';
import BookshelfBookItem from '../../common/models/BookshelfBookItem.js';
import {
collectionBook,
noticeCollectionListChange
} from "../../common/services/index.js"
export default {
mixins: [common],
props: {
listType: {
type: Number,
default: 0
}
},
data: function() {
return {
dataList: [],
title: '猜你喜欢',
}
},
mounted() {
if (this.listType == 0) {
this.title = '猜你喜欢'
} else if (this.listType == 1 || this.listType == 3) {
this.title = '热门推荐'
} else if (this.listType == 2) {
this.title = '新书推荐'
}
},
methods: {
refreshList() {
if (this.listType == 0) {
getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
} else if (this.listType == 1) {
getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
} else if (this.listType == 2) {
getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
} else if (this.listType == 3) {
getCollects((success, data) => {
if (success) {
this.changeData(data)
}
})
}
},
changeData(e) {
this.dataList = e.records.map(item => {
return new BookshelfBookItem(item)
})
},
tapItem(e, index) {
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
},
}
}
</script>
<style lang="scss" scoped>
.recommendlist {
display: flex;
flex-direction: column;
border-radius: 20rpx;
background-color: white;
margin: 30rpx;
margin-bottom: 0;
.booklabel {
display: flex;
flex-direction: row;
justify-content: space-between;
height: 100rpx;
line-height: 100rpx;
padding: 0 20rpx;
.title {
font-weight: 500;
font-size: 34rpx;
color: #383B3D;
}
.change {
font-weight: 400;
font-size: 24rpx;
color: #A5A5AD;
}
}
.columnitem {
display: flex;
flex-direction: column;
}
.rowitem {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-left: 20rpx;
.item {
width: 22%;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.item:last-child {
margin-bottom: 0;
margin-right: 0;
}
}
}
</style>
\ No newline at end of file
<template> <template>
<scroll-view class="bar-box" scroll-x id='box' :scroll-into-view="scrollId"> <scroll-view class="bar-box" scroll-x id='box' :scroll-into-view="scrollId">
<view v-if='showEmpty' class="tab-item"> <view v-if='showEmpty' class="tab-item">
<view class="title"> <view class="title">
暂无分类数据 暂无分类数据
</view> </view>
</view> </view>
<view v-else :id="'item_'+index" class="tab-item" :class="{'tab-item-selected': item.selected}" <view v-else :id="'item_'+index" class="tab-item" :class="{'tab-item-selected': item.selected}"
v-for="(item, index) in tabs" :key='item.name' @click="tapTab(index)"> v-for="(item, index) in tabs" :key='item.name' @click="tapTab(index)">
<view class="title"> <view class="title">
{{item.name}} {{item.name}}
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</template> </template>
<script> <script>
import { import {
isEmpty isEmpty
} from '../../../common/utils/util'; } from '../../../common/utils/util';
class Tab { class Tab {
constructor(param) { constructor(param) {
const { const {
name, name,
selected = false, selected = false,
data data
} = param || {} } = param || {}
this.name = name; this.name = name;
this.selected = selected; this.selected = selected;
this.data = data; this.data = data;
} }
} }
export default { export default {
props: { props: {
range: { range: {
type: Array, type: Array,
default: function() { default: function() {
return [] return []
} }
}, },
rangeKey: { rangeKey: {
type: String, type: String,
default: "name" default: "name"
}, },
current: { current: {
type: Number, type: Number,
default: 0 default: 0
} }
}, },
data: function() { data: function() {
return { return {
tabs: [], tabs: [],
tabIndex: 0, tabIndex: 0,
scrollId: null scrollId: null
} }
}, },
computed: { computed: {
showEmpty: function() { showEmpty: function() {
return isEmpty(this.tabs); return isEmpty(this.tabs);
}, },
tabValueChange: function() { tabValueChange: function() {
const { const {
range, range,
rangeKey, rangeKey,
tabIndex tabIndex
} = this; } = this;
return { return {
range, range,
rangeKey, rangeKey,
tabIndex tabIndex
} }
}, },
}, },
watch: { watch: {
tabValueChange: { tabValueChange: {
handler: function(n) { handler: function(n) {
let range = n.range; let range = n.range;
let rangeKey = n.rangeKey; let rangeKey = n.rangeKey;
let tabIndex = n.tabIndex; let tabIndex = n.tabIndex;
if (range) { if (range) {
this.tabs = range.map((item, index) => { this.tabs = range.map((item, index) => {
return new Tab({ return new Tab({
name: typeof item == 'object' ? item[rangeKey] : item, name: typeof item == 'object' ? item[rangeKey] : item,
selected: index == tabIndex, selected: index == tabIndex,
data: item data: item
}) })
}) })
} else { } else {
this.tabs = []; this.tabs = [];
} }
}, },
deep: true, deep: true,
immediate: true immediate: true
}, },
current: { current: {
handler: function(n) { handler: function(n) {
this.tabIndex = n; this.tabIndex = n;
}, },
immediate: true immediate: true
}, },
tabIndex: { tabIndex: {
handler: function(n) { handler: function(n) {
this.scrollId = `item_${n}` this.scrollId = `item_${n}`
}, },
}, },
tabs: { tabs: {
handler: function(n) { handler: function(n) {
this.$nextTick(() => { this.$nextTick(() => {
this.$emit("ready") this.$emit("ready")
}) })
}, },
immediate: true, immediate: true,
deep: true deep: true
} }
}, },
methods: { methods: {
tapTab(index) { tapTab(index) {
if (this.tabIndex != index) { if (this.tabIndex != index) {
this.tabIndex = index; this.tabIndex = index;
this.$emit("change", { this.$emit("change", {
index: index, index: index,
value: this.tabs[index].data value: this.tabs[index].data
}) })
} }
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.bar-box { .bar-box {
white-space: nowrap; margin: 20rpx 0;
padding: 0 20rpx; white-space: nowrap;
width: calc(100% - 40rpx); padding: 0 20rpx;
} width: calc(100% - 40rpx);
}
.tab-item {
display: inline-flex; .tab-item {
flex-direction: column; display: inline-flex;
align-items: center; flex-direction: column;
justify-content: center; align-items: center;
padding: 25rpx 20rpx; justify-content: center;
font-size: 30rpx; border-radius: 30rpx;
background: transparent; padding: 8rpx 16rpx;
color: #888; font-size: 30rpx;
background: #EEEEEE;
.title { color: #6B6B6B;
min-width: 80rpx; margin: 0 16rpx;
text-align: center;
} .title {
} min-width: 80rpx;
text-align: center;
.tab-item:first-child { }
padding-left: 0; }
}
.tab-item:first-child {
.tab-item:last-child { margin-left: 0;
padding-right: 0; }
}
.tab-item:last-child {
.tab-item-selected { margin-right: 0;
font-size: 36rpx; }
font-weight: 700;
color: #333 .tab-item-selected {
} background: #F1413C;
color: white;
}
</style> </style>
\ No newline at end of file
<template> <template>
<z-paging> <scroll-view scroll-y 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' <CategoryBar id='category' :range='categorys' :current='currentIndex' @change='changeCategory'
@ready='readyCategory'></CategoryBar> @ready='readyCategory'></CategoryBar>
<view :style="[listStyle]" v-if='showEmpty'> <view :style="[listStyle]" v-if='showEmpty'>
...@@ -12,12 +10,11 @@ ...@@ -12,12 +10,11 @@
@change="changeSwiper"> @change="changeSwiper">
<swiper-item v-for='(item, index) in categorys' :key='index'> <swiper-item v-for='(item, index) in categorys' :key='index'>
<WarehouseList :ref="`bookList${index}`" :category='item' :height='listHeight'></WarehouseList> <WarehouseList :ref="`bookList${index}`" :category='item' :height='listHeight'></WarehouseList>
<!-- <WarehouseList ref="bookList" :category='item' :height='listHeight'></WarehouseList> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
<c-login></c-login> <view style="height: 20rpx;"></view>
</z-paging> </scroll-view>
</template> </template>
<script> <script>
...@@ -60,7 +57,7 @@ ...@@ -60,7 +57,7 @@
}, },
listStyle: function() { listStyle: function() {
return { return {
height: `${this.listHeight}px` height: `${this.listHeight}px`,
} }
}, },
categroyChange: function() { categroyChange: function() {
...@@ -119,7 +116,7 @@ ...@@ -119,7 +116,7 @@
if (success) { if (success) {
setTimeout(() => { setTimeout(() => {
// 匹配用户直接跳转小说 // 匹配用户直接跳转小说
if (data.articleMsg != null) { if (data.articleMsg != null) {
gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis); gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis);
} }
}, 800); }, 800);
......
<template> <template>
<view> <scroll-view scroll-y style="height: 100%;background: #FFF7F7;">
<search-header-bar id='headerBar' :keyword='keyword' @clear='clearSearch' <search-header-bar id='headerBar' :keyword='keyword' @clear='clearSearch'
@start='startSearch'></search-header-bar> @start='startSearch'></search-header-bar>
<view :style='[placeholderViewStyle]'> <view :style='[placeholderViewStyle]'>
<search-placeholder-view ref='placeholder' :height='listHeight' <search-placeholder-view ref='placeholder' :height='listHeight'
@chooseKeyword='chooseKeyword'></search-placeholder-view> @chooseKeyword='chooseKeyword'></search-placeholder-view>
</view> </view>
<view :style="[resultViewStyle]"> <view :style="[resultViewStyle]">
<search-result-view ref='searchList' :height='listHeight' :keyword='keyword' :searchType='searchType' <search-result-view ref='searchList' :height='listHeight' :keyword='keyword' :searchType='searchType'
:result='result' @change='changeResult'></search-result-view> :result='result' @change='changeResult'></search-result-view>
</view> </view>
<c-login></c-login> <view style="height: 20rpx;"></view>
</view> </scroll-view>
</template> </template>
<script> <script>
import SearchHeaderBar from "./components/search-header-bar.vue"; import SearchHeaderBar from "./components/search-header-bar.vue";
import SearchPlaceholderView from "./components/search-placeholder.vue"; import SearchPlaceholderView from "./components/search-placeholder.vue";
import SearchResultView from "./components/search-result.vue" import SearchResultView from "./components/search-result.vue"
import { import {
isEmpty, isEmpty,
isNotEmpty isNotEmpty
} from "../../../common/utils/util.js" } from "../../../common/utils/util.js"
import { import {
ENUM_SEARCH_TYPE ENUM_SEARCH_TYPE
} from "../../../static/enums/enum_value"; } from "../../../static/enums/enum_value";
export default { export default {
components: { components: {
SearchHeaderBar, SearchHeaderBar,
SearchPlaceholderView, SearchPlaceholderView,
SearchResultView SearchResultView
}, },
data() { data() {
return { return {
searchType: null, searchType: null,
keyword: "", keyword: "",
result: null, result: null,
listHeight: 0 listHeight: 0
}; };
}, },
onReady() { onReady() {
const eventChannel = this.getOpenerEventChannel(); const eventChannel = this.getOpenerEventChannel();
eventChannel.on("openBookSearchPage", (info) => { eventChannel.on("openBookSearchPage", (info) => {
this.keyword = info.keyword || ''; this.keyword = info.keyword || '';
this.searchType = info.searchType || ENUM_SEARCH_TYPE.WAREHOUSE; this.searchType = info.searchType || ENUM_SEARCH_TYPE.WAREHOUSE;
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.searchType.name title: this.searchType.name
}) })
}) })
}, },
onShow() { onShow() {
this.initHeight(); this.initHeight();
}, },
computed: { computed: {
placeholderViewStyle() { placeholderViewStyle() {
return isNotEmpty(this.result, true) ? { return isNotEmpty(this.result, true) ? {
display: "none" display: "none"
} : {} } : {}
}, },
resultViewStyle: function() { resultViewStyle: function() {
return isEmpty(this.result, true) ? { return isEmpty(this.result, true) ? {
display: "none" display: "none"
} : {} } : {}
}, },
}, },
methods: { methods: {
chooseKeyword(e) { chooseKeyword(e) {
this.keyword = e.detail.keyword; this.keyword = e.detail.keyword;
this.result = []; this.result = [];
this.refreshSearchList(); this.refreshSearchList();
}, },
clearSearch(e) { clearSearch(e) {
this.keyword = ""; this.keyword = "";
this.result = null; this.result = null;
}, },
startSearch(e) { startSearch(e) {
if (isEmpty(this.result, true)) { if (isEmpty(this.result, true)) {
this.result = []; this.result = [];
} }
this.keyword = e.detail.keyword; this.keyword = e.detail.keyword;
this.refreshSearchList() this.refreshSearchList()
}, },
refreshSearchList() { refreshSearchList() {
if (!this.keyword) return; if (!this.keyword) return;
let ref = this.$refs.searchList; let ref = this.$refs.searchList;
if (ref) { if (ref) {
ref.refreshList() ref.refreshList()
} }
}, },
changeResult(e) { changeResult(e) {
this.resultList = e.detail.data; this.resultList = e.detail.data;
}, },
initHeight() { initHeight() {
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select("#headerBar").boundingClientRect(); query.select("#headerBar").boundingClientRect();
query.exec((res) => { query.exec((res) => {
let height = 0; let height = 0;
res.forEach(item => { res.forEach(item => {
if (item && item.height) { if (item && item.height) {
height = height + item.height; height = height + item.height;
} }
}) })
this.listHeight = uni.getSystemInfoSync().windowHeight - height; this.listHeight = uni.getSystemInfoSync().windowHeight - height;
}) })
}, },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.test {
display: none;
}
</style> </style>
\ No newline at end of file
...@@ -90,7 +90,6 @@ ...@@ -90,7 +90,6 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
background: #fff;
font-size: 28rpx; font-size: 28rpx;
.item { .item {
......
<template> <template>
<view> <view>
<c-list ref='list' :height="height" :ableRefresh="true" :ableLoadMore="true" :customRequest="true" <!-- <c-list ref='list' :height="height" :ableRefresh="true" :ableLoadMore="true" :customRequest="true"
:sources="[1]" :needLogin="false" @refresh='refreshData' @loadMore='loadMoreData'> :sources="[1]" :needLogin="false" @refresh='refreshData' @loadMore='loadMoreData'> -->
<placeholder-section title='搜索历史' :itemSource='searchHistory' @tapItem='tapItem($event, "history")'> <placeholder-section title='搜索历史' :itemSource='searchHistory' @tapItem='tapItem($event, "history")'>
<template v-slot:headerButton> <template v-slot:headerButton>
<view class="header-button" @click="tapDeleteHistory"> <view class="header-button" @click="tapDeleteHistory">
<uni-icons type='trash' size='30' color="#999"></uni-icons> <uni-icons type='trash' size='30' color="#999"></uni-icons>
</view> </view>
</template> </template>
</placeholder-section> </placeholder-section>
<placeholder-section title='热门搜索' :itemSource='hotSearch' @tapItem='tapItem($event, "hot")' v-if='false'> <placeholder-section title='热门搜索' :itemSource='hotSearch' @tapItem='tapItem($event, "hot")' v-if='false'>
</placeholder-section> </placeholder-section>
<placeholder-section title='热门推荐'> <RecommendList ref='recommendList' :listType="3"></RecommendList>
<c-empty v-if='recommondEmpty'></c-empty> <!-- <placeholder-section title='热门推荐'> -->
<template v-else> <!-- <c-empty v-if='recommondEmpty'></c-empty> -->
<recommond-item v-for='(item, index) in hotRecommond' :key='index' :item='item'></recommond-item> <!-- <template v-else> -->
</template> <!-- </template> -->
</placeholder-section> <!-- </placeholder-section> -->
</c-list> <!-- </c-list> -->
</view> </view>
</template> </template>
<script> <script>
import PlaceholderSection from "./search-placeholder-section.vue" import PlaceholderSection from "./search-placeholder-section.vue"
import { import {
saveSearchHistory, saveSearchHistory,
watchSearchHistoryChange, watchSearchHistoryChange,
clearSearchHistory, clearSearchHistory,
removeSearchHistoryChangeWatch, removeSearchHistoryChangeWatch,
getHotRecommondData, getHotRecommondData,
} from "../services/index.js" } from "../services/index.js"
import HotRecommondBook from "../models/HotRecommondBook.js" import HotRecommondBook from "../models/HotRecommondBook.js"
import RecommondItem from "./recommond-item.vue" // import RecommondItem from "./recommond-item.vue"
import { import RecommendList from "../../../../components/recommend-list/recommend-list.vue"
isEmpty import {
} from "../../../../common/utils/util" isEmpty
export default { } from "../../../../common/utils/util"
components: { export default {
PlaceholderSection, components: {
RecommondItem PlaceholderSection,
}, // RecommondItem,
props: { RecommendList
height: { },
type: Number, props: {
default: 0 height: {
} type: Number,
}, default: 0
data: function() { }
return { },
searchHistory: [], data: function() {
hotSearch: [], return {
hotRecommond: [], searchHistory: [],
} hotSearch: [],
}, hotRecommond: [],
mounted() { }
watchSearchHistoryChange((result) => { },
this.searchHistory = result; mounted() {
}, this); watchSearchHistoryChange((result) => {
this.initRefresh(); this.searchHistory = result;
}, }, this);
destroyed() { this.initRefresh();
removeSearchHistoryChangeWatch(this); },
}, destroyed() {
computed: { removeSearchHistoryChangeWatch(this);
recommondEmpty: function() { },
return isEmpty(this.hotRecommond); computed: {
}, recommondEmpty: function() {
}, return isEmpty(this.hotRecommond);
methods: { },
tapDeleteHistory() { },
clearSearchHistory() methods: {
}, tapDeleteHistory() {
tapItem(e, flag) { clearSearchHistory()
this.$emit('chooseKeyword', { },
detail: { tapItem(e, flag) {
keyword: e.detail.item this.$emit('chooseKeyword', {
} detail: {
}) keyword: e.detail.item
}, }
initRefresh() { })
let ref = this.$refs.list; },
if (ref) { initRefresh() {
ref.initRefresh(); // let ref = this.$refs.list;
} // if (ref) {
}, // ref.initRefresh();
refreshData(e) { // }
let pageNo = e.detail.pageNo;
let pageSize = e.detail.pageSize; let ref = this.$refs.recommendList;
this.getHotRecommondData(pageNo, pageSize) if (ref) {
}, ref.refreshList();
loadMoreData(e) { }
let pageNo = e.detail.pageNo; },
let pageSize = e.detail.pageSize; refreshData(e) {
this.getHotRecommondData(pageNo, pageSize) let pageNo = e.detail.pageNo;
}, let pageSize = e.detail.pageSize;
getHotRecommondData(pageNo, pageSize) { this.getHotRecommondData(pageNo, pageSize)
getHotRecommondData(pageNo, pageSize, (success, data) => { },
let ref = this.$refs.list; loadMoreData(e) {
if (success) { let pageNo = e.detail.pageNo;
ref.pageNoStep(); let pageSize = e.detail.pageSize;
data = data.map(item => { this.getHotRecommondData(pageNo, pageSize)
return new HotRecommondBook(item) },
}) getHotRecommondData(pageNo, pageSize) {
if (pageNo == 0) { let ref = this.$refs.recommendList;
this.hotRecommond = data; if (ref) {
} else { ref.refreshList();
this.hotRecommond = this.hotRecommond.concat(data); }
}
} // getHotRecommondData(pageNo, pageSize, (success, data) => {
ref.closeTrigger(); // let ref = this.$refs.list;
ref.changeLoadMoreStatus(this.hotRecommond.length < 16, false); // if (success) {
}) // ref.pageNoStep();
}, // data = data.map(item => {
} // return new HotRecommondBook(item)
} // })
</script> // if (pageNo == 0) {
// this.hotRecommond = data;
<style lang="scss" scoped> // } else {
.header-button { // this.hotRecommond = this.hotRecommond.concat(data);
display: flex; // }
flex-direction: column; // }
align-items: center; // ref.closeTrigger();
justify-content: center; // ref.changeLoadMoreStatus(this.hotRecommond.length < 16, false);
height: 50rpx; // })
width: 50rpx; },
} }
}
</script>
<style lang="scss" scoped>
.header-button {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 50rpx;
width: 50rpx;
}
</style> </style>
\ No newline at end of file
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<view v-if="localActiviteFlag==1" class="body"> <view v-if="localActiviteFlag==1" class="body">
<view style="height: 92%;"> <view style="height: 92%;">
<bookshelf v-show="currentPage==0" ref="index" /> <bookshelf v-show="currentPage==0" ref="index" />
<warehouse v-show="currentPage==1" ref="recommend" /> <bookcity v-show="currentPage==1" ref="city" />
<userPage v-show="currentPage==2" ref="user" /> <warehouse v-show="currentPage==2" ref="recommend" />
<userPage v-show="currentPage==3" ref="user" />
</view> </view>
<view class="tabs-bar" style="z-index: 999;"> <view class="tabs-bar" style="z-index: 999;">
<view :class="currentPage==0?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'" <view :class="currentPage==0?'tab active': 'tab'" @click="tabChange(0)">
@click="tabChange(0)">
<view style="margin: 16rpx 0 11rpx;"> <view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==0" class="tabs-image" src="/static/tab/index_selected.png" <image v-if="currentPage==0" class="tabs-image" src="/static/tab/index_selected.png"
mode="heightFix"> mode="heightFix">
...@@ -16,19 +16,25 @@ ...@@ -16,19 +16,25 @@
</view> </view>
书架 书架
</view> </view>
<view :class="currentPage == 1?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'" <view :class="currentPage == 1?'tab active': 'tab'" @click="tabChange(1)">
@click="tabChange(1)">
<view style="margin: 16rpx 0 11rpx;"> <view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==1" class="tabs-image" src="/static/tab/promote_selected.png" <image v-if="currentPage==1" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image> mode="heightFix"></image>
<image v-else class="tabs-image" src="/static/tab/promote_unselected.png" mode="heightFix"></image> <image v-else class="tabs-image" src="/static/tab/promote_unselected.png" mode="heightFix"></image>
</view> </view>
书城
</view>
<view :class="currentPage == 2?'tab active': 'tab'" @click="tabChange(2)">
<view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/promote_selected.png"
mode="heightFix"></image>
<image v-else class="tabs-image" src="/static/tab/promote_unselected.png" mode="heightFix"></image>
</view>
书库 书库
</view> </view>
<view :class="currentPage == 2?'tab active': 'tab'" :style="'padding-bottom:' + bottomSafePadding + 'px;'" <view :class="currentPage == 3?'tab active': 'tab'" @click="tabChange(3)">
@click="tabChange(2)">
<view style="margin: 16rpx 0 11rpx;"> <view style="margin: 16rpx 0 11rpx;">
<image v-if="currentPage==2" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix"> <image v-if="currentPage==3" class="tabs-image" src="/static/tab/my_selected.png" mode="heightFix">
</image> </image>
<image v-else class="tabs-image" src="/static/tab/my_unselected.png" mode="heightFix"></image> <image v-else class="tabs-image" src="/static/tab/my_unselected.png" mode="heightFix"></image>
</view> </view>
...@@ -63,6 +69,7 @@ ...@@ -63,6 +69,7 @@
const app = getApp(); const app = getApp();
import bookshelf from "@/components/bookshelf/bookshelf.vue"; import bookshelf from "@/components/bookshelf/bookshelf.vue";
import bookcity from "@/components/bookcity/bookcity.vue";
import warehouse from "@/components/warehouse/warehouse.vue"; import warehouse from "@/components/warehouse/warehouse.vue";
import userPage from "@/components/home/my.vue"; import userPage from "@/components/home/my.vue";
...@@ -71,6 +78,7 @@ ...@@ -71,6 +78,7 @@
mixins: [common], mixins: [common],
components: { components: {
bookshelf, bookshelf,
bookcity,
warehouse, warehouse,
userPage userPage
}, },
...@@ -91,13 +99,7 @@ ...@@ -91,13 +99,7 @@
}, },
onShow() { onShow() {
try { try {
// 在子组件重写show()代替onShow() if (this.currentPage == 3) {
// if (this.currentPage == 0) {
// this.$refs.index.show();
// } else if (this.currentPage == 1) {
// this.$refs.recommend.show();
// } else
if (this.currentPage == 2) {
this.$refs.user.show(); this.$refs.user.show();
} }
} catch (e) { } catch (e) {
...@@ -108,7 +110,7 @@ ...@@ -108,7 +110,7 @@
uni.$on('refreshPreviousPage', (data) => { uni.$on('refreshPreviousPage', (data) => {
if (data.vipFlag == '1') { if (data.vipFlag == '1') {
// 开通vip刷新状态 // 开通vip刷新状态
if (that.currentPage == 2) { if (that.currentPage == 3) {
that.$refs.user.show(); that.$refs.user.show();
} }
} }
...@@ -138,13 +140,15 @@ ...@@ -138,13 +140,15 @@
if (this.currentPage == 0) { if (this.currentPage == 0) {
this.$refs.index.show(); this.$refs.index.show();
} else if (this.currentPage == 1) { } else if (this.currentPage == 1) {
this.$refs.recommend.show(); this.$refs.city.show();
} else if (this.currentPage == 2) { } else if (this.currentPage == 2) {
this.$refs.recommend.show();
} else if (this.currentPage == 3) {
this.$refs.user.show(); this.$refs.user.show();
} }
} else { } else {
if (this.currentPage == 1) { if (this.currentPage == 1) {
this.$refs.recommend.show(); this.$refs.city.show();
} }
} }
} }
...@@ -155,7 +159,7 @@ ...@@ -155,7 +159,7 @@
<style lang="scss"> <style lang="scss">
.body { .body {
height: 100%; height: 100%;
background-color: whitesmoke; background: #FFF7F7;
} }
.avatar { .avatar {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment