Commit 2813f7c5 by sunerhu

1.H5 分享测试

parent ab8f72a6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<link rel="stylesheet" href="./static/font/iconfont.css">
<!--preload-links-->
<!--app-context-->
<script src="https://unpkg.com/jweixin-module/lib/index.js"></script>
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<link rel="stylesheet" href="./static/font/iconfont.css">
<!--preload-links-->
<!--app-context-->
<script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head>
<body>
<div id="app">
<!--app-html-->
</div>
<script type="module" src="/main.js"></script>
</body>
</html>
......@@ -132,9 +132,9 @@
import BootPage from "@/components/bootpage/bootpage.vue";
import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import dataHandling from "@/util/dataHandling";
// import {
// hshare
// } from '@/util/fiveshare'
import {
hshare
} from '@/util/fiveshare'
import {
nanoid
} from 'nanoid';
......@@ -342,10 +342,15 @@
'cffp_userId'),
packFileId: this.courseInfo.packFileId
}).then(res => {
console.log(res, 1551)
if (res['success']) {
this.courseInfo = res['data']['data'];
this.lecturerId = res['data']['data']['fileLecturerId'];
this.lecturerQuery();
if (uni.getStorageSync('h5_coursesharing')) {
this.coursesharing = uni.getStorageSync('h5_coursesharing')
this.getshareData()
}
if (this.courseInfo.status === 2) {
this.findVideoPlayback();
}else{
......@@ -363,7 +368,6 @@
orderId: this.courseInfo.orderId,
packFileId: this.courseInfo.packFileId
}).then(res => {
console.log('相关课程详情', res);
if (res['success']) {
this.relatedCoursesLists = res['data']['data']['relatedCourseList'];
this.nonRequiredCount = res['data']['data']['nonRequiredCount'];
......@@ -499,16 +503,16 @@
})
},
// H5 自定义分享
// getshareData() {
// let data = {
// title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅',
// link: window.location.href, //分享链接
// imgUrl: this.courseInfo.displayImage, //图片
// }
// var url = window.location.href.split('#')[0]
// hshare(data, url)
// },
getshareData() {
let data = {
title: this.courseInfo.fileTitle,
desc: '加入我们开启学习之旅',
link: window.location.href, //分享链接
imgUrl: this.courseInfo.displayImage, //图片
}
var url = window.location.href.split('#')[0]
hshare(data, url)
},
},
onLoad(option) {
this.fileId = option.fileId;
......@@ -528,15 +532,12 @@
uni.setStorageSync('h5_coursesharing', this.coursesharing);
}
// this.getshareData()
let dataForm = uni.getStorageSync('userinfodataForm')
this.realName = dataForm.realName
// this.switchTab(1);
},
onShow() {
if (uni.getStorageSync('h5_coursesharing')) {
this.coursesharing = uni.getStorageSync('h5_coursesharing')
}
this.switchTab(1);
this.loginType = uni.getStorageSync('loginType')
},
......@@ -556,9 +557,8 @@
page {
padding: 0;
}
.courseBannerBox {
height: 300rpx;
min-height: 320rpx;
// margin-top: 20rpx;
background-color: #ebebeb;
display: flex;
......@@ -566,12 +566,12 @@
z-index: 1;
.videoBox {
// max-width: 100%;
width: 100vw;
// width: 100%;
// max-width: 100%;
height: 100%;
}
}
.courseTitleContent {
height: 150rpx;
background-color: #fff;
......
......@@ -32,6 +32,7 @@
CommonUpload
} from '@/util/uploaderFile'
import api from "@/api/api";
import common from '../../common/common';
export default {
data() {
return {
......@@ -48,7 +49,6 @@
},
onLoad(options) {
this.optionForm = JSON.parse(options.customerBasicInfo)
console.log(this.optionForm, 7777)
},
methods: {
uploadAvatar(event) {
......@@ -59,6 +59,14 @@
},
// 修改个人资料接口
submitinfo() {
if (!common.nameValid(this.optionForm.realName)) {
uni.showToast({
title: '请输入真实的姓名!',
duration: 2000,
icon: 'none'
})
return;
}
let UserRequestVO = {
id: uni.getStorageSync('cffp_userId'),
realName: this.optionForm.realName,
......
// var wx = require("weixin-js-sdk/index.js") //引入刚下载的js文件
// import $H from '@/api/request.js' //封装好的接口请求\
// import * as jweixinmodule from "jweixin-module"
// var wx = require("jweixin-module")
// @ts-ignore
import * as wx from "../components/jweixin-module/lib/index.js"
import api from "../api/api";
//初始化
export function initJssdkShare(callback, url) {
console.log(callback,url, '第二步');
var url = url
//这一步需要调用后台接口,返回需要的签名 签名时间戳 随机串 和公众号appid
//注意url:window.location.href.split('#')[0] //
// request.post("", {
// url // url是当前页面的url
// },
let WxConfigRequestVO = {
url:url,
systemType:'1'
}
// @ts-ignore
api.Wxshare(WxConfigRequestVO).then((res, wx) => {
wx.config({
debug: true,//调试的时候需要 在app上回弹出errmg:config ok 的时候就证明没问题了 这时候就可以改为false
appId: res.data.appId,//appid
timestamp: res.data.timestamp,//时间戳
nonceStr: res.data.nonceStr,//随机串
signature: res.data.signature,//签名
jsApiList: res.data.jsApiList//必填 是下面需要用到的方法集合
})
if(callback){
callback()
}
})
}
// data是穿的参数 url是当前页面的链接
export function hshare(data,url){
console.log(data, url, '第一步')
// initJssdkShare(data, url)
initJssdkShare(function(wx){
wx.ready(function(){
console.log(data);
var sharedata={
title: data.title, //标题
desc: data.desc, //描述
link: data.link ,//分享链接
imgUrl:data.imgUrl, //图片
success:(res=>{
})
};
wx.updateAppMessageShareData(sharedata)//自定义微信分享给朋友
wx.updateTimelineShareData(sharedata);//自定义微信分享给朋友
wx.onMenuShareAppMessage(sharedata);//获取“分享给朋友”按钮点击状态及自定义分享内容接口(即将废弃)
})
},url)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment