yuantianjiao hace 6 años
padre
commit
4188747eda

+ 24
- 12
src/components/libraryListItem/index.vue Ver fichero

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

+ 2
- 4
src/components/vue-load-more/index.vue Ver fichero

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

+ 9
- 9
src/pages/user/App.vue Ver fichero

@@ -12,7 +12,7 @@ export default {
12 12
   name: 'app',
13 13
   data () {
14 14
     return {
15
-      showPage: true 
15
+      showPage: false 
16 16
     }
17 17
   },
18 18
   components: {},
@@ -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(() => {
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 35
   methods: {
36 36
     ...actions(['getUserInfo'])

+ 11
- 12
src/pages/user/bindMobile/bindMobile.vue Ver fichero

@@ -108,10 +108,7 @@ export default {
108 108
     console.log(1123)
109 109
   },
110 110
   methods: {
111
-    ...actions(['getCaseInfo']),
112
-    ...actions(['getCaptcha']),
113
-    ...actions(['submitData']),
114
-    ...actions(['recommendCode']),
111
+    ...actions(['getCaseInfo', 'getCaptcha', 'submitData', 'recommendCode', 'getUserInfo']),
115 112
     // onConfirmC (value, index) {
116 113
     //   this.caseName = value.CaseName
117 114
     //   this.postData.case = value.CaseId
@@ -216,10 +213,11 @@ export default {
216 213
                   window.location.href = `${window.location.origin}/game/luckdraw/${from}`
217 214
                 }, 2000)
218 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 222
             }).catch(() => {
225 223
               console.log(111)
@@ -239,10 +237,11 @@ export default {
239 237
               window.location.href = `${window.location.origin}/game/luckdraw/${from}`
240 238
             }, 2000)
241 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 246
         }).catch(() => {
248 247
           console.log(111)

+ 3
- 0
src/pages/user/library/borrowedRecord/index.vue Ver fichero

@@ -164,6 +164,9 @@ export default {
164 164
         width: 0.7rem;
165 165
         display: block;
166 166
         margin: 0 auto;
167
+        .centerLabel{
168
+          
169
+        }
167 170
       }
168 171
       span {
169 172
         width: 100%;

+ 40
- 8
src/pages/user/mainPage/libraryIndex/index.vue Ver fichero

@@ -78,6 +78,8 @@ import toolClass from '../../../../util/util'
78 78
 import { mapState, createNamespacedHelpers } from 'vuex'
79 79
 const { mapActions: mapAppActions } = createNamespacedHelpers('app')
80 80
 const { mapState: mapBookState, mapActions: mapBookActions } = createNamespacedHelpers('book')
81
+import wxsdk from '../../../../util/share'
82
+const wx = require('weixin-js-sdk')
81 83
 export default {
82 84
   name: '',
83 85
   data () {
@@ -90,7 +92,7 @@ export default {
90 92
       cases: [],
91 93
       indexSearchKey: '',
92 94
       page: 1,
93
-      pagesize: 3,
95
+      pagesize: 10,
94 96
       scrollData: {
95 97
         noFlag: false // 暂无更多数据显示
96 98
       },
@@ -125,9 +127,7 @@ export default {
125 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 132
     } else {
133 133
       (this.CaseList || []).map((item) => {
@@ -136,9 +136,7 @@ export default {
136 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 142
   methods: {
@@ -150,6 +148,38 @@ export default {
150 148
       'reserveBook',
151 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 183
     selectCaseId () { // 选择案场
154 184
       if (this.currentCaseId !== this.caseId) {
155 185
         this.currentCaseId = this.caseId
@@ -172,7 +202,9 @@ export default {
172 202
       //   page: this.page,
173 203
       //   pagesize: this.pagesize,
174 204
       // })
175
-      this.onInfinite()
205
+      this.$nextTick(() => {
206
+        this.onInfinite()
207
+      })
176 208
     },
177 209
     onInfinite () {
178 210
       this.getMineBook({

+ 3
- 3
src/pages/user/mainPage/userCenter/index.vue Ver fichero

@@ -58,9 +58,9 @@
58 58
             <img src="../../../../common/icon/pointer.png" width="100%" height="100%" alt>
59 59
           </div>
60 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 64
           </span>
65 65
         </div>
66 66
       </div>

+ 34
- 20
src/store/book/index.js Ver fichero

@@ -8,7 +8,9 @@ export default {
8 8
     recommends: {
9 9
       list: []
10 10
     },
11
-    books: {},
11
+    books: {
12
+      list: []
13
+    },
12 14
     minebooks: {},
13 15
   },
14 16
   mutations: {
@@ -16,22 +18,32 @@ export default {
16 18
       state.types = payload
17 19
     },
18 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 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 34
     updateMineBook (state, payload) {
25 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 44
           return x
32
-        }
33
-        return x
34
-      })}
45
+        })
46
+      }
35 47
       // let list = state.recommends.list
36 48
       // list = list.map(x => {
37 49
       //   if(x.BookId == bookid){
@@ -43,14 +55,16 @@ export default {
43 55
       // list.splice(list.findIndex(item => item.LeftNum < 1), 1)
44 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 65
           return x
51
-        }
52
-        return x
53
-      })}
66
+        })
67
+      }
54 68
     },
55 69
   },
56 70
   actions: {
@@ -133,12 +147,12 @@ export default {
133 147
         }).catch((err) => {
134 148
           reject(err)
135 149
         })
136
-      }) 
150
+      })
137 151
     },
138
-    updateBookLeftNum({ commit }, bookid) {
152
+    updateBookLeftNum ({ commit }, bookid) {
139 153
       commit('updateBookLeftNum', bookid)
140 154
     },
141
-    updateRecommendBookLeftNum({ commit }, bookid) {
155
+    updateRecommendBookLeftNum ({ commit }, bookid) {
142 156
       commit('updateRecommendBookLeftNum', bookid)
143 157
     },
144 158
   }

+ 4
- 2
vue.config.js Ver fichero

@@ -18,8 +18,10 @@ module.exports = {
18 18
   baseUrl: './',
19 19
   // 生产环境是否生成 sourceMap 文件
20 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 25
   devServer: {
24 26
     proxy: {
25 27
       '/api': {