初始化
This commit is contained in:
		
							
								
								
									
										66
									
								
								packages/wechat/AppBuddyMessage/AppBuddyMessage.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								packages/wechat/AppBuddyMessage/AppBuddyMessage.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| <template> | ||||
|   <div class="doc-circulation ailist-wrapper"> | ||||
|     <keep-alive :include="['List']"> | ||||
|       <component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component> | ||||
|     </keep-alive> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   import List from './components/List' | ||||
|   import Add from './components/Add' | ||||
|  | ||||
|   export default { | ||||
|     name: 'AppBuddyMessage', | ||||
|     label: '好友欢迎语', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         component: 'List', | ||||
|         params: {}, | ||||
|         include: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     components: { | ||||
|       Add, | ||||
|       List | ||||
|     }, | ||||
|  | ||||
|     mounted () { | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       onChange (data) { | ||||
|         if (data.type === 'Add') { | ||||
|           this.component = 'Add' | ||||
|           this.params = data.params | ||||
|         } | ||||
|  | ||||
|         if (data.type === 'list') { | ||||
|           this.component = 'List' | ||||
|           this.params = data.params | ||||
|  | ||||
|           this.$nextTick(() => { | ||||
|             if (data.isRefresh) { | ||||
|               this.$refs.component.getList() | ||||
|             } | ||||
|           }) | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss"> | ||||
|   .doc-circulation { | ||||
|     height: 100%; | ||||
|     background: #F3F6F9; | ||||
|     overflow: auto; | ||||
|   } | ||||
| </style> | ||||
							
								
								
									
										378
									
								
								packages/wechat/AppBuddyMessage/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										378
									
								
								packages/wechat/AppBuddyMessage/components/Add.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,378 @@ | ||||
| <template> | ||||
|   <ai-detail> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="新建欢迎语" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title> | ||||
|     </template> | ||||
|  | ||||
|     <template slot="content"> | ||||
|       <ai-card> | ||||
|         <template #title> | ||||
|           <div class="ai-card__title"> | ||||
|             <h2>基本信息</h2> | ||||
|             <span>*一个成员如果被设置了多个欢迎语,将会使用最新设置或修改的欢迎语</span> | ||||
|           </div> | ||||
|         </template> | ||||
|  | ||||
|         <template #content> | ||||
|           <el-form class="ai-form" :rules="rules" ref="userForm" :model="form" label-width="100px" label-position="right"> | ||||
|             <el-form-item label="使用成员" prop="users" style="width: 100%"> | ||||
|               <el-input size="small" placeholder="请选择..." disabled v-model="users"> | ||||
|                 <ai-wechat-selecter slot="append" :instance="instance" v-model="form.users"> | ||||
|                   <el-button type="info">选择</el-button> | ||||
|                 </ai-wechat-selecter> | ||||
|               </el-input> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|  | ||||
|       <ai-card title="发送欢迎语"> | ||||
|         <template #content> | ||||
|           <el-form class="ai-form" ref="form" :model="form" label-width="110px" label-position="right"> | ||||
|             <el-form-item class="el-form-item__textarea" label="文本内容" prop="explain" style="width: 100%"> | ||||
|               <span @click="insertNickname" class="el-form-item__btn" type="text">[插入居民昵称]</span> | ||||
|               <el-input type="textarea" placeholder="请输入…" v-model="form.content" maxlength="1000" :rows="5" show-word-limit></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="其他类型" prop="explain" style="width: 100%"> | ||||
|               <el-radio-group v-model="form.type" @change="onTypeChange"> | ||||
|                 <el-radio label="image">图片</el-radio> | ||||
|                 <el-radio label="link">链接</el-radio> | ||||
|                 <el-radio label="video">视频</el-radio> | ||||
|                 <el-radio label="miniapp">小程序</el-radio> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="图片" prop="files" style="width: 100%" v-if="form.type === 'image'"> | ||||
|               <ai-uploader :instance="instance" isWechat v-model="form.files" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="链接" prop="linkUrl" style="width: 100%" v-if="form.type === 'link'"> | ||||
|               <el-input placeholder="链接地址请以http或https开头" :rows="2" type="textarea" v-model="form.linkUrl"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="链接图片地址" prop="picUrl" style="width: 100%" v-if="form.type === 'link'"> | ||||
|               <ai-uploader :instance="instance" v-model="form.picUrl" :limit="1"></ai-uploader> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="链接标题" prop="title" style="width: 100%" v-if="form.type === 'link'"> | ||||
|               <el-input placeholder="请输入链接标题" v-model="form.title"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="视频" prop="files" style="width: 100%" v-if="form.type === 'video'"> | ||||
|               <ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="form.files" :limit="1" url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader> | ||||
|             </el-form-item> | ||||
|             <!-- <el-form-item label="小程序" prop="applets" style="width: 100%" v-if="form.type === 'miniapp'"> | ||||
|               <el-radio-group v-model="form.applets"> | ||||
|                 <div class="appletss"> | ||||
|                   <div class="applets-item" @click="form.applets = '0'" :class="[form.applets === '0' ? 'applets-active' : '']"> | ||||
|                     <el-radio label="0"></el-radio> | ||||
|                     <img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png"> | ||||
|                     <span>小程序</span> | ||||
|                   </div> | ||||
|                   <div class="applets-item" @click="form.applets = '1'" :class="[form.applets === '1' ? 'applets-active' : '']"> | ||||
|                     <el-radio label="1"></el-radio> | ||||
|                     <img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png"> | ||||
|                     <span>小程序</span> | ||||
|                   </div> | ||||
|                   <div class="applets-item" @click="form.applets = '2'" :class="[form.applets === '2' ? 'applets-active' : '']"> | ||||
|                     <el-radio label="2"></el-radio> | ||||
|                     <img src="http://www.9665.com/uploadfile/2018/0607/20180607042142312.png"> | ||||
|                     <span>小程序</span> | ||||
|                   </div> | ||||
|                 </div> | ||||
|               </el-radio-group> | ||||
|             </el-form-item> --> | ||||
|             <el-form-item label="小程序标题" prop="title" style="width: 100%" v-if="form.type === 'miniapp'"> | ||||
|               <el-input placeholder="请输入小程序标题" v-model="form.title"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="小程序APPID" prop="appid" style="width: 100%" v-if="form.type === 'miniapp'"> | ||||
|               <el-input placeholder="请输入小程序APPID" v-model="form.appid"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="小程序跳转页面" prop="page" style="width: 100%" v-if="form.type === 'miniapp'"> | ||||
|               <el-input placeholder="如pages/home/Home" v-model="form.page"></el-input> | ||||
|             </el-form-item> | ||||
|             <el-form-item label="小程序图片" prop="files" style="width: 100%" v-if="form.type === 'miniapp'"> | ||||
|               <ai-uploader :instance="instance" v-model="form.files" isWechat :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader> | ||||
|             </el-form-item> | ||||
|           </el-form> | ||||
|         </template> | ||||
|       </ai-card> | ||||
|     </template> | ||||
|  | ||||
|     <template #footer> | ||||
|       <el-button @click="cancel">取消</el-button> | ||||
|       <el-button type="primary" @click="confirm">提交</el-button> | ||||
|     </template> | ||||
|   </ai-detail> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   const validateUser = (rule, value, callback) => { | ||||
|     if (!value.length) { | ||||
|       callback(new Error('请选择使用成员')) | ||||
|     } else { | ||||
|       callback() | ||||
|     } | ||||
|   } | ||||
|   export default { | ||||
|     name: 'Add', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object, | ||||
|       params: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         isShow: false, | ||||
|         info: {}, | ||||
|         form: { | ||||
|           users: [], | ||||
|           appId: '', | ||||
|           page: '', | ||||
|           title: '', | ||||
|           miniappImg: [], | ||||
|           picUrl: [], | ||||
|           content: '', | ||||
|           files: [], | ||||
|           linkUrl: '', | ||||
|           isRemind: true, | ||||
|           type: 'text' | ||||
|         }, | ||||
|         rules: { | ||||
|           users: [ | ||||
|             { required: true, message: '请选择使用成员', trigger: 'change' }, | ||||
|             { validator: validateUser, trigger: 'change' } | ||||
|           ] | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     computed: { | ||||
|       users () { | ||||
|         return this.form.users.map(v => v.name).join(',') | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     created () { | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getInfo (id) { | ||||
|         this.instance.post(`/app/appleavemessage/queryDetailById?id=${id}`).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.info = res.data | ||||
|             this.info.appLeaveMessageReplyList = res.data.appLeaveMessageReplyList.map(item => { | ||||
|               item.images = JSON.parse(item.images).map(item => { | ||||
|                 return { | ||||
|                   ...item, | ||||
|                   url: item.accessUrl | ||||
|                 } | ||||
|               }) | ||||
|  | ||||
|               return item | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       validateUser (rule, value, callback) { | ||||
|         if (!value.length) { | ||||
|           callback(new Error('请选择使用成员')) | ||||
|         } else { | ||||
|           callback() | ||||
|         } | ||||
|       }, | ||||
|  | ||||
|       onClose () { | ||||
|         this.form.explain = '' | ||||
|       }, | ||||
|  | ||||
|       onTypeChange () { | ||||
|         this.form.files = [] | ||||
|         this.form.picUrl = [] | ||||
|         this.form.appId = '' | ||||
|         this.form.page = '' | ||||
|         this.form.title = '' | ||||
|         this.form.miniappImg = [] | ||||
|         this.form.linkUrl = '' | ||||
|       }, | ||||
|  | ||||
|       insertNickname () { | ||||
|         this.form.content = this.form.content + '[用户昵称]' | ||||
|       }, | ||||
|  | ||||
|       onChange () { | ||||
|  | ||||
|       }, | ||||
|  | ||||
|       confirm () { | ||||
|         this.$refs.userForm.validate((valid) => { | ||||
|           if (valid) { | ||||
|             if (this.form.type === 'text' && !this.form.content) { | ||||
|               return this.$message.error('请输入消息内容') | ||||
|             } | ||||
|  | ||||
|             if (this.form.type === 'image' && !this.form.files.length) { | ||||
|               return this.$message.error('请上传图片') | ||||
|             } | ||||
|             // if (this.form.type === 'file' && !this.form.files.length) { | ||||
|             //   return this.$message.error('请上传附件') | ||||
|             // } | ||||
|             if (this.form.type === 'video' && !this.form.files.length) { | ||||
|               return this.$message.error('请上传视频') | ||||
|             } | ||||
|             if (this.form.type === 'link' && !this.form.linkUrl) { | ||||
|               return this.$message.error('请输入链接') | ||||
|             } | ||||
|             if (this.form.type === 'link' && !this.form.picUrl.length) { | ||||
|               return this.$message.error('请输入链接图片') | ||||
|             } | ||||
|             if (this.form.type === 'link' && !this.form.title) { | ||||
|               return this.$message.error('请输入链接标题') | ||||
|             } | ||||
|             if (this.form.type === 'miniapp' && !this.form.title) { | ||||
|               return this.$message.error('请输入小程序标题') | ||||
|             } | ||||
|             if (this.form.type === 'miniapp' && !this.form.appid) { | ||||
|               return this.$message.error('请输入小程序appid') | ||||
|             } | ||||
|             if (this.form.type === 'miniapp' && !this.form.page) { | ||||
|               return this.$message.error('请输入小程序page') | ||||
|             } | ||||
|             if (this.form.type === 'miniapp' && !this.form.files.length) { | ||||
|               return this.$message.error('请上传小程序图片') | ||||
|             } | ||||
|  | ||||
|             this.instance.post(`/app/wxcp/wxwelcomeword/add`, { | ||||
|               type: '1', | ||||
|               content: this.form.content || '', | ||||
|               isNotify: '0', | ||||
|               media: { | ||||
|                 createdAt: this.form.files.length ? this.form.files[0].media.createdAt : '', | ||||
|                 file: this.form.files.length ? this.form.files[0] : {}, | ||||
|                 mediaId: this.form.files.length ? this.form.files[0].media.mediaId : '', | ||||
|                 sysFileId: this.form.files.length ? this.form.files[0].id : '', | ||||
|                 type: this.form.type, | ||||
|                 linkUrl: this.form.type === 'link' && this.form.linkUrl ? this.form.linkUrl : '', | ||||
|                 title: this.form.title, | ||||
|                 appId: this.form.appid, | ||||
|                 page: this.form.page, | ||||
|                 picUrl: this.form.type === 'link' ? this.form.picUrl[0].url : '' | ||||
|               }, | ||||
|               users: this.form.users.map(item => { | ||||
|                 return { | ||||
|                   type: 0, | ||||
|                   objectId: item.id, | ||||
|                   objectName: item.name | ||||
|                 } | ||||
|               }) | ||||
|             }).then(res => { | ||||
|               if (res.code == 0) { | ||||
|                 this.$message.success('提交成功') | ||||
|                 setTimeout(() => { | ||||
|                   this.cancel(true) | ||||
|                 }, 600) | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       cancel (isRefresh) { | ||||
|         this.$emit('change', { | ||||
|           type: 'list', | ||||
|           isRefresh: isRefresh ? true : false | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style scoped lang="scss"> | ||||
|   .ai-card__title { | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|  | ||||
|     h2 { | ||||
|       margin-right: 20px; | ||||
|       color: #222222; | ||||
|       font-size: 16px; | ||||
|       font-weight: 700; | ||||
|     } | ||||
|  | ||||
|     span { | ||||
|       color: #888888; | ||||
|       font-size: 14px; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .appletss { | ||||
|     display: flex; | ||||
|     flex-wrap: wrap; | ||||
|  | ||||
|     .applets-item { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       width: 400px; | ||||
|       height: 60px; | ||||
|       margin-right: 8px; | ||||
|       margin-bottom: 8px; | ||||
|       padding: 0 17px; | ||||
|       background: #FFFFFF; | ||||
|       border-radius: 2px; | ||||
|       border: 1px solid #D0D4DC; | ||||
|       cursor: pointer; | ||||
|  | ||||
|       &:hover { | ||||
|         border-color: #2266FF; | ||||
|       } | ||||
|  | ||||
|       ::v-deep { | ||||
|         .el-radio__label { | ||||
|           display: none; | ||||
|         } | ||||
|       } | ||||
|  | ||||
|       img { | ||||
|         width: 40px; | ||||
|         height: 40px; | ||||
|         margin: 0 8px 0 13px; | ||||
|       } | ||||
|  | ||||
|       span { | ||||
|         color: #222222; | ||||
|         font-size: 12px; | ||||
|       } | ||||
|  | ||||
|       .el-radio { | ||||
|         margin: 0; | ||||
|       } | ||||
|  | ||||
|       &.applets-active { | ||||
|         border-color: #2266FF; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .tips { | ||||
|     position: relative; | ||||
|     top: 2px; | ||||
|     padding-left: 8px; | ||||
|     color: #222222; | ||||
|     font-size: 14px; | ||||
|   } | ||||
|  | ||||
|   .el-form-item-item__textarea  { | ||||
|     position: relative; | ||||
|   } | ||||
|  | ||||
|     .el-form-item__btn { | ||||
|       position: absolute; | ||||
|       bottom: 12px; | ||||
|       left: 12px; | ||||
|       line-height: 1; | ||||
|       z-index: 1; | ||||
|       color: #2266FF; | ||||
|       font-size: 14px; | ||||
|       user-select: none; | ||||
|       background: #fff; | ||||
|       cursor: pointer; | ||||
|     } | ||||
| </style> | ||||
							
								
								
									
										235
									
								
								packages/wechat/AppBuddyMessage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										235
									
								
								packages/wechat/AppBuddyMessage/components/List.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,235 @@ | ||||
| <template> | ||||
|   <ai-list class="message"> | ||||
|     <template slot="title"> | ||||
|       <ai-title title="好友欢迎语" isShowBottomBorder></ai-title> | ||||
|     </template> | ||||
|     <template slot="content"> | ||||
|       <ai-search-bar class="search-bar"> | ||||
|         <template #left> | ||||
|           <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd">添加好友欢迎语</el-button> | ||||
|         </template> | ||||
|         <template slot="right"> | ||||
|         </template> | ||||
|       </ai-search-bar> | ||||
|       <ai-table | ||||
|         :tableData="tableData" | ||||
|         :col-configs="colConfigs" | ||||
|         :total="total" | ||||
|         style="margin-top: 6px;" | ||||
|         :current.sync="search.current" | ||||
|         :size.sync="search.size" | ||||
|         @getList="getList"> | ||||
|         <el-table-column slot="type" width="240px" label="消息内容" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <el-popover | ||||
|               placement="bottom" | ||||
|               width="400" | ||||
|               :visible-arrow="false" | ||||
|               popper-class="wechat-message__container" | ||||
|               trigger="hover"> | ||||
|               <div class="count" slot="reference">共{{ row.count }}条</div> | ||||
|               <div class="message-info"> | ||||
|                 <h2 v-if="row.content" :style="{marginBottom: row.media ? '16px' : '0'}">{{ row.content }}</h2> | ||||
|                 <div class="message-info__wrapper" v-if="row.media && (row.media.file || row.media.type === 'link')"> | ||||
|                   <img v-if="row.media.type === 'image' || row.media.type === 'miniapp'" :src="row.media.file.url"> | ||||
|                   <video v-if="row.media.type === 'video'" :src="row.media.file.url"></video> | ||||
|                   <img v-if="row.media.type === 'link'" :src="row.media.picUrl"> | ||||
|                   <div class="message-info__wrapper--right"> | ||||
|                     <h3 v-if="row.media.type === 'miniapp'">{{ row.media.title }}</h3> | ||||
|                     <h3 v-if="row.media.type === 'image'">{{ row.media.file.name }}</h3> | ||||
|                     <h3 v-if="row.media.type === 'link'">{{ row.media.linkUrl }}</h3> | ||||
|                     <h3 v-if="row.media.type === 'video'">{{ row.media.file.name }}</h3> | ||||
|                     <p v-if="row.media.type === 'image'">{{ row.media.file.fileSizeStr }}</p> | ||||
|                     <p v-if="row.media.type === 'link'">{{ row.media.title }}</p> | ||||
|                     <p v-if="row.media.type === 'video'">{{ row.media.file.fileSizeStr }}</p> | ||||
|                   </div> | ||||
|                 </div> | ||||
|               </div> | ||||
|             </el-popover> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|         <el-table-column slot="options" width="120px" fixed="right" label="操作" align="center"> | ||||
|           <template slot-scope="{ row }"> | ||||
|             <div class="table-options"> | ||||
|               <!-- <el-button type="text" disabled @click="toAdd(row.id)" title="编辑">编辑</el-button> --> | ||||
|               <el-button type="text" @click="remove(row.id)" title="删除">删除</el-button> | ||||
|             </div> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </ai-table> | ||||
|     </template> | ||||
|   </ai-list> | ||||
| </template> | ||||
|  | ||||
| <script> | ||||
|   export default { | ||||
|     name: 'List', | ||||
|  | ||||
|     props: { | ||||
|       instance: Function, | ||||
|       dict: Object | ||||
|     }, | ||||
|  | ||||
|     data () { | ||||
|       return { | ||||
|         search: { | ||||
|           current: 1, | ||||
|           size: 10, | ||||
|           content: '' | ||||
|         }, | ||||
|         currIndex: 0, | ||||
|         total: 10, | ||||
|         colConfigs: [ | ||||
|           { prop: 'type',  label: '类型', align: 'left', width: '160', | ||||
|             render: (h, params) => { | ||||
|               let str = '' | ||||
|  | ||||
|               if (params.row.content) { | ||||
|                 str = '文字' | ||||
|               } | ||||
|  | ||||
|               if (params.row.media && params.row.media.type === 'link') { | ||||
|                 str += this.dict.getLabel('wxMsgType', params.row.media.type) ? (params.row.content ? '+' : '') + this.dict.getLabel('wxMsgType', params.row.media.type) : '' | ||||
|               } | ||||
|  | ||||
|               if (params.row.media && params.row.media.file) { | ||||
|                 str += this.dict.getLabel('wxMsgType', params.row.media.type) ? (params.row.content ? '+' : '') + this.dict.getLabel('wxMsgType', params.row.media.type) : '' | ||||
|               } | ||||
|  | ||||
|               return h('span', { | ||||
|                 style: { | ||||
|                 } | ||||
|               }, str) | ||||
|             } | ||||
|           }, | ||||
|           { slot: 'type' }, | ||||
|           { prop: 'users', label: '使用成员', align: 'left', formart: v => v.join(';') }, | ||||
|           { prop: 'createUser', label: '创建人' }, | ||||
|           { prop: 'createTime', label: '编辑时间' }, | ||||
|           { slot: 'options', label: '操作' } | ||||
|         ], | ||||
|         tableData: [] | ||||
|       } | ||||
|     }, | ||||
|  | ||||
|     mounted () { | ||||
|       this.dict.load(['wxMsgType']).then(() => { | ||||
|         this.getList() | ||||
|       }) | ||||
|     }, | ||||
|  | ||||
|     methods: { | ||||
|       getList() { | ||||
|         this.instance.post(`/app/wxcp/wxwelcomeword/list`, null, { | ||||
|           params: { | ||||
|             ...this.search | ||||
|           } | ||||
|         }).then(res => { | ||||
|           if (res.code == 0) { | ||||
|             this.tableData = res.data.records.map(item => { | ||||
|               let count = 0 | ||||
|  | ||||
|               if (item.content) { | ||||
|                 count = count + 1 | ||||
|               } | ||||
|  | ||||
|               if (item.media && item.media.type !== 'text') { | ||||
|                 count = count + 1 | ||||
|               } | ||||
|  | ||||
|               item.count = count | ||||
|               return item | ||||
|             }) | ||||
|             this.total = res.data.total | ||||
|           } | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       remove (id) { | ||||
|         this.$confirm('确定删除该数据?').then(() => { | ||||
|           this.instance.post(`/app/wxcp/wxwelcomeword/delete?id=${id}`).then(res => { | ||||
|             if (res.code == 0) { | ||||
|               this.$message.success('删除成功!') | ||||
|               this.getList() | ||||
|             } | ||||
|           }) | ||||
|         }) | ||||
|       }, | ||||
|  | ||||
|       toAdd (id) { | ||||
|         this.$emit('change', { | ||||
|           type: 'Add', | ||||
|           params: { | ||||
|             id | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
|   .message { | ||||
|     .count { | ||||
|       cursor: pointer; | ||||
|       color: #2266FF; | ||||
|       font-size: 14px; | ||||
|  | ||||
|       &:hover { | ||||
|         opacity: 0.6; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   .message-info { | ||||
|     padding: 8px; | ||||
|     min-height: 116px; | ||||
|  | ||||
|     h2 { | ||||
|       color: #222222; | ||||
|       font-weight: 500; | ||||
|       font-size: 14px; | ||||
|     } | ||||
|  | ||||
|     .message-info__wrapper { | ||||
|       display: flex; | ||||
|       align-items: center; | ||||
|       width: 368px; | ||||
|       height: 60px; | ||||
|       padding: 10px; | ||||
|       background: #FFFFFF; | ||||
|       border-radius: 2px; | ||||
|       border: 1px solid #D0D4DC; | ||||
|  | ||||
|       .message-info__wrapper--right { | ||||
|         flex: 1; | ||||
|         overflow: hidden; | ||||
|         text-overflow:ellipsis; | ||||
|         white-space: nowrap; | ||||
|       } | ||||
|  | ||||
|       h3 { | ||||
|         width: 100%; | ||||
|         color: #222222; | ||||
|         font-size: 14px; | ||||
|         overflow: hidden; | ||||
|         text-overflow:ellipsis; | ||||
|         white-space: nowrap; | ||||
|         font-weight: normal; | ||||
|       } | ||||
|  | ||||
|       img, video { | ||||
|         width: 40px; | ||||
|         height: 40px; | ||||
|         margin-right: 10px; | ||||
|         object-fit: cover; | ||||
|       } | ||||
|  | ||||
|       p { | ||||
|         margin-top: 6px; | ||||
|         font-size: 14px; | ||||
|         color: #888888; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user