yuantianjiao vor 6 Jahren
Ursprung
Commit
cb91a62353

+ 1
- 0
package.json Datei anzeigen

@@ -9,6 +9,7 @@
9 9
     "build": "node build/build.js"
10 10
   },
11 11
   "dependencies": {
12
+    "better-scroll": "^1.12.6",
12 13
     "node-sass": "^4.9.3",
13 14
     "sass-loader": "^7.1.0",
14 15
     "swiper": "^4.3.5",

+ 1
- 0
src/common/css/reset.css Datei anzeigen

@@ -60,6 +60,7 @@ select option {
60 60
 	width: 100%;
61 61
 	height: 100%;
62 62
 	position: relative;
63
+	background: #fff;
63 64
 }
64 65
 
65 66
 .van-toast div{

BIN
src/common/icon/bottomMsg.png Datei anzeigen


+ 139
- 0
src/components/bubble/bubble.vue Datei anzeigen

@@ -0,0 +1,139 @@
1
+<template>
2
+  <canvas ref="bubble" :width="width" :height="height" :style="style"></canvas>
3
+</template>
4
+
5
+<script type="text/ecmascript-6">
6
+export default {
7
+  props: {
8
+    y: {
9
+      type: Number,
10
+      default: 0
11
+    }
12
+  },
13
+  data () {
14
+    return {
15
+      width: 50,
16
+      height: 80
17
+    }
18
+  },
19
+  computed: {
20
+    distance () {
21
+      return Math.max(0, Math.min(this.y * this.ratio, this.maxDistance))
22
+    },
23
+    style () {
24
+      return `width:${this.width / this.ratio}px;height:${this.height / this.ratio}px`
25
+    }
26
+  },
27
+  created () {
28
+    this.ratio = window.devicePixelRatio
29
+    this.width *= this.ratio
30
+    this.height *= this.ratio
31
+    this.initRadius = 18 * this.ratio
32
+    this.minHeadRadius = 12 * this.ratio
33
+    this.minTailRadius = 5 * this.ratio
34
+    this.initArrowRadius = 10 * this.ratio
35
+    this.minArrowRadius = 6 * this.ratio
36
+    this.arrowWidth = 3 * this.ratio
37
+    this.maxDistance = 40 * this.ratio
38
+    this.initCenterX = 25 * this.ratio
39
+    this.initCenterY = 25 * this.ratio
40
+    this.headCenter = {
41
+      x: this.initCenterX,
42
+      y: this.initCenterY
43
+    }
44
+  },
45
+  mounted () {
46
+    this._draw()
47
+  },
48
+  methods: {
49
+    _draw () {
50
+      const bubble = this.$refs.bubble
51
+      let ctx = bubble.getContext('2d')
52
+      ctx.clearRect(0, 0, bubble.width, bubble.height)
53
+
54
+      this._drawBubble(ctx)
55
+
56
+      this._drawArrow(ctx)
57
+    },
58
+    _drawBubble (ctx) {
59
+      ctx.save()
60
+      ctx.beginPath()
61
+
62
+      const rate = this.distance / this.maxDistance
63
+      const headRadius = this.initRadius - (this.initRadius - this.minHeadRadius) * rate
64
+
65
+      this.headCenter.y = this.initCenterY - (this.initRadius - this.minHeadRadius) * rate
66
+
67
+      // 画上半弧线
68
+      ctx.arc(this.headCenter.x, this.headCenter.y, headRadius, 0, Math.PI, true)
69
+
70
+      // 画左侧贝塞尔
71
+      const tailRadius = this.initRadius - (this.initRadius - this.minTailRadius) * rate
72
+      const tailCenter = {
73
+        x: this.headCenter.x,
74
+        y: this.headCenter.y + this.distance
75
+      }
76
+
77
+      const tailPointL = {
78
+        x: tailCenter.x - tailRadius,
79
+        y: tailCenter.y
80
+      }
81
+      const controlPointL = {
82
+        x: tailPointL.x,
83
+        y: tailPointL.y - this.distance / 2
84
+      }
85
+
86
+      ctx.quadraticCurveTo(controlPointL.x, controlPointL.y, tailPointL.x, tailPointL.y)
87
+
88
+      // 画下半弧线
89
+      ctx.arc(tailCenter.x, tailCenter.y, tailRadius, Math.PI, 0, true)
90
+
91
+      // 画右侧贝塞尔
92
+      const headPointR = {
93
+        x: this.headCenter.x + headRadius,
94
+        y: this.headCenter.y
95
+      }
96
+      const controlPointR = {
97
+        x: tailCenter.x + tailRadius,
98
+        y: headPointR.y + this.distance / 2
99
+      }
100
+      ctx.quadraticCurveTo(controlPointR.x, controlPointR.y, headPointR.x, headPointR.y)
101
+
102
+      ctx.fillStyle = 'rgb(170,170,170)'
103
+      ctx.fill()
104
+      ctx.strokeStyle = 'rgb(153,153,153)'
105
+      ctx.stroke()
106
+      ctx.restore()
107
+    },
108
+    _drawArrow (ctx) {
109
+      ctx.save()
110
+      ctx.beginPath()
111
+
112
+      const rate = this.distance / this.maxDistance
113
+      const arrowRadius = this.initArrowRadius - (this.initArrowRadius - this.minArrowRadius) * rate
114
+
115
+      // 画内圆
116
+      ctx.arc(this.headCenter.x, this.headCenter.y, arrowRadius - (this.arrowWidth - rate), -Math.PI / 2, 0, true)
117
+
118
+      // 画外圆
119
+      ctx.arc(this.headCenter.x, this.headCenter.y, arrowRadius, 0, Math.PI * 3 / 2, false)
120
+
121
+      ctx.lineTo(this.headCenter.x, this.headCenter.y - arrowRadius - this.arrowWidth / 2 + rate)
122
+      ctx.lineTo(this.headCenter.x + this.arrowWidth * 2 - rate * 2, this.headCenter.y - arrowRadius + this.arrowWidth / 2)
123
+
124
+      ctx.lineTo(this.headCenter.x, this.headCenter.y - arrowRadius + this.arrowWidth * 3 / 2 - rate)
125
+
126
+      ctx.fillStyle = 'rgb(255,255,255)'
127
+      ctx.fill()
128
+      ctx.strokeStyle = 'rgb(170,170,170)'
129
+      ctx.stroke()
130
+      ctx.restore()
131
+    }
132
+  },
133
+  watch: {
134
+    y () {
135
+      this._draw()
136
+    }
137
+  }
138
+}
139
+</script>

BIN
src/components/loading/loading.gif Datei anzeigen


+ 20
- 0
src/components/loading/loading.vue Datei anzeigen

@@ -0,0 +1,20 @@
1
+<template>
2
+  <div class="mf-loading-container">
3
+    <img src="./loading.gif">
4
+  </div>
5
+</template>
6
+<script type="text/ecmascript-6">
7
+const COMPONENT_NAME = 'loading'
8
+export default {
9
+  name: COMPONENT_NAME
10
+}
11
+</script>
12
+<style lang="scss" scoped>
13
+.mf-loading-container {
14
+  img {
15
+    width: 20px;
16
+    height: 20px;
17
+    display: block;
18
+  }
19
+}
20
+</style>

+ 27
- 0
src/components/noMore/noMore.vue Datei anzeigen

@@ -0,0 +1,27 @@
1
+<template>
2
+  <div class="nomore">
3
+    <img :src="bottomImg" alt="">
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+import bottomImg from '../../common/icon/bottomMsg.png'
9
+export default {
10
+  data () {
11
+    return {
12
+      bottomImg
13
+    }
14
+  }
15
+}
16
+</script>
17
+
18
+<style lang="scss" scoped>
19
+.nomore{
20
+  img{
21
+    width: 100%;
22
+    position: absolute;
23
+    top: 40%;
24
+    transform: translateX(-50%);
25
+  }
26
+}
27
+</style>

+ 324
- 0
src/components/scroll/scroll.vue Datei anzeigen

@@ -0,0 +1,324 @@
1
+<template>
2
+  <div ref="wrapper" class="list-wrapper">
3
+    <div class="scroll-content">
4
+      <div ref="listWrapper">
5
+        <slot></slot>
6
+      </div>
7
+      <slot name="pullup" v-if="isloading" :pullUpLoad="pullUpLoad" :isPullUpLoad="isPullUpLoad">
8
+        <div class="pullup-wrapper" v-if="pullUpLoad">
9
+          <div class="before-trigger" v-if="!isPullUpLoad">
10
+            <span>{{pullUpTxt}}</span>
11
+          </div>
12
+          <div class="after-trigger" v-else>
13
+            <loading></loading>
14
+          </div>
15
+        </div>
16
+      </slot>
17
+    </div>
18
+    <slot name="pulldown" :pullDownRefresh="pullDownRefresh" :pullDownStyle="pullDownStyle" :beforePullDown="beforePullDown" :isPullingDown="isPullingDown" :bubbleY="bubbleY" >
19
+      <div ref="pulldown" class="pulldown-wrapper" :style="pullDownStyle" v-if="pullDownRefresh">
20
+        <div class="before-trigger" v-if="beforePullDown">
21
+          <bubble :y="bubbleY"></bubble>
22
+        </div>
23
+        <div class="after-trigger" v-else>
24
+          <div v-if="isPullingDown" class="loading">
25
+            <loading></loading>
26
+          </div>
27
+          <div v-else>
28
+            <span>{{refreshTxt}}</span>
29
+          </div>
30
+        </div>
31
+      </div>
32
+    </slot>
33
+  </div>
34
+</template>
35
+<script type="text/ecmascript-6">
36
+import BScroll from 'better-scroll'
37
+import Loading from '../loading/loading.vue'
38
+import Bubble from '../bubble/bubble.vue'
39
+import Dom from '../../util/dom'
40
+const COMPONENT_NAME = 'scroll'
41
+const DIRECTION_H = 'horizontal'
42
+const DIRECTION_V = 'vertical'
43
+
44
+export default {
45
+  name: COMPONENT_NAME,
46
+  props: {
47
+    data: {
48
+      type: Array,
49
+      default: function () {
50
+        return []
51
+      }
52
+    },
53
+    probeType: {
54
+      type: Number,
55
+      default: 1
56
+    },
57
+    click: {
58
+      type: Boolean,
59
+      default: true
60
+    },
61
+    listenScroll: {
62
+      type: Boolean,
63
+      default: false
64
+    },
65
+    listenBeforeScroll: {
66
+      type: Boolean,
67
+      default: false
68
+    },
69
+    direction: {
70
+      type: String,
71
+      default: DIRECTION_V
72
+    },
73
+    scrollbar: {
74
+      type: null,
75
+      default: false
76
+    },
77
+    pullDownRefresh: {
78
+      type: null,
79
+      default: false
80
+    },
81
+    pullUpLoad: {
82
+      type: null,
83
+      default: false
84
+    },
85
+    startY: {
86
+      type: Number,
87
+      default: 0
88
+    },
89
+    refreshDelay: {
90
+      type: Number,
91
+      default: 20
92
+    },
93
+    freeScroll: {
94
+      type: Boolean,
95
+      default: false
96
+    },
97
+    mouseWheel: {
98
+      type: Boolean,
99
+      default: false
100
+    },
101
+    bounce: {
102
+      default: false
103
+    },
104
+    isloading: {
105
+      type: Boolean,
106
+      default: false
107
+    }
108
+  },
109
+  data () {
110
+    return {
111
+      beforePullDown: true,
112
+      isRebounding: false,
113
+      isPullingDown: false,
114
+      isPullUpLoad: false,
115
+      pullUpDirty: true,
116
+      pullDownStyle: '',
117
+      bubbleY: 0
118
+    }
119
+  },
120
+  computed: {
121
+    pullUpTxt () {
122
+      const moreTxt = '--- 上拉更多 ---'
123
+
124
+      const noMoreTxt = '--- 我也是有底线的 ---'
125
+
126
+      return this.pullUpDirty ? moreTxt : noMoreTxt
127
+    },
128
+    refreshTxt () {
129
+      return this.pullDownRefresh && (this.pullDownRefresh.txt || '已刷新')
130
+    }
131
+  },
132
+  created () {
133
+    this.pullDownInitTop = -50
134
+  },
135
+  mounted () {
136
+    this.$nextTick(() => {
137
+      this.initScroll()
138
+    })
139
+  },
140
+  methods: {
141
+    initScroll () {
142
+      if (!this.$refs.wrapper) {
143
+        return
144
+      }
145
+      if (this.$refs.listWrapper && (this.pullDownRefresh || this.pullUpLoad)) {
146
+        this.$refs.listWrapper.style.minHeight = `${Dom.getRect(this.$refs.wrapper).height + 1}px`
147
+      }
148
+
149
+      let options = {
150
+        probeType: this.probeType,
151
+        click: this.click,
152
+        scrollY: this.freeScroll || this.direction === DIRECTION_V,
153
+        scrollX: this.freeScroll || this.direction === DIRECTION_H,
154
+        scrollbar: this.scrollbar,
155
+        pullDownRefresh: this.pullDownRefresh,
156
+        pullUpLoad: this.pullUpLoad,
157
+        startY: this.startY,
158
+        freeScroll: this.freeScroll,
159
+        mouseWheel: this.mouseWheel,
160
+        bounce: this.bounce
161
+      }
162
+
163
+      this.scroll = new BScroll(this.$refs.wrapper, options)
164
+
165
+      if (this.listenScroll) {
166
+        this.scroll.on('scroll', (pos) => {
167
+          this.$emit('scroll', pos)
168
+        })
169
+      }
170
+
171
+      if (this.listenBeforeScroll) {
172
+        this.scroll.on('beforeScrollStart', () => {
173
+          this.$emit('beforeScrollStart')
174
+        })
175
+      }
176
+
177
+      if (this.pullDownRefresh) {
178
+        this._initPullDownRefresh()
179
+      }
180
+
181
+      if (this.pullUpLoad) {
182
+        this._initPullUpLoad()
183
+      }
184
+    },
185
+    disable () {
186
+      this.scroll && this.scroll.disable()
187
+    },
188
+    enable () {
189
+      this.scroll && this.scroll.enable()
190
+    },
191
+    refresh () {
192
+      this.scroll && this.scroll.refresh()
193
+    },
194
+    scrollTo () {
195
+      this.scroll && this.scroll.scrollTo.apply(this.scroll, arguments)
196
+    },
197
+    scrollToElement () {
198
+      this.scroll && this.scroll.scrollToElement.apply(this.scroll, arguments)
199
+    },
200
+    clickItem (e, item) {
201
+      this.$emit('click', item)
202
+    },
203
+    destroy () {
204
+      this.scroll.destroy()
205
+    },
206
+    forceUpdate (dirty) {
207
+      if (this.pullDownRefresh && this.isPullingDown) {
208
+        this.isPullingDown = false
209
+        this._reboundPullDown().then(() => {
210
+          this._afterPullDown()
211
+        })
212
+      } else if (this.pullUpLoad && this.isPullUpLoad) {
213
+        this.isPullUpLoad = false
214
+        this.scroll.finishPullUp()
215
+        this.pullUpDirty = dirty
216
+        this.refresh()
217
+      } else {
218
+        this.refresh()
219
+      }
220
+    },
221
+    _initPullDownRefresh () {
222
+      this.scroll.on('pullingDown', () => {
223
+        this.beforePullDown = false
224
+        this.isPullingDown = true
225
+        this.$emit('pullingDown')
226
+      })
227
+
228
+      this.scroll.on('scroll', (pos) => {
229
+        if (!this.pullDownRefresh) {
230
+          return
231
+        }
232
+        if (this.beforePullDown) {
233
+          this.bubbleY = Math.max(0, pos.y + this.pullDownInitTop)
234
+          this.pullDownStyle = `top:${Math.min(pos.y + this.pullDownInitTop, 10)}px`
235
+        } else {
236
+          this.bubbleY = 0
237
+        }
238
+
239
+        if (this.isRebounding) {
240
+          this.pullDownStyle = `top:${10 - (this.pullDownRefresh.stop - pos.y)}px`
241
+        }
242
+      })
243
+    },
244
+    _initPullUpLoad () {
245
+      this.scroll.on('pullingUp', () => {
246
+        this.isPullUpLoad = true
247
+        this.$emit('pullingUp')
248
+      })
249
+    },
250
+    _reboundPullDown () {
251
+      const { stopTime = 600 } = this.pullDownRefresh
252
+      return new Promise((resolve) => {
253
+        setTimeout(() => {
254
+          this.isRebounding = true
255
+          this.scroll.finishPullDown()
256
+          resolve()
257
+        }, stopTime)
258
+      })
259
+    },
260
+    _afterPullDown () {
261
+      setTimeout(() => {
262
+        this.pullDownStyle = `top:${this.pullDownInitTop}px`
263
+        this.beforePullDown = true
264
+        this.isRebounding = false
265
+        this.refresh()
266
+      }, this.scroll.options.bounceTime)
267
+    }
268
+  },
269
+  watch: {
270
+    data () {
271
+      setTimeout(() => {
272
+        this.forceUpdate(true)
273
+      }, this.refreshDelay)
274
+    }
275
+  },
276
+  components: {
277
+    Loading,
278
+    Bubble
279
+  }
280
+}
281
+
282
+</script>
283
+
284
+<style lang="scss" scoped>
285
+.list-wrapper {
286
+  position: relative;
287
+  height: 100%;
288
+  overflow: hidden;
289
+  background: #fff;
290
+}
291
+
292
+.scroll-content {
293
+  position: relative;
294
+  z-index: 1;
295
+}
296
+
297
+.list-content {
298
+  position: relative;
299
+  z-index: 10;
300
+  background: #fff;
301
+}
302
+
303
+.pulldown-wrapper {
304
+  position: absolute;
305
+  width: 100%;
306
+  left: 0;
307
+  display: flex;
308
+  justify-content: center;
309
+  align-items: center;
310
+  transition: all;
311
+}
312
+
313
+.after-trigger {
314
+  margin-top: 10px;
315
+}
316
+
317
+.pullup-wrapper {
318
+  width: 100%;
319
+  display: flex;
320
+  justify-content: center;
321
+  align-items: center;
322
+  padding-bottom: 10px;
323
+}
324
+</style>

+ 133
- 0
src/module/user/lessonOrder/index.vue Datei anzeigen

@@ -0,0 +1,133 @@
1
+<template>
2
+  <div class="mainPage">
3
+    <scroll ref='scroll' :isloading='isloading' class='wrapper' :data='list' :pullUpLoad='pullUpLoadObj' :startY='parseInt(startY)' @pullingUp='getList'>
4
+      <div class="box">
5
+          <div class="order-card flex-h" v-for="(item,index) in list" :key='index' :class="{'gray' : item.useType == '已失效'}">
6
+            <div class="card-pic">
7
+              <div :class="{'gray-location' : item.useType == '已失效'}"><span>{{item.LocationName}}</span></div>
8
+              <img src="" class="cover" width="100%" height="100%" alt="">
9
+            </div>
10
+            <div class="card-msg">
11
+              <div class="title">{{item.title}}</div>
12
+              <div class="text">付款方式:{{item.payType}}</div>
13
+              <div class="text">下单时间:{{item.time}}</div>
14
+            </div>
15
+            <div class="card-price">
16
+              <div class="price">¥ {{item.price}}</div>
17
+              <div class="type" :class="{'un-use' : item.useType == '未使用'}">{{item.useType}}</div>
18
+            </div>
19
+          </div>
20
+          <!-- <noMore v-if="hasPic"></noMore> -->
21
+      </div>
22
+    </scroll>
23
+  </div>
24
+</template>
25
+
26
+<script>
27
+// 上拉加载组件
28
+import scroll from '../../../components/scroll/scroll'
29
+import noMore from '../../../components/noMore/noMore'
30
+export default {
31
+  data () {
32
+    return {
33
+      hasPic: false,
34
+      pullUpLoad: true,
35
+      pullUpLoadThreshold: 40,
36
+      startY: 0,
37
+      isloading: true,
38
+      hasMore: true,
39
+      list: [
40
+        {
41
+          LocationName: '社交',
42
+          title: '小小外交官课程',
43
+          payType: '优惠券抵用',
44
+          time: '2018-7-18 12:19',
45
+          price: 199,
46
+          useType: '未使用'
47
+        },
48
+        {
49
+          LocationName: '社交',
50
+          title: '小小外交官课程',
51
+          payType: '优惠券抵用',
52
+          time: '2018-7-18 12:19',
53
+          price: 199,
54
+          useType: '已使用'
55
+        },
56
+        {
57
+          LocationName: '社交',
58
+          title: '小小外交官课程',
59
+          payType: '优惠券抵用',
60
+          time: '2018-7-18 12:19',
61
+          price: 199,
62
+          useType: '已失效'
63
+        },
64
+        {
65
+          LocationName: '社交',
66
+          title: '小小外交官课程',
67
+          payType: '优惠券抵用',
68
+          time: '2018-7-18 12:19',
69
+          price: 199,
70
+          useType: '已失效'
71
+        },
72
+        {
73
+          LocationName: '社交',
74
+          title: '小小外交官课程',
75
+          payType: '优惠券抵用',
76
+          time: '2018-7-18 12:19',
77
+          price: 199,
78
+          useType: '已失效'
79
+        },
80
+        {
81
+          LocationName: '社交',
82
+          title: '小小外交官课程',
83
+          payType: '优惠券抵用',
84
+          time: '2018-7-18 12:19',
85
+          price: 199,
86
+          useType: '已失效'
87
+        }
88
+      ]
89
+    }
90
+  },
91
+  components: {
92
+    scroll,
93
+    noMore
94
+  },
95
+  computed: {
96
+    pullUpLoadObj: function () {
97
+      return this.pullUpLoad
98
+        ? {
99
+          threshold: parseInt(this.pullUpLoadThreshold),
100
+          txt: {
101
+            more: this.pullUpLoadMoreTxt,
102
+            noMore: this.pullUpLoadNoMoreTxt
103
+          }
104
+        }
105
+        : false
106
+    }
107
+  },
108
+  methods: {
109
+    getList () {
110
+      this.list.length <= 8 ? this.hasMore = true : this.hasMore = false
111
+      if (this.hasMore) {
112
+        setTimeout(() => {
113
+          this.list.push({
114
+            LocationName: '社交',
115
+            title: '小小外交官课程',
116
+            payType: '优惠券抵用',
117
+            time: '2018-7-18 12:19',
118
+            price: 199,
119
+            useType: '已失效'
120
+          })
121
+        }, 1000)
122
+      } else {
123
+        this.$refs.scroll.forceUpdate()
124
+        return false
125
+      }
126
+    }
127
+  }
128
+}
129
+</script>
130
+
131
+<style lang="scss" scoped>
132
+@import "page.scss";
133
+</style>

+ 78
- 0
src/module/user/lessonOrder/page.scss Datei anzeigen

@@ -0,0 +1,78 @@
1
+.box {
2
+  padding: .2rem .16rem 0;
3
+  .order-card {
4
+    padding: .2rem .15rem .2rem .1rem;
5
+    box-sizing: border-box;
6
+    background:rgba(255,255,255,1);
7
+    box-shadow:0px 2px 8px 0px rgba(204,204,204,0.5);
8
+    border-radius:10px;
9
+    margin-bottom: .2rem;
10
+    &.gray {
11
+      opacity: .5;
12
+    }
13
+    .card-pic {
14
+      width: .8rem;
15
+      height: .8rem;
16
+      border-radius: .08rem;
17
+      overflow: hidden;
18
+      position: relative;
19
+      div{
20
+        position: absolute;
21
+        background:linear-gradient(45deg,rgba(255,105,0,1) 0%,rgba(255,136,0,0.76) 100%);
22
+        opacity:0.85;
23
+        width: .6rem;
24
+        height: .6rem;
25
+        transform: rotate(45deg);
26
+        top: -0.3rem;
27
+        left: -0.3rem;
28
+        &.gray-location{
29
+          background: rgba(189,189,189,1);
30
+        }
31
+        span{
32
+          position: absolute;
33
+          bottom: .22rem;
34
+          right: -0.03rem;
35
+          font-size: .12rem;
36
+          color: #fff;
37
+          transform: rotate(-90deg);
38
+        }
39
+      }
40
+    }
41
+    .card-msg{
42
+      width: 1.7rem;
43
+      padding-left: .12rem;
44
+      .title{
45
+        font-size: .14rem;
46
+        padding-bottom: .12rem
47
+      }
48
+      .text{
49
+        font-size: .12rem;
50
+        color:rgba(153,153,153,1);
51
+        padding-bottom: .06rem;
52
+      }
53
+    }
54
+    .card-price{
55
+      flex: 1;
56
+      text-align: right;
57
+      .price, .type{
58
+        font-size: .14rem;
59
+        color: #000;
60
+        &.un-use{
61
+          color: #F25004;
62
+        }
63
+      }
64
+    }
65
+  }
66
+}
67
+
68
+@media screen and (max-width: 320px) {
69
+  .order-card {
70
+    .card-pic {
71
+      div{
72
+        span{
73
+          bottom: .2rem !important;
74
+        }
75
+      }
76
+    }
77
+  }
78
+}

+ 18
- 15
src/module/user/mainPage/userCenter/index.vue Datei anzeigen

@@ -9,12 +9,12 @@
9 9
         <div class="zIndex_bg"></div>
10 10
         <div class="userAvatar_Border">
11 11
           <div class="userAvatar">
12
-            <img src="" alt="" width="100%" height="100%">
12
+            <img :src='AccountInfo.headimgurl' alt="" width="100%" height="100%">
13 13
           </div>
14 14
         </div>
15 15
         <div class="uesr-info">
16
-          <div class="user-name">Rejo Varghese</div>
17
-          <div class="mobile">18833445567</div>
16
+          <div class="user-name">{{user.Name}}</div>
17
+          <div class="mobile">{{user.Phone}}</div>
18 18
         </div>
19 19
       </div>
20 20
       <div class="vip-privilege flex-h">
@@ -32,7 +32,7 @@
32 32
           <span>卡券</span>
33 33
           <span>2张未使用</span>
34 34
         </div>
35
-        <div class="flex-item privilege-item">
35
+        <div class="flex-item privilege-item" @click="toVip">
36 36
           <div class="img-box">
37 37
             <img src="../../../../common/icon/userCenter-icon-3.png" width="100%" height="100%" alt="">
38 38
           </div>
@@ -42,7 +42,7 @@
42 42
       </div>
43 43
 
44 44
       <div class="userCenter-menu">
45
-        <div class="menu-item flex-h">
45
+        <div class="menu-item flex-h" @click="toLessonOrder">
46 46
           <span>课程订单</span>
47 47
           <i class="iconfont icon-jiantou-right"></i>
48 48
         </div>
@@ -54,10 +54,6 @@
54 54
           <span>体检报告</span>
55 55
           <i class="iconfont icon-jiantou-right"></i>
56 56
         </div>
57
-        <div class="menu-item flex-h">
58
-          <span>消息提醒</span>
59
-          <i class="iconfont icon-jiantou-right"></i>
60
-        </div>
61 57
       </div>
62 58
     </div>
63 59
   </div>
@@ -71,9 +67,7 @@ export default {
71 67
   name: '',
72 68
   data () {
73 69
     return {
74
-      user: {
75
-
76
-      },
70
+      user: {},
77 71
       loading,
78 72
       isLoading: true
79 73
     }
@@ -89,8 +83,11 @@ export default {
89 83
   },
90 84
   created () {
91 85
     this.getUserInfo({ org: this.org }).then(() => {
92
-      this.user = this.userInfo
93
-      if (this.user.mobile) {
86
+      this.user = this.userInfo.customer
87
+      this.AccountInfo = JSON.parse(this.user.AccountInfo)
88
+      this.headimgurl = this.AccountInfo.headimgurl
89
+      console.log(this.AccountInfo)
90
+      if (this.user.Phone) {
94 91
         this.isLoading = false
95 92
       } else {
96 93
         this.$router.push({ name: 'bindMobile' })
@@ -98,7 +95,13 @@ export default {
98 95
     })
99 96
   },
100 97
   methods: {
101
-    ...actions(['getUserInfo'])
98
+    ...actions(['getUserInfo']),
99
+    toLessonOrder () {
100
+      this.$router.push({ name: 'lessonOrder' })
101
+    },
102
+    toVip () {
103
+      this.$router.push({ name: 'vip' })
104
+    }
102 105
   }
103 106
 }
104 107
 </script>

+ 12
- 0
src/module/user/router.js Datei anzeigen

@@ -9,6 +9,8 @@ import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题
9 9
 import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
10 10
 import userCenter from './mainPage/userCenter/index' // 个人中心
11 11
 import bindMobile from './bindMobile/bindMobile' // 绑定手机号
12
+import lessonOrder from './lessonOrder/index' // 我的订单
13
+import vip from './vip/index' // vip卡说明
12 14
 
13 15
 Vue.use(Router)
14 16
 
@@ -53,6 +55,16 @@ const router = new Router({
53 55
     name: 'bindMobile',
54 56
     component: bindMobile,
55 57
     children: []
58
+  },{ // 我的订单
59
+    path: '/lessonOrder',
60
+    name: 'lessonOrder',
61
+    component: lessonOrder,
62
+    children: []
63
+  },{ // vip卡说明
64
+    path: '/lessonOrder',
65
+    name: 'lessonOrder',
66
+    component: lessonOrder,
67
+    children: []
56 68
   }],
57 69
   linkActiveClass: 'active',
58 70
 })

+ 111
- 0
src/module/user/vip/index.vue Datei anzeigen

@@ -0,0 +1,111 @@
1
+<template>
2
+  <div class="mainPage">
3
+    vip
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  data () {
10
+    return {
11
+      hasPic: false,
12
+      pullUpLoad: true,
13
+      pullUpLoadThreshold: 40,
14
+      startY: 0,
15
+      isloading: true,
16
+      hasMore: true,
17
+      list: [
18
+        {
19
+          LocationName: '社交',
20
+          title: '小小外交官课程',
21
+          payType: '优惠券抵用',
22
+          time: '2018-7-18 12:19',
23
+          price: 199,
24
+          useType: '未使用'
25
+        },
26
+        {
27
+          LocationName: '社交',
28
+          title: '小小外交官课程',
29
+          payType: '优惠券抵用',
30
+          time: '2018-7-18 12:19',
31
+          price: 199,
32
+          useType: '已使用'
33
+        },
34
+        {
35
+          LocationName: '社交',
36
+          title: '小小外交官课程',
37
+          payType: '优惠券抵用',
38
+          time: '2018-7-18 12:19',
39
+          price: 199,
40
+          useType: '已失效'
41
+        },
42
+        {
43
+          LocationName: '社交',
44
+          title: '小小外交官课程',
45
+          payType: '优惠券抵用',
46
+          time: '2018-7-18 12:19',
47
+          price: 199,
48
+          useType: '已失效'
49
+        },
50
+        {
51
+          LocationName: '社交',
52
+          title: '小小外交官课程',
53
+          payType: '优惠券抵用',
54
+          time: '2018-7-18 12:19',
55
+          price: 199,
56
+          useType: '已失效'
57
+        },
58
+        {
59
+          LocationName: '社交',
60
+          title: '小小外交官课程',
61
+          payType: '优惠券抵用',
62
+          time: '2018-7-18 12:19',
63
+          price: 199,
64
+          useType: '已失效'
65
+        }
66
+      ]
67
+    }
68
+  },
69
+  components: {
70
+    scroll,
71
+    noMore
72
+  },
73
+  computed: {
74
+    pullUpLoadObj: function () {
75
+      return this.pullUpLoad
76
+        ? {
77
+          threshold: parseInt(this.pullUpLoadThreshold),
78
+          txt: {
79
+            more: this.pullUpLoadMoreTxt,
80
+            noMore: this.pullUpLoadNoMoreTxt
81
+          }
82
+        }
83
+        : false
84
+    }
85
+  },
86
+  methods: {
87
+    getList () {
88
+      this.list.length <= 8 ? this.hasMore = true : this.hasMore = false
89
+      if (this.hasMore) {
90
+        setTimeout(() => {
91
+          this.list.push({
92
+            LocationName: '社交',
93
+            title: '小小外交官课程',
94
+            payType: '优惠券抵用',
95
+            time: '2018-7-18 12:19',
96
+            price: 199,
97
+            useType: '已失效'
98
+          })
99
+        }, 1000)
100
+      } else {
101
+        this.$refs.scroll.forceUpdate()
102
+        return false
103
+      }
104
+    }
105
+  }
106
+}
107
+</script>
108
+
109
+<style lang="scss" scoped>
110
+@import "page.scss";
111
+</style>

+ 0
- 0
src/module/user/vip/page.scss Datei anzeigen


+ 64
- 0
src/util/dom.js Datei anzeigen

@@ -0,0 +1,64 @@
1
+class Dom {
2
+  getSeacrhRequire(name) {
3
+    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
4
+    var r = window.location.href.split('?')[1]
5
+    if (!r) {
6
+      return
7
+    } else {
8
+      r = window.location.href.split('?')[1].match(reg)
9
+    }
10
+    if (r != null) return unescape(r[2])
11
+    return null
12
+  }
13
+  hasClass(el, className) {
14
+    let reg = new RegExp('(^|\\s)' + className + '(\\s|$)')
15
+    return reg.test(el.className)
16
+  }
17
+
18
+  addClass(el, className) {
19
+    if (this.hasClass(el, className)) {
20
+      return
21
+    }
22
+
23
+    let newClass = el.className.split(' ')
24
+    newClass.push(className)
25
+    el.className = newClass.join(' ')
26
+  }
27
+
28
+  removeClass(el, className) {
29
+    if (!this.hasClass(el, className)) {
30
+      return
31
+    }
32
+
33
+    let reg = new RegExp('(^|\\s)' + className + '(\\s|$)', 'g')
34
+    el.className = el.className.replace(reg, ' ')
35
+  }
36
+
37
+  getData(el, name, val) {
38
+    let prefix = 'data-'
39
+    if (val) {
40
+      return el.setAttribute(prefix + name, val)
41
+    }
42
+    return el.getAttribute(prefix + name)
43
+  }
44
+
45
+  getRect(el) {
46
+    if (el instanceof window.SVGElement) {
47
+      let rect = el.getBoundingClientRect()
48
+      return {
49
+        top: rect.top,
50
+        left: rect.left,
51
+        width: rect.width,
52
+        height: rect.height
53
+      }
54
+    } else {
55
+      return {
56
+        top: el.offsetTop,
57
+        left: el.offsetLeft,
58
+        width: el.offsetWidth,
59
+        height: el.offsetHeight
60
+      }
61
+    }
62
+  }
63
+}
64
+export default new Dom()