|
@@ -15,15 +15,19 @@
|
15
|
15
|
</a>
|
16
|
16
|
</div>
|
17
|
17
|
<nav class="nav">
|
18
|
|
- <a v-for="(item, index) in navList" :key="index" @click="navClick(item)">
|
19
|
|
- <img :src="item.icon" alt>
|
20
|
|
- <span>{{item.name}}</span>
|
|
18
|
+ <a v-for="(item, index) in navList" v-if="navList.length < 9 || index<7" :key="index" @click="navClick(item)">
|
|
19
|
+ <img :src="item.BookTypeImg" alt>
|
|
20
|
+ <span>{{item.BookTypeName}}</span>
|
|
21
|
+ </a>
|
|
22
|
+ <a v-if="navList.length >8 " @click="moreNav()">
|
|
23
|
+ <img src="https://spaceofcheng.oss-cn-beijing.aliyuncs.com/test-icon8.png" alt>
|
|
24
|
+ <span>更多</span>
|
21
|
25
|
</a>
|
22
|
26
|
</nav>
|
23
|
27
|
<div class="list">
|
24
|
28
|
<h1>精选推荐</h1>
|
25
|
29
|
<ul>
|
26
|
|
- <li v-for="(item, index) in bookList" :key="index">
|
|
30
|
+ <li v-for="(item, index) in books.list" :key="index">
|
27
|
31
|
<libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
|
28
|
32
|
</li>
|
29
|
33
|
</ul>
|
|
@@ -60,7 +64,7 @@ import libraryListItem from '../../../../components/libraryListItem/index'
|
60
|
64
|
import radio from '../../../../components/radio/index'
|
61
|
65
|
import { mapState, createNamespacedHelpers } from 'vuex'
|
62
|
66
|
const { mapActions: mapAppActions } = createNamespacedHelpers('app')
|
63
|
|
-const { mapState: mapLibraryState, mapActions: mapLibraryActions, mapMutations: mapLibraryMutations } = createNamespacedHelpers('library')
|
|
67
|
+const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
|
64
|
68
|
export default {
|
65
|
69
|
name: '',
|
66
|
70
|
data () {
|
|
@@ -70,7 +74,10 @@ export default {
|
70
|
74
|
caseId: '',
|
71
|
75
|
currentCaseId: '',
|
72
|
76
|
currentCaseName: '',
|
73
|
|
- cases: []
|
|
77
|
+ cases: [],
|
|
78
|
+ indexSearchKey: '',
|
|
79
|
+ page: 1,
|
|
80
|
+ pagesize: 10,
|
74
|
81
|
}
|
75
|
82
|
},
|
76
|
83
|
computed: {
|
|
@@ -78,10 +85,9 @@ export default {
|
78
|
85
|
userInfo: x => x.userCenter.userInfo,
|
79
|
86
|
CaseList: x => x.app.CaseList
|
80
|
87
|
}),
|
81
|
|
- ...mapLibraryState({
|
82
|
|
- navList: x => x.navList,
|
83
|
|
- bookList: x => x.bookList,
|
84
|
|
- indexSearchKey: x => x.indexSearchKey
|
|
88
|
+ ...mapBookState({
|
|
89
|
+ navList: x => x.types.list,
|
|
90
|
+ books: x => x.recommends
|
85
|
91
|
}),
|
86
|
92
|
},
|
87
|
93
|
components: {
|
|
@@ -97,6 +103,9 @@ export default {
|
97
|
103
|
id: item.CaseId
|
98
|
104
|
})
|
99
|
105
|
})
|
|
106
|
+ this.currentCaseId = ((res.cases || [])[0] || {}).CaseId
|
|
107
|
+ this.currentCaseName = ((res.cases || [])[0] || {}).CaseName
|
|
108
|
+ this.init()
|
100
|
109
|
})
|
101
|
110
|
} else {
|
102
|
111
|
(this.CaseList || []).map((item) => {
|
|
@@ -105,27 +114,36 @@ export default {
|
105
|
114
|
id: item.CaseId
|
106
|
115
|
})
|
107
|
116
|
})
|
|
117
|
+ this.currentCaseId = ((this.CaseList || [])[0] || {}).CaseId
|
|
118
|
+ this.currentCaseName = ((this.CaseList || [])[0] || {}).CaseName
|
|
119
|
+ this.init()
|
108
|
120
|
}
|
109
|
121
|
},
|
110
|
122
|
methods: {
|
111
|
123
|
...mapAppActions(['getCaseList']),
|
112
|
|
- ...mapLibraryActions(['getNavList', 'getRecommendBookList']),
|
113
|
|
- ...mapLibraryMutations(['emptyNavInfo', 'emptyRecommendBookList']),
|
|
124
|
+ ...mapBookActions(['getBookType', 'getRecommendBook']),
|
114
|
125
|
selectCaseId () { // 选择案场
|
115
|
126
|
if (this.currentCaseId !== this.caseId) {
|
116
|
127
|
this.currentCaseId = this.caseId
|
117
|
128
|
this.CaseList.map((item) => {
|
118
|
129
|
if (item.CaseId === this.currentCaseId) this.currentCaseName = item.CaseName
|
119
|
130
|
})
|
120
|
|
- this.emptyNavInfo() // 清空nav
|
121
|
|
- this.getNavList() // 获取nav
|
122
|
|
- this.emptyRecommendBookList() // 清空精选推荐书籍列表
|
123
|
|
- this.getRecommendBookList() // 获取精选推荐书籍列表
|
|
131
|
+ this.page = 1
|
|
132
|
+ this.init()
|
124
|
133
|
}
|
125
|
134
|
this.showDialog = false
|
126
|
135
|
},
|
127
|
136
|
init () { // 初始化
|
128
|
|
-
|
|
137
|
+ this.getBookType({
|
|
138
|
+ caseid: this.currentCaseId,
|
|
139
|
+ page: 1,
|
|
140
|
+ pagesize: 10,
|
|
141
|
+ })
|
|
142
|
+ this.getRecommendBook({
|
|
143
|
+ caseid: this.currentCaseId,
|
|
144
|
+ page: this.page,
|
|
145
|
+ pagesize: this.pagesize,
|
|
146
|
+ })
|
129
|
147
|
},
|
130
|
148
|
appointmentBook () { // 预约图书
|
131
|
149
|
this.showAppointmentDialog = true
|
|
@@ -134,11 +152,10 @@ export default {
|
134
|
152
|
this.showAppointmentDialog = false
|
135
|
153
|
},
|
136
|
154
|
navClick (item) { // 点击nav
|
137
|
|
- if (item.id === 'more') {
|
138
|
|
- this.$router.push({ name: 'libraryNavList' })
|
139
|
|
- } else {
|
140
|
|
- this.$router.push({ name: 'booksList', query: { id: item.id } })
|
141
|
|
- }
|
|
155
|
+ this.$router.push({ name: 'booksList', query: { type: item.BookTypeId } })
|
|
156
|
+ },
|
|
157
|
+ moreNav () {
|
|
158
|
+ this.$router.push({ name: 'libraryNavList', query: {caseid: this.currentCaseId} })
|
142
|
159
|
}
|
143
|
160
|
}
|
144
|
161
|
}
|