浏览代码

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/wechat into dev

许成详 6 年前
父节点
当前提交
76e5dbffaf

+ 1
- 1
src/pages/bodyCheck/app.js 查看文件

1
 import Vue from 'vue'
1
 import Vue from 'vue'
2
 import App from './App.vue'
2
 import App from './App.vue'
3
 import Vant from 'vant'
3
 import Vant from 'vant'
4
-import 'vant/lib/vant-css/index.css'
4
+import 'vant/lib/index.css'
5
 import router from './router'
5
 import router from './router'
6
 import store from '../../store/index'
6
 import store from '../../store/index'
7
 import Vuex from 'vuex'
7
 import Vuex from 'vuex'

+ 1
- 1
src/pages/sales/app.js 查看文件

1
 import Vue from 'vue'
1
 import Vue from 'vue'
2
 import App from './App.vue'
2
 import App from './App.vue'
3
 import Vant from 'vant'
3
 import Vant from 'vant'
4
-import 'vant/lib/vant-css/index.css'
4
+import 'vant/lib/index.css'
5
 import router from './router'
5
 import router from './router'
6
 import store from '../../store/index'
6
 import store from '../../store/index'
7
 import Vuex from 'vuex'
7
 import Vuex from 'vuex'

+ 1
- 1
src/pages/user/app.js 查看文件

1
 import Vue from 'vue'
1
 import Vue from 'vue'
2
 import App from './App.vue'
2
 import App from './App.vue'
3
 import Vant from 'vant'
3
 import Vant from 'vant'
4
-import 'vant/lib/vant-css/index.css'
4
+import 'vant/lib/index.css'
5
 import router from './router'
5
 import router from './router'
6
 import store from '../../store/index'
6
 import store from '../../store/index'
7
 import Vuex from 'vuex'
7
 import Vuex from 'vuex'

+ 17
- 16
src/pages/user/library/booksList/index.vue 查看文件

2
   <div class="mainPage">
2
   <div class="mainPage">
3
     <div>
3
     <div>
4
       <ul>
4
       <ul>
5
-        <li v-for="(item, index) in bookTypeList" :key="index">
5
+        <li v-for="(item, index) in (books.list || [])" :key="index">
6
           <libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
6
           <libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
7
         </li>
7
         </li>
8
       </ul>
8
       </ul>
24
 
24
 
25
 <script>
25
 <script>
26
 import libraryListItem from '../../../../components/libraryListItem/index'
26
 import libraryListItem from '../../../../components/libraryListItem/index'
27
-import { mapState, createNamespacedHelpers } from 'vuex'
28
-const { mapActions: mapAppActions } = createNamespacedHelpers('app')
29
-const { mapState: mapLibraryState, mapActions: mapLibraryAction } = createNamespacedHelpers('library')
27
+import { createNamespacedHelpers } from 'vuex'
28
+const { mapState: mapBookState, mapActions: mapBookAction } = createNamespacedHelpers('book')
30
 export default {
29
 export default {
31
   data () {
30
   data () {
32
     return {
31
     return {
33
-      showAppointmentDialog: false
32
+      showAppointmentDialog: false,
33
+      query: {
34
+        caseid: '',
35
+        bookType: '',
36
+        page: 1,
37
+        pagesize: 10,
38
+      }
34
     }
39
     }
35
   },
40
   },
36
   created () {
41
   created () {
42
+    this.query.bookType = this.$route.query.type
43
+    this.query.caseid = this.$route.query.caseid
44
+    this.getBookList(this.query)
37
   },
45
   },
38
   computed: {
46
   computed: {
39
-    ...mapState({
40
-      CaseList: x => x.app.CaseList,
41
-    }),
42
-    ...mapLibraryState({
43
-      navList: x => x.navList,
44
-      bookTypeList: x => x.bookTypeList
47
+    ...mapBookState({
48
+      books: x => x.books
45
     })
49
     })
46
   },
50
   },
47
   components: {
51
   components: {
48
     libraryListItem,
52
     libraryListItem,
49
   },
53
   },
50
   methods: {
54
   methods: {
51
-    ...mapAppActions([
52
-      'getCaseList',
55
+    ...mapBookAction([
56
+      'getBookList',
53
     ]),
57
     ]),
54
-    ...mapLibraryAction(['getBookListByType']),
55
-    navClick (item) {
56
-    },
57
     appointmentBook () { // 预约图书
58
     appointmentBook () { // 预约图书
58
       this.showAppointmentDialog = true
59
       this.showAppointmentDialog = true
59
     },
60
     },

+ 30
- 25
src/pages/user/library/booksSearch/index.vue 查看文件

11
       </div>
11
       </div>
12
       <a @click="search">搜索</a>
12
       <a @click="search">搜索</a>
13
     </div>
13
     </div>
14
-    <div class="searchRemark" v-if="showSearchRemark">
14
+    <div class="searchRemark" v-if="showSearch">
15
       <span>
15
       <span>
16
         关于“
16
         关于“
17
-        <em>{{indexSearchKey}}</em>”的搜索结果:
17
+        <em>{{doSearchKey}}</em>”的搜索结果:
18
       </span>
18
       </span>
19
     </div>
19
     </div>
20
-    <div class="flex-item">
20
+    <div class="flex-item" :hidden="!showSearch">
21
       <div>
21
       <div>
22
-        <div class="noData" v-if="noData">
22
+        <div class="noData" v-if="(books.list || []).length < 1">
23
           <img src="../../../../common/icon/kong.png" alt>
23
           <img src="../../../../common/icon/kong.png" alt>
24
           <span>暂无内容</span>
24
           <span>暂无内容</span>
25
         </div>
25
         </div>
26
-        <ul>
27
-          <li v-for="(item, index) in searchBooksList" :key="index">
26
+        <ul v-else>
27
+          <li v-for="(item, index) in books.list" :key="index">
28
             <libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
28
             <libraryListItem :data="item" @appointmentBook="appointmentBook"></libraryListItem>
29
           </li>
29
           </li>
30
         </ul>
30
         </ul>
48
 <script>
48
 <script>
49
 import libraryListItem from '../../../../components/libraryListItem/index'
49
 import libraryListItem from '../../../../components/libraryListItem/index'
50
 import { mapState, createNamespacedHelpers } from 'vuex'
50
 import { mapState, createNamespacedHelpers } from 'vuex'
51
-const { mapActions: mapAppActions } = createNamespacedHelpers('app')
52
-const { mapState: mapLibraryState, mapActions: mapLibraryAction, mapMutations: mapLibraryMutations } = createNamespacedHelpers('library')
51
+const { mapState: mapBookState, mapActions: mapBookAction } = createNamespacedHelpers('book')
53
 export default {
52
 export default {
54
   data () {
53
   data () {
55
     return {
54
     return {
56
       searchKey: '',
55
       searchKey: '',
57
-      showSearchRemark: false,
56
+      showSearch: false,
58
       noData: false,
57
       noData: false,
59
-      showAppointmentDialog: false
58
+      showAppointmentDialog: false,
59
+      caseid: '',
60
+      page: 1,
61
+      pagesize: 10,
62
+      doSearchKey: '',
60
     }
63
     }
61
   },
64
   },
62
   created () {
65
   created () {
66
+    this.caseid = this.$route.query.caseid
63
   },
67
   },
64
   computed: {
68
   computed: {
65
-    ...mapState({
66
-      CaseList: x => x.app.CaseList,
67
-    }),
68
-    ...mapLibraryState({
69
-      indexSearchKey: x => x.indexSearchKey,
70
-      searchBooksList: x => x.searchBooksList
69
+    ...mapBookState({
70
+      books: x => x.books,
71
     })
71
     })
72
   },
72
   },
73
   mounted () {
73
   mounted () {
74
-    this.$nextTick(() => {
75
-      this.searchKey = this.indexSearchKey || ''
76
-    })
77
   },
74
   },
78
   components: {
75
   components: {
79
     libraryListItem
76
     libraryListItem
80
   },
77
   },
81
   methods: {
78
   methods: {
82
-    ...mapAppActions([
83
-      'getCaseList',
79
+    ...mapBookAction([
80
+      'getBookList',
84
     ]),
81
     ]),
85
-    ...mapLibraryAction(['']),
86
-    ...mapLibraryMutations(['setIndexSearchKey']),
87
     search () { // 搜索
82
     search () { // 搜索
88
       if (this.searchKey !== '') {
83
       if (this.searchKey !== '') {
89
-        this.setIndexSearchKey(this.searchKey)
90
-        this.showSearchRemark = true
84
+        this.doSearchKey = this.searchKey
85
+        this.getSearchList()
91
       } else {
86
       } else {
92
         this.$toast('搜索关键词不能为空')
87
         this.$toast('搜索关键词不能为空')
93
       }
88
       }
98
     sureAppointmentBook () { // 确定预约图书
93
     sureAppointmentBook () { // 确定预约图书
99
       this.showAppointmentDialog = false
94
       this.showAppointmentDialog = false
100
     },
95
     },
96
+    getSearchList () {
97
+      this.getBookList({
98
+        caseid: this.caseid,
99
+        name: this.doSearchKey,
100
+        page: this.page,
101
+        pagesize: this.pagesize,
102
+      }).then(() => {
103
+        this.showSearch = true
104
+      })
105
+    },
101
   }
106
   }
102
 }
107
 }
103
 </script>
108
 </script>

+ 1
- 1
src/pages/user/library/navList/index.vue 查看文件

38
   methods: {
38
   methods: {
39
     ...mapBookAction(['getBookType']),
39
     ...mapBookAction(['getBookType']),
40
     navClick (item) {
40
     navClick (item) {
41
-      this.$router.push({ name: 'booksList', query: { type: item.BookTypeId } })
41
+      this.$router.push({ name: 'booksList', query: { type: item.BookTypeId, caseid: this.caseid } })
42
     }
42
     }
43
   }
43
   }
44
 }
44
 }

+ 3
- 3
src/pages/user/mainPage/libraryIndex/index.vue 查看文件

15
         </a>
15
         </a>
16
       </div>
16
       </div>
17
       <nav class="nav">
17
       <nav class="nav">
18
-        <a v-for="(item, index) in navList" v-if="navList.length < 9 || index<7" :key="index" @click="navClick(item)">
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>
19
           <img :src="item.BookTypeImg" alt>
20
           <span>{{item.BookTypeName}}</span>
20
           <span>{{item.BookTypeName}}</span>
21
         </a>
21
         </a>
22
-        <a v-if="navList.length >8 " @click="moreNav()">
22
+        <a v-if="(navList || []).length >8 " @click="moreNav()">
23
           <img src="https://spaceofcheng.oss-cn-beijing.aliyuncs.com/test-icon8.png" alt>
23
           <img src="https://spaceofcheng.oss-cn-beijing.aliyuncs.com/test-icon8.png" alt>
24
           <span>更多</span>
24
           <span>更多</span>
25
         </a>
25
         </a>
152
       this.showAppointmentDialog = false
152
       this.showAppointmentDialog = false
153
     },
153
     },
154
     navClick (item) { // 点击nav
154
     navClick (item) { // 点击nav
155
-      this.$router.push({ name: 'booksList', query: { type: item.BookTypeId } })
155
+      this.$router.push({ name: 'booksList', query: { type: item.BookTypeId, caseid: this.currentCaseId } })
156
     },
156
     },
157
     moreNav () {
157
     moreNav () {
158
       this.$router.push({ name: 'libraryNavList', query: {caseid: this.currentCaseId} })
158
       this.$router.push({ name: 'libraryNavList', query: {caseid: this.currentCaseId} })

+ 22
- 3
src/store/book/index.js 查看文件

4
 export default {
4
 export default {
5
   namespaced: true,
5
   namespaced: true,
6
   state: {
6
   state: {
7
-    types: [],
8
-    recommends: [],
7
+    types: {},
8
+    recommends: {},
9
+    books: {},
9
   },
10
   },
10
   mutations: {
11
   mutations: {
11
     updateTypeList (state, payload) {
12
     updateTypeList (state, payload) {
14
     updateRecommendBooks (state, payload) {
15
     updateRecommendBooks (state, payload) {
15
       state.recommends = payload
16
       state.recommends = payload
16
     },
17
     },
18
+    updateBookList (state, payload) {
19
+      state.books = payload
20
+    }
17
   },
21
   },
18
   actions: {
22
   actions: {
19
     getBookType ({ commit }, payload) {
23
     getBookType ({ commit }, payload) {
51
           reject(err)
55
           reject(err)
52
         })
56
         })
53
       })
57
       })
54
-    }
58
+    },
59
+    getBookList ({ commit }, payload) {
60
+      return new Promise((resolve, reject) => {
61
+        Ajax({
62
+          ...api.library.getBookList,
63
+          queryData: {
64
+            ...payload
65
+          },
66
+        }).then(res => {
67
+          commit('updateBookList', res)
68
+          resolve(res)
69
+        }).catch((err) => {
70
+          reject(err)
71
+        })
72
+      })
73
+    },
55
   }
74
   }
56
 }
75
 }

+ 2
- 2
src/util/api.js 查看文件

342
       method: 'get',
342
       method: 'get',
343
       url: `${baseUrl}${wechat}/book/recommend/:caseid`
343
       url: `${baseUrl}${wechat}/book/recommend/:caseid`
344
     },
344
     },
345
-    getBookListByType: { // 获取分类书籍列表
345
+    getBookList: { // 获取书籍列表
346
       method: 'get',
346
       method: 'get',
347
-      url: `${baseUrl}${wechat}/`
347
+      url: `${baseUrl}${wechat}/book`
348
     }
348
     }
349
   }
349
   }
350
 }
350
 }