Browse Source

活动编辑页

庄逸洲 5 years ago
parent
commit
5b82878473

+ 10 - 0
src/api/activity/activity.js View File

11
     method: 'get',
11
     method: 'get',
12
     params: params,
12
     params: params,
13
   })
13
   })
14
+}
15
+
16
+export function fetchActivity(id) {
17
+  return request({
18
+    url: "/api/activity",
19
+    method: "get",
20
+    params: {
21
+      id: id,
22
+    }
23
+  })
14
 }
24
 }

+ 2 - 1
src/lang/en.js View File

114
     marketingTool: "marketing tools",
114
     marketingTool: "marketing tools",
115
     activityList: "activity list",
115
     activityList: "activity list",
116
     activityPublish: "publish activity",
116
     activityPublish: "publish activity",
117
-    systemsetting:'Systemsetting'
117
+    activityModify: "edit activity",
118
+    systemsetting:'Systemsetting',
118
   },
119
   },
119
   navbar: {
120
   navbar: {
120
     logOut: 'Log Out',
121
     logOut: 'Log Out',

+ 2 - 1
src/lang/zh.js View File

162
     marketingTool: "营销工具",
162
     marketingTool: "营销工具",
163
     activityList: "活动列表",
163
     activityList: "活动列表",
164
     activityPublish: "发布活动",
164
     activityPublish: "发布活动",
165
+    activityModify: "编辑活动",
165
     systemsetting:'系统设置',
166
     systemsetting:'系统设置',
166
-    staffmanagement:'员工管理'
167
+    staffmanagement:'员工管理',
167
   },
168
   },
168
   navbar: {
169
   navbar: {
169
     logOut: '退出登录',
170
     logOut: '退出登录',

+ 11 - 0
src/router/modules/marketing_tool.js View File

28
         noCache: true
28
         noCache: true
29
       }
29
       }
30
     },
30
     },
31
+    {
32
+      path: '/activity/modify',
33
+      hidden: true,
34
+      is_menu: false,
35
+      component: () => import('@/scrm_pages/marketing_tool/activity_publish'),
36
+      name: 'activityModify',
37
+      meta: {
38
+        title: 'activityModify',
39
+        noCache: true
40
+      }
41
+    },
31
   ]
42
   ]
32
 }
43
 }

+ 38 - 1
src/scrm_pages/marketing_tool/activity_publish.vue View File

9
                     <preview-form :activity="activity" :paragraph="activity_paragraph"></preview-form>
9
                     <preview-form :activity="activity" :paragraph="activity_paragraph"></preview-form>
10
                 </div>
10
                 </div>
11
                 <div class="edit-panel">
11
                 <div class="edit-panel">
12
-                    <edit-form :activity="activity" :paragraph="activity_paragraph"></edit-form>
12
+                    <edit-form ref="edit_form" :activity="activity" :paragraph="activity_paragraph"></edit-form>
13
                 </div>
13
                 </div>
14
             </div>
14
             </div>
15
         </div>
15
         </div>
20
 import BreadCrumb from "@/scrm_pages/components/bread-crumb";
20
 import BreadCrumb from "@/scrm_pages/components/bread-crumb";
21
 import PreviewForm from "@/scrm_pages/marketing_tool/components/edit_activity_preview_form"
21
 import PreviewForm from "@/scrm_pages/marketing_tool/components/edit_activity_preview_form"
22
 import EditForm from "@/scrm_pages/marketing_tool/components/edit_activity_edit_form"
22
 import EditForm from "@/scrm_pages/marketing_tool/components/edit_activity_edit_form"
23
+import { fetchActivity } from "@/api/activity/activity"
23
 
24
 
24
 export default {
25
 export default {
25
     name: "ActivityPublish",
26
     name: "ActivityPublish",
48
                 sign_up_notice: "",
49
                 sign_up_notice: "",
49
             },
50
             },
50
             activity_paragraph: {
51
             activity_paragraph: {
52
+                id: 0,
51
                 title: "",
53
                 title: "",
52
                 content: "",
54
                 content: "",
53
             }
55
             }
54
         }
56
         }
55
     },
57
     },
58
+    created() {
59
+        var id = this.$route.query.id
60
+        if (id != undefined) {
61
+            fetchActivity(id).then(rs => {
62
+                var resp = rs.data
63
+                if (resp.state == 1) {
64
+                    // console.log(resp.data)
65
+                    var activity = resp.data.activity
66
+                    this.activity.id = activity.id
67
+                    this.activity.poster_photo = activity.poster_photo
68
+                    this.activity.title = activity.title
69
+                    this.activity.subtitle = activity.subtitle
70
+                    this.activity.address = activity.address
71
+                    this.activity.limit_num = activity.limit_num
72
+                    this.activity.sign_up_deadline = activity.sign_up_deadline * 1000
73
+                    this.activity.start_time = activity.start_time * 1000
74
+                    this.activity.phone_number = activity.phone_number
75
+                    this.activity.sign_up_notice = activity.sign_up_notice
76
+
77
+                    var paragraph = resp.data.paragraph
78
+                    this.activity_paragraph.id = paragraph.id
79
+                    this.activity_paragraph.title = paragraph.title
80
+                    this.activity_paragraph.content = paragraph.content
81
+
82
+                    this.$refs.edit_form.initForms()
83
+
84
+                } else {
85
+                    this.$message.error(resp.msg)
86
+                }
87
+
88
+            }).catch(err => {
89
+                this.$message.error(err)
90
+            })
91
+        }
92
+    },
56
 }
93
 }
57
 </script>
94
 </script>
58
 
95
 

+ 1 - 1
src/scrm_pages/marketing_tool/components/drafts_cell.vue View File

10
                 <a href="/">{{ activity.title }}</a>
10
                 <a href="/">{{ activity.title }}</a>
11
             </h3>
11
             </h3>
12
             <div class="operation">
12
             <div class="operation">
13
-                <el-button type="primary" size="small" icon="el-icon-edit-outline">编辑</el-button>
13
+                <el-button type="primary" size="small" icon="el-icon-edit-outline" @click="$router.push({ path: '/activity/modify', query: {id: activity.id} })">编辑</el-button>
14
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
14
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
15
             </div>
15
             </div>
16
         </div>
16
         </div>

+ 6 - 4
src/scrm_pages/marketing_tool/components/edit_activity_edit_form.vue View File

160
         },
160
         },
161
     },
161
     },
162
     methods: {
162
     methods: {
163
-        initParagraphContent: function(content) {
163
+        initForms: function() {
164
+            this.poster_photo_file_name = this.activity.poster_photo
165
+            this.limit_num = this.activity.limit_num > 0 ? this.activity.limit_num : ""
166
+            this.activity_time = this.activity.start_time
167
+            this.sign_up_deadline = this.activity.sign_up_deadline
168
+
164
             this.paragraph_init_content = this.paragraph.content
169
             this.paragraph_init_content = this.paragraph.content
165
         },
170
         },
166
         paragraphContentChanged: function(content) {
171
         paragraphContentChanged: function(content) {
172
             this.$message.error(err)
177
             this.$message.error(err)
173
         },
178
         },
174
         posterPhotoUploadSuccess: function(res, file) {
179
         posterPhotoUploadSuccess: function(res, file) {
175
-            console.log(res)
176
-            console.log(file)
177
             this.poster_photo_file_name = file.name
180
             this.poster_photo_file_name = file.name
178
             this.uploading_poster_photo = false
181
             this.uploading_poster_photo = false
179
             this.activity.poster_photo = "https://images.shengws.com/" + res.url
182
             this.activity.poster_photo = "https://images.shengws.com/" + res.url
180
         },
183
         },
181
         beforePosterPhotoUpload: function(file) {
184
         beforePosterPhotoUpload: function(file) {
182
-            console.log(file)
183
             var is_image = file.type.indexOf("image") > -1
185
             var is_image = file.type.indexOf("image") > -1
184
             var mb = file.size / 1024 / 1024
186
             var mb = file.size / 1024 / 1024
185
 
187
 

+ 2 - 0
src/scrm_pages/marketing_tool/components/edit_activity_preview_form.vue View File

197
                     width: 40px;
197
                     width: 40px;
198
                     height: 40px;
198
                     height: 40px;
199
                     border-radius: 20px;
199
                     border-radius: 20px;
200
+                    object-fit: cover;
201
+                    object-position: center;
200
                 }
202
                 }
201
             }
203
             }
202
             .text-info {
204
             .text-info {

+ 1 - 1
src/scrm_pages/marketing_tool/components/unapproved_cell.vue View File

13
                 审核未通过:{{ activity.reason }}
13
                 审核未通过:{{ activity.reason }}
14
             </div>
14
             </div>
15
             <div class="operation">
15
             <div class="operation">
16
-                <el-button type="primary" size="small" icon="el-icon-edit-outline">编辑</el-button>
16
+                <el-button type="primary" size="small" icon="el-icon-edit-outline" @click="$router.push({ path: '/activity/modify', query: {id: activity.id} })">编辑</el-button>
17
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
17
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
18
             </div>
18
             </div>
19
         </div>
19
         </div>