提交 06b1ea57 编写于 作者: guangjun.yang's avatar guangjun.yang

分享的项目详情页面

上级 2162343b
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
+ 'padding-top:' + paddingTop + ';border-bottom:' + borderStyle" + 'padding-top:' + paddingTop + ';border-bottom:' + borderStyle"
> >
<div class="nav-title"> <div class="nav-title">
<span class="nav-back" @click="goBack"> <span v-if="isShowShare" class="nav-back" @click="goBack">
<img v-show="isBlack" src="../../images/left-array-black.png" alt=""> <img v-show="isBlack" src="../../images/left-array-black.png" alt="">
<img v-show="!isBlack" src="../../images/left-array-whiter.png" alt=""> <img v-show="!isBlack" src="../../images/left-array-whiter.png" alt="">
</span> </span>
...@@ -76,6 +76,10 @@ export default { ...@@ -76,6 +76,10 @@ export default {
shareTitleInfo: { shareTitleInfo: {
type: String, type: String,
default: "" default: ""
},
shareUrl: {
type: String,
default: ""
} }
}, },
computed: { computed: {
...@@ -103,12 +107,13 @@ export default { ...@@ -103,12 +107,13 @@ export default {
}, },
//分享 //分享
goShare() { goShare() {
let url = location.href, // 这里要改造
_this = this; // let url = location.href,
let _this = this;
rocNative.shareWechat({ rocNative.shareWechat({
type: 6, type: 6,
shareId: 0, shareId: 0,
shareUrl: url, shareUrl: _this.shareUrl,
title1: _this.shareTitle, title1: _this.shareTitle,
title2: _this.shareTitleInfo, title2: _this.shareTitleInfo,
shareImageUrl: "https://file.yunqueyi.com/logo.png?version=" + new Date().getTime() shareImageUrl: "https://file.yunqueyi.com/logo.png?version=" + new Date().getTime()
......
...@@ -5,6 +5,7 @@ const complist = r => require.ensure([], () => r(require('../views/component-det ...@@ -5,6 +5,7 @@ const complist = r => require.ensure([], () => r(require('../views/component-det
const cooplist = r => require.ensure([], () => r(require('../views/cooperation-details')), 'cooplist') const cooplist = r => require.ensure([], () => r(require('../views/cooperation-details')), 'cooplist')
const parent = r => require.ensure([], () => r(require('../views/parent-page')), 'parent') const parent = r => require.ensure([], () => r(require('../views/parent-page')), 'parent')
const merge = r => require.ensure([], () => r(require('../views/merge-detail')), 'merge') const merge = r => require.ensure([], () => r(require('../views/merge-detail')), 'merge')
const shareMerge = r => require.ensure([], () => r(require('../views/share-merge-detail')), 'share-merge')
const test = r => require.ensure([], () => r(require('../views/test-components')), 'test-components') const test = r => require.ensure([], () => r(require('../views/test-components')), 'test-components')
const creditedit = r => require.ensure([], () => r(require('../views/credit-edit')), 'credit-edit') const creditedit = r => require.ensure([], () => r(require('../views/credit-edit')), 'credit-edit')
const creditdetail = r => require.ensure([], () => r(require('../views/credit-detail')), 'credit-detail') const creditdetail = r => require.ensure([], () => r(require('../views/credit-detail')), 'credit-detail')
...@@ -42,6 +43,10 @@ export default [{ ...@@ -42,6 +43,10 @@ export default [{
{ {
path: '/coop', path: '/coop',
component: merge component: merge
},
{
path: '/sharecoop',
component: shareMerge
}, },
{ {
path: '/test', path: '/test',
......
...@@ -12,6 +12,7 @@ export const envConfig = { ...@@ -12,6 +12,7 @@ export const envConfig = {
webPageUrl: 'https://dev-phome.yunqueyi.com/', webPageUrl: 'https://dev-phome.yunqueyi.com/',
baseUrl: 'https://dev-sc.yunqueyi.com/', baseUrl: 'https://dev-sc.yunqueyi.com/',
hactiveUrl: 'https://dev-hactive.yunqueyi.com', hactiveUrl: 'https://dev-hactive.yunqueyi.com',
appId: 'wxf4e66242d31c81c2', // 用于微信授权登录
// http://dev-hactive.yunqueyi.com/message_push/#/study-card // http://dev-hactive.yunqueyi.com/message_push/#/study-card
// baseUrl: 'https://test1-sc.yunqueyi.com/', // baseUrl: 'https://test1-sc.yunqueyi.com/',
...@@ -35,23 +36,27 @@ export const envConfig = { ...@@ -35,23 +36,27 @@ export const envConfig = {
apiUrl: 'https://dev-api.yunqueyi.com/', apiUrl: 'https://dev-api.yunqueyi.com/',
webPageUrl: 'https://dev-phome.yunqueyi.com/', webPageUrl: 'https://dev-phome.yunqueyi.com/',
hactiveUrl: 'https://dev-hactive.yunqueyi.com', hactiveUrl: 'https://dev-hactive.yunqueyi.com',
appId: 'wxf4e66242d31c81c2', // 用于微信授权登录
}, },
test: { test: {
baseUrl: 'https://test1-sc.yunqueyi.com/', baseUrl: 'https://test1-sc.yunqueyi.com/',
apiUrl: 'https://test1-api.yunqueyi.com/', apiUrl: 'https://test1-api.yunqueyi.com/',
webPageUrl: 'https://test1-phome.yunqueyi.com/', webPageUrl: 'https://test1-phome.yunqueyi.com/',
hactiveUrl: 'https://test1-hactive.yunqueyi.com', hactiveUrl: 'https://test1-hactive.yunqueyi.com',
appId: 'wxcaad75b7fff5659c', // 用于微信授权登录
}, },
uat: { uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/', baseUrl: 'https://uat-sc.yunqueyi.com/',
apiUrl: 'https://uat-api.yunqueyi.com/', apiUrl: 'https://uat-api.yunqueyi.com/',
webPageUrl: 'https://uat-phome.yunqueyi.com/', webPageUrl: 'https://uat-phome.yunqueyi.com/',
hactiveUrl: 'https://uat-hactive.yunqueyi.com', hactiveUrl: 'https://uat-hactive.yunqueyi.com',
appId: 'wx342ef0e5afee54a7', // 用于微信授权登录
}, },
pro: { pro: {
baseUrl: 'https://sc.yunqueyi.com/', baseUrl: 'https://sc.yunqueyi.com/',
apiUrl: 'https://api.yunqueyi.com/', apiUrl: 'https://api.yunqueyi.com/',
webPageUrl: 'https://phome.yunqueyi.com/', webPageUrl: 'https://phome.yunqueyi.com/',
hactiveUrl: 'https://hactive.yunqueyi.com', hactiveUrl: 'https://hactive.yunqueyi.com',
appId: 'wx2c577552a2d28550', // 用于微信授权登录
} }
} }
...@@ -23,6 +23,11 @@ export function getHactiveUrl(url) { ...@@ -23,6 +23,11 @@ export function getHactiveUrl(url) {
return getConfigByEnvType('hactiveUrl') + (url || '') return getConfigByEnvType('hactiveUrl') + (url || '')
} }
// 获取微信APPID
export function getAPPID() {
return getConfigByEnvType('appId')
}
// 根据不同环境,生成URL // 根据不同环境,生成URL
function getConfigByEnvType(urlType) { function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType] return envConfig[process.env.BUILD_ENV][urlType]
......
/* eslint-disable */
import Vue from 'vue'
import request from '@/service/api';
import wx from 'weixin-js-sdk'
import { getBaseUrl } from "@/utils/index";
/** 注入配置信息 */
export const wxConfig = (link) => {
// const params = { resetURI: true, url: encodeURIComponent(location.href) };
// 上线前是需要把域名改为线上的sc
let baseUrl = getBaseUrl();
// request({ url: `https://sc.yunqueyi.com/wechats/signs?url=${encodeURIComponent(link)}` }).then(res => {
request({ url: `${baseUrl}/wechats/signs?url=${encodeURIComponent(link)}` }).then(res => {
let configs = res.data.signMap;
wx.config({
debug: false,
appId: configs.appId,
nonceStr: configs.nonceStr,
timestamp: configs.timestamp,
signature: configs.signature,
jsApiList: [
'hideMenuItems',
'previewImage',
'checkJsApi',
'chooseWXPay',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone',
'getLocation',
'openLocation',
'translateVoice'
]
});
});;
};
/**
* wxShare 分享
* @param option
*/
export const wxShare = (option = {}, successCB = () => {}) => {
wx.ready(() => {
// 分享给朋友
wx.onMenuShareAppMessage({
title: option.title,
desc: option.desc,
link: option.link,
imgUrl: option.imgUrl,
success: function(res) {
// 用户确认分享后执行的回调函数
successCB(res);
},
cancel: function() {
// 用户取消分享后执行的回调函数
}
});
// 分享到朋友圈
wx.onMenuShareTimeline({
title: option.friendtitle || option.title, // 标题
desc: option.desc,
link: option.link, // 链接
imgUrl: option.imgUrl, // 分享图标
success: function(res) {
successCB(res);
},
cancel: function() {
// 用户取消分享后执行的回调函数
}
});
});
};
export const wxDisabledShare = () => {
wx.ready(() => {
wx.hideMenuItems({
menuList: [
'menuItem:share:appMessage',
'menuItem:share:timeline',
'menuItem:share:qq',
'menuItem:share:weiboApp',
'menuItem:share:QZone'
]
});
});
};
/**
*
* @param source
* @param option
*/
export const wechatShare = async (option = {}, successCB = () => {}) => {
const shareOption = {
link: location.href,
title: `云鹊医!`,
friendtitle: `讨论进行中,速来围观!`,
desc: '参与讨论,一起畅谈医学那些事!快来看看吧~',
imgUrl: 'https://file.yunqueyi.com/logo.png',
...option
};
wxConfig(link);
wxShare(shareOption, successCB);
};
Vue.prototype.wechatShare = wechatShare
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册