Commit 2813f7c5 by sunerhu

1.H5 分享测试

parent ab8f72a6
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script> <script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)')) CSS.supports('top: constant(a)'))
document.write( document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + '<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' : '') + '" />') (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script> </script>
<title></title> <title></title>
<link rel="stylesheet" href="./static/font/iconfont.css"> <link rel="stylesheet" href="./static/font/iconfont.css">
<!--preload-links--> <!--preload-links-->
<!--app-context--> <!--app-context-->
<script src="https://unpkg.com/jweixin-module/lib/index.js"></script> <script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head> </head>
<body> <body>
<div id="app"><!--app-html--></div> <div id="app">
<script type="module" src="/main.js"></script> <!--app-html-->
</body> </div>
<script type="module" src="/main.js"></script>
</body>
</html> </html>
...@@ -132,9 +132,9 @@ ...@@ -132,9 +132,9 @@
import BootPage from "@/components/bootpage/bootpage.vue"; import BootPage from "@/components/bootpage/bootpage.vue";
import UniShareWx from "@/uni_modules/uni-share-wx/index.vue"; import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import dataHandling from "@/util/dataHandling"; import dataHandling from "@/util/dataHandling";
// import { import {
// hshare hshare
// } from '@/util/fiveshare' } from '@/util/fiveshare'
import { import {
nanoid nanoid
} from 'nanoid'; } from 'nanoid';
...@@ -342,10 +342,15 @@ ...@@ -342,10 +342,15 @@
'cffp_userId'), 'cffp_userId'),
packFileId: this.courseInfo.packFileId packFileId: this.courseInfo.packFileId
}).then(res => { }).then(res => {
console.log(res, 1551)
if (res['success']) { if (res['success']) {
this.courseInfo = res['data']['data']; this.courseInfo = res['data']['data'];
this.lecturerId = res['data']['data']['fileLecturerId']; this.lecturerId = res['data']['data']['fileLecturerId'];
this.lecturerQuery(); this.lecturerQuery();
if (uni.getStorageSync('h5_coursesharing')) {
this.coursesharing = uni.getStorageSync('h5_coursesharing')
this.getshareData()
}
if (this.courseInfo.status === 2) { if (this.courseInfo.status === 2) {
this.findVideoPlayback(); this.findVideoPlayback();
}else{ }else{
...@@ -363,7 +368,6 @@ ...@@ -363,7 +368,6 @@
orderId: this.courseInfo.orderId, orderId: this.courseInfo.orderId,
packFileId: this.courseInfo.packFileId packFileId: this.courseInfo.packFileId
}).then(res => { }).then(res => {
console.log('相关课程详情', res);
if (res['success']) { if (res['success']) {
this.relatedCoursesLists = res['data']['data']['relatedCourseList']; this.relatedCoursesLists = res['data']['data']['relatedCourseList'];
this.nonRequiredCount = res['data']['data']['nonRequiredCount']; this.nonRequiredCount = res['data']['data']['nonRequiredCount'];
...@@ -499,16 +503,16 @@ ...@@ -499,16 +503,16 @@
}) })
}, },
// H5 自定义分享 // H5 自定义分享
// getshareData() { getshareData() {
// let data = { let data = {
// title: this.courseInfo.fileTitle, title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅', desc: '加入我们开启学习之旅',
// link: window.location.href, //分享链接 link: window.location.href, //分享链接
// imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
// } }
// var url = window.location.href.split('#')[0] var url = window.location.href.split('#')[0]
// hshare(data, url) hshare(data, url)
// }, },
}, },
onLoad(option) { onLoad(option) {
this.fileId = option.fileId; this.fileId = option.fileId;
...@@ -528,15 +532,12 @@ ...@@ -528,15 +532,12 @@
uni.setStorageSync('h5_coursesharing', this.coursesharing); uni.setStorageSync('h5_coursesharing', this.coursesharing);
} }
// this.getshareData()
let dataForm = uni.getStorageSync('userinfodataForm') let dataForm = uni.getStorageSync('userinfodataForm')
this.realName = dataForm.realName this.realName = dataForm.realName
// this.switchTab(1); // this.switchTab(1);
}, },
onShow() { onShow() {
if (uni.getStorageSync('h5_coursesharing')) {
this.coursesharing = uni.getStorageSync('h5_coursesharing')
}
this.switchTab(1); this.switchTab(1);
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
}, },
...@@ -556,9 +557,8 @@ ...@@ -556,9 +557,8 @@
page { page {
padding: 0; padding: 0;
} }
.courseBannerBox { .courseBannerBox {
height: 300rpx; min-height: 320rpx;
// margin-top: 20rpx; // margin-top: 20rpx;
background-color: #ebebeb; background-color: #ebebeb;
display: flex; display: flex;
...@@ -566,12 +566,12 @@ ...@@ -566,12 +566,12 @@
z-index: 1; z-index: 1;
.videoBox { .videoBox {
// max-width: 100%;
width: 100vw; width: 100vw;
// width: 100%;
// max-width: 100%;
height: 100%; height: 100%;
} }
} }
.courseTitleContent { .courseTitleContent {
height: 150rpx; height: 150rpx;
background-color: #fff; background-color: #fff;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
CommonUpload CommonUpload
} from '@/util/uploaderFile' } from '@/util/uploaderFile'
import api from "@/api/api"; import api from "@/api/api";
import common from '../../common/common';
export default { export default {
data() { data() {
return { return {
...@@ -48,7 +49,6 @@ ...@@ -48,7 +49,6 @@
}, },
onLoad(options) { onLoad(options) {
this.optionForm = JSON.parse(options.customerBasicInfo) this.optionForm = JSON.parse(options.customerBasicInfo)
console.log(this.optionForm, 7777)
}, },
methods: { methods: {
uploadAvatar(event) { uploadAvatar(event) {
...@@ -59,6 +59,14 @@ ...@@ -59,6 +59,14 @@
}, },
// 修改个人资料接口 // 修改个人资料接口
submitinfo() { submitinfo() {
if (!common.nameValid(this.optionForm.realName)) {
uni.showToast({
title: '请输入真实的姓名!',
duration: 2000,
icon: 'none'
})
return;
}
let UserRequestVO = { let UserRequestVO = {
id: uni.getStorageSync('cffp_userId'), id: uni.getStorageSync('cffp_userId'),
realName: this.optionForm.realName, 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