许成详 6 years ago
parent
commit
bb2f43b48d

+ 1
- 1
config/index.js View File

@@ -18,7 +18,7 @@ module.exports = {
18 18
   },
19 19
   dev: {
20 20
     env: require('./dev.env'),
21
-    port: 8080,
21
+    port: 8081,
22 22
     assetsSubDirectory: 'static',
23 23
     assetsPublicPath: '/',
24 24
     proxyTable: {},

+ 81
- 50
src/module/user/majorProjects/index.vue View File

@@ -6,28 +6,16 @@
6 6
     <p>段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落段落</p>
7 7
     <div class="list flex-h">
8 8
       <div class="flex-item">
9
-        <div>
10
-          <span>6月</span>
9
+        <div v-for="(item,index) in courseList" :key="index">
10
+          <span>{{item.month+1}}月</span>
11 11
           <ul>
12
-            <li v-for="(item,index) in courseList" :key="index" class="flex-h">
12
+            <router-link tag="li" :to="{name: 'majorProjectsDetail', query: {}}" v-for="(subItem,subIndex) in item.list" :key="subIndex" class="flex-h">
13 13
               <div class="flex-item">
14 14
                 <div>
15
-                  <courseItem :data="item"></courseItem>
15
+                  <courseItem :data="subItem"></courseItem>
16 16
                 </div>
17 17
               </div>
18
-            </li>
19
-          </ul>
20
-        </div>
21
-        <div>
22
-          <span>5月</span>
23
-          <ul>
24
-            <li v-for="(item,index) in courseList" :key="index" class="flex-h">
25
-              <div class="flex-item">
26
-                <div>
27
-                  <courseItem :data="item"></courseItem>
28
-                </div>
29
-              </div>
30
-            </li>
18
+            </router-link>
31 19
           </ul>
32 20
         </div>
33 21
         <div class="cutLine"></div>
@@ -39,7 +27,7 @@
39 27
                 <div class="flex-item flex-h">
40 28
                   <div class="flex-item">
41 29
                     <div>
42
-                      <span class="centerLabel">长按方二维码<br>关注“城的空间”公众号</span>
30
+                      <span class="centerLabel">长按方二维码<br>关注“城的空间”公众号</span>
43 31
                     </div>
44 32
                   </div>
45 33
                   <div class="qrCode">
@@ -62,36 +50,55 @@ export default {
62 50
   name: '',
63 51
   data () {
64 52
     return {
65
-      courseList: [{ // 课程列表
66
-        id:'',
67
-        title:'课程名称',
68
-        img:'',
69
-        time:'2018.04.04 18:30-20:00',
70
-        address:'南京南',
71
-        tag:['儿童教育','小小外交官'],
72
-        courseType:'团体课',
73
-        defaultPrice:'168/节',
74
-        getWay:'ticket'
75
-      },{
76
-        id:'',
77
-        title:'课程名称',
78
-        img:'',
79
-        time:'2018.04.04 18:30-20:00',
80
-        address:'南京南',
81
-        tag:['儿童教育','小小外交官'],
82
-        courseType:'团体课',
83
-        defaultPrice:'168/节',
84
-        getWay:'ticket'
85
-      },{
86
-        id:'',
87
-        title:'课程名称',
88
-        img:'',
89
-        time:'2018.04.04 18:30-20:00',
90
-        address:'南京南',
91
-        tag:['儿童教育','小小外交官'],
92
-        courseType:'团体课',
93
-        defaultPrice:'168/节',
94
-        getWay:'ticket'
53
+      courseList: [], // 课程列表
54
+      initList: [{ // 初始化课程列表
55
+        id: '',
56
+        title: '课程名称',
57
+        img: '',
58
+        time: '2018.04.04 18:30-20:00',
59
+        address: '南京南',
60
+        tag: ['儿童教育', '小小外交官'],
61
+        courseType: '团体课',
62
+        defaultPrice: '168/节',
63
+        getWay: 'ticket',
64
+        startDate: 1514779200000,
65
+        endDate: 1514781600000,
66
+      }, {
67
+        id: '',
68
+        title: '课程名称',
69
+        img: '',
70
+        time: '2018.04.04 18:30-20:00',
71
+        address: '南京南',
72
+        tag: ['儿童教育', '小小外交官'],
73
+        courseType: '团体课',
74
+        defaultPrice: '168/节',
75
+        getWay: 'ticket',
76
+        startDate: 1514779200000,
77
+        endDate: 1514781600000,
78
+      }, {
79
+        id: '',
80
+        title: '课程名称',
81
+        img: '',
82
+        time: '2018.04.04 18:30-20:00',
83
+        address: '南京南',
84
+        tag: ['儿童教育', '小小外交官'],
85
+        courseType: '团体课',
86
+        defaultPrice: '168/节',
87
+        getWay: 'ticket',
88
+        startDate: 1517460000000,
89
+        endDate: 1517467200000,
90
+      }, {
91
+        id: '',
92
+        title: '课程名称',
93
+        img: '',
94
+        time: '2018.04.04 18:30-20:00',
95
+        address: '南京南',
96
+        tag: ['儿童教育', '小小外交官'],
97
+        courseType: '团体课',
98
+        defaultPrice: '168/节',
99
+        getWay: 'ticket',
100
+        startDate: 1517460000000,
101
+        endDate: 1517467200000,
95 102
       }],
96 103
     }
97 104
   },
@@ -100,10 +107,34 @@ export default {
100 107
     courseItem,
101 108
   },
102 109
   created () {
103
-
110
+    this.initData()
104 111
   },
105 112
   methods: {
106
-
113
+    initData () { // 初始化数据
114
+      let arr = []
115
+      for (var n = 0; n < this.initList.length; n++) {
116
+        arr.push(new Date(this.initList[n].startDate).getMonth())
117
+      }
118
+      for (var i = 0; i < arr.length; i++) {
119
+        if (arr.indexOf(arr[i]) !== i) {
120
+          arr.splice(i, 1)
121
+          i--
122
+        }
123
+      }
124
+      for (var i = 0; i < arr.length; i++) {
125
+        this.courseList.push({
126
+          month: arr[i],
127
+          list: []
128
+        })
129
+      }
130
+      for (var n = 0; n < this.initList.length; n++) {
131
+        for (var i = 0; i < this.courseList.length; i++) {
132
+          if (new Date(this.initList[n].startDate).getMonth() === this.courseList[i].month) {
133
+            this.courseList[i].list.push(this.initList[n])
134
+          }
135
+        }
136
+      }
137
+    },
107 138
   }
108 139
 }
109 140
 </script>

+ 44
- 0
src/module/user/majorProjectsDetail/index.vue View File

@@ -0,0 +1,44 @@
1
+<template>
2
+  <div class="mainPage flex-v">
3
+    <div class="flex-item">
4
+      <div class="content">
5
+        <div class="banner">
6
+          <img src="" class="centerLabel cover" alt="">
7
+          <div>
8
+            <span>课程名称</span>
9
+            <div>
10
+              <span>¥<em>199</em>.00起/课时</span>
11
+              <span>参与者<em>30</em>/40人</span>
12
+            </div>
13
+          </div>
14
+        </div>
15
+      </div>
16
+    </div>
17
+    <div class="flex-h">
18
+      <div class="flex-item">
19
+        <div>
20
+
21
+        </div>
22
+      </div>
23
+      <router-link :to="{name: '', query: {}}">去购买</router-link>
24
+    </div>
25
+  </div>
26
+</template>
27
+
28
+<script>
29
+
30
+export default {
31
+  name: '',
32
+  data () {
33
+    return {}
34
+  },
35
+  computed: {},
36
+  created () {},
37
+  methods: {}
38
+}
39
+</script>
40
+
41
+<!-- Add "scoped" attribute to limit CSS to this component only -->
42
+<style lang="scss" scoped>
43
+@import "page.scss";
44
+</style>

+ 95
- 0
src/module/user/majorProjectsDetail/page.scss View File

@@ -0,0 +1,95 @@
1
+.mainPage{
2
+  background: #fff;
3
+  &>div.flex-item{
4
+    &>div{
5
+      width: 100%;
6
+      position: absolute;
7
+      left: 0;
8
+      top: 0;
9
+      bottom: 0;
10
+      overflow-y: scroll;
11
+      -webkit-overflow-scrolling: touch;
12
+      transform: translateZ(0);
13
+      -webkit-transform: translateZ(0);
14
+      .banner{
15
+        width: 100%;
16
+        height: 0;
17
+        padding-bottom: 118%;
18
+        background: #eee;
19
+        position: relative;
20
+        overflow: hidden;
21
+        img{
22
+          z-index: 1;
23
+        }
24
+        &>div{
25
+          width: 100%;
26
+          position: absolute;
27
+          left: 0;
28
+          bottom: 0;
29
+          overflow: hidden;
30
+          z-index: 2;
31
+          background: linear-gradient(to top, rgba(0,0,0,.1),rgba(0,0,0,0));
32
+          background: -webkit-linear-gradient(bottom, rgba(0,0,0,.1),rgba(0,0,0,0));
33
+          &>span{
34
+            width: 100%;
35
+            display: block;
36
+            line-height: .38rem;
37
+            color: #fff;
38
+            font-size: .2rem;
39
+            text-indent: .26rem;
40
+            text-overflow: ellipsis;
41
+            white-space: nowrap;
42
+            overflow: hidden;
43
+          }
44
+          &>div{
45
+            font-size: 0;
46
+            white-space: nowrap;
47
+            margin-bottom: .26rem;
48
+            &>span{
49
+              display: inline-block;
50
+              line-height: .32rem;
51
+              color: #fff;
52
+              font-size: .11rem;
53
+              vertical-align: middle;
54
+              &:first-child{
55
+                margin-left: .26rem;
56
+                margin-right: .1rem;
57
+                em{
58
+                  font-size: .2rem;
59
+                  color: #fff;
60
+                }
61
+                &+span{
62
+                  line-height: .24rem;
63
+                  background: rgba(0,0,0,.2);
64
+                  padding: 0 .15rem;
65
+                  border-radius: .32rem;
66
+                  em{
67
+                    color: #e8a813;
68
+                    line-height: .24rem;
69
+                    font-size: .11rem;
70
+                  }
71
+                }
72
+              }
73
+            }
74
+          }
75
+        }
76
+      }
77
+    }
78
+  }
79
+  &>div.flex-h{
80
+    padding: .1rem 0;
81
+    background: #fff;
82
+    position: relative;
83
+    z-index: 100;
84
+    box-shadow: 0 0 .2rem .02rem rgba(0,0,0,.05);
85
+    &>a{
86
+      line-height: .4rem;
87
+      padding: 0 .6rem;
88
+      border-radius: .4rem;
89
+      color: #fff;
90
+      font-size: .15rem;
91
+      margin-right: .2rem;
92
+      background: #fc6243;
93
+    }
94
+  }
95
+}

+ 6
- 0
src/module/user/router.js View File

@@ -5,6 +5,7 @@ import mainPage from './mainPage/index' // 主页
5 5
 import indexPage from './mainPage/indexPage/index' // 首页
6 6
 import fiveA from './fiveA/index' // 5A
7 7
 import majorProjects from './majorProjects/index' // 项目专题
8
+import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题
8 9
 import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
9 10
 import userCenter from './mainPage/userCenter/index' // 个人中心
10 11
 
@@ -36,6 +37,11 @@ const router = new Router({
36 37
     name: 'majorProjects',
37 38
     component: majorProjects,
38 39
     children: []
40
+  },{ // 项目专题详情
41
+    path: '/majorProjectsDetail',
42
+    name: 'majorProjectsDetail',
43
+    component: majorProjectsDetail,
44
+    children: []
39 45
   },{ // 5A
40 46
     path: '/fiveA',
41 47
     name: 'fiveA',