微信分享test

This commit is contained in:
黄心宇 2024-04-03 09:26:43 +08:00
parent e6e91952ff
commit 3fdc93f169
6 changed files with 23 additions and 9 deletions

View File

@ -177,7 +177,7 @@
"eslintConfig": {
"extends": "react-app"
},
"proxy": "http://172.20.32.202:4000",
"proxy": "https://testforgeplus.trustie.net",
"port": "3007",
"devDependencies": {
"@babel/runtime": "7.0.0-beta.51",

View File

@ -50,6 +50,7 @@
<script src="%PUBLIC_URL%js/codemirror/merge/merge.js"></script>
<script src="%PUBLIC_URL%js/alex/moment.js"></script>
<script src="https://gw.alipayobjects.com/os/lib/alipay/alex/2.0.19/bundle/alex.all.global.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<meta name="viewport" content="">
<%= htmlWebpackPlugin.tags.bodyTags %>
<script>

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "http://172.20.32.202:4000";
var proxy = "https://testforgeplus.trustie.net";
//响应前的设置

View File

@ -1,6 +1,15 @@
import axios from 'axios'
const host = window.location.protocol + '//' + window.location.host
const wx = window.wx
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
let actionUrl = settings && settings.common.zone +'/api';
const service = axios.create({
baseURL: actionUrl,
timeout: 1800000, // 请求超时时间
});
function share(shareData) {
try {
wx.onMenuShareAppMessage(shareData);//分享给好友
@ -21,17 +30,18 @@ function requestForSignatrue (callback) {
callback && callback()
} else {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
const url = '/cms/doc/open/wechatSignature'
urlDoneMap[currentUrl] = true
// window.encodeURIComponent()
axios.post(url, {
url: window.__testUrl || currentUrl,
service.post(url, {
url: 'https://www.gitlink.org.cn' || currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
const data = response.data && response.data.data;
wx.config({
debug: false,
appId: data.appid,
debug: true,
appId: 'wxf8debe756b4a0309', // data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.signature,

View File

@ -7,7 +7,7 @@ import { getNewsDetail } from '../api';
import { isPhone } from 'educoder';
import { tempConfig } from '../tempInfo';
import Acce from '../Component/mobile/accessory';
import { addMeta, setSeoMeta } from 'educoder';
import { addMeta, setSeoMeta, configShareForCustom } from 'educoder';
import CommentList from '../Component/comments/list'
@ -28,6 +28,7 @@ function NewsDetail(props){
const { name, cmsDir, summary} = detail;
document.title = `${ name }/${ cmsDir.name }`;
addMeta('Keywords', `${ name },${ cmsDir.name },${ summary }`);
configShareForCustom(detail.name, detail.summary, detail.headImg)
}
if(isPhone() && zonedetail){
setTimeout(()=>{

View File

@ -17,6 +17,7 @@ import "slick-carousel/slick/slick-theme.css";
import { tempEnum } from "./tempInfo";
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
import { setSeoMeta } from 'educoder';
import { configShareForCustom } from 'educoder';
const SourceDetail = Loadable({
@ -134,6 +135,7 @@ function Index(props){
getAdminUrl(data.id);
getRole(data.id)
}
configShareForCustom(data.mainTitle, data.subTitle)
// deptIdheader
sessionStorage.setItem('deptId', data.deptId)
setSeoMeta(`${data.name},`, data.name, data.subTitle, `/zone/${deptId}`)