invitation.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // pages/channel/invitation/invitation.js
  2. // 引入 QCloud 小程序增强 SDK
  3. var qcloud = require('../../../vendor/qcloud-weapp-client-sdk/index');
  4. // 引入配置
  5. var config = require('../../../config');
  6. // 显示繁忙提示
  7. var showBusy = text => wx.showToast({
  8. title: text,
  9. icon: 'loading',
  10. duration: 10000
  11. });
  12. // 显示成功提示
  13. var showSuccess = text => {
  14. wx.hideToast();
  15. wx.showToast({
  16. title: text,
  17. icon: 'success'
  18. });
  19. };
  20. // 显示失败提示
  21. var showModel = (title, content) => {
  22. wx.hideToast();
  23. wx.showModal({
  24. title,
  25. content: JSON.stringify(content),
  26. showCancel: false
  27. });
  28. };
  29. function formatDate(now) {
  30. var year=now.getFullYear();
  31. var month=now.getMonth()+1;
  32. if(month<10){
  33. month='0'+month.toString();
  34. }
  35. var date=now.getDate();
  36. if(date<10){
  37. date='0'+date.toString();
  38. }
  39. var hour=now.getHours();
  40. if(hour<10){
  41. hour='0'+hour.toString();
  42. }
  43. var minute=now.getMinutes();
  44. if(minute<10){
  45. minute='0'+minute.toString();
  46. }
  47. var second=now.getSeconds();
  48. return month+"-"+date+" "+hour+":"+minute;
  49. }
  50. //获取应用实例
  51. var app = getApp()
  52. Page({
  53. data: {
  54. "hash_key":"",
  55. "imageSrc":"",
  56. "height":"",
  57. "share_txt":"",
  58. "share":false,
  59. "is_qun":false,
  60. "expire_time":"",
  61. "text":""
  62. },
  63. onLoad: function (e) {
  64. console.log('onLoad');
  65. app.getUserInfo(function(userInfo){
  66. console.log(userInfo);
  67. });
  68. this.setData({
  69. hash_key:e.hash_key
  70. })
  71. var self=this
  72. try {
  73. var res = wx.getSystemInfoSync();
  74. self.setData({
  75. height:(res.windowWidth)*0.8
  76. });
  77. } catch (e) {
  78. // Do something when catch error
  79. }
  80. },
  81. onShow: function () {
  82. console.log('onShow');
  83. },
  84. edit:function(){
  85. wx.switchTab({
  86. url: '/pages/person/index/index'
  87. })
  88. },
  89. share:function(){
  90. this.setData({
  91. share:true
  92. })
  93. var self=this
  94. setTimeout(function(){
  95. self.setData({
  96. share:false
  97. })
  98. }, 500);
  99. },
  100. onShareAppMessage: function () {
  101. return {
  102. title: '密件-邀请您成为我的密友',
  103. path: 'pages/channel/index/index?hash_key='+this.data.hash_key
  104. }
  105. }
  106. })