yuantianjiao 6 年前
父节点
当前提交
4188747eda

+ 24
- 12
src/components/libraryListItem/index.vue 查看文件

12
         <h5 v-if="!type">{{data.BookDescription}}</h5>
12
         <h5 v-if="!type">{{data.BookDescription}}</h5>
13
         <div v-if="!type" class="flex-h" style="margin-top: .06rem;">
13
         <div v-if="!type" class="flex-h" style="margin-top: .06rem;">
14
           <span class="flex-item">{{data.Author}} 著</span>
14
           <span class="flex-item">{{data.Author}} 著</span>
15
-          <span class="status active" @click="appointmentBook(data.BookId)">{{bookStatus}}</span>
15
+          <span class="status" :class="{'active' : status != 1 && status != 0 && status != 4}" @click="appointmentBook(data.BookId)">{{bookStatus}}</span>
16
         </div>
16
         </div>
17
         <div v-if="!type" class="flex-h">
17
         <div v-if="!type" class="flex-h">
18
           <span class="flex-item">{{data.Publisher}}</span>
18
           <span class="flex-item">{{data.Publisher}}</span>
27
         <div v-if="type === 1" class="flex-h">
27
         <div v-if="type === 1" class="flex-h">
28
           <span class="flex-item">{{data.CaseName}}</span>
28
           <span class="flex-item">{{data.CaseName}}</span>
29
           <span v-if="data.BorrowStatus=='3' || data.BorrowStatus=='2'">已归还</span>
29
           <span v-if="data.BorrowStatus=='3' || data.BorrowStatus=='2'">已归还</span>
30
-          <span v-if="data.BorrowStatus == '1'">已借阅
30
+          <span v-if="data.BorrowStatus == '1'">
31
+            已借阅
31
             <em>{{borrowDay}}</em>天
32
             <em>{{borrowDay}}</em>天
32
           </span>
33
           </span>
33
-          <span v-if="data.BorrowStatus == '0'">已逾期
34
+          <span v-if="data.BorrowStatus == '0'">
35
+            已逾期
34
             <em>{{lateDay}}</em>天
36
             <em>{{lateDay}}</em>天
35
           </span>
37
           </span>
36
         </div>
38
         </div>
38
           <span class="flex-item">预约时间:{{toolClass.dateFormat(data.ReserveDate)}}</span>
40
           <span class="flex-item">预约时间:{{toolClass.dateFormat(data.ReserveDate)}}</span>
39
         </div>
41
         </div>
40
         <div v-if="type === 2" class="flex-h" style="margin-top: 0;">
42
         <div v-if="type === 2" class="flex-h" style="margin-top: 0;">
41
-          <span class="flex-item">预约资格将保留至:{{toolClass.dateFormat(data.ReserveEndDate, 'yyyy-MM-dd')}}</span>
43
+          <span
44
+            class="flex-item"
45
+          >预约资格将保留至:{{toolClass.dateFormat(data.ReserveEndDate, 'yyyy-MM-dd')}}</span>
42
         </div>
46
         </div>
43
         <div v-if="type === 2" class="flex-h" style="margin-top: 0;">
47
         <div v-if="type === 2" class="flex-h" style="margin-top: 0;">
44
           <span class="flex-item">{{data.CaseName}}</span>
48
           <span class="flex-item">{{data.CaseName}}</span>
50
 
54
 
51
 <script>
55
 <script>
52
 import toolClass from '../../util/util'
56
 import toolClass from '../../util/util'
57
+import { mapState } from 'vuex'
53
 
58
 
54
 export default {
59
 export default {
55
   name: '',
60
   name: '',
59
     }
64
     }
60
   },
65
   },
61
   computed: {
66
   computed: {
62
-    bookStatus() {
67
+    ...mapState({
68
+      user: item => item.userCenter.userInfo.customer
69
+    }),
70
+    bookStatus () {
63
       let status = '在线预约'
71
       let status = '在线预约'
64
-      switch(this.status) {
72
+      switch (this.status) {
65
         case '4':
73
         case '4':
66
           status = '已预约'
74
           status = '已预约'
67
           break
75
           break
74
       }
82
       }
75
       return status
83
       return status
76
     },
84
     },
77
-    myBookStatus() {
85
+    myBookStatus () {
78
       let status = ''
86
       let status = ''
79
-      switch(this.data.BorrowStatus) {
87
+      switch (this.data.BorrowStatus) {
80
         case '4':
88
         case '4':
81
           status = '已预约'
89
           status = '已预约'
82
           break
90
           break
95
       }
103
       }
96
       return status
104
       return status
97
     },
105
     },
98
-    lateDay() {
106
+    lateDay () {
99
       const nowdata = new Date()
107
       const nowdata = new Date()
100
       return toolClass.diffDate(new Date(this.data.EndDate), nowdata)
108
       return toolClass.diffDate(new Date(this.data.EndDate), nowdata)
101
     },
109
     },
102
-    borrowDay() {
110
+    borrowDay () {
103
       const nowdata = new Date()
111
       const nowdata = new Date()
104
       return toolClass.diffDate(new Date(this.data.BorrowDate), nowdata)
112
       return toolClass.diffDate(new Date(this.data.BorrowDate), nowdata)
105
     }
113
     }
110
   },
118
   },
111
   methods: {
119
   methods: {
112
     appointmentBook (id) {
120
     appointmentBook (id) {
113
-      if(this.status == '4' || this.status == '1' || this.status == '0'){
121
+      if (this.status == '4' || this.status == '1' || this.status == '0') {
122
+        return
123
+      }
124
+      if (!this.user.Phone) {
125
+        this.$router.push({ name: 'bindMobile' })
114
         return
126
         return
115
       }
127
       }
116
       this.$emit('appointmentBook', id)
128
       this.$emit('appointmentBook', id)
156
       line-height: 0.25rem;
168
       line-height: 0.25rem;
157
       border-radius: 0.25rem;
169
       border-radius: 0.25rem;
158
       padding: 0 0.15rem;
170
       padding: 0 0.15rem;
159
-      &.active{
171
+      &.active {
160
         background: #fc5534;
172
         background: #fc5534;
161
       }
173
       }
162
     }
174
     }

+ 2
- 4
src/components/vue-load-more/index.vue 查看文件

12
           <span class="down-tip">下拉更新</span>
12
           <span class="down-tip">下拉更新</span>
13
           <span class="up-tip">松开刷新数据</span>
13
           <span class="up-tip">松开刷新数据</span>
14
           <span class="refresh-tip">加载中……</span>
14
           <span class="refresh-tip">加载中……</span>
15
-        </slot> -->
15
+        </slot>-->
16
       </header>
16
       </header>
17
       <slot></slot>
17
       <slot></slot>
18
       <footer class="load-more" v-show="!dataList.noFlag">
18
       <footer class="load-more" v-show="!dataList.noFlag">
67
       downFlag: false // 用来显示是否加载中
67
       downFlag: false // 用来显示是否加载中
68
     }
68
     }
69
   },
69
   },
70
-  created () {
71
-    console.log(this.dataList)
72
-  },
70
+  created () { },
73
   methods: {
71
   methods: {
74
     touchStart (e) {
72
     touchStart (e) {
75
       this.startY = e.targetTouches[0].pageY
73
       this.startY = e.targetTouches[0].pageY

+ 9
- 9
src/pages/user/App.vue 查看文件

12
   name: 'app',
12
   name: 'app',
13
   data () {
13
   data () {
14
     return {
14
     return {
15
-      showPage: true 
15
+      showPage: false 
16
     }
16
     }
17
   },
17
   },
18
   components: {},
18
   components: {},
23
     })
23
     })
24
   },
24
   },
25
   created () {
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(() => {
32
-    //   this.showPage = true
33
-    // })
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
+      this.showPage = true
33
+    })
34
   },
34
   },
35
   methods: {
35
   methods: {
36
     ...actions(['getUserInfo'])
36
     ...actions(['getUserInfo'])

+ 11
- 12
src/pages/user/bindMobile/bindMobile.vue 查看文件

108
     console.log(1123)
108
     console.log(1123)
109
   },
109
   },
110
   methods: {
110
   methods: {
111
-    ...actions(['getCaseInfo']),
112
-    ...actions(['getCaptcha']),
113
-    ...actions(['submitData']),
114
-    ...actions(['recommendCode']),
111
+    ...actions(['getCaseInfo', 'getCaptcha', 'submitData', 'recommendCode', 'getUserInfo']),
115
     // onConfirmC (value, index) {
112
     // onConfirmC (value, index) {
116
     //   this.caseName = value.CaseName
113
     //   this.caseName = value.CaseName
117
     //   this.postData.case = value.CaseId
114
     //   this.postData.case = value.CaseId
216
                   window.location.href = `${window.location.origin}/game/luckdraw/${from}`
213
                   window.location.href = `${window.location.origin}/game/luckdraw/${from}`
217
                 }, 2000)
214
                 }, 2000)
218
               } else {
215
               } else {
219
-                setTimeout(() => {
220
-                  // this.$router.push({name: 'userCenter'})
221
-                  window.history.go(-1)
222
-                }, 2000)
216
+                this.getUserInfo().then(() => {
217
+                  setTimeout(() => {
218
+                    window.history.go(-1)
219
+                  }, 2000)
220
+                })
223
               }
221
               }
224
             }).catch(() => {
222
             }).catch(() => {
225
               console.log(111)
223
               console.log(111)
239
               window.location.href = `${window.location.origin}/game/luckdraw/${from}`
237
               window.location.href = `${window.location.origin}/game/luckdraw/${from}`
240
             }, 2000)
238
             }, 2000)
241
           } else {
239
           } else {
242
-            setTimeout(() => {
243
-              // this.$router.push({name: 'userCenter'})
244
-              window.history.go(-1)
245
-            }, 2000)
240
+            this.getUserInfo().then(() => {
241
+              setTimeout(() => {
242
+                window.history.go(-1)
243
+              }, 2000)
244
+            })
246
           }
245
           }
247
         }).catch(() => {
246
         }).catch(() => {
248
           console.log(111)
247
           console.log(111)

+ 3
- 0
src/pages/user/library/borrowedRecord/index.vue 查看文件

164
         width: 0.7rem;
164
         width: 0.7rem;
165
         display: block;
165
         display: block;
166
         margin: 0 auto;
166
         margin: 0 auto;
167
+        .centerLabel{
168
+          
169
+        }
167
       }
170
       }
168
       span {
171
       span {
169
         width: 100%;
172
         width: 100%;

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

78
 import { mapState, createNamespacedHelpers } from 'vuex'
78
 import { mapState, createNamespacedHelpers } from 'vuex'
79
 const { mapActions: mapAppActions } = createNamespacedHelpers('app')
79
 const { mapActions: mapAppActions } = createNamespacedHelpers('app')
80
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
80
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
81
+import wxsdk from '../../../../util/share'
82
+const wx = require('weixin-js-sdk')
81
 export default {
83
 export default {
82
   name: '',
84
   name: '',
83
   data () {
85
   data () {
90
       cases: [],
92
       cases: [],
91
       indexSearchKey: '',
93
       indexSearchKey: '',
92
       page: 1,
94
       page: 1,
93
-      pagesize: 3,
95
+      pagesize: 10,
94
       scrollData: {
96
       scrollData: {
95
         noFlag: false // 暂无更多数据显示
97
         noFlag: false // 暂无更多数据显示
96
       },
98
       },
125
             id: item.CaseId
127
             id: item.CaseId
126
           })
128
           })
127
         })
129
         })
128
-        this.currentCaseId = ((res.cases || [])[0] || {}).CaseId
129
-        this.currentCaseName = ((res.cases || [])[0] || {}).CaseName
130
-        this.init()
130
+        this.Location()
131
       })
131
       })
132
     } else {
132
     } else {
133
       (this.CaseList || []).map((item) => {
133
       (this.CaseList || []).map((item) => {
136
           id: item.CaseId
136
           id: item.CaseId
137
         })
137
         })
138
       })
138
       })
139
-      this.currentCaseId = ((this.CaseList || [])[0] || {}).CaseId
140
-      this.currentCaseName = ((this.CaseList || [])[0] || {}).CaseName
141
-      this.init()
139
+      this.Location()
142
     }
140
     }
143
   },
141
   },
144
   methods: {
142
   methods: {
150
       'reserveBook',
148
       'reserveBook',
151
       'updateRecommendBookLeftNum',
149
       'updateRecommendBookLeftNum',
152
     ]),
150
     ]),
151
+    Location () {
152
+      let that = this
153
+      wxsdk({ url: encodeURIComponent(window.location.href.split('#')[0]) }, {
154
+        title: '城的空间',
155
+        desc: '城的空间',
156
+        link: `${window.location.origin}${window.location.pathname}#/mainPage/indexPage`,
157
+        thu_image: `https://spaceofcheng.oss-cn-beijing.aliyuncs.com/indexlogo.jpg?x-oss-process=style/wxicon`
158
+      }).then(() => {
159
+        wx.getLocation({
160
+          type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
161
+          success: function (res) {
162
+            let latitude1 = res.latitude // 纬度,浮点数,范围为90 ~ -90
163
+            let longitude1 = res.longitude // 经度,浮点数,范围为180 ~ -180。
164
+            for (let i = 0; i < that.CaseList.length; i++) {
165
+              let result = that.CaseList[i].Coordinate.split(",")
166
+              let latitude2 = parseFloat(result[0])
167
+              let longitude2 = parseFloat(result[1])
168
+              if (that.toolClass.getGreatCircleDistance(latitude1, longitude1, latitude2, longitude2) < 500) {
169
+
170
+                that.currentCaseId = that.CaseList[i].CaseId
171
+                that.currentCaseName = that.CaseList[i].CaseName
172
+              }
173
+            }
174
+            if (!that.currentCaseId || !that.currentCaseName) {
175
+              that.currentCaseId = ((that.CaseList || [])[0] || {}).CaseId
176
+              that.currentCaseName = ((that.CaseList || [])[0] || {}).CaseName
177
+            }
178
+            that.init()
179
+          }
180
+        })
181
+      })
182
+    },
153
     selectCaseId () { // 选择案场
183
     selectCaseId () { // 选择案场
154
       if (this.currentCaseId !== this.caseId) {
184
       if (this.currentCaseId !== this.caseId) {
155
         this.currentCaseId = this.caseId
185
         this.currentCaseId = this.caseId
172
       //   page: this.page,
202
       //   page: this.page,
173
       //   pagesize: this.pagesize,
203
       //   pagesize: this.pagesize,
174
       // })
204
       // })
175
-      this.onInfinite()
205
+      this.$nextTick(() => {
206
+        this.onInfinite()
207
+      })
176
     },
208
     },
177
     onInfinite () {
209
     onInfinite () {
178
       this.getMineBook({
210
       this.getMineBook({

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

58
             <img src="../../../../common/icon/pointer.png" width="100%" height="100%" alt>
58
             <img src="../../../../common/icon/pointer.png" width="100%" height="100%" alt>
59
           </div>
59
           </div>
60
           <span>积分</span>
60
           <span>积分</span>
61
-          <span>
62
-            ¥{{Nums.vipbalance}}
63
-            <i class="iconfont icon-jiantou-right" style="font-size: 0.1rem;"></i>
61
+          <span>0
62
+            <!-- ¥{{Nums.vipbalance}} -->
63
+            <!-- <i class="iconfont icon-jiantou-right" style="font-size: 0.1rem;"></i> -->
64
           </span>
64
           </span>
65
         </div>
65
         </div>
66
       </div>
66
       </div>

+ 34
- 20
src/store/book/index.js 查看文件

8
     recommends: {
8
     recommends: {
9
       list: []
9
       list: []
10
     },
10
     },
11
-    books: {},
11
+    books: {
12
+      list: []
13
+    },
12
     minebooks: {},
14
     minebooks: {},
13
   },
15
   },
14
   mutations: {
16
   mutations: {
16
       state.types = payload
18
       state.types = payload
17
     },
19
     },
18
     updateRecommendBooks (state, payload) {
20
     updateRecommendBooks (state, payload) {
19
-      payload.list ? state.recommends.list = state.recommends.list.concat(payload.list) : null
21
+      if (payload.page === 1) {
22
+        state.recommends.list = payload.list
23
+      } else {
24
+        payload.list ? state.recommends.list = state.recommends.list.concat(payload.list) : null
25
+      }
20
     },
26
     },
21
     updateBookList (state, payload) {
27
     updateBookList (state, payload) {
22
-      state.books = payload
28
+      if (payload.page === 1) {
29
+        state.books.list = payload.list
30
+      } else {
31
+        payload.list ? state.books.list = state.books.list.concat(payload.list) : null
32
+      }
23
     },
33
     },
24
     updateMineBook (state, payload) {
34
     updateMineBook (state, payload) {
25
       state.minebooks = payload
35
       state.minebooks = payload
26
     },
36
     },
27
-    updateRecommendBookLeftNum(state, bookid) {
28
-      state.recommends = {...state.recommends, list: state.recommends.list.map(x => {
29
-        if(x.BookId == bookid){
30
-          x.LeftNum = x.LeftNum - 1
37
+    updateRecommendBookLeftNum (state, bookid) {
38
+      state.recommends = {
39
+        ...state.recommends, list: state.recommends.list.map(x => {
40
+          if (x.BookId == bookid) {
41
+            x.LeftNum = x.LeftNum - 1
42
+            return x
43
+          }
31
           return x
44
           return x
32
-        }
33
-        return x
34
-      })}
45
+        })
46
+      }
35
       // let list = state.recommends.list
47
       // let list = state.recommends.list
36
       // list = list.map(x => {
48
       // list = list.map(x => {
37
       //   if(x.BookId == bookid){
49
       //   if(x.BookId == bookid){
43
       // list.splice(list.findIndex(item => item.LeftNum < 1), 1)
55
       // list.splice(list.findIndex(item => item.LeftNum < 1), 1)
44
       // state.recommends = {...state.recommends, list}
56
       // state.recommends = {...state.recommends, list}
45
     },
57
     },
46
-    updateBookLeftNum(state, bookid) {
47
-      state.books = {...state.books, list: state.books.list.map(x => {
48
-        if(x.BookId == bookid){
49
-          x.LeftNum = x.LeftNum - 1
58
+    updateBookLeftNum (state, bookid) {
59
+      state.books = {
60
+        ...state.books, list: state.books.list.map(x => {
61
+          if (x.BookId == bookid) {
62
+            x.LeftNum = x.LeftNum - 1
63
+            return x
64
+          }
50
           return x
65
           return x
51
-        }
52
-        return x
53
-      })}
66
+        })
67
+      }
54
     },
68
     },
55
   },
69
   },
56
   actions: {
70
   actions: {
133
         }).catch((err) => {
147
         }).catch((err) => {
134
           reject(err)
148
           reject(err)
135
         })
149
         })
136
-      }) 
150
+      })
137
     },
151
     },
138
-    updateBookLeftNum({ commit }, bookid) {
152
+    updateBookLeftNum ({ commit }, bookid) {
139
       commit('updateBookLeftNum', bookid)
153
       commit('updateBookLeftNum', bookid)
140
     },
154
     },
141
-    updateRecommendBookLeftNum({ commit }, bookid) {
155
+    updateRecommendBookLeftNum ({ commit }, bookid) {
142
       commit('updateRecommendBookLeftNum', bookid)
156
       commit('updateRecommendBookLeftNum', bookid)
143
     },
157
     },
144
   }
158
   }

+ 4
- 2
vue.config.js 查看文件

18
   baseUrl: './',
18
   baseUrl: './',
19
   // 生产环境是否生成 sourceMap 文件
19
   // 生产环境是否生成 sourceMap 文件
20
   productionSourceMap: true,
20
   productionSourceMap: true,
21
-  // devtool: 'source-map',
22
-  chainWebpack: config => config.plugins.delete('named-chunks'),
21
+  chainWebpack: config => { // webpack配置,值位对象时会合并配置,为方法时会改写配置
22
+    config.devtool = 'source-map'
23
+    config.plugins.delete('named-chunks')
24
+  },
23
   devServer: {
25
   devServer: {
24
     proxy: {
26
     proxy: {
25
       '/api': {
27
       '/api': {