123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id:0,
- info:{},
- content: '',
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let id = options.id;
- this.setData({id:id});
- this.getInfo();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- let info = this.data.info
- return {
- title: info.title,
- path: "/pages/activity/detail/detail?id="+info.id,
- imageUrl: info.main_image,
- };
- },
- //详情
- getInfo() {
- let self = this;
- app.post('activity/activity/detail',{id:this.data.id},function(res){
- self.setData({info:res});
- self.setData({ content: res.content.replace(/\<img/gi, '<img style="max-width:100%;display:block;" ') });
- });
- },
- copyUrl(e) {
- let url = e.currentTarget.dataset.url;
- wx.setClipboardData({
- data: url,
- success (res) {
- app.msg('复制成功,请用手机浏览器或电脑打开链接下载附件','',5000);
- }
- });
- },
- toReview() {
- wx.navigateTo({
- url: '/pages/activity/reviewdetail/reviewdetail?id='+this.data.info.review.id,
- })
- },
- joinActivity() {
- app.post('activity/activity/join',{id:this.data.id},function(res){
- if (res.code == 1001) {
- app.msg('请完善信息','/pages/my/info/info');
- } else {
- app.msg(res.msg);
- }
- });
- }
- })
|