|
@@ -1,197 +1,201 @@
|
|
|
<template>
|
|
|
<div style="overflow: hidden">
|
|
|
-
|
|
|
<Sticky>
|
|
|
<NavBar
|
|
|
- @click-left="onClickLeft"
|
|
|
- left-arrow
|
|
|
- left-text="返回"
|
|
|
- title="文章详情"
|
|
|
+ @click-left="onClickLeft"
|
|
|
+ left-arrow
|
|
|
+ left-text="返回"
|
|
|
+ title="文章详情"
|
|
|
>
|
|
|
<template #right>
|
|
|
- <span
|
|
|
- @click="clkgood"
|
|
|
- id="clickgood">
|
|
|
- <icon name="like-o" v-if="!isgood"/>
|
|
|
- <icon color="red" name="like" v-else/>
|
|
|
+ <span @click="clkgood" id="clickgood">
|
|
|
+ <icon name="like-o" v-if="!isgood" />
|
|
|
+ <icon color="red" name="like" v-else />
|
|
|
</span>
|
|
|
</template>
|
|
|
</NavBar>
|
|
|
</Sticky>
|
|
|
|
|
|
-
|
|
|
<div class="indexbox">
|
|
|
<Panel :desc="textdetaildata.creator_name" :title="textdetaildata.title">
|
|
|
<div>
|
|
|
- <div class="container" style="overflow: hidden"
|
|
|
- v-html="textdetaildata.content">
|
|
|
- </div>
|
|
|
+ <div
|
|
|
+ class="container"
|
|
|
+ style="overflow: hidden"
|
|
|
+ v-html="textdetaildata.content"
|
|
|
+ ></div>
|
|
|
<div class="like">
|
|
|
<span>发布日期:{{ textdetaildata.create_datetime }}</span>
|
|
|
<span>阅读量:{{ textdetaildata.read_count }}</span>
|
|
|
-
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
<template #footer>
|
|
|
- <div class="contacts" v-if="myId?true:false">
|
|
|
+ <div class="contacts" v-if="myId ? true : false">
|
|
|
<div>
|
|
|
- <h1>{{ menuberinfo }}</h1>
|
|
|
+ <h1 style="font-size: 1.5rem">{{ menuberinfo }}</h1>
|
|
|
<div>
|
|
|
<span @click="showPopup" class="iconfont icon-weixin"></span>
|
|
|
<span @click="callPhone" class="iconfont icon-dianhua"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <popup :style="{ height: '60%',width:'80vw' }"
|
|
|
- closeable
|
|
|
- close-icon="close"
|
|
|
- v-model="show">
|
|
|
+ <popup
|
|
|
+ :style="{ height: '60%', width: '80vw' }"
|
|
|
+ closeable
|
|
|
+ close-icon="close"
|
|
|
+ v-model="show"
|
|
|
+ >
|
|
|
<div id="qrcode">
|
|
|
<div class="top-color">
|
|
|
- <img :src=avatar
|
|
|
- alt=""
|
|
|
- >
|
|
|
-
|
|
|
+ <img :src="avatar" alt="" />
|
|
|
</div>
|
|
|
<div class="qrcodeimg">
|
|
|
- <span ></span>
|
|
|
- <img :src=qrcode
|
|
|
- alt="" >
|
|
|
- <p >长按识别二维码,添加 <ww-open-data type="userName" :openid=myId />企业微信</p>
|
|
|
+ <span></span>
|
|
|
+ <img :src="qrcode" alt="" />
|
|
|
+ <p>
|
|
|
+ 长按识别二维码,添加
|
|
|
+ <ww-open-data type="userName" :openid="myId" />企业微信
|
|
|
+ </p>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</popup>
|
|
|
<div>
|
|
|
- <img :src=avatar
|
|
|
- alt=""
|
|
|
- style="width: 15vw;height: 15vw;border-radius: 50%;">
|
|
|
+ <img
|
|
|
+ :src="avatar"
|
|
|
+ alt=""
|
|
|
+ style="width: 15vw; height: 15vw; border-radius: 50%"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</Panel>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {
|
|
|
- getArticleCategoryDetail,
|
|
|
- clkgoodInfo,
|
|
|
- getMember,
|
|
|
- getShareParmas,
|
|
|
- getparameter,
|
|
|
- postShareinfo
|
|
|
- } from "../../../../serves/prove";
|
|
|
- import {Popup, NavBar, Toast, Panel, icon, Sticky} from "vant";
|
|
|
- import storage from '../../../util/sessionStorage.js'
|
|
|
+import {
|
|
|
+ getArticleCategoryDetail,
|
|
|
+ clkgoodInfo,
|
|
|
+ getMember,
|
|
|
+ getShareParmas,
|
|
|
+ getparameter,
|
|
|
+ postShareinfo,
|
|
|
+} from "../../../../serves/prove";
|
|
|
+import { Popup, NavBar, Toast, Panel, icon, Sticky } from "vant";
|
|
|
+import storage from "../../../util/sessionStorage.js";
|
|
|
|
|
|
export default {
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
textdetaildata: {},
|
|
|
article_id: "",
|
|
|
- isgood: '',
|
|
|
+ isgood: "",
|
|
|
show: false,
|
|
|
- menuberinfo: '',
|
|
|
- avatar: '',
|
|
|
- qrcode: '',
|
|
|
- phone: '',
|
|
|
- myId: '',
|
|
|
+ menuberinfo: "",
|
|
|
+ avatar: "",
|
|
|
+ qrcode: "",
|
|
|
+ phone: "",
|
|
|
+ myId: "",
|
|
|
shareData: {
|
|
|
- title: '',
|
|
|
- desc: '',
|
|
|
- link: '',
|
|
|
- imgUrl: ''
|
|
|
- }
|
|
|
- }
|
|
|
+ title: "",
|
|
|
+ desc: "",
|
|
|
+ link: "",
|
|
|
+ imgUrl: "",
|
|
|
+ },
|
|
|
+ };
|
|
|
},
|
|
|
components: {
|
|
|
- Popup, NavBar, Panel, icon, Sticky
|
|
|
+ Popup,
|
|
|
+ NavBar,
|
|
|
+ Panel,
|
|
|
+ icon,
|
|
|
+ Sticky,
|
|
|
},
|
|
|
created() {
|
|
|
- if (!this.$route.query.id || this.$route.query.id === "" || this.$route.query.id === "undefined") {
|
|
|
+ if (
|
|
|
+ !this.$route.query.id ||
|
|
|
+ this.$route.query.id === "" ||
|
|
|
+ this.$route.query.id === "undefined"
|
|
|
+ ) {
|
|
|
Toast("页面参数错误");
|
|
|
- return false
|
|
|
+ return false;
|
|
|
}
|
|
|
this.article_id = this.$route.query.id;
|
|
|
if (!this.myId) {
|
|
|
- this.myId = storage.getLocalstorage('user_id')
|
|
|
+ this.myId = storage.getLocalstorage("user_id");
|
|
|
}
|
|
|
- if (this.myId != null && this.myId !== '' && this.myId !== 'undefined') {
|
|
|
- this.getMemberapi(this.myId)
|
|
|
+ if (this.myId != null && this.myId !== "" && this.myId !== "undefined") {
|
|
|
+ this.getMemberapi(this.myId);
|
|
|
}
|
|
|
// this.myId = 'WeiQiJia'
|
|
|
- this.getUserIdparameter({'url': location.href.split('#')[0]})
|
|
|
+ this.getUserIdparameter({ url: location.href.split("#")[0] });
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
this.textdetailapi(this.article_id, this.myId);
|
|
|
},
|
|
|
methods: {
|
|
|
//底部弹出
|
|
|
- showPopup () {
|
|
|
+ showPopup() {
|
|
|
this.show = true;
|
|
|
},
|
|
|
//点赞接口
|
|
|
- clkgood () {
|
|
|
+ clkgood() {
|
|
|
if (this.isgood) {
|
|
|
- Toast.fail('不能取消点赞');
|
|
|
+ Toast.fail("不能取消点赞");
|
|
|
} else {
|
|
|
- clkgoodInfo(this.article_id, this.myId)
|
|
|
- this.isgood = true
|
|
|
- Toast.success('点赞成功');
|
|
|
+ clkgoodInfo(this.article_id, this.myId);
|
|
|
+ this.isgood = true;
|
|
|
+ Toast.success("点赞成功");
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
//文章详情接口
|
|
|
- async textdetailapi (id, userId) {
|
|
|
+ async textdetailapi(id, userId) {
|
|
|
const res = await getArticleCategoryDetail(id, userId);
|
|
|
if (res.code === 2000) {
|
|
|
this.textdetaildata = res.data;
|
|
|
this.isgood = res.data.like;
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
- this.$router.go(-1)
|
|
|
+ this.$router.go(-1);
|
|
|
},
|
|
|
//分享到对话框
|
|
|
- shareDialogue () {
|
|
|
+ shareDialogue() {
|
|
|
window.wx.invoke(
|
|
|
- "shareAppMessage", {
|
|
|
- title: '', // 分享标题
|
|
|
- desc: '', // 分享描述
|
|
|
- link: '', // 分享链接
|
|
|
- imgUrl: '', // 分享封面
|
|
|
- enableIdTrans: 0, // 是否开启id转译,不填默认为0
|
|
|
- }, function (res) {
|
|
|
- if (res.err_msg === "shareAppMessage:ok") {
|
|
|
- //正确处理
|
|
|
- } else {
|
|
|
- //错误处理
|
|
|
+ "shareAppMessage",
|
|
|
+ {
|
|
|
+ title: "", // 分享标题
|
|
|
+ desc: "", // 分享描述
|
|
|
+ link: "", // 分享链接
|
|
|
+ imgUrl: "", // 分享封面
|
|
|
+ enableIdTrans: 0, // 是否开启id转译,不填默认为0
|
|
|
+ },
|
|
|
+ function (res) {
|
|
|
+ if (res.err_msg === "shareAppMessage:ok") {
|
|
|
+ //正确处理
|
|
|
+ } else {
|
|
|
+ //错误处理
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
);
|
|
|
},
|
|
|
//获取个人信息 //WeiQiJia
|
|
|
- async getMemberapi (user_id) {
|
|
|
- const res = await getMember(user_id)
|
|
|
+ async getMemberapi(user_id) {
|
|
|
+ const res = await getMember(user_id);
|
|
|
if (res.code === 2000) {
|
|
|
- this.menuberinfo = res.data.name
|
|
|
- this.avatar = res.data.avatar
|
|
|
- this.phone = res.data.tel
|
|
|
- this.qrcode = res.data.qrcode
|
|
|
+ this.menuberinfo = res.data.name;
|
|
|
+ this.avatar = res.data.avatar;
|
|
|
+ this.phone = res.data.tel;
|
|
|
+ this.qrcode = res.data.qrcode;
|
|
|
}
|
|
|
},
|
|
|
//打电话
|
|
|
- callPhone () {
|
|
|
- window.location.href = 'tel:'+ this.phone
|
|
|
+ callPhone() {
|
|
|
+ window.location.href = "tel:" + this.phone;
|
|
|
},
|
|
|
//获取分享参数 在wx.ready执行分享的事件分享到朋友/朋友圈等
|
|
|
- async getShareParmasinfo (id,myId) {
|
|
|
- const res = await getShareParmas(id,myId);
|
|
|
+ async getShareParmasinfo(id, myId) {
|
|
|
+ const res = await getShareParmas(id, myId);
|
|
|
let { title, desc, link, image } = res.data;
|
|
|
this.shareData.title = title;
|
|
|
this.shareData.desc = desc;
|
|
@@ -204,17 +208,17 @@ export default {
|
|
|
imgUrl: image, // 分享图标
|
|
|
enableIdTrans: 0, // 是否开启id转译,不填默认为0
|
|
|
success: function () {
|
|
|
- postShareinfo({'article':id,'userid':myId})
|
|
|
+ postShareinfo({ article: id, userid: myId });
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
},
|
|
|
error: function (res) {
|
|
|
- if (res.errMsg.indexOf('no permission') > 0) {
|
|
|
- alert.log('未agentConfig')
|
|
|
+ if (res.errMsg.indexOf("no permission") > 0) {
|
|
|
+ alert.log("未agentConfig");
|
|
|
}
|
|
|
},
|
|
|
cancel: function () {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
window.wx.onMenuShareTimeline({
|
|
|
title: title, // 分享标题
|
|
@@ -222,16 +226,16 @@ export default {
|
|
|
imgUrl: image, // 分享图标
|
|
|
enableIdTrans: 0, // 是否开启id转译,不填默认为0
|
|
|
success: function () {
|
|
|
- postShareinfo({'article':id,'userid':myId})
|
|
|
+ postShareinfo({ article: id, userid: myId });
|
|
|
},
|
|
|
error: function (res) {
|
|
|
- if (res.errMsg.indexOf('no permission') > 0) {
|
|
|
- alert('未agentConfig')
|
|
|
+ if (res.errMsg.indexOf("no permission") > 0) {
|
|
|
+ alert("未agentConfig");
|
|
|
}
|
|
|
},
|
|
|
cancel: function () {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
window.wx.onMenuShareWechat({
|
|
|
title: title, // 分享标题
|
|
@@ -240,106 +244,108 @@ export default {
|
|
|
imgUrl: image, // 分享图标
|
|
|
enableIdTrans: 0, // 是否开启id转译,不填默认为0
|
|
|
success: function () {
|
|
|
- postShareinfo({'article':id,'userid':myId})
|
|
|
+ postShareinfo({ article: id, userid: myId });
|
|
|
},
|
|
|
error: function (res) {
|
|
|
- if (res.errMsg.indexOf('no permission') > 0) {
|
|
|
- alert('未agentConfig')
|
|
|
+ if (res.errMsg.indexOf("no permission") > 0) {
|
|
|
+ alert("未agentConfig");
|
|
|
}
|
|
|
},
|
|
|
cancel: function () {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
//config
|
|
|
- async getUserIdparameter (url) {
|
|
|
- let result = await getparameter(url)
|
|
|
+ async getUserIdparameter(url) {
|
|
|
+ let result = await getparameter(url);
|
|
|
if (result.code !== 2000) {
|
|
|
- Toast(result.msg)
|
|
|
- return false;
|
|
|
+ Toast(result.msg);
|
|
|
+ return false;
|
|
|
}
|
|
|
- let { appId, agentid, timestamp, nonceStr, signature, agent_signature } = result.data;
|
|
|
+ let { appId, agentid, timestamp, nonceStr, signature, agent_signature } =
|
|
|
+ result.data;
|
|
|
this._Config(appId, timestamp, nonceStr, signature)
|
|
|
- .then(data=> {
|
|
|
- return this.getShareParmasinfo(this.article_id, this.myId)
|
|
|
- })
|
|
|
- .catch(data => {
|
|
|
- Toast(data)
|
|
|
- })
|
|
|
- },
|
|
|
- _Config (appId, timestamp, nonceStr, signature) {
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- const wx = window.wx;
|
|
|
- if (!wx) {
|
|
|
- reject("企业微信apk引入失败,尝试刷新页面!")
|
|
|
- }
|
|
|
- wx.config({
|
|
|
- beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
|
|
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
- appId: appId, // 必填,企业微信的corpID
|
|
|
- timestamp: timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
|
- jsApiList: ["agentConfig", "onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareWechat"], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
|
|
|
- });
|
|
|
- wx.ready(function () {
|
|
|
- resolve()
|
|
|
- });
|
|
|
- wx.error(function (res) {
|
|
|
- reject("注入权限验证失败")
|
|
|
- })
|
|
|
+ .then((data) => {
|
|
|
+ return this.getShareParmasinfo(this.article_id, this.myId);
|
|
|
})
|
|
|
+ .catch((data) => {
|
|
|
+ Toast(data);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ _Config(appId, timestamp, nonceStr, signature) {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ const wx = window.wx;
|
|
|
+ if (!wx) {
|
|
|
+ reject("企业微信apk引入失败,尝试刷新页面!");
|
|
|
+ }
|
|
|
+ wx.config({
|
|
|
+ beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
|
|
+ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
+ appId: appId, // 必填,企业微信的corpID
|
|
|
+ timestamp: timestamp, // 必填,生成签名的时间戳
|
|
|
+ nonceStr: nonceStr, // 必填,生成签名的随机串
|
|
|
+ signature: signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
|
+ jsApiList: [
|
|
|
+ "agentConfig",
|
|
|
+ "onMenuShareTimeline",
|
|
|
+ "onMenuShareAppMessage",
|
|
|
+ "onMenuShareWechat",
|
|
|
+ ], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
|
|
|
+ });
|
|
|
+ wx.ready(function () {
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ wx.error(function (res) {
|
|
|
+ reject("注入权限验证失败");
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
_agentConfig(appId, agentid, timestamp, nonceStr, agent_signature) {
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
- const wx = window.wx;
|
|
|
+ const wx = window.wx;
|
|
|
if (!wx) {
|
|
|
- reject("企业微信apk引入失败,尝试刷新页面!")
|
|
|
+ reject("企业微信apk引入失败,尝试刷新页面!");
|
|
|
}
|
|
|
wx.agentConfig({
|
|
|
- corpid: appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
|
- agentid: agentid, // 必填,企业微信的应用id (e.g. 1000247)
|
|
|
- timestamp: timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: agent_signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
|
|
|
- jsApiList: ['getContext', 'getCurExternalContact'], //必填,传入需要使用的接口名称
|
|
|
- success: function (res) {
|
|
|
- resolve()
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- if (res.errMsg.indexOf('function not exist') > -1) {
|
|
|
- reject("版本过低请升级")
|
|
|
- } else {
|
|
|
- reject("应用注入权限验证失败")
|
|
|
- }
|
|
|
+ corpid: appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
|
+ agentid: agentid, // 必填,企业微信的应用id (e.g. 1000247)
|
|
|
+ timestamp: timestamp, // 必填,生成签名的时间戳
|
|
|
+ nonceStr: nonceStr, // 必填,生成签名的随机串
|
|
|
+ signature: agent_signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
|
|
|
+ jsApiList: ["getContext", "getCurExternalContact"], //必填,传入需要使用的接口名称
|
|
|
+ success: function (res) {
|
|
|
+ resolve();
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ if (res.errMsg.indexOf("function not exist") > -1) {
|
|
|
+ reject("版本过低请升级");
|
|
|
+ } else {
|
|
|
+ reject("应用注入权限验证失败");
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
+img {
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 100%;
|
|
|
+}
|
|
|
|
|
|
+.indexbox {
|
|
|
+ width: 90vw;
|
|
|
+ // height: 0vh !important;
|
|
|
+ margin: 0 auto;
|
|
|
+ box-sizing: border-box;
|
|
|
+ overflow-y: auto;
|
|
|
|
|
|
- img {
|
|
|
- max-width: 100%;
|
|
|
- max-height: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- .indexbox {
|
|
|
- width: 90vw;
|
|
|
- // height: 0vh !important;
|
|
|
- margin: 0 auto;
|
|
|
- padding-top: 2rem;
|
|
|
- box-sizing: border-box;
|
|
|
- overflow-y: auto;
|
|
|
-
|
|
|
- .imgStyle {
|
|
|
- position: absolute;
|
|
|
- display: flex;
|
|
|
+ .imgStyle {
|
|
|
+ position: absolute;
|
|
|
+ display: flex;
|
|
|
left: -1vw;
|
|
|
width: 18vw;
|
|
|
margin-left: 1vw;
|
|
@@ -381,7 +387,7 @@ export default {
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
|
|
|
- .qrcodeimg{
|
|
|
+ .qrcodeimg {
|
|
|
width: 100%;
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
@@ -394,20 +400,20 @@ export default {
|
|
|
width: 50vw;
|
|
|
height: 50vw;
|
|
|
}
|
|
|
- span{
|
|
|
+ span {
|
|
|
display: block;
|
|
|
width: 80%;
|
|
|
height: 1rem;
|
|
|
border-radius: 30px;
|
|
|
background: linear-gradient(to right, #a1c4fd, #c2e9fb);
|
|
|
}
|
|
|
- p{
|
|
|
+ p {
|
|
|
font-size: 1rem;
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
}
|
|
|
.top-color {
|
|
|
- width:100%;
|
|
|
+ width: 100%;
|
|
|
height: 10rem;
|
|
|
background-image: linear-gradient(to bottom, #3974c7, #f2f4f8);
|
|
|
display: flex;
|
|
@@ -421,7 +427,6 @@ export default {
|
|
|
height: 6rem;
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -499,6 +504,4 @@ export default {
|
|
|
.pith {
|
|
|
background: gray !important;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
</style>
|