许成详 6 years ago
parent
commit
d2d789b665

+ 34
- 22
src/pages/user/library/booksList/index.vue View File

1
 <template>
1
 <template>
2
   <div class="mainPage">
2
   <div class="mainPage">
3
     <div>
3
     <div>
4
-      1
4
+      <ul>
5
+        <li v-for="(item, index) in bookTypeList" :key="index">
6
+          <libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
7
+        </li>
8
+      </ul>
9
+      <van-dialog v-model="showAppointmentDialog" :show-confirm-button="false">
10
+        <div class="dialogContent">
11
+          <span class="title">确认在线预约当前图书?</span>
12
+          <div>
13
+            <span style="color: #666;">在线预约需在2018年12月20日前前往案场借阅图书, 否则 将取消预约资格</span>
14
+          </div>
15
+          <div class="btn">
16
+            <a @click="sureAppointmentBook">确定</a>
17
+            <a @click="showAppointmentDialog = false">取消</a>
18
+          </div>
19
+        </div>
20
+      </van-dialog>
5
     </div>
21
     </div>
6
   </div>
22
   </div>
7
 </template>
23
 </template>
8
 
24
 
9
 <script>
25
 <script>
26
+import libraryListItem from '../../../../components/libraryListItem/index'
10
 import { mapState, createNamespacedHelpers } from 'vuex'
27
 import { mapState, createNamespacedHelpers } from 'vuex'
11
 const { mapActions: mapAppActions } = createNamespacedHelpers('app')
28
 const { mapActions: mapAppActions } = createNamespacedHelpers('app')
12
 const { mapState: mapLibraryState, mapActions: mapLibraryAction } = createNamespacedHelpers('library')
29
 const { mapState: mapLibraryState, mapActions: mapLibraryAction } = createNamespacedHelpers('library')
13
 export default {
30
 export default {
14
   data () {
31
   data () {
15
     return {
32
     return {
33
+      showAppointmentDialog: false
16
     }
34
     }
17
   },
35
   },
18
   created () {
36
   created () {
22
       CaseList: x => x.app.CaseList,
40
       CaseList: x => x.app.CaseList,
23
     }),
41
     }),
24
     ...mapLibraryState({
42
     ...mapLibraryState({
25
-      navList: x => x.navList
43
+      navList: x => x.navList,
44
+      bookTypeList: x => x.bookTypeList
26
     })
45
     })
27
   },
46
   },
28
   components: {
47
   components: {
48
+    libraryListItem,
29
   },
49
   },
30
   methods: {
50
   methods: {
31
     ...mapAppActions([
51
     ...mapAppActions([
32
       'getCaseList',
52
       'getCaseList',
33
     ]),
53
     ]),
34
-    ...mapLibraryAction(['getNavList']),
54
+    ...mapLibraryAction(['getBookListByType']),
35
     navClick (item) {
55
     navClick (item) {
56
+    },
57
+    appointmentBook () { // 预约图书
58
+      this.showAppointmentDialog = true
59
+    },
60
+    sureAppointmentBook () { // 确定预约图书
61
+      this.showAppointmentDialog = false
36
     }
62
     }
37
   }
63
   }
38
 }
64
 }
50
     -webkit-overflow-scrolling: touch;
76
     -webkit-overflow-scrolling: touch;
51
     transform: translateZ(0);
77
     transform: translateZ(0);
52
     -webkit-transform: translateZ(0);
78
     -webkit-transform: translateZ(0);
53
-    .nav {
54
-      width: 100%;
79
+    >ul{
80
+      padding: 0 .16rem;
81
+      margin-bottom: .1rem;
55
       position: relative;
82
       position: relative;
56
       overflow: hidden;
83
       overflow: hidden;
57
-      font-size: 0;
58
-      > a {
59
-        display: inline-block;
60
-        width: 25%;
61
-        text-align: center;
62
-        margin-top: 0.15rem;
63
-        img {
64
-          height: 0.48rem;
65
-        }
66
-        span {
67
-          width: 100%;
68
-          display: inline-block;
69
-          text-align: center;
70
-          font-size: 0.12rem;
71
-          line-height: 0.22rem;
72
-          margin: 0.08rem auto 0;
73
-        }
84
+      li{
85
+        margin: .1rem auto 0;
74
       }
86
       }
75
     }
87
     }
76
   }
88
   }

+ 60
- 0
src/pages/user/library/booksSearch/index.vue View File

1
+<template>
2
+  <div class="mainPage">
3
+    1
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+import { mapState, createNamespacedHelpers } from 'vuex'
9
+const { mapActions: mapAppActions } = createNamespacedHelpers('app')
10
+const { mapState: mapLibraryState, mapActions: mapLibraryAction, mapMutations: mapLibraryMutations } = createNamespacedHelpers('library')
11
+export default {
12
+  data () {
13
+    return {
14
+    }
15
+  },
16
+  created () {
17
+  },
18
+  computed: {
19
+    ...mapState({
20
+      CaseList: x => x.app.CaseList,
21
+    }),
22
+    ...mapLibraryState({
23
+    })
24
+  },
25
+  components: {
26
+  },
27
+  methods: {
28
+    ...mapAppActions([
29
+      'getCaseList',
30
+    ]),
31
+    ...mapLibraryAction(['']),
32
+    ...mapLibraryMutations(['setIndexSearchKey']),
33
+  }
34
+}
35
+</script>
36
+
37
+<style lang="scss" scoped>
38
+.mainPage {
39
+  > div {
40
+    width: 100%;
41
+    position: absolute;
42
+    left: 0;
43
+    top: 0;
44
+    bottom: 0;
45
+    overflow-y: scroll;
46
+    -webkit-overflow-scrolling: touch;
47
+    transform: translateZ(0);
48
+    -webkit-transform: translateZ(0);
49
+    >ul{
50
+      padding: 0 .16rem;
51
+      margin-bottom: .1rem;
52
+      position: relative;
53
+      overflow: hidden;
54
+      li{
55
+        margin: .1rem auto 0;
56
+      }
57
+    }
58
+  }
59
+}
60
+</style>

+ 3
- 6
src/pages/user/mainPage/libraryIndex/index.vue View File

4
       <div class="header flex-h">
4
       <div class="header flex-h">
5
         <div class="flex-item flex-h">
5
         <div class="flex-item flex-h">
6
           <i class="iconfont icon-sousuo"></i>
6
           <i class="iconfont icon-sousuo"></i>
7
-          <div class="flex-item">
8
-            <div>
9
-              <input type="text">
10
-            </div>
11
-          </div>
7
+          <router-link class="flex-item" :to="{name: 'booksSearch'}">{{indexSearchKey}}</router-link>
12
         </div>
8
         </div>
13
         <a @click="showDialog = true">
9
         <a @click="showDialog = true">
14
           <i class="iconfont icon-dingwei"></i>
10
           <i class="iconfont icon-dingwei"></i>
81
     }),
77
     }),
82
     ...mapLibraryState({
78
     ...mapLibraryState({
83
       navList: x => x.navList,
79
       navList: x => x.navList,
84
-      bookList: x => x.bookList
80
+      bookList: x => x.bookList,
81
+      indexSearchKey: x => x.indexSearchKey
85
     }),
82
     }),
86
   },
83
   },
87
   components: {
84
   components: {

+ 2
- 19
src/pages/user/mainPage/libraryIndex/page.scss View File

16
       >div{
16
       >div{
17
         margin: 0 .1rem 0 .2rem;
17
         margin: 0 .1rem 0 .2rem;
18
         background: #f2f2f2;
18
         background: #f2f2f2;
19
-        align-items: center;
20
         i{
19
         i{
21
           font-size: .15rem;
20
           font-size: .15rem;
22
           color: #ccc;
21
           color: #ccc;
23
           margin-left: .08rem;
22
           margin-left: .08rem;
23
+          line-height: .3rem;
24
         }
24
         }
25
-        >div{
25
+        >a{
26
           margin-left: .05rem;
26
           margin-left: .05rem;
27
-          >*{
28
-            display: inline-block;
29
-            vertical-align: middle;
30
-            line-height: .2rem;
31
-          }
32
-          >div{
33
-            width: 100%;
34
-            position: relative;
35
-            overflow: hidden;
36
-            input{
37
-              width: 100%;
38
-              font-size: .13rem;
39
-              color: #ccc;
40
-              background: none;
41
-              padding: .05rem 0;
42
-            }
43
-          }
44
         }
27
         }
45
       }
28
       }
46
       >a{
29
       >a{

+ 6
- 0
src/pages/user/router.js View File

15
 import libraryIndex from './mainPage/libraryIndex/index' // 图书馆首页
15
 import libraryIndex from './mainPage/libraryIndex/index' // 图书馆首页
16
 import userCenter from './mainPage/userCenter/index' // 个人中心
16
 import userCenter from './mainPage/userCenter/index' // 个人中心
17
 import libraryNavList from './library/navList/index' // 图书馆nav
17
 import libraryNavList from './library/navList/index' // 图书馆nav
18
+import booksSearch from './library/booksSearch/index' // 搜索图书
18
 import booksList from './library/booksList/index' // 图书列表
19
 import booksList from './library/booksList/index' // 图书列表
19
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
20
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
20
 import lessonOrder from './lessonOrder/index' // 我的订单
21
 import lessonOrder from './lessonOrder/index' // 我的订单
72
     name: 'libraryNavList',
73
     name: 'libraryNavList',
73
     component: libraryNavList,
74
     component: libraryNavList,
74
     children: []
75
     children: []
76
+  }, { // 图书搜索
77
+    path: '/booksSearch',
78
+    name: 'booksSearch',
79
+    component: booksSearch,
80
+    children: []
75
   }, { // 图书列表
81
   }, { // 图书列表
76
     path: '/booksList',
82
     path: '/booksList',
77
     name: 'booksList',
83
     name: 'booksList',

+ 105
- 3
src/store/library/index.js View File

4
 export default {
4
 export default {
5
   namespaced: true,
5
   namespaced: true,
6
   state: {
6
   state: {
7
-    navList: [{
7
+    indexSearchKey: '', // 图书首页搜索关键词
8
+    navList: [{ // 图书馆首页nav
8
       icon: '',
9
       icon: '',
9
       name: '名著',
10
       name: '名著',
10
       id: ''
11
       id: ''
37
       name: '更多',
38
       name: '更多',
38
       id: 'more'
39
       id: 'more'
39
     }],
40
     }],
40
-    bookList: [{
41
+    bookList: [{ // 图书馆首页推荐书籍
42
+      img: '',
43
+      name: '书名',
44
+      id: '',
45
+      status: '状态',
46
+      author: '作者',
47
+      publishingHouses: '出版社',
48
+      stock: '10'
49
+    }, {
50
+      img: '',
51
+      name: '书名',
52
+      id: '',
53
+      status: '状态',
54
+      author: '作者',
55
+      publishingHouses: '出版社',
56
+      stock: '10'
57
+    }, {
58
+      img: '',
59
+      name: '书名',
60
+      id: '',
61
+      status: '状态',
62
+      author: '作者',
63
+      publishingHouses: '出版社',
64
+      stock: '10'
65
+    }, {
66
+      img: '',
67
+      name: '书名',
68
+      id: '',
69
+      status: '状态',
70
+      author: '作者',
71
+      publishingHouses: '出版社',
72
+      stock: '10'
73
+    }, {
74
+      img: '',
75
+      name: '书名',
76
+      id: '',
77
+      status: '状态',
78
+      author: '作者',
79
+      publishingHouses: '出版社',
80
+      stock: '10'
81
+    }],
82
+    bookTypeList: [{ // 分类书籍列表
83
+      img: '',
84
+      name: '书名',
85
+      id: '',
86
+      status: '状态',
87
+      author: '作者',
88
+      publishingHouses: '出版社',
89
+      stock: '10'
90
+    }, {
91
+      img: '',
92
+      name: '书名',
93
+      id: '',
94
+      status: '状态',
95
+      author: '作者',
96
+      publishingHouses: '出版社',
97
+      stock: '10'
98
+    }, {
99
+      img: '',
100
+      name: '书名',
101
+      id: '',
102
+      status: '状态',
103
+      author: '作者',
104
+      publishingHouses: '出版社',
105
+      stock: '10'
106
+    }, {
107
+      img: '',
108
+      name: '书名',
109
+      id: '',
110
+      status: '状态',
111
+      author: '作者',
112
+      publishingHouses: '出版社',
113
+      stock: '10'
114
+    }, {
41
       img: '',
115
       img: '',
42
       name: '书名',
116
       name: '书名',
43
       id: '',
117
       id: '',
80
     }]
154
     }]
81
   },
155
   },
82
   mutations: {
156
   mutations: {
157
+    setIndexSearchKey (state, data) { // 赋值图书首页搜索关键词
158
+      state.indexSearchKey = data || ''
159
+    },
83
     setNavInfo (state, data) { // 赋值nav
160
     setNavInfo (state, data) { // 赋值nav
84
       (data || []).map((item) => {
161
       (data || []).map((item) => {
85
         state.navList.push({
162
         state.navList.push({
107
     },
184
     },
108
     emptyRecommendBookList (state, data) { // 清空精选推荐书籍列表
185
     emptyRecommendBookList (state, data) { // 清空精选推荐书籍列表
109
       state.bookList = []
186
       state.bookList = []
110
-    }
187
+    },
188
+    setBookTypeList (state, data) { // 赋值分类书籍列表
189
+      (data || []).map((item) => {
190
+        state.bookList.push({
191
+          img: '',
192
+          name: '书名',
193
+          id: '',
194
+          status: '状态',
195
+          author: '作者',
196
+          publishingHouses: '出版社',
197
+          stock: '10'
198
+        })
199
+      })
200
+    },
111
   },
201
   },
112
   actions: {
202
   actions: {
203
+    getBookListByType (context, data) { // 获取分类书籍列表
204
+      return new Promise((resolve, reject) => {
205
+        Ajax(api.library.getBookListByType.url, {
206
+          method: api.library.getBookListByType.method
207
+        }).then(res => {
208
+          context.commit('setBookTypeList', res)
209
+          resolve(res)
210
+        }).catch((err) => {
211
+          reject(err)
212
+        })
213
+      })
214
+    },
113
     getNavList (context, data) { // 获取nav数据
215
     getNavList (context, data) { // 获取nav数据
114
       return new Promise((resolve, reject) => {
216
       return new Promise((resolve, reject) => {
115
         Ajax(api.library.getNavList.url, {
217
         Ajax(api.library.getNavList.url, {

+ 4
- 0
src/util/api.js View File

341
     getRecommendBookList: { // 获取精选推荐书籍列表
341
     getRecommendBookList: { // 获取精选推荐书籍列表
342
       method: 'get',
342
       method: 'get',
343
       url: `${baseUrl}${wechat}/`
343
       url: `${baseUrl}${wechat}/`
344
+    },
345
+    getBookListByType: { // 获取分类书籍列表
346
+      method: 'get',
347
+      url: `${baseUrl}${wechat}/`
344
     }
348
     }
345
   }
349
   }
346
 }
350
 }