Browse Source

书架页面更新

master
xuhuajiao 4 weeks ago
parent
commit
2afe9d56dc
  1. 4
      .env.development
  2. BIN
      src/assets/images/refresh.png
  3. BIN
      src/assets/images/refresh2.png
  4. 26
      src/views/bookRackList-dxh.vue
  5. 129
      src/views/bookRackList.vue
  6. 12
      src/views/module/bookDetails.vue

4
.env.development

@ -7,8 +7,8 @@ ENV = 'development'
#VUE_APP_WS_API = 'ws://120.76.47.59:8080'
# 许镇-本地服地址
VUE_APP_BASE_API = 'http://192.168.99.67:8080'
VUE_APP_WS_API = 'ws://192.168.99.67:8081'
VUE_APP_BASE_API = 'http://192.168.99.72:8080'
VUE_APP_WS_API = 'ws://192.168.99.72:8081'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true

BIN
src/assets/images/refresh.png

After

Width: 200  |  Height: 200  |  Size: 5.7 KiB

BIN
src/assets/images/refresh2.png

After

Width: 200  |  Height: 200  |  Size: 6.6 KiB

26
src/views/bookRackList-dxh.vue

@ -5,6 +5,7 @@
<span class="icon iconfont icon-l">&#xe631;</span>
</router-link> -->
<span class="icon iconfont icon-l" @click="goBack()">&#xe631;</span>
<img style="display: block; width: 46px; height: 46px; position: absolute; left: 100px; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%);" src="~@/assets/images/refresh.png" alt="" @click="handleRefresh" />
<h2>本架图书</h2>
<div class="rack-direct">
<span :class="classnameL" @click="handleDirect(-1)"></span>
@ -51,15 +52,38 @@ export default {
listData: [],
bookList: {},
classnameL: 'rack-direct-active',
classnameR: null
classnameR: null,
timer: null,
refreshtime: 30000
}
},
created() {
this.initBookshelfDetails(-1)
},
mounted() {
const _this = this
this.timer = setInterval(() => {
if (_this.classnameL !== null) {
_this.initBookshelfDetails(-1)
} else {
_this.initBookshelfDetails(1)
}
}, this.refreshtime)
},
beforeDestroy() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
},
methods: {
handleRefresh() {
if (this.classnameL !== null) {
this.initBookshelfDetails(-1)
} else {
this.initBookshelfDetails(1)
}
},
initSwiper() {
this.$nextTick(() => {
for (const key in this.bookList) {

129
src/views/bookRackList.vue

@ -5,14 +5,24 @@
<span class="icon iconfont icon-l">&#xe631;</span>
</router-link> -->
<span class="icon iconfont icon-l" @click="goBack()">&#xe631;</span>
<img style="display: block; width: 46px; height: 46px; position: absolute; left: 100px; top: 50%; -webkit-transform: translateY(-50%); transform: translateY(-50%);" src="~@/assets/images/refresh.png" alt="" @click="handleRefresh" />
<h2>本架图书</h2>
<div class="rack-direct">
<span :class="classnameL" @click="handleDirect(-1)"></span>
<span :class="classnameR" @click="handleDirect(1)"></span>
</div>
</div>
<div v-loading="loading" class="rack-box">
<div v-for="(item, index) in listData" :key="index" class="rack-item">
<!-- v-loading="loading" -->
<div class="rack-box">
<div
v-for="(item, index) in listData"
:key="index"
class="rack-item"
@mouseenter="handleSwiperEnter"
@mouseleave="handleSwiperLeave"
@touchstart="handleSwiperTouchStart"
@touchend="handleSwiperTouchEnd"
>
<div :class="['swiper'+index,'rack-box-list']">
<div class="swiper-wrapper">
<div v-for="eitem in bookList[item]" :key="eitem.id" class="list-item swiper-slide" @click="handleDetails(eitem)">
@ -30,7 +40,7 @@
</div>
</div>
</div>
<BookDetails ref="detailDom" />
<BookDetails ref="detailDom" @close="handleDetailClose" />
</div>
</template>
@ -51,15 +61,114 @@ export default {
listData: [],
bookList: {},
classnameL: 'rack-direct-active',
classnameR: null
classnameR: null,
timer: null,
refreshtime: 10000,
isDetailOpen: false, //
isOperating: false, //
timerResetDelay: 3000, // 5
isMouseOverSwiper: false
}
},
computed: {
isMouseOverAnySwiper() {
return this.isMouseOverSwiper // DOMSwiper
}
},
created() {
this.initBookshelfDetails(-1)
},
mounted() {
this.startTimer()
// const _this = this
// this.timer = setInterval(() => {
// if (_this.classnameL !== null) {
// _this.initBookshelfDetails(-1)
// } else {
// _this.initBookshelfDetails(1)
// }
// }, this.refreshtime)
},
beforeDestroy() {
this.stopTimer() //
},
methods: {
// Swiper
handleSwiperEnter() {
this.isMouseOverSwiper = true
this.stopTimer() //
},
// Swiper
handleSwiperLeave() {
this.isMouseOverSwiper = false
this.restartTimer() //
},
//
handleSwiperTouchStart() {
this.isMouseOverSwiper = true
this.stopTimer() //
},
//
handleSwiperTouchEnd() {
// 200ms
setTimeout(() => {
this.isMouseOverSwiper = false
this.restartTimer() //
}, 200)
},
//
handleUserAction() {
if (this.isOperating) return //
this.isOperating = true //
//
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
//
setTimeout(() => {
this.isOperating = false //
this.restartTimer() //
}, this.timerResetDelay)
},
//
startTimer() {
if (this.isDetailOpen || this.isOperating || this.isMouseOverAnySwiper) return //
this.timer = setInterval(() => {
if (!this.isMouseOverSwiper) { // Swiper
this.initBookshelfDetails(this.classnameL ? -1 : 1)
}
}, this.refreshtime)
},
//
restartTimer() {
if (!this.isDetailOpen) {
this.stopTimer()
this.startTimer()
}
},
//
stopTimer() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
},
handleRefresh() {
this.handleUserAction()
if (this.classnameL !== null) {
this.initBookshelfDetails(-1)
} else {
this.initBookshelfDetails(1)
}
},
initSwiper() {
this.$nextTick(() => {
for (const key in this.bookList) {
@ -85,13 +194,21 @@ export default {
})
}, 50)
},
//
handleDetailClose() {
this.isDetailOpen = false
this.restartTimer() //
},
handleDetails(itemData) {
this.handleUserAction()
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const params = {
isbn: itemData.isbn.replace(/\-/g, '')
}
getBookDetailsByISBN(params).then(res => {
this.$refs.detailDom.dialogVisible = true
this.isDetailOpen = true
this.stopTimer() //
if (res) {
this.$refs.detailDom.bookData = res
// console.log('res', res)
@ -118,6 +235,7 @@ export default {
},
//
handlePage(page) {
this.handleUserAction()
if (page === 1) {
//
} else {
@ -126,6 +244,7 @@ export default {
},
//
handleDirect(n) {
this.handleUserAction()
if (n === -1) { //
this.classnameR = null
this.classnameL = 'rack-direct-active'
@ -139,6 +258,7 @@ export default {
this.$router.go(-1)
},
initBookshelfDetails(n) {
if (this.isDetailOpen) return
this.loading = true
const params = {}
if (n === -1) { //
@ -169,6 +289,7 @@ export default {
setTimeout(() => {
this.loading = false
}, 1000)
this.isOperating = false //
})
}
}

12
src/views/module/bookDetails.vue

@ -1,6 +1,11 @@
<template>
<div>
<el-dialog title="图书详情" :visible.sync="dialogVisible" width="80%">
<el-dialog
title="图书详情"
:visible.sync="dialogVisible"
width="80%"
@close="closeDialog"
>
<!-- :before-close="handleClose" -->
<div class="dialog-setting">
<div v-if="bookData" class="book-details-box">
@ -60,6 +65,11 @@ export default {
toBookNav(index) {
const linkSrc = process.env.VUE_APP_BASE_API
window.location.href = linkSrc + '/anchoring/goNavigation.do?libcode=' + this.libcode + '&barcode=' + this.bookData.places[index].barcode
},
//
closeDialog() {
this.dialogVisible = false
this.$emit('close') //
}
}
}

Loading…
Cancel
Save