|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
const host = window.location.protocol + '//' + window.location.host
|
|
|
|
const host = window.location.protocol + '//' + window.location.host
|
|
|
|
const wx = window.wx
|
|
|
|
const wx = window.wx
|
|
|
|
function share(shareData) {
|
|
|
|
function share(shareData) {
|
|
|
@ -11,7 +12,47 @@ function share(shareData) {
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const urlDoneMap = {}
|
|
|
|
|
|
|
|
function requestForSignatrue (callback) {
|
|
|
|
|
|
|
|
const currentUrl = window.location.href.split('#')[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (window.wx && !urlDoneMap[currentUrl]) {
|
|
|
|
|
|
|
|
const wx = window.wx
|
|
|
|
|
|
|
|
const url = '/wechats/js_sdk_signature.json'
|
|
|
|
|
|
|
|
urlDoneMap[currentUrl] = true
|
|
|
|
|
|
|
|
// window.encodeURIComponent()
|
|
|
|
|
|
|
|
axios.post(url, {
|
|
|
|
|
|
|
|
url: window.__testUrl || currentUrl,
|
|
|
|
|
|
|
|
}).then((response) => {
|
|
|
|
|
|
|
|
console.log('got res')
|
|
|
|
|
|
|
|
const data = response.data;
|
|
|
|
|
|
|
|
wx.config({
|
|
|
|
|
|
|
|
debug: false,
|
|
|
|
|
|
|
|
appId: data.appid,
|
|
|
|
|
|
|
|
timestamp: data.timestamp,
|
|
|
|
|
|
|
|
nonceStr: data.noncestr,
|
|
|
|
|
|
|
|
signature: data.signature,
|
|
|
|
|
|
|
|
jsApiList: [
|
|
|
|
|
|
|
|
'onMenuShareTimeline',//
|
|
|
|
|
|
|
|
'onMenuShareAppMessage',
|
|
|
|
|
|
|
|
'onMenuShareQQ',
|
|
|
|
|
|
|
|
'onMenuShareWeibo',
|
|
|
|
|
|
|
|
'onMenuShareQZone'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
wx.ready(function () {
|
|
|
|
|
|
|
|
callback && callback()
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
wx.error(function (res) {
|
|
|
|
|
|
|
|
console.log('wx is error')
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
//alert(res.errMsg);//错误提示
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
实践课程 平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。
|
|
|
|
实践课程 平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。
|
|
|
|
实训项目 覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。
|
|
|
|
实训项目 覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。
|
|
|
@ -20,7 +61,7 @@ function share(shareData) {
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function configShareForIndex (path) {
|
|
|
|
export function configShareForIndex (path) {
|
|
|
|
if (!wx) return;
|
|
|
|
requestForSignatrue(() => {
|
|
|
|
var shareData = {
|
|
|
|
var shareData = {
|
|
|
|
title: 'EduCoder - 首页',
|
|
|
|
title: 'EduCoder - 首页',
|
|
|
|
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
|
|
|
|
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
|
|
|
@ -29,9 +70,10 @@ export function configShareForIndex (path) {
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
share(shareData)
|
|
|
|
share(shareData)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export function configShareForPaths () {
|
|
|
|
export function configShareForPaths () {
|
|
|
|
if (!wx) return;
|
|
|
|
requestForSignatrue(() => {
|
|
|
|
console.log('configShareForPaths', host)
|
|
|
|
console.log('configShareForPaths', host)
|
|
|
|
var shareData = {
|
|
|
|
var shareData = {
|
|
|
|
title: 'EduCoder - 实践课程',
|
|
|
|
title: 'EduCoder - 实践课程',
|
|
|
@ -41,9 +83,10 @@ export function configShareForPaths () {
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
share(shareData)
|
|
|
|
share(shareData)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export function configShareForShixuns () {
|
|
|
|
export function configShareForShixuns () {
|
|
|
|
if (!wx) return;
|
|
|
|
requestForSignatrue(() => {
|
|
|
|
console.log('configShareForShixuns', host)
|
|
|
|
console.log('configShareForShixuns', host)
|
|
|
|
|
|
|
|
|
|
|
|
var shareData = {
|
|
|
|
var shareData = {
|
|
|
@ -54,9 +97,10 @@ export function configShareForShixuns () {
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
share(shareData)
|
|
|
|
share(shareData)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export function configShareForCourses () {
|
|
|
|
export function configShareForCourses () {
|
|
|
|
if (!wx) return;
|
|
|
|
requestForSignatrue(() => {
|
|
|
|
console.log('configShareForCourses', host)
|
|
|
|
console.log('configShareForCourses', host)
|
|
|
|
|
|
|
|
|
|
|
|
var shareData = {
|
|
|
|
var shareData = {
|
|
|
@ -67,11 +111,12 @@ export function configShareForCourses () {
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
share(shareData)
|
|
|
|
share(shareData)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// detail
|
|
|
|
// detail
|
|
|
|
export function configShareForCustom (title, desc, path, imgUrl) {
|
|
|
|
export function configShareForCustom (title, desc, path, imgUrl) {
|
|
|
|
if (!wx) return;
|
|
|
|
requestForSignatrue(() => {
|
|
|
|
console.log('configShareForCustom', host)
|
|
|
|
console.log('configShareForCustom', host)
|
|
|
|
|
|
|
|
|
|
|
|
var shareData = {
|
|
|
|
var shareData = {
|
|
|
@ -82,4 +127,5 @@ export function configShareForCustom (title, desc, path, imgUrl) {
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
|| host + '/react/build/images/share_logo_icon.jpg'
|
|
|
|
};
|
|
|
|
};
|
|
|
|
share(shareData)
|
|
|
|
share(shareData)
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|