庄逸洲 5 лет назад
Родитель
Сommit
5b82878473

+ 10 - 0
src/api/activity/activity.js Просмотреть файл

@@ -11,4 +11,14 @@ export function fetchActivities(page, keyword, status) {
11 11
     method: 'get',
12 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 Просмотреть файл

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

+ 2 - 1
src/lang/zh.js Просмотреть файл

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

+ 11 - 0
src/router/modules/marketing_tool.js Просмотреть файл

@@ -28,5 +28,16 @@ export default {
28 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 Просмотреть файл

@@ -9,7 +9,7 @@
9 9
                     <preview-form :activity="activity" :paragraph="activity_paragraph"></preview-form>
10 10
                 </div>
11 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 13
                 </div>
14 14
             </div>
15 15
         </div>
@@ -20,6 +20,7 @@
20 20
 import BreadCrumb from "@/scrm_pages/components/bread-crumb";
21 21
 import PreviewForm from "@/scrm_pages/marketing_tool/components/edit_activity_preview_form"
22 22
 import EditForm from "@/scrm_pages/marketing_tool/components/edit_activity_edit_form"
23
+import { fetchActivity } from "@/api/activity/activity"
23 24
 
24 25
 export default {
25 26
     name: "ActivityPublish",
@@ -48,11 +49,47 @@ export default {
48 49
                 sign_up_notice: "",
49 50
             },
50 51
             activity_paragraph: {
52
+                id: 0,
51 53
                 title: "",
52 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 94
 </script>
58 95
 

+ 1 - 1
src/scrm_pages/marketing_tool/components/drafts_cell.vue Просмотреть файл

@@ -10,7 +10,7 @@
10 10
                 <a href="/">{{ activity.title }}</a>
11 11
             </h3>
12 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 14
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
15 15
             </div>
16 16
         </div>

+ 6 - 4
src/scrm_pages/marketing_tool/components/edit_activity_edit_form.vue Просмотреть файл

@@ -160,7 +160,12 @@ export default {
160 160
         },
161 161
     },
162 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 169
             this.paragraph_init_content = this.paragraph.content
165 170
         },
166 171
         paragraphContentChanged: function(content) {
@@ -172,14 +177,11 @@ export default {
172 177
             this.$message.error(err)
173 178
         },
174 179
         posterPhotoUploadSuccess: function(res, file) {
175
-            console.log(res)
176
-            console.log(file)
177 180
             this.poster_photo_file_name = file.name
178 181
             this.uploading_poster_photo = false
179 182
             this.activity.poster_photo = "https://images.shengws.com/" + res.url
180 183
         },
181 184
         beforePosterPhotoUpload: function(file) {
182
-            console.log(file)
183 185
             var is_image = file.type.indexOf("image") > -1
184 186
             var mb = file.size / 1024 / 1024
185 187
 

+ 2 - 0
src/scrm_pages/marketing_tool/components/edit_activity_preview_form.vue Просмотреть файл

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

+ 1 - 1
src/scrm_pages/marketing_tool/components/unapproved_cell.vue Просмотреть файл

@@ -13,7 +13,7 @@
13 13
                 审核未通过:{{ activity.reason }}
14 14
             </div>
15 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 17
                 <el-button type="danger" size="small" icon="el-icon-delete">删除</el-button>
18 18
             </div>
19 19
         </div>