瀏覽代碼

完成活动详情页

庄逸洲 5 年之前
父節點
當前提交
5058f78a9d

+ 1 - 1
config/index.js 查看文件

@@ -19,7 +19,7 @@ module.exports = {
19 19
 
20 20
     host: 'test1.sgjyun.com',
21 21
     port: 8090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
22
-    host: 'test1.sgjyun.com',
22
+    // host: 'test1.sgjyun.com',
23 23
     autoOpenBrowser: true,
24 24
     errorOverlay: true,
25 25
     notifyOnErrors: false,

+ 22 - 0
src/api/activity/activity.js 查看文件

@@ -32,4 +32,26 @@ export function submitActivity(publish, activity) {
32 32
     },
33 33
     data: activity,
34 34
   })
35
+}
36
+
37
+export function fetchActivityDetailViewData(id) {
38
+  return request({
39
+    url: "/api/activity/detailview",
40
+    method: "get",
41
+    params: {
42
+      id: id,
43
+    }
44
+  })
45
+}
46
+
47
+export function fetchActivitySignupUsers(activity_id, keyword, page) {
48
+  return request({
49
+    url: "/api/activity/signups",
50
+    method: "get",
51
+    params: {
52
+      id: activity_id,
53
+      keyword: keyword,
54
+      page: page,
55
+    }
56
+  })
35 57
 }

+ 3 - 0
src/lang/en.js 查看文件

@@ -116,6 +116,9 @@ export default {
116 116
     activityPublish: "publish activity",
117 117
     activityModify: "edit activity",
118 118
     systemsetting:'Systemsetting',
119
+    activityDetail: "activity detail",
120
+    activityShare: "activity share",
121
+    activityPreview: "activity preview",
119 122
   },
120 123
   navbar: {
121 124
     logOut: 'Log Out',

+ 3 - 0
src/lang/zh.js 查看文件

@@ -165,6 +165,9 @@ export default {
165 165
     activityModify: "编辑活动",
166 166
     systemsetting:'系统设置',
167 167
     staffmanagement:'员工管理',
168
+    activityDetail: "活动详情",
169
+    activityShare: "活动分享",
170
+    activityPreview: "活动预览",
168 171
   },
169 172
   navbar: {
170 173
     logOut: '退出登录',

+ 33 - 0
src/router/modules/marketing_tool.js 查看文件

@@ -39,5 +39,38 @@ export default {
39 39
         noCache: true
40 40
       }
41 41
     },
42
+    {
43
+      path: "/activity",
44
+      hidden: true,
45
+      is_menu: false,
46
+      component: () => import("@/scrm_pages/marketing_tool/activity_detail"),
47
+      name: "activityDetail",
48
+      meta: {
49
+        title: "activityDetail",
50
+        noCache: true,
51
+      }
52
+    },
53
+    {
54
+      path: "/activity/share",
55
+      hidden: true,
56
+      is_menu: false,
57
+      component: () => import("@/scrm_pages/marketing_tool/activity_share"),
58
+      name: "activityShare",
59
+      meta: {
60
+        title: "activityShare",
61
+        noCache: true,
62
+      }
63
+    },
64
+    {
65
+      path: "/activity/preview",
66
+      hidden: true,
67
+      is_menu: false,
68
+      component: () => import("@/scrm_pages/marketing_tool/activity_preview"),
69
+      name: "activityPreview",
70
+      meta: {
71
+        title: "activityPreview",
72
+        noCache: true,
73
+      }
74
+    },
42 75
   ]
43 76
 }

+ 248 - 0
src/scrm_pages/marketing_tool/activity_detail.vue 查看文件

@@ -0,0 +1,248 @@
1
+<template>
2
+    <div class="main-contain">
3
+        <div class="position">
4
+            <bread-crumb :crumbs="crumbs"></bread-crumb>
5
+        </div>
6
+        <div class="app-container" style="padding-top: 0; background-color: #f6f8f9;">
7
+            <div class="base-info">
8
+                <div class="poster-photo">
9
+                    <img :src="poster_photo" />
10
+                </div>
11
+                <div class="title-panel">
12
+                    <p class="title">
13
+                        <router-link :to="activity_url">{{ title }}</router-link>
14
+                    </p>
15
+                    <p class="date">活动日期:{{ activity_time }}</p>
16
+                </div>
17
+                <div class="action-panel">
18
+                    <el-button type="primary" v-if="show_share_btn" @click="$router.push({ path: '/activity/share', query: { id: activity_id } })">再次分享</el-button>
19
+                    <el-button type="primary" v-if="show_publish_btn">发布</el-button>
20
+                </div>
21
+            </div>
22
+            <div class="times-statistics">
23
+                <el-row :gutter="20">
24
+                    <el-col :span="12">
25
+                        <div class="item">
26
+                            <span class="count">{{ read_times }}</span>
27
+                            <p class="desc">展示次数</p>
28
+                        </div>
29
+                    </el-col>
30
+                    <el-col :span="12">
31
+                        <div class="item">
32
+                            <span class="count">{{ join_count }}</span>
33
+                            <p class="desc">参与人数</p>
34
+                        </div>
35
+                    </el-col>
36
+                </el-row>
37
+            </div>
38
+            <div class="signup-header">
39
+                <div class="input">
40
+                    <el-input v-model="signup_keyword" placeholder="搜索报名人" style="width: 330px;"></el-input>
41
+                    <el-button type="primary" icon="el-icon-search" :loading="loading_search" @click="fetchSignupUsers">搜索</el-button>
42
+                </div>
43
+                <div class="all-btn">
44
+                    <router-link to="/">
45
+                        <el-button type="primary">查看全部</el-button>
46
+                    </router-link>
47
+                </div>
48
+            </div>
49
+            <div class="signup-table-panel">
50
+                <el-table :data="signup_users" empty-text="暂无人报名">
51
+                    <el-table-column label="报名号" align="center" prop="id"></el-table-column>
52
+                    <el-table-column label="手机号" align="center" prop="mobile"></el-table-column>
53
+                    <el-table-column label="客户姓名" align="center" prop="real_name"></el-table-column>
54
+                    <el-table-column label="报名时间" align="center">
55
+                        <template slot-scope="scope">
56
+                            <span>{{ parseTime(scope.row.ctime, "{y}-{m}-{d} {h}:{i}") }}</span>
57
+                        </template>
58
+                    </el-table-column>
59
+                </el-table>
60
+            </div>
61
+        </div>
62
+    </div>
63
+</template>
64
+
65
+<script>
66
+import BreadCrumb from "@/scrm_pages/components/bread-crumb"
67
+import { fetchActivityDetailViewData, fetchActivitySignupUsers } from "@/api/activity/activity"
68
+import { parseTime } from "@/utils"
69
+
70
+export default {
71
+    name: "ActivityDetail",
72
+    components: {
73
+        BreadCrumb,
74
+    },
75
+    data() {
76
+        return {
77
+            crumbs: [
78
+                { path: false, name: "营销工具" },
79
+                { path: false, name: "活动详情" },
80
+            ],
81
+
82
+            activity_id: 0,
83
+            activity: null,
84
+
85
+            signup_keyword: "",
86
+            signup_users: [],
87
+
88
+            loading_search: false,
89
+        }
90
+    },
91
+    computed: {
92
+        title: function() {
93
+            return this.activity == null ? "" : this.activity.title
94
+        },
95
+        poster_photo: function() {
96
+            return this.activity == null ? "/" : this.activity.poster_photo
97
+        },
98
+        activity_url: function() {
99
+            if (this.activity != null) {
100
+                return "/activity/preview?id=" + this.activity_id
101
+            }
102
+            return ""
103
+        },
104
+        activity_time: function() {
105
+            return this.activity == null ? "" : parseTime(this.activity.start_time, "{y}-{m}-{d} {h}:{i}")
106
+        },
107
+        show_share_btn: function() {
108
+            return this.activity == null ? false : (this.activity.status == 1)
109
+        },
110
+        show_publish_btn: function() {
111
+            return this.activity == null ? false : (this.activity.status == 4)
112
+        },
113
+        read_times: function() {
114
+            return this.activity == null ? 0 : this.activity.read_num
115
+        },
116
+        join_count: function() {
117
+            return this.activity == null ? 0 : this.activity.join_num
118
+        }
119
+    },
120
+    mounted() {
121
+        this.activity_id = this.$route.query.id
122
+
123
+        fetchActivityDetailViewData(this.activity_id).then(rs => {
124
+            var resp = rs.data
125
+            if (resp.state == 1) {
126
+                this.activity = resp.data.activity
127
+                this.signup_users = resp.data.users
128
+            } else {
129
+                this.$message.error(resp.msg)
130
+            }
131
+
132
+        }).catch(err => {
133
+            this.$message.error(err)
134
+        })
135
+    },
136
+    methods: {
137
+        parseTime,
138
+        fetchSignupUsers: function() {
139
+            this.loading_search = true
140
+            fetchActivitySignupUsers(this.activity_id, this.signup_keyword, 1).then(rs => {
141
+                this.loading_search = false
142
+                var resp = rs.data
143
+                if (resp.state == 1) {
144
+                    this.signup_users = resp.data.users
145
+                } else {
146
+                    this.$message.error(resp.msg)
147
+                }
148
+            }).catch(err => {
149
+                this.loading_search = false
150
+                this.$message.error(err)
151
+            })
152
+        }
153
+    },
154
+}
155
+</script>
156
+
157
+<style lang="scss" scoped>
158
+.base-info {
159
+    padding: 20px 25px;
160
+    display: flex;
161
+    justify-content: flex-end;
162
+    flex-wrap: nowrap;
163
+    align-items: center;
164
+    background-color: white;
165
+    box-shadow: 0 0 1px #dee2e5;
166
+
167
+    .poster-photo {
168
+        width: 120px;
169
+        height: 96px;
170
+        display: flex;
171
+        justify-content: center;
172
+        margin-right: 22px;
173
+
174
+        img {
175
+            width: 100%;
176
+            height: auto;
177
+            border-radius: 4px;
178
+            object-fit: cover;
179
+            object-position: center;
180
+        }
181
+    }
182
+    .title-panel {
183
+        flex: 3;
184
+        padding-right: 20px;
185
+
186
+        .title {
187
+            font-size: 18px;
188
+            color: #485b6d;
189
+            font-weight: 700;
190
+            word-break: break-all;
191
+            overflow: hidden;
192
+            text-overflow: ellipsis;
193
+            display: -webkit-box;
194
+            -webkit-line-clamp: 2;
195
+            -webkit-box-orient: vertical;
196
+            height: 70px;
197
+            line-height: 34px;
198
+        }
199
+        .date {
200
+            color: #7b8a97;
201
+            line-height: 20px;
202
+            font-size: 14px;
203
+        }
204
+    }
205
+    .action-panel {
206
+        flex: 1;
207
+        text-align: right;
208
+    }
209
+}
210
+.times-statistics {
211
+    margin-top: 20px;
212
+
213
+    .item {
214
+        padding: 40px 0 30px 0;
215
+        box-shadow: 0 0 1px #dee2e5;
216
+        background-color: white;
217
+        text-align: center;
218
+
219
+        .count {
220
+            font-size: 36px;
221
+            color: #58a2ec;
222
+        }
223
+        .desc {
224
+            margin-top: 5px;
225
+            font-size: 14px;
226
+            color: #485b6d;
227
+        }
228
+    }
229
+}
230
+.signup-header {
231
+    margin-top: 20px;
232
+    display: flex;
233
+    justify-content: space-between;
234
+
235
+    .input {
236
+        width: 500px;
237
+        display: block;
238
+    }
239
+    .all-btn {
240
+        display: block;
241
+    }
242
+}
243
+.signup-table-panel {
244
+    margin-top: 10px;
245
+}
246
+</style>
247
+
248
+

+ 1 - 1
src/scrm_pages/marketing_tool/activity_list.vue 查看文件

@@ -46,7 +46,7 @@
46 46
 </template>
47 47
 
48 48
 <script>
49
-import BreadCrumb from "@/scrm_pages/components/bread-crumb";
49
+import BreadCrumb from "@/scrm_pages/components/bread-crumb"
50 50
 import PublishedCell from "@/scrm_pages/marketing_tool/components/published_cell"
51 51
 import UnapprovedCell from "@/scrm_pages/marketing_tool/components/unapproved_cell"
52 52
 import DraftsCell from "@/scrm_pages/marketing_tool/components/drafts_cell"

+ 14 - 0
src/scrm_pages/marketing_tool/activity_preview.vue 查看文件

@@ -0,0 +1,14 @@
1
+<template>
2
+    <div></div>
3
+</template>
4
+
5
+<script>
6
+export default {
7
+    name: "ActivityPreview",
8
+}
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>
14
+

+ 14 - 0
src/scrm_pages/marketing_tool/activity_share.vue 查看文件

@@ -0,0 +1,14 @@
1
+<template>
2
+    <div></div>
3
+</template>
4
+
5
+<script>
6
+export default {
7
+    name: "ActivityShare",
8
+}
9
+</script>
10
+
11
+<style scoped>
12
+
13
+</style>
14
+

+ 8 - 1
src/scrm_pages/marketing_tool/components/drafts_cell.vue 查看文件

@@ -7,7 +7,9 @@
7 7
         </div>
8 8
         <div class="activity-info-panel">
9 9
             <h3 class="title">
10
-                <a href="/">{{ activity.title }}</a>
10
+                <router-link :to="activityUrl">
11
+                    <a>{{ activity.title }}</a>
12
+                </router-link>
11 13
             </h3>
12 14
             <div class="operation">
13 15
                 <el-button type="primary" size="small" icon="el-icon-edit-outline" @click="$router.push({ path: '/activity/modify', query: {id: activity.id} })">编辑</el-button>
@@ -32,6 +34,11 @@ export default {
32 34
             
33 35
         }
34 36
     },
37
+    computed: {
38
+        activityUrl: function() {
39
+            return "/activity?id=" + this.activity.id
40
+        }
41
+    },
35 42
 }
36 43
 </script>
37 44
 

+ 11 - 3
src/scrm_pages/marketing_tool/components/edit_activity_edit_form.vue 查看文件

@@ -222,18 +222,20 @@ export default {
222 222
 
223 223
         saveAction: function() {
224 224
             this.saving_activity = true
225
-            this.submitActivity(false)
225
+            this.submitActivity(false, function() {
226
+                // 弹框 => 再发一条/前往列表
227
+            })
226 228
         },
227 229
         publishAction: function() {
228 230
             this.publishing_activity = true
229 231
             this.submitActivity(true, function() {
230
-                // 前往活动详情页
232
+                this.$router.push({ path: "/activity", query: { id: this.activity.id } })
231 233
             })
232 234
         },
233 235
         previewAction: function() {
234 236
             this.saving_before_preview_activity = true
235 237
             this.submitActivity(false, function() {
236
-                // 前往活动预览页
238
+                this.$router.push({ path: "/activity/preview", query: { id: this.activity.id } })
237 239
             })
238 240
         },
239 241
         submitActivity: function(is_publish, successCallBack) {
@@ -290,16 +292,22 @@ export default {
290 292
             return new Promise((resolve, reject) => {
291 293
                 if (this.activity.poster_photo.length == 0) {
292 294
                     reject("海报不能为空")
295
+                    return
293 296
                 } else if (this.activity.title.length == 0) {
294 297
                     reject("标题不能为空")
298
+                    return
295 299
                 } else if (this.activity.subtitle.length == 0) {
296 300
                     reject("副标题不能为空")
301
+                    return
297 302
                 } else if (this.activity.address.length == 0) {
298 303
                     reject("活动地址不能为空")
304
+                    return
299 305
                 } else if (this.activity.sign_up_deadline == 0) {
300 306
                     reject("活动报名时间不能为空")
307
+                    return
301 308
                 } else if (this.activity.start == 0) {
302 309
                     reject("活动时间不能为空")
310
+                    return
303 311
                 } else {
304 312
                     if (this.activity.phone_number.length > 0) {
305 313
                         if (/^1\d{10}$/.test(this.activity.phone_number) == false && /^(0\d{2,3}-?\d{7,8}$)/.test(this.activity.phone_number) == false) {

+ 7 - 2
src/scrm_pages/marketing_tool/components/published_cell.vue 查看文件

@@ -7,7 +7,9 @@
7 7
         </div>
8 8
         <div class="activity-info-panel">
9 9
             <h3 class="title">
10
-                <a href="">{{ activity.title }}</a>
10
+                <router-link :to="activityUrl">
11
+                    <a>{{ activity.title }}</a>
12
+                </router-link>
11 13
             </h3>
12 14
             <div class="statistics">
13 15
                 阅读:{{ activity.read_num }} 丨 评论:{{ activity.comment_num }} 丨 点赞:{{ activity.star_num }}
@@ -52,6 +54,9 @@ export default {
52 54
                 return "已发布"
53 55
             }
54 56
         },
57
+        activityUrl: function() {
58
+            return "/activity?id=" + this.activity.id
59
+        },
55 60
         progress_percent: function() {
56 61
             if (this.activity.limit_num > 0) {
57 62
                 return (this.activity.join_num / this.activity.limit_num) * 100
@@ -71,7 +76,7 @@ export default {
71 76
             }
72 77
         },
73 78
         start_time: function() {
74
-            return parseTime(this.activity.start_time, "{y}-{m}-{d}")
79
+            return parseTime(this.activity.start_time, "{y}-{m}-{d} {h}-{i}")
75 80
         },
76 81
     },
77 82
 }

+ 1 - 1
src/scrm_pages/marketing_tool/components/unapproved_cell.vue 查看文件

@@ -42,7 +42,7 @@ export default {
42 42
     },
43 43
     computed: {
44 44
         start_time: function() {
45
-            return parseTime(this.activity.start_time, "{y}-{m}-{d}")
45
+            return parseTime(this.activity.start_time, "{y}-{m}-{d} {h}:{i}")
46 46
         },
47 47
     },
48 48
 }