mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
mp:支持 wx-news、wx-location 类型的消息
This commit is contained in:
parent
9e4a978f85
commit
b0386429fe
36
yudao-ui-admin/src/views/mp/components/wx-location/main.vue
Normal file
36
yudao-ui-admin/src/views/mp/components/wx-location/main.vue
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!--
|
||||||
|
【微信消息 - 定位】
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-link type="primary" target="_blank" :href="'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=' + locationY + '&pointy=' + locationX + '&name=' + label + '&ref=yudao'">
|
||||||
|
<img :src="'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|' + locationX + ',' + locationY + '&key=' + qqMapKey + '&size=250*180'">
|
||||||
|
<p/><i class="el-icon-map-location"></i>{{label}}
|
||||||
|
</el-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "wxLocation",
|
||||||
|
props: {
|
||||||
|
locationX: {
|
||||||
|
required: true,
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
locationY: {
|
||||||
|
required: true,
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
label: { // 地名
|
||||||
|
required: true,
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
qqMapKey: { // QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
||||||
|
required: false,
|
||||||
|
type: String,
|
||||||
|
default: 'TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E' // 需要自定义
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -58,23 +58,20 @@
|
|||||||
<div v-else-if="item.type === 'video' || item.type === 'shortvideo'" style="text-align: center">
|
<div v-else-if="item.type === 'video' || item.type === 'shortvideo'" style="text-align: center">
|
||||||
<wx-video-player :url="item.mediaUrl" />
|
<wx-video-player :url="item.mediaUrl" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item.type === 'link'" class="avue-card__detail">
|
<div v-else-if="item.type === 'link'" class="avue-card__detail">
|
||||||
<el-link type="success" :underline="false" target="_blank" :href="item.url">
|
<el-link type="success" :underline="false" target="_blank" :href="item.url">
|
||||||
<div class="avue-card__title"><i class="el-icon-link"></i>{{ item.title }}</div>
|
<div class="avue-card__title"><i class="el-icon-link"></i>{{ item.title }}</div>
|
||||||
</el-link>
|
</el-link>
|
||||||
<div class="avue-card__info" style="height: unset">{{item.description}}</div>
|
<div class="avue-card__info" style="height: unset">{{item.description}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO 芋艿:待完善 -->
|
<!-- TODO 芋艿:待完善 -->
|
||||||
<!-- <div v-if="item.repType == 'location'">-->
|
<div v-else-if="item.type === 'location'">
|
||||||
<!-- <el-link type="primary" target="_blank" :href="'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx='+item.repLocationY+'&pointy='+item.repLocationX+'&name='+item.repContent+'&ref=joolun'">-->
|
<wx-location :label="item.label" :location-y="item.locationY" :location-x="item.locationX" />
|
||||||
<!-- <img :src="'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|'+item.repLocationX+','+item.repLocationY+'&key='+qqMapKey+'&size=250*180'">-->
|
</div>
|
||||||
<!-- <p/><i class="el-icon-map-location"></i>{{item.repContent}}-->
|
|
||||||
<!-- </el-link>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<!-- <div v-if="item.repType == 'news'" style="width: 300px">-->
|
<div v-else-if="item.type === 'news'" style="width: 300px"> <!-- TODO 芋艿:待测试;详情页也存在类似的情况 -->
|
||||||
<!-- <WxNews :objData="item.content.articles"></WxNews>-->
|
<wx-news :articles="item.articles" />
|
||||||
<!-- </div>-->
|
</div>
|
||||||
|
|
||||||
<!-- <div v-if="item.repType == 'music'">-->
|
<!-- <div v-if="item.repType == 'music'">-->
|
||||||
<!-- <el-link type="success" :underline="false" target="_blank" :href="item.repUrl">-->
|
<!-- <el-link type="success" :underline="false" target="_blank" :href="item.repUrl">-->
|
||||||
@ -105,14 +102,17 @@
|
|||||||
// import WxNews from '@/components/wx-news/main.vue'
|
// import WxNews from '@/components/wx-news/main.vue'
|
||||||
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
|
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
|
||||||
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
|
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
|
||||||
|
import WxNews from '@/views/mp/components/wx-news/main.vue';
|
||||||
|
import WxLocation from '@/views/mp/components/wx-location/main.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "wxMsg",
|
name: "wxMsg",
|
||||||
components: {
|
components: {
|
||||||
// WxReplySelect,
|
// WxReplySelect,
|
||||||
// WxNews,
|
|
||||||
WxVideoPlayer,
|
WxVideoPlayer,
|
||||||
WxVoicePlayer
|
WxVoicePlayer,
|
||||||
|
WxNews,
|
||||||
|
WxLocation
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
wxUserId: {
|
wxUserId: {
|
||||||
@ -140,7 +140,8 @@
|
|||||||
mp: {
|
mp: {
|
||||||
nickname: '公众号',
|
nickname: '公众号',
|
||||||
avatar: require("@/assets/images/wechat.png"),
|
avatar: require("@/assets/images/wechat.png"),
|
||||||
}
|
},
|
||||||
|
qqMapKey: '' //
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
101
yudao-ui-admin/src/views/mp/components/wx-news/main.vue
Normal file
101
yudao-ui-admin/src/views/mp/components/wx-news/main.vue
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<!--
|
||||||
|
- Copyright (C) 2018-2019
|
||||||
|
- All rights reserved, Designed By www.joolun.com
|
||||||
|
【微信消息 - 图文】
|
||||||
|
芋道源码:
|
||||||
|
① 代码优化,补充注释,提升阅读性
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="news-home">
|
||||||
|
<div v-for="(article, index) in articles" :key="index" class="news-div">
|
||||||
|
<!-- 头条 -->
|
||||||
|
<a target="_blank" :href="article.url" v-if="index === 0">
|
||||||
|
<div class="news-main">
|
||||||
|
<div class="news-content">
|
||||||
|
<img class="material-img" :src="article.picUrl" width="280px" height="120px"/>
|
||||||
|
<div class="news-content-title">
|
||||||
|
<span>{{article.title}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<!-- 二条/三条等等 -->
|
||||||
|
<a target="_blank" :href="article.url" v-else>
|
||||||
|
<div class="news-main-item">
|
||||||
|
<div class="news-content-item">
|
||||||
|
<div class="news-content-item-title">{{article.title}}</div>
|
||||||
|
<div class="news-content-item-img">
|
||||||
|
<img class="material-img" :src="article.picUrl" height="100%"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "wxNews",
|
||||||
|
props: {
|
||||||
|
articles: {
|
||||||
|
type: Array // title - 标题;description - 描述;picUrl - 图片连接;url - 跳转链接
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.news-home {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
width: 100%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.news-main {
|
||||||
|
width: 100%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.news-content {
|
||||||
|
background-color: #acadae;
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.news-content-title {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: black;
|
||||||
|
width: 98%;
|
||||||
|
padding: 1%;
|
||||||
|
opacity: 0.65;
|
||||||
|
white-space: normal;
|
||||||
|
box-sizing: unset!important
|
||||||
|
}
|
||||||
|
.news-main-item {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
padding: 5px 0;
|
||||||
|
border-top: 1px solid #eaeaea;
|
||||||
|
}
|
||||||
|
.news-content-item {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.news-content-item-title {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 10px;
|
||||||
|
width: 70%;
|
||||||
|
margin-left: 1%;
|
||||||
|
white-space: normal
|
||||||
|
}
|
||||||
|
.news-content-item-img {
|
||||||
|
display: inline-block;
|
||||||
|
width: 25%;
|
||||||
|
background-color: #acadae;
|
||||||
|
margin-right: 1%;
|
||||||
|
}
|
||||||
|
.material-img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,6 +1,7 @@
|
|||||||
<!--
|
<!--
|
||||||
- Copyright (C) 2018-2019
|
- Copyright (C) 2018-2019
|
||||||
- All rights reserved, Designed By www.joolun.com
|
- All rights reserved, Designed By www.joolun.com
|
||||||
|
【微信消息 - 视频】
|
||||||
芋道源码:
|
芋道源码:
|
||||||
① bug 修复:
|
① bug 修复:
|
||||||
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<!--
|
<!--
|
||||||
- Copyright (C) 2018-2019
|
- Copyright (C) 2018-2019
|
||||||
- All rights reserved, Designed By www.joolun.com
|
- All rights reserved, Designed By www.joolun.com
|
||||||
|
【微信消息 - 语音】
|
||||||
芋道源码:
|
芋道源码:
|
||||||
① bug 修复:
|
① bug 修复:
|
||||||
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
1)joolun 的做法:使用 mediaId 从微信公众号,下载对应的 mp4 素材,从而播放内容;
|
||||||
|
@ -86,6 +86,9 @@
|
|||||||
<el-tag size="mini">链接</el-tag>:
|
<el-tag size="mini">链接</el-tag>:
|
||||||
<a :href="scope.row.url" target="_blank">{{scope.row.title}}</a>
|
<a :href="scope.row.url" target="_blank">{{scope.row.title}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="scope.row.type === 'location'">
|
||||||
|
<wx-location :label="scope.row.label" :location-y="scope.row.locationY" :location-x="scope.row.locationX" />
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-tag type="danger" size="mini">未知消息类型</el-tag>
|
<el-tag type="danger" size="mini">未知消息类型</el-tag>
|
||||||
</div>
|
</div>
|
||||||
@ -115,13 +118,15 @@ import { getMessagePage } from "@/api/mp/message";
|
|||||||
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
|
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue';
|
||||||
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
|
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue';
|
||||||
import WxMsg from '@/views/mp/components/wx-msg/main.vue';
|
import WxMsg from '@/views/mp/components/wx-msg/main.vue';
|
||||||
|
import WxLocation from '@/views/mp/components/wx-location/main.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "WxFansMsg",
|
name: "WxFansMsg",
|
||||||
components: {
|
components: {
|
||||||
WxVideoPlayer,
|
WxVideoPlayer,
|
||||||
WxVoicePlayer,
|
WxVoicePlayer,
|
||||||
WxMsg
|
WxMsg,
|
||||||
|
WxLocation
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user