details.js 2.8 KB
Newer Older
zhenglide's avatar
zhenglide committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
let app = getApp();
let domain = app.globalData.domain;
//获取用户信息的url

let conferenceUrl = domain + "/dingding/conference";

Page({

  data: {
    conference: null,
     imageUrl: "http://139.159.202.24:8888" ,
    date: dateFtt("yyyy-MM-dd", new Date())  
  },
  goto:function(e){
   var cnum= e.currentTarget.dataset.cnum;
    dd.navigateTo({
      url: '../addmeeting/addmeeting?cnum=' + cnum
    })
  },
  setImageUrl: function(e) {
    console.log("图片加载错误detail");
    var index = e.currentTarget.dataset.index;
    // document.getElementById(id).src = "../../../resource/images/list-room.png";
  
    var conference = this.data.conference;
    if (conference.photoUrl)
    conference.photoUrl = "/images/conference/dd-defalut.png"
    this.setData({
      conference
    });
  
  },
  onLoad: function(query) {
    // 生命周期函数--监听页面加载
   console.log("load会议室编号",query);
   var _this=this;
    _this.setData({
      conference: null
    })
   
    dd.httpRequest({
      url: conferenceUrl,
      method: 'POST',
      data: {
        cnum: query.cnum
      },
      dataType: 'json',
      success: function(res) {
        console.log('success----', res)

        _this.setData({
          conference: res.data.result
        })
      },
      fail: function(res) {
        console.log("httpRequestFail---", res)
        dd.alert({ content: JSON.stringify(res) });
      },
      complete: function(res) {
        dd.hideLoading();
      }

    });
   
  },

  
  onReady(query) {
    // 页面加载完成
   console.log("ready会议室编号",query)

  },
  onShow(query) {
    // 页面显示
     console.log("show会议室编号",query)
  },
  onHide() {
    // 页面隐藏
  },
  onUnload() {
    // 页面被关闭
  },
  onTitleClick() {
    // 标题被点击
  },
  onPullDownRefresh() {
    // 页面被下拉
  },
  onReachBottom() {
    // 页面被拉到底部
  },
  onShareAppMessage() {
    // 返回自定义分享信息
    return {
      title: 'My App',
      desc: 'My App description',
      path: 'pages/index/index',
    };
  },
});
function dateFtt(fmt, date) { //author: meizz   
  var o = {
    "M+": date.getMonth() + 1,                 //月份   
    "d+": date.getDate(),                    //日   
    "h+": date.getHours(),                   //小时   
    "m+": date.getMinutes(),                 //分   
    "s+": date.getSeconds(),                 //秒   
    "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
    "S": date.getMilliseconds()             //毫秒   
  };
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt))
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  return fmt;
}