wangfei 6 년 전
부모
커밋
e982e63c30

+ 1
- 0
package.json 파일 보기

@@ -9,6 +9,7 @@
9 9
   },
10 10
   "dependencies": {
11 11
     "element-ui": "^2.4.6",
12
+    "jsbarcode": "^3.11.0",
12 13
     "vue": "^2.5.17",
13 14
     "weixin-js-sdk": "^1.3.3"
14 15
   },

+ 6
- 6
src/components/libraryListItem/index.vue 파일 보기

@@ -2,20 +2,20 @@
2 2
   <div class="libraryListItem flex-h">
3 3
     <div class="img">
4 4
       <a>
5
-        <img :src="data.img" class="centerLabel cover" alt>
5
+        <img :src="data.BookImg" class="centerLabel cover" alt>
6 6
       </a>
7 7
     </div>
8 8
     <div class="flex-item">
9 9
       <div>
10
-        <span>{{data.name}}</span>
10
+        <span>{{data.BookName}}</span>
11 11
         <div class="flex-h" style="margin-top: .06rem;">
12
-          <span class="flex-item">{{data.author}} 著</span>
13
-          <span class="status" @click="appointmentBook(data.id)">{{data.status}}</span>
12
+          <span class="flex-item">{{data.Author}} 著</span>
13
+          <span class="status" @click="appointmentBook(data.BookId)">{{data.Status}}</span>
14 14
         </div>
15 15
         <div class="flex-h">
16
-          <span class="flex-item">{{data.publishingHouses}}</span>
16
+          <span class="flex-item">{{data.Publisher}}</span>
17 17
           <span>剩余可借
18
-            <em>{{data.stock}}</em>本
18
+            <em>{{data.LeftNum}}</em>本
19 19
           </span>
20 20
         </div>
21 21
       </div>

+ 1
- 1
src/pages/bodyCheck/app.js 파일 보기

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

+ 1
- 1
src/pages/sales/app.js 파일 보기

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

+ 7
- 7
src/pages/user/App.vue 파일 보기

@@ -23,14 +23,14 @@ export default {
23 23
     })
24 24
   },
25 25
   created () {
26
-    if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
-      this.code = this.toolClass.UrlSearch(location.search).code
28
-    } else {
29
-      this.code = null
30
-    }
31
-    this.getUserInfo({ org: this.org, code: this.code }).then(() => {
26
+    // if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
+    //   this.code = this.toolClass.UrlSearch(location.search).code
28
+    // } else {
29
+    //   this.code = null
30
+    // }
31
+    // this.getUserInfo({ org: this.org, code: this.code }).then(() => {
32 32
       this.showPage = true
33
-    })
33
+    //})
34 34
   },
35 35
   methods: {
36 36
     ...actions(['getUserInfo'])

+ 1
- 1
src/pages/user/app.js 파일 보기

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

+ 14
- 13
src/pages/user/library/navList/index.vue 파일 보기

@@ -3,8 +3,8 @@
3 3
     <div>
4 4
       <nav class="nav">
5 5
         <a v-for="(item, index) in navList" :key="index" @click="navClick(item)">
6
-          <img :src="item.icon" alt>
7
-          <span>{{item.name}}</span>
6
+          <img :src="item.BookTypeImg" alt>
7
+          <span>{{item.BookTypeName}}</span>
8 8
         </a>
9 9
       </nav>
10 10
     </div>
@@ -13,31 +13,32 @@
13 13
 
14 14
 <script>
15 15
 import { mapState, createNamespacedHelpers } from 'vuex'
16
-const { mapActions: mapAppActions } = createNamespacedHelpers('app')
17
-const { mapState: mapLibraryState, mapActions: mapLibraryAction } = createNamespacedHelpers('library')
16
+const { mapState: mapBookState, mapActions: mapBookAction } = createNamespacedHelpers('book')
18 17
 export default {
19 18
   data () {
20 19
     return {
20
+      caseid: '',
21 21
     }
22 22
   },
23 23
   created () {
24
+    this.caseid = this.$route.query.caseid
25
+    this.getBookType({
26
+      caseid: this.caseid,
27
+      page: 1,
28
+      pagesize: 10000,
29
+    })
24 30
   },
25 31
   computed: {
26
-    ...mapState({
27
-      CaseList: x => x.app.CaseList,
28
-    }),
29
-    ...mapLibraryState({
30
-      navList: x => x.navList
32
+    ...mapBookState({
33
+      navList: x => x.types.list
31 34
     })
32 35
   },
33 36
   components: {
34 37
   },
35 38
   methods: {
36
-    ...mapAppActions([
37
-      'getCaseList',
38
-    ]),
39
-    ...mapLibraryAction(['getNavList']),
39
+    ...mapBookAction(['getBookType']),
40 40
     navClick (item) {
41
+      this.$router.push({ name: 'booksList', query: { type: item.BookTypeId } })
41 42
     }
42 43
   }
43 44
 }

+ 39
- 22
src/pages/user/mainPage/libraryIndex/index.vue 파일 보기

@@ -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
 }

+ 56
- 0
src/store/book/index.js 파일 보기

@@ -0,0 +1,56 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    types: [],
8
+    recommends: [],
9
+  },
10
+  mutations: {
11
+    updateTypeList (state, payload) {
12
+      state.types = payload
13
+    },
14
+    updateRecommendBooks (state, payload) {
15
+      state.recommends = payload
16
+    },
17
+  },
18
+  actions: {
19
+    getBookType ({ commit }, payload) {
20
+      return new Promise((resolve, reject) => {
21
+        Ajax({
22
+          ...api.library.getNavList,
23
+          queryData: {
24
+            ...payload
25
+          },
26
+          urlData: {
27
+            caseid: payload.caseid,
28
+          }
29
+        }).then(res => {
30
+          commit('updateTypeList', res)
31
+          resolve(res)
32
+        }).catch((err) => {
33
+          reject(err)
34
+        })
35
+      })
36
+    },
37
+    getRecommendBook ({ commit }, payload) {
38
+      return new Promise((resolve, reject) => {
39
+        Ajax({
40
+          ...api.library.getRecommendBookList,
41
+          queryData: {
42
+            ...payload
43
+          },
44
+          urlData: {
45
+            caseid: payload.caseid,
46
+          }
47
+        }).then(res => {
48
+          commit('updateRecommendBooks', res)
49
+          resolve(res)
50
+        }).catch((err) => {
51
+          reject(err)
52
+        })
53
+      })
54
+    }
55
+  }
56
+}

+ 1
- 0
src/store/index.js 파일 보기

@@ -31,6 +31,7 @@ export const modules = {
31 31
   making: () => require('./making/index').default,
32 32
   customization: () => require('./customization/index').default,
33 33
   library: () => require('./library/index').default,
34
+  book: () => require('./book/index').default,
34 35
 }
35 36
 
36 37
 Object.keys(modules).forEach((modKey) => {

+ 2
- 2
src/util/api.js 파일 보기

@@ -336,11 +336,11 @@ const $api = {
336 336
   library: {
337 337
     getNavList: { // 获取图书馆nav
338 338
       method: 'get',
339
-      url: `${baseUrl}${wechat}/`
339
+      url: `${baseUrl}${wechat}/booktype/:caseid`
340 340
     },
341 341
     getRecommendBookList: { // 获取精选推荐书籍列表
342 342
       method: 'get',
343
-      url: `${baseUrl}${wechat}/`
343
+      url: `${baseUrl}${wechat}/book/recommend/:caseid`
344 344
     },
345 345
     getBookListByType: { // 获取分类书籍列表
346 346
       method: 'get',

+ 2
- 2
vue.config.js 파일 보기

@@ -23,10 +23,10 @@ module.exports = {
23 23
     proxy: {
24 24
       '/api': {
25 25
         // target: 'https://dp.huiju360.com.cn/hj_operations',
26
-        // target: 'http://192.168.0.62:8080', // wf
26
+        target: 'http://localhost:8080', // wf
27 27
         // target: 'http://192.168.0.102:8080', // hyq
28 28
         // target: 'http://192.168.0.11', // ys
29
-        target: 'http://dev.ycjcjy.com', // frp
29
+        // target: 'http://dev.ycjcjy.com', // frp
30 30
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
31 31
         // pathRewrite: {
32 32
         //   '^/api': '/api-v2/api'