diff --git a/src/components/weChat/autoReply.vue b/src/components/weChat/autoReply.vue index 822a341e8fa3ce7e13a067ffdee03162c042a76e..62ae490b2e6ee2a0d939360211a8a14ef8949ef4 100644 --- a/src/components/weChat/autoReply.vue +++ b/src/components/weChat/autoReply.vue @@ -1,7 +1,7 @@ <template> <div> <el-row type="flex" class="add-btn" justify="end"> - <el-col :span="6"> + <el-col :span="6" style="text-align: right;"> <el-button type="success" plain @click="add">æ·»åŠ å›žå¤</el-button> </el-col> </el-row> @@ -99,8 +99,6 @@ this.dialogObj.desc = res.desc; this.dialogObj.show = true; }); - console.log('edit data', data); - console.log('edit this.dialogObj', this.dialogObj); }, del(data){ this.$confirm('æ¤æ“ä½œå°†åˆ é™¤è¯¥è®°å½•?', 'æç¤º', { diff --git a/src/components/weChat/weChatResource.vue b/src/components/weChat/weChatResource.vue index 32bffc0a89d195b1abbe8f8039bc4e5ff9b757c2..1b121c64139536ba6a07131be83fc05956d65905 100644 --- a/src/components/weChat/weChatResource.vue +++ b/src/components/weChat/weChatResource.vue @@ -1,13 +1,190 @@ <template> - + <div class="media" v-loading="loading"> + <h2 class="media-title">ç´ æç®¡ç†</h2> + <div> + <ul class="media-navs"> + <!----> + <!--<li class="media-nav js_top" :class="type === 'view' ? 'media-current-nav' : ''" @click="getMediaType('view')">--> + <!--<a href="javascript:void(0);">图文消æ¯<br /></a>--> + <!--</li>--> + <li class="media-nav js_top" :class="type === 'image' ? 'media-current-nav' : ''" @click="getMediaType('image')"> + <a href="javascript:void(0);">图片<br /></a> + </li> + <!--<li class="media-nav js_top" :class="type === 'audio' ? 'media-current-nav' : ''" @click="getMediaType('audio')">--> + <!--<a href="javascript:void(0);">è¯éŸ³<br /></a>--> + <!--</li>--> + <!--<li class="media-nav js_top" :class="type === 'video' ? 'media-current-nav' : ''" @click="getMediaType('video')">--> + <!--<a href="javascript:void(0);">视频<br /></a>--> + <!--</li>--> + <!----> + </ul> + <div class="media-panel"> + <div class="media-panel-top flex-bt"> + <div class="media-panel-top-left"> + 图片(共{{total}}æ¡ï¼‰ + </div> + <div class="media-panel-top-right"> + <el-upload + class="upload-demo" + ref="upload" + action="/api/public/upload" + :show-file-list="false" + :on-success="handleUploadSuccess" + > + <el-button style="order:2;" slot="trigger" size="small" type="primary">选喿–‡ä»¶</el-button> + <!--<div slot="tip" class="el-upload__tip">大å°ä¸è¶…过5M</div>--> + </el-upload> + </div> + </div> + <div v-if="mediaList.length > 0"> + <el-table + :data="mediaList" + style="width: 100%"> + <el-table-column + prop="name" + label="åç§°"> + </el-table-column> + <el-table-column + prop="media_id" + label="mediaId"> + </el-table-column> + <el-table-column + label="URL"> + <template slot-scope="scope" v-if="type === 'image'"> + <a :href="scope.row.url"> + <img style="width: 60px;" :src="scope.row.url"/> + </a> + </template> + </el-table-column> + </el-table> + <page :total="total" v-model="nowPage"/> + </div> + </div> + </div> + </div> </template> <script> - export default { - name: "weChatResource" + import {getMediaListApi} from "../../service/api"; + export default { + name: "weChatResource", + data() { + return { + mediaList: [], + nowPage: 0, + total: 0, + loading: false, + type: 'image', + imageList: [] + } + }, + mounted(){ + this.getMediaList(this.type) + }, + methods: { + getMediaType(type){ + this.type = type; + this.nowPage = 0; + this.getMediaList(type); + }, + getMediaList(type){ + let json = { + type: type, + page: this.nowPage + }; + this.loading = true; + getMediaListApi(json).then(res=>{ + this.loading = false; + this.type = type; + this.mediaList = res.item; + this.total = res.total_count; + if (res.item.length === 0 ) { + this.$message({ + showClose: true, + message: 'æš‚æ— æ•°æ®' + }); + } + }).catch(() => { + this.loading = false; + }) + }, + handleUploadSuccess(res) { + if (res.code === 200) { + this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}] + } + } + } } </script> -<style scoped> +<style scoped lang="less"> + .flex-bt { + display: flex; + justify-content: space-between; + align-items: flex-start; + } + .el-upload__tip { + margin-right: 15px; + font-size: 13px; + color: #8d8d8d; + order: 1; + } + .upload-demo { + display: flex; + .el-upload { + order: 2; + } + } + .media { + margin-bottom: 40px; + padding: 20px; + &-title { + font-size: 26px; + font-weight: 400; + line-height: 1; + margin-bottom: 20px; + } + &-navs { + text-align: left; + line-height: 1; + border-bottom: 1px solid #E0E1E2; + font-size: 16px; + } + &-nav { + display: inline-block; + margin-right: 24px; + margin-bottom: -1px; + line-height: 40px; + a { + display: block; + text-decoration: none; + color: #353535; + width: auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + word-wrap: normal; + max-width: 120px; + } + } + &-current-nav { + border-bottom: 2px solid #1AAD19; + a { + color: #44B549; + } + } + &-panel { + padding: 24px 40px; + margin-bottom: 30px; + background-color: #FFFFFF; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.05); + .el-upload { + order: 2; + } + } + } </style>