欢迎光临,了解微信小程序开发,就上易用通!

当前位置 : 易用通 > 小程序模板
T沙龙;分享,简单布局T沙龙;分享,简单布局
立即下载

T沙龙;分享,简单布局

模板分类 : 小程序模板 模板编号 : Y920 源码文件 : 完全开源 下载权限 : VIP会员
模板大小 :  模板指数 :  更新时间 : 2018-03-14 17:37 模板等级 : ☆☆☆☆☆

模板截图:

T沙龙;分享,简单布局(图1) T沙龙;分享,简单布局(图2) T沙龙;分享,简单布局(图3) T沙龙;分享,简单布局(图4) T沙龙;分享,简单布局(图5) 代码示例:
[AppleScript] 纯文本查看 复制代码
?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// 获取全局应用程序实例对象
const app = getApp();
// 获得 AV 的引用
const AV = require('../../libs/av-weapp-min.js');
 
// 创建页面实例对象
Page({
  // 页面名称
  name: "detail",
  // 页面的初始数据
  data: {
    objectId: '',
    salon: { },
    orators: [],
  },
 
  // 生命周期函数--监听页面加载
  onLoad: function(option) {
    this.setData({
      objectId: option.objectId
    });
    wx.setNavigationBarTitle({
      title: '<T> 沙龙详情',
    });
  },
  // 生命周期函数--监听页面初次渲染完成
  onReady () {
    var params = {
      'objectId': this.data.objectId,
    }
    var that = this;
    AV.Cloud.run('getSalonWithObjectId', params).then(salon => {
      var speeches = salon.salon_speeches;
      this.setData({ orators: [] });
      speeches.forEach(function (speech, i, a) {
        var id = speech.speech_orator_id;
        var query = new AV.Query('TGuest');
        query.get(id).then(function (orator) {
          console.log(orator);
          var newOrators = that.data.orators;
          newOrators.push(orator);
          that.setData({ orators: newOrators });
        }).catch(console.error);
      })
      this.setData({ salon: salon });
    }).catch(error => {
      app.showError(error);
    });
  },
 
  // 自定义事件
  toggleEnroll: function(e) {
    // 首先检查是否需要完善信息
    var that = this;
    var userid = app.globalData.user.objectId;
    var params = {
      'userid': userid,
    }
    AV.Cloud.run('checkShouldFullInfo', params).then(result => {
      if (result == null) {
        // 需要,则跳转至报名界面
        wx.showModal({
          title: '报名',
          content: '我们需要您完善个人信息才能完成报名,是否前往完善信息?',
          success: function(res) {
            if (res.confirm) {
              var objectId = that.data.objectId;
              console.log(objectId);
              // 跳转到报名页面
              wx.redirectTo({ url: '../enroll/enroll?objectId=' + objectId });
            }
          }
        });
      } else {
        // 不需要,则直接调用报名接口
        wx.showModal({
          title: '报名',
          content: '是否确认报名?确认后暂不支持主动取消,如果需要取消报名请联系沙龙主办方',
          success: function(res) {
            if (res.confirm) {
              var enrollParams = {
                'salon_id': that.data.objectId,
                'guest_id': result.objectId,
              };
              AV.Cloud.run('enrollSalon', enrollParams).then(result => {
                console.log(result);
                if (result) {
                  // 报名成功,跳转报名成功页面
                  wx.navigateTo({ url: '../success/success' });
                } else {
                  var error = '报名失败!';
                  app.showError(error);
                }
              }).catch(error => {
                app.showError(error);
              });
            }
          }
        });
      }
    }).catch(error => {
      app.showError(error);
    });
  },
  onShareAppMessage: function() {
    var title = this.data.salon.salon_title;
    return {
      title: title,
      desc: title + '<T> 沙龙即将召开,感兴趣的朋友快来报名参加吧~',
      path: '/page/detail/detail',
    };
  },
 
  toggleGuests: function(e) {
    var objectId = this.data.objectId;
    // 跳转到用户详情页面
    wx.navigateTo({ url: '../users/users?objectId=' + objectId });
  },
})

加入收藏
立即下载
分享到微信朋友圈
X

免责声明:

1. 本站所有素材(未指定商用),仅限学习交流,请勿用于商业用途。
2. 本站所有小程序模板Demo和图片均来自用户分享上传和网络收集,模板和图片版权归原作者及原出处所有。
3. 未经合法授权,会员不得以任何形式发布、传播、复制、转售该素材。