Commit 58ae2999 authored by wangxuelai's avatar wangxuelai

'闯关打卡分享'

parent 59a4699d
......@@ -196,25 +196,23 @@ Page({
this.clockListGet(this.data.oneSmallSort, 'up')
},
onShareAppMessage: function (option) { // return custom share data when user share.
// console.log(option)
const {
from,
target
} = option;
let shareObj = {
}
if (target.dataset.type == 'share_clock') {
this.newShare.onShareAppMessage()
return
}
if (from == 'menu') {
shareObj = this.data.shareObj;
shareObj = {
title: this.data.moreTheme.title,
path: `/src/pages/sharemoretheme/index?tid=${this.data.tid}&id=${this.data.id}`
}
} else if (from == 'button') {
if (!target.dataset.info) {
shareObj = {
title: `邀请您提交「${this.data.params.title}」作业`,
path: `/src/pages/themeindex/index?tid=${this.data.tid}&id=${this.data.id}&sid=${this.data.sid}`
title: this.data.moreTheme.title,
path: `/src/pages/sharemoretheme/index?tid=${this.data.tid}&id=${this.data.id}`
}
} else {
const {
......@@ -228,16 +226,30 @@ Page({
title: `${info.school_student.nickname}的打卡详情`,
path: `/src/pages/clockdetail/newindex?tid=${info.subject_id}&cid=${info.id}`
}
return {
title: shareObj.title,
path: shareObj.path,
imageUrl:'https://cdn.img.shangjiadao.cn/source/images/dakav4/morethemeindex/unlockindex1.png',
success: (res) => {
if (res.errMsg == 'shareAppMessage:ok') {
this.setData({
shareObj: this.data.initShareObj
})
}
},
}
}
}
return {
title: shareObj.title,
path: shareObj.path,
imageUrl: `${this.data.imageRoot}pageshare_cover/theme_share.png?${this.data.imageRoot}`,
imageUrl:'https://cdn.img.shangjiadao.cn/source/images/dakav4/morethemeindex/unlockindex.png',
success: (res) => {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
this.data.shareObj = this.data.initShareObj
this.setData({
shareObj: this.data.initShareObj
})
}
},
}
......
......@@ -21,6 +21,7 @@ Page({
classList: [],
page: 1,
subjectCount: 1,
initShareObj: {},
lockparams: {
title: '',
created_at: '',
......@@ -55,6 +56,28 @@ Page({
},
onUnload: function() { // Do something when page close.
},
onShareAppMessage: function (option) { // return custom share data when user share.
const {
from,
target
} = option;
let shareObj = {
}
return {
title: this.data.lockparams.title,
path: `/src/pages/sharemoretheme/index?tid=${this.data.tid}&sid=${this.data.sid}`,
imageUrl:'https://cdn.img.shangjiadao.cn/source/images/dakav4/morethemeindex/unlockindex.png',
success: (res) => {
// 转发成功之后的回调
if (res.errMsg == 'shareAppMessage:ok') {
this.setData({
shareObj: this.data.initShareObj
})
}
},
}
},
onPullDownRefresh() {
this.getUnlockSubject();
......
......@@ -22,7 +22,7 @@
</view>
<view class="btnbox">
<view class="btn" bindtap="setting">高级设置</view>
<view class="btn share">分享</view>
<view class="btn share"><button class="sharebtn" open-type="share"></button>分享</view>
</view>
<view class="modal modal-setup {{settingModalClass? 'hide': ''}}" hidden="{{!settingModalShow}}">
<view class="mask" bindtap="closeSettingModal"></view>
......
......@@ -74,6 +74,15 @@
font-size: 30rpx;
letter-spacing: 2rpx;
color: #666666;
position: relative;
}
.sharebtn {
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.btnbox .btn.share {
background-color: #16B0FD;
......
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