Skip to content

Commit

Permalink
v3.3.4
Browse files Browse the repository at this point in the history
优化图书详情界面&首页移除频繁请求一卡通余额
  • Loading branch information
Airmole committed Sep 18, 2022
1 parent 1bccefb commit 01eae5c
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 162 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ App({
const cookie = edusysInfo.cookie ? edusysInfo.cookie : ''
const openid = wx.getStorageSync('openid') || { openid: this.globalData.openid }
wx.request({
url: `https://dev.shellbox.airmole.cn/api/edu/profile`,
// url: `${self.globalData.domain}/edu/profile`,
// url: `https://dev.shellbox.airmole.cn/api/edu/profile`,
url: `${self.globalData.domain}/edu/profile`,
data:{
uid: uid,
pwd: pwd,
Expand Down
3 changes: 3 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于校园导航定位"
},
"scope.addPhoneCalendar": {
"desc": "用于添加上课日历事件提醒"
}
},
"requiredPrivateInfos": [
Expand Down
12 changes: 9 additions & 3 deletions colorui/components/cu-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ Component({
*/
methods: {
BackPage() {
wx.navigateBack({
delta: 1
});
try {
const _this = this
wx.navigateBack({
delta: 1,
fail() { _this.toHome()}
});
} catch (error) {
this.toHome()
}
},
toHome(){
wx.reLaunch({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shellbox",
"version": "3.3.3",
"description": "优化菜单列表分类展示,更新默认密码文案",
"version": "3.3.4",
"description": "优化图书详情界面&首页移除频繁请求一卡通余额",
"author": "Airmole"
}
89 changes: 87 additions & 2 deletions pages/books/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,29 @@ Page({
jsonStr: "",
doubanStr: '',
title: '',
isbn: ''
isbn: '',
place: '',
placeType: 0,
showCollection: true,
showDistribution: true,
showBookInfo: true,
showSameAuthor: true,
socialDistribution: [
{ floor: '四层', content: ['A', 'B', 'C', 'D'], desc: '中文社科图书A,B,C,D类', infloor: false },
{ floor: '三层', content: ['D', 'E', 'F', 'G', 'H', 'I'], desc: '中文社科图书D、E、F、G、H、I类', infloor: false },
{ floor: '二层', content: ['I', 'J', 'K'], desc: '中文社科图书I、J、K类、社科馆外文书库', infloor: false },
{ floor: '一层', content: [], desc: '借还处、音像制品库、新书库、图书漂流区', infloor: false }
],
industryDistribution: [
{ room: '101', content: ['TP'], desc: '理工馆中文书库101室 TP', infloor: false },
{ room: '102', content: ['TP'], desc: '理工馆中文书库102室 TP', infloor: false },
{ room: '103', content: ['TB', 'TD', 'TE', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN'], desc: '理工馆中文书库103室', infloor: false },
{ room: '104', content: ['TQ', 'TS', 'TU', 'TV'], desc: '理工馆中文书库104室', infloor: false },
{ room: '106', content: ['O', 'P', 'Q', 'R', 'U', 'V', 'X', 'Z'], desc: '理工馆中文书库106室', infloor: false },
{ room: '107', content: [], desc: '理工馆中文书库107室', infloor: false },
{ room: '108', content: [], desc: '理工馆中文书库108 过刊、最新书库', infloor: false },
{ room: '202', content: [], desc: '报刊阅览室', infloor: false },
]
},
onLoad: function (options) {
wx.showLoading({ title: "等我加载一下~" });
Expand All @@ -32,6 +54,7 @@ Page({
url: `${app.globalData.domain}/book/marc/${marc}`,
success: function (res) {
try {
_this.bookPossibleInfloor(res.data)
_this.setData({
jsonStr: res.data,
title: _this.getTitleFromBookInfo(res.data.bookInfo),
Expand All @@ -56,7 +79,8 @@ Page({
url: `${app.globalData.domain}/book/isbn/${isbn}`,
success: function (res) {
if (res.data.length != 0) {
_this.setData({ jsonStr: res.data, title: res.data.bookInfo[0].value, isLoading: false });
_this.bookPossibleInfloor(res.data)
_this.setData({ jsonStr: res.data, title: res.data.bookInfo[0].value, isLoading: false, isbn: isbn });
wx.hideLoading();
} else {
wx.hideLoading();
Expand Down Expand Up @@ -130,6 +154,67 @@ Page({
path: `pages/search/index?keyword=${title}&cid=0`
})
},
bookPossibleInfloor(book) {
let callNo = '' // 索书号
let callNoPrefix = '' // 索书号字母前缀
let place = ''
// 索书号
book.bookInfo.forEach(element => {
if (element.name.indexOf('中图法分类号') >= 0) {
callNo = element.value
return
}
})
// 馆藏地
book.collection.forEach(bookItem => {
bookItem.forEach(prop => {
if (prop.title == '索书号' && prop.value.length > 0) callNo = prop.value
if (prop.title.indexOf('馆藏地') >= 0) place = prop.value
})
})
const pattern = /^[a-zA-Z]+/
const matchedCallNoPrefix = pattern.exec(callNo)
callNoPrefix = matchedCallNoPrefix == null ? '' : matchedCallNoPrefix[0]
// 社科馆图书
if (place.indexOf('社科馆') >= 0) {
let socialDistribution = this.data.socialDistribution
if (place.indexOf('音像制品') === -1) {
socialDistribution.forEach((floor, index) => {
if (floor.content.includes(callNoPrefix)) socialDistribution[index].infloor = true
})
}
if (place.indexOf('新书库') >= 0 || place.indexOf('音像制品') >= 0) socialDistribution[3].infloor = true
this.setData({ socialDistribution: socialDistribution, place: place, placeType: 0 })
return
}
// 理工馆图书
let industryDistribution = this.data.industryDistribution
if (place.indexOf('理工馆') >= 0) {
industryDistribution.forEach((room, index) => {
if (room.content.includes(callNoPrefix)) industryDistribution[index].infloor = true
})
}
if (place.indexOf('新书库') >= 0) industryDistribution[6].infloor = true
if (place.indexOf('期刊室') >= 0) industryDistribution[industryDistribution.length - 1].infloor = true
this.setData({ industryDistribution: industryDistribution, place: place, placeType: 1 })
console.log('馆藏地,索书号', callNo, place)
},
distributionChanged() {
const currentValue = this.data.showDistribution
this.setData({ showDistribution: !currentValue })
},
showCollectionChanged() {
const currentValue = this.data.showCollection
this.setData({ showCollection: !currentValue })
},
showBookInfoChanged() {
const currentValue = this.data.showBookInfo
this.setData({ showBookInfo: !currentValue })
},
showSameAuthorChanged() {
const currentValue = this.data.showSameAuthor
this.setData({ showSameAuthor: !currentValue })
},
onShareAppMessage: function (res) {
let code = this.data.code;
let codeType = this.data.codeType;
Expand Down
Loading

0 comments on commit 01eae5c

Please sign in to comment.