提交 d2e1a256 编写于 作者: guofeng.chen's avatar guofeng.chen

修改分享

上级 bf4013ec
......@@ -3,6 +3,7 @@ import Vue from 'vue'
import request from '@/utils/fetch';
import wx from 'weixin-js-sdk'
import { getBaseUrl } from "@/utils/index";
import weixinJsSdk from 'weixin-js-sdk';
/** 注入配置信息 */
export const wxConfig = (link) => {
// const params = { resetURI: true, url: encodeURIComponent(location.href) };
......@@ -73,6 +74,12 @@ export const wxShare = (option = {}, successCB = () => {}) => {
});
};
function wxHideMenu() {
wx.ready(() => {
WeixinJSBridge.call('hideOptionMenu');
});
}
export const wxDisabledShare = () => {
wx.ready(() => {
wx.hideMenuItems({
......@@ -95,7 +102,7 @@ export const wxDisabledShare = () => {
* @param source
* @param option
*/
export const wechatShare = async (option = {}, successCB = () => {}) => {
export const wechatShare = (option = {}, successCB = () => {}, hideMenu) => {
const shareOption = {
link: location.href,
title: `云鹊医!`,
......@@ -106,7 +113,11 @@ export const wechatShare = async (option = {}, successCB = () => {}) => {
...option
};
wxConfig(shareOption.link);
wxShare(shareOption, successCB);
if (hideMenu) {
wxHideMenu()
} else {
wxShare(shareOption, successCB);
}
};
Vue.prototype.wechatShare = wechatShare;
......
......@@ -91,7 +91,6 @@ import CourseComment from '@/components/course/course-comment';
import Loading from "@/components/common/common-loading";
import DownloadButton from "@/components/course/download-button";
import { getPdfFileUrl, formatLeftTimeObj, deepCopy } from '@/utils';
import { wxDisabledShare } from '@/utils/wxShare';
export default {
components: {
......@@ -161,7 +160,7 @@ export default {
const { width } = this.$el.querySelector('.tab-item').getBoundingClientRect();
this.videoH = height;
this.tabW = width;
wxDisabledShare();
this.wechatShare(undefined, undefined, true);
},
methods: {
getCourseInfo() {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册