art.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // pages/art/art.js
  2. <<<<<<< HEAD
  3. const app = getApp()
  4. const util = require('../../utils/util.js');
  5. const APIClient = require('../../utils/APIClient.js');
  6. const login = require('../../utils/loginSchedule.js');
  7. Page({
  8. data: {
  9. flag: false,
  10. productionData: {},
  11. questionsData: {},
  12. },
  13. =======
  14. const APIClient = require('../../utils/APIClient.js');
  15. Component({
  16. /**
  17. * 组件的属性列表
  18. */
  19. properties: {
  20. },
  21. /**
  22. * 组件的初始数据
  23. */
  24. data: {
  25. flag: false,
  26. productionData: {},
  27. questionsData: {}
  28. },
  29. /**
  30. * 组件的方法列表
  31. */
  32. >>>>>>> d311ba85855d9833139d43ef0f7038e08d5d9599
  33. methods: {
  34. shareImage: function(e) {
  35. console.log(e.target.dataset.flag)
  36. }
  37. },
  38. <<<<<<< HEAD
  39. onLoad: function (options) {
  40. //分享按钮
  41. wx.showShareMenu({
  42. withShareTicket: true
  43. })
  44. },
  45. onShow: function () {
  46. /* 区分答疑和分享 */
  47. let distinction = (type, success) => {
  48. login.getOpenidSessionKey(function(res) {
  49. //console.log(res.data.data.uid);
  50. APIClient.getProductionSchedule({
  51. uid: res.data.data.uid
  52. }, {
  53. "type": type,
  54. "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
  55. "pageNo": 1,
  56. "pageSize": 6
  57. }).success(success)
  58. }, function() {
  59. wx.showModal({
  60. title: '提示',
  61. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  62. showCancel: false,
  63. success: function (res) {
  64. if (res.confirm) {
  65. console.log('用户点击确定')
  66. } else if (res.cancel) {
  67. console.log('用户点击取消')
  68. }
  69. }
  70. })
  71. });
  72. };
  73. /* 分享 */
  74. distinction(2, res => {
  75. if(res.data.success) {
  76. console.log(res.data.data)
  77. this.setData({
  78. productionData: res.data.data,
  79. })
  80. }
  81. });
  82. /* 答疑 */
  83. distinction(1, res => {
  84. if(res.data.success) {
  85. console.log(res.data.data)
  86. this.setData({
  87. questionsData: res.data.data,
  88. })
  89. }
  90. });
  91. },
  92. /* 转发*/
  93. onShareAppMessage: function (ops) {
  94. if (ops.from === 'button') {
  95. // 来自页面内转发按钮
  96. console.log(ops.target)
  97. }
  98. const postId = ops.target.dataset.postid;
  99. return {
  100. title: '小学王者班',
  101. path: `pages/transmit/transmit?ind=7&postId=${postId}`,
  102. success: function (res) {
  103. // 转发成功
  104. console.log("转发成功:" + JSON.stringify(res));
  105. },
  106. fail: function (res) {
  107. // 转发失败
  108. console.log("转发失败:" + JSON.stringify(res));
  109. }
  110. }
  111. =======
  112. ready () {
  113. /* 区分答疑和分享 */
  114. let distinction = (type, success) => {
  115. APIClient.getProductionSchedule({
  116. uid: 'e7e0d43a-36b1-4e71-a3a3-61469c90d0a2'
  117. }, {
  118. "userId": "e7e0d43a-36b1-4e71-a3a3-61469c90d0a2",
  119. "type": type,
  120. "columnId": "41209f14-05ba-11e8-9771-080027fcfc4b",
  121. "pageNo": 1,
  122. "pageSize": 2
  123. }).success(success)
  124. };
  125. /* 分享 */
  126. distinction(2, res => {
  127. console.log(res.data.data)
  128. this.setData({
  129. productionData: res.data.data,
  130. })
  131. });
  132. /* 答疑 */
  133. distinction(1, res => {
  134. console.log(res.data)
  135. this.setData({
  136. questionsData: res.data.data,
  137. })
  138. })
  139. >>>>>>> d311ba85855d9833139d43ef0f7038e08d5d9599
  140. },
  141. })