Browse Source

还原图片写法

master
xuhuajiao 2 weeks ago
parent
commit
7b8dc7a28f
  1. BIN
      src/assets/images/default-img.png
  2. BIN
      src/assets/images/default-img2.png
  3. 18
      src/views/bookRackList.vue
  4. 30
      src/views/index.vue
  5. 62
      src/views/mixins/booklist.js
  6. 18
      src/views/module/homeListItem.vue

BIN
src/assets/images/default-img.png

Before

Width: 440  |  Height: 526  |  Size: 51 KiB

After

Width: 440  |  Height: 526  |  Size: 35 KiB

BIN
src/assets/images/default-img2.png

After

Width: 440  |  Height: 526  |  Size: 51 KiB

18
src/views/bookRackList.vue

@ -86,22 +86,22 @@ export default {
}, 50)
},
handleDetails(itemData) {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// 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
if (res) {
// this.$refs.detailDom.bookData = res
console.log('res', res)
Object.keys(res).forEach(key => {
if (key === 'srcUrl' && res[key]) {
res[key] = linkSrc + '/downloadFile' + res[key]
}
})
this.$refs.detailDom.bookData = res
console.log('ddd', this.$refs.detailDom.bookData)
// console.log('res', res)
// Object.keys(res).forEach(key => {
// if (key === 'srcUrl' && res[key]) {
// res[key] = linkSrc + '/downloadFile' + res[key]
// }
// })
// this.$refs.detailDom.bookData = res
// console.log('ddd', this.$refs.detailDom.bookData)
} else {
this.$refs.detailDom.bookData = {
srcUrl: itemData.bookAuthor,

30
src/views/index.vue

@ -110,26 +110,26 @@ export default {
},
// -
getNewBookList() {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const params = {
libcode: this.libcode,
pageNo: 1,
pageSize: 4
}
FetchNewBookRecommend(params).then(res => {
// let data = []
// data = res.newbookList
// data.forEach(item => {
// this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
// })
this.newList = res.newbookList.map((item, index) => {
if (item.nbImgPath) {
item.cover = linkSrc + '/downloadFile' + item.nbImgPath
} else {
item.cover = null
}
return item
let data = []
data = res.newbookList
data.forEach(item => {
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
})
// this.newList = res.newbookList.map((item, index) => {
// if (item.nbImgPath) {
// item.cover = linkSrc + '/downloadFile' + item.nbImgPath
// } else {
// item.cover = null
// }
// return item
// })
}).catch(() => {
this.$message.error('接口错误')
})
@ -173,9 +173,9 @@ export default {
//
initBookData(bookList) {
return bookList.map(async(item, index) => {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const newItem = {
cover: linkSrc + '/downloadFile' + item.srcUrl,
cover: item.srcUrl,
ranking: item.bookUID,
nbName: item.bookName,
isOtherBook: index !== 0,

62
src/views/mixins/booklist.js

@ -21,7 +21,7 @@ export const bookListCrud = {
methods: {
// 获取热门/新书图书list
getBookData() {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
this.bookLoading = true
const bookType = this.$route.query.bookType
const params = {
@ -32,35 +32,35 @@ export const bookListCrud = {
if (bookType === 'hot') {
FetchHotBookRecommend(params).then(res => {
this.pageCount = res.page.totalPages
// res.hotbookList.forEach(item => {
// this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
// })
this.bookData = res.hotbookList.map((item, index) => {
if (item.nbImgPath) {
item.cover = linkSrc + '/downloadFile' + item.nbImgPath
} else {
item.cover = null
}
return item
res.hotbookList.forEach(item => {
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
})
// this.bookData = res.hotbookList.map((item, index) => {
// if (item.nbImgPath) {
// item.cover = linkSrc + '/downloadFile' + item.nbImgPath
// } else {
// item.cover = null
// }
// return item
// })
this.bookLoading = false
}).catch(() => {
this.$message.error('接口错误')
})
} else {
FetchNewBookRecommend(params).then(res => {
this.bookData = res.newbookList.map((item, index) => {
if (item.nbImgPath) {
item.cover = linkSrc + '/downloadFile' + item.nbImgPath
} else {
item.cover = null
}
return item
})
this.bookLoading = false
// res.newbookList.forEach(item => {
// this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
// this.bookData = res.newbookList.map((item, index) => {
// if (item.nbImgPath) {
// item.cover = linkSrc + '/downloadFile' + item.nbImgPath
// } else {
// item.cover = null
// }
// return item
// })
this.bookLoading = false
res.newbookList.forEach(item => {
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
})
}).catch(() => {
this.$message.error('接口错误')
})
@ -101,21 +101,21 @@ export const bookListCrud = {
},
// 点击查看详情
handleDetails(index) {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const params = {
isbn: this.bookData[index].isbn.replace(/\-/g, '')
}
getBookDetailsByISBN(params).then(res => {
if (res) {
// this.$refs.detailDom.bookData = res
console.log('res', res)
Object.keys(res).forEach(key => {
if (key === 'srcUrl' && res[key]) {
res[key] = linkSrc + '/downloadFile' + res[key]
}
})
this.$refs.detailDom.bookData = res
console.log('ddd', this.$refs.detailDom.bookData)
// console.log('res', res)
// Object.keys(res).forEach(key => {
// if (key === 'srcUrl' && res[key]) {
// res[key] = linkSrc + '/downloadFile' + res[key]
// }
// })
// this.$refs.detailDom.bookData = res
// console.log('ddd', this.$refs.detailDom.bookData)
this.$refs.detailDom.dialogVisible = true
} else {
this.$message.error('暂无图书内容~')

18
src/views/module/homeListItem.vue

@ -67,22 +67,22 @@ export default {
},
methods: {
handleDetails(index) {
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const params = {
isbn: this.listData[index].isbn.replace(/\-/g, '')
}
getBookDetailsByISBN(params).then(res => {
this.$refs.detailDom.dialogVisible = true
if (res) {
// this.$refs.detailDom.bookData = res
console.log('res', res)
Object.keys(res).forEach(key => {
if (key === 'srcUrl' && res[key]) {
res[key] = linkSrc + '/downloadFile' + res[key]
}
})
this.$refs.detailDom.bookData = res
console.log('ddd', this.$refs.detailDom.bookData)
// console.log('res', res)
// Object.keys(res).forEach(key => {
// if (key === 'srcUrl' && res[key]) {
// res[key] = linkSrc + '/downloadFile' + res[key]
// }
// })
// this.$refs.detailDom.bookData = res
// console.log('ddd', this.$refs.detailDom.bookData)
} else {
this.$refs.detailDom.bookData = {
srcUrl: this.listData[index].cover,

Loading…
Cancel
Save