From 10572998aa54d61c45df3e334eb01e44a15df729 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Wed, 10 Aug 2022 18:35:59 +0800 Subject: [PATCH] 常量提取,优化视频模块布局 --- src/components/mini/box-new-article.vue | 44 +++++++++++++++++++++++++++++--------------- 1 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/components/mini/box-new-article.vue b/src/components/mini/box-new-article.vue index ee2ea16..7e442d8 100644 --- a/src/components/mini/box-new-article.vue +++ b/src/components/mini/box-new-article.vue @@ -4,8 +4,12 @@ <div class="miniTag" v-if="isTop==1">置顶</div> <div class="post_cover left_radius" v-if="index%2==0"> - <a :href="jumpURL" target="_blank" class="no-underline" v-if="articleFileType==5" - @click="showMsg(articleFileType,jumpURL)"> + <router-link :to="{path:'/platform'}" :title="title" v-if="articleFileType==myConstant.fileTypeVideo"> + <div class="block left_radius"></div> + <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> + </router-link> + <a :href="jumpURL" target="_blank" class="no-underline" + v-else-if="articleFileType==myConstant.fileTypeShort" @click="showMsg(articleFileType,jumpURL)"> <div class="block left_radius"></div> <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> </a> @@ -16,27 +20,22 @@ </div> <div class="post_cover right_radius" v-else> - <a :href="jumpURL" target="_blank" class="no-underline" v-if="articleFileType==5" - @click="showMsg(articleFileType,jumpURL)"> + <router-link :to="{path:'/platform'}" :title="title" v-if="articleFileType==myConstant.fileTypeVideo"> + <div class="block left_radius"></div> + <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> + </router-link> + <a :href="jumpURL" target="_blank" class="no-underline" + v-else-if="articleFileType==myConstant.fileTypeShort" @click="showMsg(articleFileType,jumpURL)"> <div class="block left_radius"></div> <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> </a> <router-link :to="{path:'/mdDetail',query:{id:id}}" :title="title" v-else> <div class="block right_radius"></div> <img class="post_bg" :src="coverFileURL" :onerror="img404" :alt="title"> - <!-- <img class="post_bg" src="https://unpkg.zhimg.com/ahzo@1.0.3/blogpic/1.jpg" onerror="this.onerror=null,this.src="/img/404.jpg"" :alt="title"> --> </router-link> </div> <div class="recent-post-info"> - - <!-- <a :href="jumpURL" target="_blank" class="article-title" v-if="articleFileType==5" - @click="showMsg(articleFileType,jumpURL)"> - <a-icon type="lock" style="color:rgba(0,0,0,.25)" v-if="authStatus==3" /> - <a-icon type="stop" style="color:rgba(0,0,0,.25)" v-if="authStatus==2" /> - {{title}} - <a-badge :count="1" dot v-if="isAnyUpdate==1" title="最近有更新"></a-badge> - </a> --> <router-link :to="{path:'/mdDetail',query:{id:id,articleFileType:articleFileType}}" class="article-title"> @@ -58,7 +57,7 @@ <a-icon type="book" /> <router-link :to="{path:'/articleList',query:{typeId:articleTypeId}}" class="article-meta__categories"> {{articleTypeName}}</router-link> - <span v-if="articleFileType==5"> + <span v-if="articleFileType==myConstant.fileTypeShort"> <span v-if="jumpURL !=null && jumpURL!=''"> <span class="article-meta__separator" style="margin: 0px 3px ;">|</span> <span class="post-meta-date"> @@ -73,6 +72,17 @@ <a-icon type="thunderbolt" />碎碎念 </span> </span> + </span> + + <span v-if="articleFileType==myConstant.fileTypeVideo"> + <span v-if="jumpURL !=null && jumpURL!=''"> + <span class="article-meta__separator" style="margin: 0px 3px ;">|</span> + <span class="post-meta-date"> + <a-icon type="video-camera" /> + <a :href="jumpURL" target="_blank" class="no-underline"> 视频 </a> + </span> + </span> + </span> <!-- <a class="article-meta__categories" href="#"> {{tag}}</a> --> </span> @@ -90,10 +100,13 @@ NotificationOutlined } from '@ant-design/icons-vue'; + import myConstant from "../../config/myConstant.js" + + export default { methods: { showMsg(articleFileType, jumpURL) { - if (articleFileType == 5 && (jumpURL == null || jumpURL == "")) { + if (articleFileType == myConstant.fileTypeShort && (jumpURL == null || jumpURL == "")) { this.$message.info('这只是一句碎碎念,没有更多内容啦', 3); return } @@ -148,6 +161,7 @@ }, data() { return { + myConstant: myConstant, img404: "this.onerror='';this.src=\"http://t.inleft.com/share/media_photo/1.jpg\"", } } -- Gitblit v1.9.1