Browse Source

开发创建朋友圈

liuxiaona 2 years ago
parent
commit
723bc2d41b

+ 4 - 6
.idea/workspace.xml

@@ -2,15 +2,12 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="326b77ef-a0bc-4d8a-bd1c-34c4541ee400" name="Changes" comment="">
5
-      <change afterPath="$PROJECT_DIR$/project/src/components/assembly/screen/customerServiceFC.vue" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/project/src/components/dataBoard/throwPerson/index.vue" afterDir="false" />
7 5
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8 6
       <change beforePath="$PROJECT_DIR$/project/src/assets/config/interface_api.js" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/assets/config/interface_api.js" afterDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/project/src/components/assembly/screen/customerService.vue" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/components/assembly/screen/customerService.vue" afterDir="false" />
7
+      <change beforePath="$PROJECT_DIR$/project/src/components/assembly/conTwo.vue" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/components/assembly/conTwo.vue" afterDir="false" />
8
+      <change beforePath="$PROJECT_DIR$/project/src/components/assembly/editCon.vue" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/components/assembly/editCon.vue" afterDir="false" />
10 9
       <change beforePath="$PROJECT_DIR$/project/src/components/customOperate/createFriendsCircle.vue" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/components/customOperate/createFriendsCircle.vue" afterDir="false" />
11
-      <change beforePath="$PROJECT_DIR$/project/src/components/dataBoard/thePublic.vue" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/components/dataBoard/thePublic.vue" afterDir="false" />
12
-      <change beforePath="$PROJECT_DIR$/project/src/components/dataBoard/throwPerson.vue" beforeDir="false" />
13
-      <change beforePath="$PROJECT_DIR$/project/src/router/allRouter.js" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/router/allRouter.js" afterDir="false" />
10
+      <change beforePath="$PROJECT_DIR$/project/src/style/self.scss" beforeDir="false" afterPath="$PROJECT_DIR$/project/src/style/self.scss" afterDir="false" />
14 11
     </list>
15 12
     <option name="SHOW_DIALOG" value="false" />
16 13
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -128,6 +125,7 @@
128 125
       <workItem from="1652617577799" duration="43000" />
129 126
       <workItem from="1652617650540" duration="272000" />
130 127
       <workItem from="1653271650799" duration="18349000" />
128
+      <workItem from="1653444395016" duration="24196000" />
131 129
     </task>
132 130
     <servers />
133 131
   </component>

+ 1 - 1
project/src/assets/config/interface_api.js

@@ -116,7 +116,7 @@ var api = {
116 116
   activeFansData: "/api/statistics/activeFansData",
117 117
   statistics_playletDataTrend: "/api/statistics/playletDataTrend",
118 118
   pitcherData: "/api/stat/pitcherData",
119
-  // pitcherData: "/api/momentMsg/set",
119
+  createFriendsCircleSend: "/api/momentMsg/set",
120 120
 
121 121
 };
122 122
 

+ 277 - 30
project/src/components/assembly/conTwo.vue

@@ -1,22 +1,106 @@
1 1
 <template>
2 2
   <div v-loading="loading">
3 3
     <div class="conBcg">
4
-      <template v-if="conType==0 || conType==1">
5
-        <div class="conBcgBorder">
6
-          <div class="el-icon-circle-plus f16"></div>
7
-          <div v-if="conType==0">添加图片</div>
8
-          <div v-if="conType==1">添加视频</div>
9
-        </div>
10
-      </template>
11
-      <template v-if="conType==2">
4
+      <div class="friendCircleUploader" v-show="conType==0">
5
+        <el-upload
6
+          key="imgUpload"
7
+          multiple
8
+          class="imgUploader"
9
+          :action="URL.BASEURL + URL.material_upload"
10
+          :data="imgFileData"
11
+          name="material_file"
12
+          accept=".jpg,.jpeg,.png"
13
+          list-type="picture-card"
14
+          :limit="9"
15
+          :on-preview="handleSee"
16
+          :on-remove="handleRemove"
17
+          :on-success="uploadSuccess"
18
+          :on-error='uploadFail'
19
+          :on-exceed="handleExceed">
20
+          <div>
21
+            <div class="el-icon-circle-plus f16"></div>
22
+            <div class="f14">添加图片</div>
23
+          </div>
24
+        </el-upload>
25
+        <el-dialog :visible.sync="imgVisible">
26
+          <img width="100%" :src="dialogImageUrl" alt="">
27
+        </el-dialog>
28
+      </div>
29
+      <div class="friendCircleUploader" v-show="conType==1">
30
+        <el-upload
31
+          key="videoUpload"
32
+          class="imgUploader"
33
+          :action="URL.BASEURL + URL.material_upload"
34
+          :data="videoFileData"
35
+          name="material_file"
36
+          accept=".mp4"
37
+          list-type="picture-card"
38
+          :limit="1"
39
+          :on-preview="handleSee"
40
+          :on-remove="handleRemove"
41
+          :on-success="uploadSuccess"
42
+          :on-error='uploadFail'
43
+          :on-exceed="handleExceed">
44
+          <div>
45
+            <div class="el-icon-circle-plus f16"></div>
46
+            <div class="f14">添加视频</div>
47
+          </div>
48
+        </el-upload>
49
+        <el-dialog :visible.sync="videoVisible">
50
+          <video :src="dialogVideoUrl" controls="controls" width="300px"></video>
51
+        </el-dialog>
52
+      </div>
53
+      <div v-show="conType==2" style="width: 100%">
12 54
         <div class="box">
13 55
           <div class="itemBox">
14
-            <div class="txt">图文链接:</div>
56
+            <div class="txt"><em>*</em>图文链接:</div>
15 57
             <div class="conEle">
16
-              <el-input v-model="linkAdd" size="mini" placeholder="链接地址请以http或https开头"></el-input>
58
+              <el-input v-model="linkUrl.link.url" size="mini" placeholder="链接地址请以http或https开头"></el-input>
59
+            </div>
60
+          </div>
61
+          <div class="itemBox">
62
+            <div class="txt"><em style="opacity: 0;">*</em>链接标题:</div>
63
+            <div class="conEle" style="width: 62%">
64
+              <div class="flex">
65
+                <el-input v-model="linkUrl.link.title" size="mini" placeholder="请输入链接标题"></el-input>
66
+                <span class="font_zj">{{$getStrBytes(linkUrl.link.title)}}/64字节</span>
67
+              </div>
68
+              <div class="warning_hint f12" style="margin-left:0" v-if="$getStrBytes(linkUrl.link.title)>64"> <i class="el-icon-warning-outline"></i> 链接标题,最多64个字节,已超出!</div>
17 69
             </div>
18 70
           </div>
19 71
           <div class="itemBox" style="align-items: flex-start">
72
+            <div class="txt"><em>*</em>链接封面:</div>
73
+            <div class="conEle friendCircleUploader">
74
+              <el-upload
75
+                key="coverUpload"
76
+                class="imgUploader"
77
+                :action="URL.BASEURL + URL.material_upload"
78
+                :data="imgFileData"
79
+                name="material_file"
80
+                accept=".jpg,.jpeg,.png"
81
+                list-type="picture-card"
82
+                :limit="1"
83
+                :on-preview="handleSee"
84
+                :on-remove="handleRemove"
85
+                :on-success="uploadSuccess"
86
+                :on-error='uploadFail'
87
+                :on-exceed="handleExceed">
88
+                <div>
89
+                  <div class="el-icon-circle-plus f16"></div>
90
+                  <div class="f14">添加封面</div>
91
+                </div>
92
+              </el-upload>
93
+              <el-dialog :visible.sync="coverVisible">
94
+                <img width="100%" :src="dialogcoverUrl" alt="">
95
+              </el-dialog>
96
+            </div>
97
+          </div>
98
+<!--
99
+等产品过完后再删
100
+ <template v-if="seniorFlag">
101
+
102
+          </template>
103
+    <div class="itemBox" style="align-items: flex-start">
20 104
             <div class="txt">高级设置:</div>
21 105
             <div class="conEle">
22 106
               <div>
@@ -25,26 +109,13 @@
25 109
               <div class="f12 c-666 tMar8">开启后可自定义标题和封面图</div>
26 110
             </div>
27 111
           </div>
28
-          <template v-if="seniorFlag">
29
-            <div class="itemBox">
30
-              <div class="txt">链接标题:</div>
31
-              <div class="conEle">
32
-                <el-input v-model="linkAdd" size="mini" placeholder="请输入链接标题"></el-input>
33
-              </div>
34
-            </div>
35
-            <div class="itemBox">
36
-              <div class="txt">链接封面:</div>
37
-              <div class="conEle">
38
-                <el-input v-model="linkAdd" size="mini" placeholder="请输入链接标题"></el-input>
39
-              </div>
40
-            </div>
41
-          </template>
112
+-->
42 113
         </div>
43
-      </template>
114
+      </div>
44 115
     </div>
45 116
     <div class="tips">
46
-      <template v-if="conType==0">因企业微信限制,图片长宽建议不超过1440x1080,大小不超过10M</template>
47
-      <template v-if="conType==1">因企业微信限制,视频建议不超过1280X720,帧率30FPS,视频码率1.67Mbps,最长不超过30s,最大不超过10MB</template>
117
+      <template v-if="conType==0">因企业微信限制,图片长宽建议不超过1440x1080,大小不超过10M,最多9张图片</template>
118
+      <template v-if="conType==1">因企业微信限制,视频建议不超过1280X720,帧率30FPS,视频码率1.67Mbps,最长不超过30s,最大不超过10MB,最多1个视频</template>
48 119
     </div>
49 120
   </div>
50 121
 </template>
@@ -57,18 +128,184 @@ export default {
57 128
     return{
58 129
       loading:false,
59 130
       linkAdd:'',
60
-      seniorFlag:false
131
+      seniorFlag:false,
132
+      image: {
133
+        media_id: '',
134
+        pic_url: '',
135
+      },
136
+      dialogImageUrl: false,
137
+      imgVisible: false,
138
+      imgFileData: {
139
+        admin_id: this.$cookie.getCookie('admin_id'),
140
+        ttl: this.$cookie.getCookie('ttl'),
141
+        sign: this.$cookie.getCookie('sign'),
142
+        corpid: this.$localSelfStore.getLocal('defaultCorp') && this.$localSelfStore.getLocal('defaultCorp') != 'undefined' ? JSON.parse(this.$localSelfStore.getLocal('defaultCorp')).corpid : '',
143
+        type: 1,//素材类型。1图片 2语音 3视频
144
+        need_media_id: 1,//是否需要返回media_id.0否 1是
145
+      },
146
+      coverVisible:false,
147
+      dialogcoverUrl:'',
148
+      videoVisible: false,
149
+      dialogVideoUrl:false,
150
+      videoFileData:{
151
+        admin_id: this.$cookie.getCookie('admin_id'),
152
+        ttl: this.$cookie.getCookie('ttl'),
153
+        sign: this.$cookie.getCookie('sign'),
154
+        corpid: this.$localSelfStore.getLocal('defaultCorp') && this.$localSelfStore.getLocal('defaultCorp') != 'undefined' ? JSON.parse(this.$localSelfStore.getLocal('defaultCorp')).corpid : '',
155
+        type: 3,//素材类型。1图片 2语音 3视频
156
+        need_media_id: 1,//是否需要返回media_id.0否 1是
157
+      },
158
+      imgObj:{
159
+        msgType:'image',
160
+        image:{
161
+          media_id: ''
162
+        }
163
+      },
164
+      imgUrls:[],
165
+      videoUrls:[],
166
+      linkUrl:{
167
+        msgType:'link',
168
+        link:{
169
+          title:'',
170
+          url:'',
171
+          media_id: ''
172
+        }
173
+      },
174
+      attachments: [],
61 175
     }
176
+  },
177
+  methods:{
178
+    getFinallyAttach(){
179
+      if(this.conType==0){
180
+        this.attachments = this.imgUrls
181
+      }else if(this.conType==1){
182
+        this.attachments = this.videoUrls
183
+      }else if(this.conType==2){
184
+        if(this.linkUrl.link.url==''||this.linkUrl.link.media_id==''){
185
+          this.attachments = []
186
+        }else{
187
+          this.attachments.push(this.linkUrl)
188
+        }
189
+      }
190
+      this.$parent.createFriendsCircleSend(this.attachments)
191
+    },
192
+    handleExceed(files){
193
+      if(this.conType==0){
194
+        this.$message({
195
+          message: '最多上传9张图片',
196
+          type: "warning"
197
+        })
198
+      }else if(this.conType==1){
199
+        this.$message({
200
+          message: '最多上传1个视频',
201
+          type: "warning"
202
+        })
203
+      }else if(this.conType==2){
204
+        this.$message({
205
+          message: '最多上传1个照片',
206
+          type: "warning"
207
+        })
208
+      }
209
+    },
210
+    uploadSuccess (res, file, fileList) {
211
+      if (res.errno == 0) {
212
+        if(this.conType==0){
213
+          this.imgUrls.push({
214
+            msgType:'image',
215
+            image:{
216
+              media_id: res.rst.material_id
217
+            }
218
+          })
219
+        }else if(this.conType==1){
220
+          this.videoUrls.push({
221
+            msgType:'video',
222
+            video:{
223
+              media_id: res.rst.material_id
224
+            }
225
+          })
226
+        }else if(this.conType==2){
227
+          this.linkUrl.link.media_id = res.rst.material_id
228
+        }
229
+      } else {
230
+        this.$message({
231
+          message: res.err,
232
+          type: 'warning'
233
+        })
234
+      }
235
+    },
236
+    uploadFail () {
237
+      this.$message({
238
+        message: '上传失败',
239
+        type: 'fail'
240
+      })
241
+    },
242
+    handleRemove(res,file) {
243
+      let finallyRes = res.response
244
+      if (finallyRes.errno == 0) {
245
+        if(this.conType==0){
246
+          let ids = []//所有图片的id集合
247
+          this.imgUrls.forEach(item=>{
248
+            ids.push(item.image.media_id)
249
+          })
250
+          let deleImgidx = ids.indexOf(finallyRes.rst.material_id)
251
+          this.imgUrls.splice(deleImgidx,1)
252
+        }else if(this.conType==1){
253
+          this.videoUrls=[]
254
+        }else if(this.conType==2){
255
+          this.linkUrl.link.media_id = ''
256
+        }
257
+      } else {
258
+        this.$message({
259
+          message: finallyRes.err,
260
+          type: 'warning'
261
+        })
262
+      }
263
+    },
264
+    handleSee(file) {
265
+      if(this.conType==0){
266
+        this.dialogImageUrl = file.url;
267
+        this.imgVisible = true;
268
+      }else if(this.conType==1){
269
+        this.dialogVideoUrl = file.url;
270
+        this.videoVisible = true;
271
+      }else if(this.conType==2){
272
+        this.dialogcoverUrl = file.url;
273
+        this.coverVisible = true;
274
+      }
275
+    },
276
+
277
+    beforeUploadUpload (file) {
278
+      this.$loading(this.$loadingConfig);
279
+    },
62 280
   }
63 281
 }
64 282
 </script>
65
-
283
+<style lang="scss">
284
+.friendCircleUploader{
285
+  .imgUploader{
286
+    .el-upload--picture-card{
287
+      width: 100px;
288
+      height: 100px;
289
+      display: inline-flex;
290
+      align-items: center;
291
+      justify-content: center;
292
+      line-height: 24px;
293
+    }
294
+    .el-upload-list--picture-card .el-upload-list__item{
295
+      width: 100px;
296
+      height: 100px;
297
+    }
298
+  }
299
+}
300
+</style>
66 301
 <style lang="scss" scoped>
67 302
 .conBcg{
68 303
   background-color: #fafafa;
69 304
   border: 1px solid #e9e9e9;
70 305
   padding: 10px;
71 306
   width: 54%;
307
+  display: flex;
308
+  align-items: center;
72 309
   .conBcgBorder{
73 310
     width: 100px;
74 311
     height: 100px;
@@ -80,10 +317,15 @@ export default {
80 317
     font-size: 14px;
81 318
     cursor: pointer;
82 319
     color: #999;
320
+    margin-right: 10px;
83 321
     .el-icon-circle-plus{
84 322
       color: #ddd;
85 323
       margin-bottom: 5px;
86 324
     }
325
+    img{
326
+      width: 100%;
327
+      height: 100%;
328
+    }
87 329
   }
88 330
   .box{
89 331
     .itemBox{
@@ -92,12 +334,16 @@ export default {
92 334
       font-size: 14px;
93 335
       margin-bottom: 15px;
94 336
       color: #777;
337
+      em{
338
+        color: red;
339
+        margin-right: 2px;
340
+      }
95 341
       .txt{
96 342
         flex-shrink: 0;
97 343
         margin-right: 6px;
98 344
       }
99 345
       .conEle{
100
-        width: 100%;
346
+        width: 50%;
101 347
       }
102 348
     }
103 349
   }
@@ -107,4 +353,5 @@ export default {
107 353
   font-size: 12px;
108 354
   margin-top: 10px;
109 355
 }
356
+
110 357
 </style>

+ 10 - 2
project/src/components/assembly/editCon.vue

@@ -109,7 +109,15 @@
109 109
       </div> -->
110 110
       <div class="lineItem">
111 111
         <label><em>*</em>图片:</label>
112
-        <el-upload class="avatar-uploader" :action="URL.BASEURL + URL.material_upload" name="material_file" :show-file-list="false" :data="fileData2" :on-success="uploadSuccess" :on-progress='beforeUploadUpload' :on-error='uploadFail' accept=".jpg,.jpeg,.png">
112
+        <el-upload class="avatar-uploader"
113
+                   :action="URL.BASEURL + URL.material_upload"
114
+                   name="material_file"
115
+                   :show-file-list="false"
116
+                   :data="fileData2"
117
+                   :on-success="uploadSuccess"
118
+                   :on-progress='beforeUploadUpload'
119
+                   :on-error='uploadFail'
120
+                   accept=".jpg,.jpeg,.png">
113 121
           <img v-if="image.pic_url" :src="image.pic_url" class="fm_img">
114 122
           <i v-else class="el-icon-plus avatar-uploader-icon"></i>
115 123
         </el-upload>
@@ -803,4 +811,4 @@ export default {
803 811
   line-height: 20px;
804 812
   padding-left: 6px;
805 813
 }
806
-</style>
814
+</style>

+ 133 - 234
project/src/components/customOperate/createFriendsCircle.vue

@@ -11,14 +11,14 @@
11 11
       <div class="self-hint" style="margin-top:10px;width:730px">
12 12
         <i class="el-icon-message-solid"></i>
13 13
         <div v-if="fc_type==1">管理员可创建客户朋友圈发表任务,成员确认内容后即可发布到朋友圈中,每位客户的朋友圈每个月最多展示4条企业发表的内容电脑上暂不支持发送企微朋友圈。 </div>
14
-        <div v-if="fc_type==0">管理员可创建客户朋友圈发表任务,成员确认内容后即可发布到朋友圈中,每位客户的朋友圈每天最多展示3条个人发表的内容。电脑上暂不支持发送企微朋友圈。 </div>
14
+        <div v-if="fc_type==2">管理员可创建客户朋友圈发表任务,成员确认内容后即可发布到朋友圈中,每位客户的朋友圈每天最多展示3条个人发表的内容。电脑上暂不支持发送企微朋友圈。 </div>
15 15
       </div>
16 16
       <div class="regulations">
17
-        <label>朋友圈类型:</label>
17
+        <label><em>*</em>朋友圈类型:</label>
18 18
         <div>
19 19
           <div style="display:flex">
20 20
             <el-radio v-model="fc_type" :label="1">企业发表</el-radio>
21
-            <el-radio v-model="fc_type" :label="0">个人发表</el-radio>
21
+            <el-radio v-model="fc_type" :label="2">个人发表</el-radio>
22 22
           </div>
23 23
         </div>
24 24
       </div>
@@ -28,26 +28,27 @@
28 28
       <div class="regulations">
29 29
         <label><em>*</em>朋友圈主题</label>
30 30
         <el-input placeholder="例:活动推送/拉新等" style="width:300px" v-model.trim="themeName" clearable size="small"></el-input>
31
+        <p style="font-size:13px;line-height:30px;color:#f9a527;margin-left:10px">*仅作为企业内部人员记录朋友圈摘要,不会推送给客户</p>
31 32
       </div>
32 33
       <div class="regulations">
33 34
         <label><em>*</em>发表成员:</label>
34 35
         <div>
35 36
           <div style="display:flex">
36
-            <el-radio :disabled="!editFlag" v-model="is_for_all" :label="1">全部员工</el-radio>
37
-            <el-radio :disabled="!editFlag" v-model="is_for_all" :label="0">部分员工</el-radio>
37
+            <el-radio v-model="is_for_all" :label="1">全部员工</el-radio>
38
+            <el-radio v-model="is_for_all" :label="0">部分员工</el-radio>
38 39
           </div>
39
-          <self-customerservice-f-c :disabled="!editFlag" v-if="is_for_all==0" title='' width="300px" :afferent_users='user_id_list' @customerDefine="(val)=>{user_id_list=val;}" style="margin-top: 10px"></self-customerservice-f-c>
40
+          <self-customerservice-f-c v-if="is_for_all==0" title='' width="300px" :afferent_users='user_id_list' @customerDefine="(val)=>{user_id_list=val;}" style="margin-top: 10px"></self-customerservice-f-c>
40 41
         </div>
41 42
       </div>
42 43
       <div class="regulations">
43 44
         <label><em>*</em>选择客户</label>
44 45
         <div>
45 46
           <div>
46
-            <el-radio v-model="customer_filter" :disabled="!editFlag" :label="0" @change="changeEvent">全部客户</el-radio>
47
-            <el-radio v-model="customer_filter" :disabled="!editFlag" :label="1" @change="changeEvent">筛选客户</el-radio>
47
+            <el-radio v-model="customer_filter" :label="0" @change="changeEvent">全部客户</el-radio>
48
+            <el-radio v-model="customer_filter" :label="1" @change="changeEvent">筛选客户</el-radio>
48 49
           </div>
49 50
           <div class="" v-if="customer_filter==1">
50
-            <enterprise-tag title="" width="300px" :disabled="!editFlag" :afferent_obj='afferent_tag_obj' :reset='resetFlag' @tagDefine="tagDefine" style="margin:0;margin-top: 10px"></enterprise-tag>
51
+            <enterprise-tag title="" width="300px" :afferent_obj='afferent_tag_obj' :reset='resetFlag' @tagDefine="tagDefine" style="margin:0;margin-top: 10px"></enterprise-tag>
51 52
           </div>
52 53
           <div class="customer_all">将群发消息给{{customer_filter==0?'全部客户的':customer_filter==1?'筛选客户的':''}}
53 54
             <span @click="massMsg_customerMatchCount" v-if="isLookCount" class="pointer"><i class="el-icon-loading" v-if="customerMatchCountLoading"></i> {{!customerMatchCountLoading?'查看':''}}</span>
@@ -58,16 +59,21 @@
58 59
       </div>
59 60
       <div class="regulations">
60 61
         <label>消息内容1</label>
61
-        <el-input
62
-          class="contentOne"
63
-          style="width: 50%"
64
-          type="textarea"
65
-          rows="6"
66
-          autocomplete="off"
67
-          placeholder="请输入消息内容"
68
-          v-model="content1"
69
-          show-word-limit
70
-          maxlength="1000"></el-input>
62
+        <div style="flex: 1">
63
+          <div style="position: relative">
64
+            <el-input
65
+              class="contentOne"
66
+              style="width: 56%"
67
+              type="textarea"
68
+              rows="6"
69
+              autocomplete="off"
70
+              placeholder="请输入消息内容"
71
+              v-model="content1"
72
+              clearable></el-input>
73
+            <span class="f_zj">{{$getStrBytes(content1)}}/2000字节</span>
74
+          </div>
75
+          <div class="warning_hint_fc f12" style="margin-left:0" v-if="$getStrBytes(content1)>2000"> <i class="el-icon-warning-outline"></i> 消息内容1,最多2000个字节,已超出!</div>
76
+        </div>
71 77
       </div>
72 78
       <div class="regulations">
73 79
         <label>消息内容2</label>
@@ -77,7 +83,7 @@
77 83
             <el-radio v-model="con_type" :label="1" style="width: 60px">视频</el-radio>
78 84
             <el-radio v-model="con_type" :label="2" >图文链接</el-radio>
79 85
           </div>
80
-          <conTwo :conType="con_type"></conTwo>
86
+          <conTwo :conType="con_type" ref="conTwo"></conTwo>
81 87
         </div>
82 88
       </div>
83 89
 
@@ -88,11 +94,11 @@
88 94
         <div>
89 95
           <div style="display:flex">
90 96
             <el-radio v-model="send_type" :label="1">立即发送</el-radio>
91
-            <el-radio v-model="send_type" :label="0">定时发送</el-radio>
97
+            <el-radio v-model="send_type" :label="2">定时发送</el-radio>
92 98
           </div>
93
-          <div style="margin-top:15px;" v-if="send_type==0">
94
-            <el-date-picker v-model="send_time.date" :picker-options="pickerOptions" :disabled="!editFlag" size="small" value-format="yyyy-MM-dd" type="date" style="width:160px" placeholder="选择日期"></el-date-picker>
95
-            <el-time-picker v-model="send_time.time" :disabled="!editFlag" size="small" format="HH:mm" value-format="HH:mm:ss" placeholder="请输入时间" style="width:130px"></el-time-picker>
99
+          <div style="margin-top:15px;" v-if="send_type==2">
100
+            <el-date-picker v-model="send_time.date" :picker-options="pickerOptions" size="small" value-format="yyyy-MM-dd" type="date" style="width:160px" placeholder="选择日期"></el-date-picker>
101
+            <el-time-picker v-model="send_time.time" size="small" format="HH:mm" value-format="HH:mm:ss" placeholder="请输入时间" style="width:130px"></el-time-picker>
96 102
           </div>
97 103
         </div>
98 104
       </div>
@@ -109,7 +115,7 @@
109 115
           <img v-if="processFlag" src="@/assets/img/exterprise-mass-send.png" class="img" alt="">
110 116
         </div>
111 117
       </div>
112
-      <button class="button" @click="welcomeMsg_set">通知成员发送</button>
118
+      <button class="button" @click="getAttachments">通知成员发送</button>
113 119
     </div>
114 120
   </div>
115 121
 </template>
@@ -127,36 +133,13 @@ export default {
127 133
     return {
128 134
       loading: false,
129 135
       user_id_list: [],
130
-      fc_type: 0,
131
-      editFlag: true,
132
-      is_day_parting: false,
133
-      name: '',
134
-      deleteTimeIntervalList: [],//删除的分时段列表
135
-      timeIntervalList: [],//分时段列表
136
-      init_welcom_con: {
137
-        is_day_parting: 1,//是否为分时段欢迎语 0:否 1:是
138
-        weeks: [1, 2, 3, 4, 5, 6, 0],
139
-        start_time: '',
140
-        end_time: '',
141
-        content: '',
142
-        attachments: [],
143
-      },
144
-      main_msg_data: {
145
-        "is_day_parting": 0,
146
-        "weeks": [],
147
-        "start_time": "",
148
-        "end_time": "",
149
-        "content": '',
150
-        "attachments": []
151
-      },
152
-      dataInfo: {},
136
+      fc_type: 2,
153 137
       is_for_all: 1,
154 138
       customer_filter: 0,
155 139
       gender: 3,
156 140
       customerMatchCountLoading: false,
157 141
       isLookCount: true,//是否查看群发的客户数
158 142
       msg_count: '',
159
-
160 143
       afferent_tag_obj: {
161 144
         tag_id_list: [],
162 145
         tag: 1
@@ -168,7 +151,6 @@ export default {
168 151
         date: '',
169 152
         time: ''
170 153
       },
171
-
172 154
       pickerOptions: {
173 155
         disabledDate (time) {
174 156
           return time < Date.now() - 8.64e7;
@@ -196,17 +178,112 @@ export default {
196 178
       },
197 179
       content1:'',
198 180
       con_type:0,
199
-      themeName:''
181
+      themeName:'',
182
+      tag_info: {},//标签
200 183
     }
201 184
   },
202 185
   created () {
203
-    if (this.$route.params.rule_id) {//详情
204
-      this.detail()
205
-    } else {
206
-      this.loading = false;
207
-    }
186
+
187
+    this.loading = false;
208 188
   },
209 189
   methods: {
190
+    getAttachments(){
191
+      this.$nextTick(()=>{
192
+        this.$refs.conTwo.getFinallyAttach()
193
+      })
194
+    },
195
+    createFriendsCircleSend (attachments) {//通知成员发送
196
+      if(this.fc_type==''){
197
+        this.$message({
198
+          message: '请选择朋友圈类型!',
199
+          type: "warning"
200
+        })
201
+        return
202
+      }
203
+      if(this.themeName==''){
204
+        this.$message({
205
+          message: '请输入朋友圈主题!',
206
+          type: "warning"
207
+        })
208
+        return
209
+      }
210
+      if(this.is_for_all == 0 && (this.user_id_list==[] || this.user_id_list.length == 0)){
211
+        this.$message({
212
+          message: '请选择成员!',
213
+          type: "warning"
214
+        })
215
+        return
216
+      }
217
+      console.log(attachments,'createFriendsCircleSend');
218
+      if(this.content1 == '' && (attachments&&attachments.length==0)){
219
+        this.$message({
220
+          message: '消息内容1与消息内容2不能同时为空!',
221
+          type: "warning"
222
+        })
223
+        return
224
+      }
225
+
226
+      if(this.send_type==''){
227
+        this.$message({
228
+          message: '请选择发布方式!',
229
+          type: "warning"
230
+        })
231
+        return
232
+      }
233
+      let send_time = '';
234
+      if (this.send_type == 1) {//立即发送
235
+        send_time = this.$getDay(0, true).now
236
+      } else {//定时发送
237
+        if (this.send_time.date == '') {
238
+          this.$message({
239
+            message: '请选择定时发送的日期!',
240
+            type: "warning"
241
+          })
242
+          return
243
+        }
244
+        if (this.send_time.time == '') {
245
+          this.$message({
246
+            message: '请选择定时发送的时间!',
247
+            type: "warning"
248
+          })
249
+          return
250
+        }
251
+        send_time = this.send_time.date + ' ' + this.send_time.time
252
+      }
253
+
254
+      this.$loading(this.$loadingConfig)
255
+      this.$axios.post(this.URL.BASEURL + this.URL.createFriendsCircleSend, {
256
+        rule_id: this.$route.params.rule_id ? this.$route.params.rule_id : '',
257
+        name: this.themeName,//规则标题
258
+        filter_type: this.fc_type,//朋友圈类型1企业发表 2个人发表
259
+        send_type:this.send_type,//发送类型 1立即发送 2定时发送
260
+        send_time:send_time,//发送时间
261
+        sender_list:'',//发表成员userid集合
262
+        department_list:'',//发表部门id集合
263
+        customer_filter:this.customer_filter,//。0全部客户 1筛选客户
264
+        customer_tag_list:this.tag_info && this.tag_info.tag_id_list ? this.tag_info.tag_id_list.join(',') : '',//可见客户标签集合
265
+        content:this.content1,//消息内容1
266
+        attachments:attachments ? JSON.stringify(attachments) : '',//消息2
267
+        // users: this.fc_type == 0 ? this.user_id_list.join(',') : '',
268
+      }).then((res) => {
269
+        var res = res.data
270
+        this.$loading(this.$loadingConfig).close()
271
+        if (res && res.errno == 0) {
272
+          // this.$router.go(-1)
273
+          this.$message({
274
+            message: res.err,
275
+            type: "warning"
276
+          })
277
+        } else if (res.errno != 4002) {
278
+          this.$message({
279
+            message: res.err,
280
+            type: "warning"
281
+          })
282
+        }
283
+      }).catch((err) => {
284
+        this.$loading(this.$loadingConfig).close()
285
+      });
286
+    },
210 287
     changeEvent () {
211 288
       this.isLookCount = true
212 289
     },
@@ -264,184 +341,6 @@ export default {
264 341
         this.customerMatchCountLoading = false
265 342
       });
266 343
     },
267
-    detail () {//详情
268
-      this.loading = true
269
-      this.$axios.get(this.URL.BASEURL + this.URL.welcomeMsg_detail, {
270
-        params: {
271
-          rule_id: this.$route.params.rule_id
272
-        }
273
-      }).then((res) => {
274
-        var res = res.data
275
-        this.loading = false
276
-        if (res && res.errno == 0) {
277
-          this.dataInfo = res.rst;
278
-          this.fc_type = res.rst.fc_type;
279
-          this.user_id_list = res.rst.users ? res.rst.users.split(',') : [];
280
-          this.name = res.rst.name;
281
-          let msg_list = res.rst.msg_list;
282
-          msg_list.forEach((item) => {
283
-            // item.content = item.content ? item.content.replace('%NICKNAME%', '「客户昵称」') : '';
284
-            item.attachments = item.attachments && item.attachments != '' ? JSON.parse(item.attachments) : [];
285
-            item.weeks = item.weeks ? item.weeks.split(',') : []
286
-          })
287
-          let main_msg_data = msg_list.filter((v) => {//特定有一个主欢迎语内容
288
-            return v.is_day_parting == 0
289
-          })
290
-          this.main_msg_data = main_msg_data && main_msg_data.length > 0 ? main_msg_data[0] : {};
291
-
292
-          this.timeIntervalList = msg_list.filter((v) => {//分时段欢迎语内容
293
-            return v.is_day_parting == 1
294
-          })
295
-
296
-          if (msg_list.length > 1) {
297
-            this.is_day_parting = true
298
-          }
299
-        } else if (res.errno != 4002) {
300
-          this.$message({
301
-            message: res.err,
302
-            type: "warning"
303
-          })
304
-        }
305
-      }).catch((err) => {
306
-        this.loading = false
307
-      });
308
-    },
309
-    getAttachment (val) {
310
-      this.main_msg_data.attachments = val;
311
-    },
312
-    getWelcomEdit (val, index) {//分时段编辑
313
-      this.$set(this.timeIntervalList, index, val)
314
-    },
315
-    deleteWelcomCon (index) {//删除分时段
316
-      if (this.$route.params.rule_id && this.timeIntervalList[index].msg_id) {//删除的分时段内容
317
-        let obj = JSON.parse(JSON.stringify(this.timeIntervalList[index]))
318
-        obj.operate = 'del';
319
-        this.deleteTimeIntervalList.push(obj)
320
-      }
321
-      this.timeIntervalList.splice(index, 1)
322
-    },
323
-    addWelcom () {//添加分时段
324
-      this.timeIntervalList.push(this.init_welcom_con)
325
-    },
326
-
327
-    welcomeMsg_set () {//保存
328
-      if (this.name == '') {
329
-        this.$message({
330
-          message: '请输入欢迎语标题!',
331
-          type: "warning"
332
-        })
333
-        return
334
-      }
335
-      if (this.fc_type == 0 && (!this.user_id_list || this.user_id_list.length == 0)) {
336
-        this.$message({
337
-          message: '请选择使用成员!',
338
-          type: "warning"
339
-        })
340
-        return
341
-      }
342
-      if (this.main_msg_data.content == '' && (!this.main_msg_data.attachments || this.main_msg_data.attachments == '' || this.main_msg_data.attachments.length == 0)) {
343
-        this.$message({
344
-          message: '请输入【主】欢迎语内容!',
345
-          type: "warning"
346
-        })
347
-        return
348
-      }
349
-      if (this.main_msg_data.content != '' && this.$getStrBytes(this.main_msg_data.content) > 4000) {
350
-        this.$message({
351
-          message: '请检查【主】欢迎语内容,最多4000个字节,已超出!',
352
-          type: "error"
353
-        })
354
-        return
355
-      }
356
-      let msg_data = []
357
-      if (this.is_day_parting) {//开启分段欢迎语
358
-        for (let i = 0; i < this.timeIntervalList.length; i++) {
359
-          let item = this.timeIntervalList[i];
360
-          if (item.content == '' && (!item.attachments || item.attachments == '' || item.attachments.length == 0)) {
361
-            this.$message({
362
-              message: `请输入【时段${i + 1}】欢迎语内容!`,
363
-              type: "warning"
364
-            })
365
-            return
366
-          }
367
-          if (item.content != '' && this.$getStrBytes(item.content) > 4000) {
368
-            this.$message({
369
-              message: `请检查【时段${i + 1}】欢迎语内容,最多4000个字节,已超出!`,
370
-              type: "error"
371
-            })
372
-            return
373
-          }
374
-          if (!item.weeks || item.weeks.length == 0) {
375
-            this.$message({
376
-              message: `请选择【时段${i + 1}】发送日期!`,
377
-              type: "warning"
378
-            })
379
-            return
380
-          }
381
-          if (!item.start_time || item.start_time == '') {
382
-            this.$message({
383
-              message: `请输入【时段${i + 1}】发送开始时间!`,
384
-              type: "warning"
385
-            })
386
-            return
387
-          }
388
-          if (!item.end_time || item.end_time == '') {
389
-            this.$message({
390
-              message: `请输入【时段${i + 1}】发送结束时间!`,
391
-              type: "warning"
392
-            })
393
-            return
394
-          }
395
-          if (this.$date_compatible(('2020-04-01 ' + item.start_time)).getTime() > this.$date_compatible(('2020-04-01 ' + item.end_time)).getTime()) {
396
-            this.$message({
397
-              message: `请正确输入【时段${i + 1}】发送时间!`,
398
-              type: "warning"
399
-            })
400
-            return
401
-          }
402
-        }
403
-        msg_data = msg_data.concat(this.timeIntervalList)
404
-      } else {//关闭分段欢迎语
405
-        let delete_arr = JSON.parse(JSON.stringify(this.timeIntervalList));
406
-        delete_arr = delete_arr.filter((v) => {
407
-          return v.msg_id
408
-        })
409
-        delete_arr.forEach((item) => {
410
-          item.operate = 'del'
411
-        })
412
-        this.deleteTimeIntervalList = this.deleteTimeIntervalList.concat(delete_arr)
413
-      }
414
-      msg_data = msg_data.concat(this.deleteTimeIntervalList);//删除的分时段内容
415
-
416
-      msg_data.push(this.main_msg_data)
417
-      msg_data.forEach((item) => {
418
-        item.weeks = item.weeks.join(',');
419
-        // item.content = item.content.replace('「客户昵称」', '%NICKNAME%')
420
-        item.attachments = item.attachments == '' || item.attachments.length == 0 ? '' : JSON.stringify(item.attachments)
421
-      })
422
-
423
-      this.$loading(this.$loadingConfig)
424
-      this.$axios.post(this.URL.BASEURL + this.URL.welcomeMsg_set, {
425
-        rule_id: this.$route.params.rule_id ? this.$route.params.rule_id : '',
426
-        name: this.name,
427
-        fc_type: this.fc_type,
428
-        users: this.fc_type == 0 ? this.user_id_list.join(',') : '',
429
-        msg_data: msg_data
430
-      }).then((res) => {
431
-        var res = res.data
432
-        this.$loading(this.$loadingConfig).close()
433
-        if (res && res.errno == 0) {
434
-          this.$router.go(-1)
435
-        } else if (res.errno != 4002) {
436
-          this.$message({
437
-            message: res.err,
438
-            type: "warning"
439
-          })
440
-        }
441
-      }).catch((err) => {
442
-        this.$loading(this.$loadingConfig).close()
443
-      });
444
-    }
445 344
   }
446 345
 }
447 346
 </script>

+ 27 - 0
project/src/style/self.scss

@@ -195,6 +195,33 @@
195 195
 .f61{
196 196
   font-size: 61px;
197 197
 }
198
+.warning_hint_fc {
199
+  color: red;
200
+  font-size: 13px;
201
+  margin-left: 10px;
202
+  line-height: 20px;
203
+}
204
+.f_zj {
205
+  font-size: 11px;
206
+  line-height: 20px;
207
+  padding-left: 6px;
208
+  position: absolute;
209
+  bottom: 5px;
210
+  right: 45%;
211
+}
212
+.warning_hint {
213
+  color: red;
214
+  font-size: 13px;
215
+  margin-left: 10px;
216
+  line-height: 20px;
217
+}
218
+.font_zj {
219
+  font-size: 12px;
220
+  width: 96px;
221
+  line-height: 20px;
222
+  padding-left: 6px;
223
+}
224
+
198 225
 .c-fff{
199 226
   color: #fff !important;
200 227
 }