publicpraisemsg.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. const app = getApp();
  2. var utils = require("../../../utils/http")
  3. const util = require("../../../utils/util")
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. imgUrl: app.globalData.imgUrl,
  10. eid: '',
  11. evidencemsg: {},
  12. lastId: '',
  13. nextId: '',
  14. wshareshow: false,
  15. personMsg: app.globalData.personMsg,
  16. companyobj:app.globalData.companyobj,
  17. priceflag: false,
  18. showDsc: false,
  19. ltype:'',//不为空是从名片中点击进去
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. var that = this;
  26. wx.showLoading({
  27. title: '加载中...',
  28. })
  29. that.setData({
  30. eid: options.eid,
  31. ltype:options.ltype?options.ltype:''
  32. })
  33. that.evidencefun();
  34. },
  35. showDscTextFunc: function () {
  36. if (this.data.evidencemsg.desc.length > 29) {
  37. this.data.showDsc = !this.data.showDsc;
  38. this.setData({
  39. showDsc: this.data.showDsc
  40. })
  41. }
  42. },
  43. priceshowtap() {
  44. this.setData({
  45. priceflag: true
  46. })
  47. },
  48. closepricetap() {
  49. this.setData({
  50. priceflag: false
  51. })
  52. },
  53. /**
  54. * 生命周期函数--监听页面初次渲染完成
  55. */
  56. onReady: function () {
  57. },
  58. setpostertap: function () {
  59. wx.navigateTo({
  60. url: '/index/pages/setposter/setposter?type=materialEvidence&aid=' + this.data.eid + "&listshare=",
  61. })
  62. },
  63. sharetap: function () {
  64. this.setData({
  65. wshareshow: true
  66. })
  67. },
  68. evidencefun: function () {
  69. var that = this;
  70. utils.$get({
  71. url: app.globalData.webUrl + 'api/evidencedetail',
  72. header: {
  73. 'Authorization': 'bearer ' + app.globalData.token
  74. },
  75. data: {
  76. id: that.data.eid,
  77. uid: app.globalData.personMsg.id,
  78. },
  79. success: function (res) {
  80. wx.hideLoading()
  81. if (res.data.code == '0') {
  82. res.data.data.desc = res.data.data.title + '#' + res.data.data.desc + '#';
  83. that.setData({
  84. evidencemsg: res.data.data,
  85. lastId: res.data.lastId,
  86. nextId: res.data.nextId,
  87. })
  88. wx.setNavigationBarTitle({
  89. title: res.data.data.title
  90. })
  91. if (res.data.data.difference == 1) {
  92. const videoContext = that.selectComponent('#myVideo');
  93. videoContext.play();
  94. }
  95. }
  96. }
  97. })
  98. },
  99. collectap: function () {
  100. var that = this;
  101. var list = that.data.evidencemsg;
  102. utils.$post({
  103. url: app.globalData.webUrl + 'api/collect',
  104. header: {
  105. 'Authorization': 'bearer ' + app.globalData.token
  106. },
  107. data: {
  108. user_id: app.globalData.personMsg.id,
  109. content_type: "materialEvidence",
  110. content_id: that.data.eid
  111. },
  112. success: function (res) {
  113. if (res.data.code == '0') {
  114. wx.showToast({
  115. title: res.data.msg,
  116. icon: 'none',
  117. duration: 2000
  118. })
  119. list.collected = !list.collected;
  120. that.setData({
  121. evidencemsg: list
  122. })
  123. }
  124. }
  125. })
  126. },
  127. shareurltap: function () {
  128. wx.showLoading({
  129. title: '加载中...',
  130. })
  131. util.schemefun('/share/pages/publicpraisemsg/publicpraisemsg', 'eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, this.data.eid, 'materialEvidence', '');
  132. this.evidencesharetap();
  133. },
  134. sendfriendtap() {
  135. this.evidencesharetap();
  136. },
  137. evidencesharetap: function () {
  138. var that = this;
  139. utils.$post({
  140. url: app.globalData.webUrl + 'api/share/addlog',
  141. header: {
  142. 'Authorization': 'bearer ' + app.globalData.token
  143. },
  144. data: {
  145. id: that.data.eid,
  146. type: 'materialEvidence'
  147. },
  148. success: function (r) {}
  149. })
  150. },
  151. pretap: function () {
  152. if (!this.data.lastId) {
  153. wx.showToast({
  154. title: '已经第一篇了!',
  155. icon: 'none',
  156. duration: 2000
  157. })
  158. return false
  159. }
  160. wx.redirectTo({
  161. url: '/index/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.lastId,
  162. })
  163. },
  164. nextap: function () {
  165. if (!this.data.nextId) {
  166. wx.showToast({
  167. title: '已经最后一篇了!',
  168. icon: 'none',
  169. duration: 2000
  170. })
  171. return false
  172. }
  173. wx.redirectTo({
  174. url: '/index/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.nextId,
  175. })
  176. },
  177. prelooktap() {
  178. if (!app.globalData.personMsg.binded.qrcode) {
  179. wx.showToast({
  180. title: "您的二维码为空,请上传二维码!",
  181. icon: 'none',
  182. duration: 2000
  183. })
  184. return false;
  185. }
  186. wx.previewImage({
  187. current: app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode, // 当前显示图片的http链接
  188. urls: [app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode] // 需要预览的图片http链接列表
  189. })
  190. },
  191. callphonetap: function () {
  192. wx.makePhoneCall({
  193. phoneNumber: app.globalData.personMsg.phone
  194. })
  195. },
  196. /**
  197. * 生命周期函数--监听页面显示
  198. */
  199. onShow: function () {
  200. this.setData({
  201. companyobj:app.globalData.companyobj,
  202. personMsg: app.globalData.personMsg,
  203. })
  204. },
  205. /**
  206. * 生命周期函数--监听页面隐藏
  207. */
  208. onHide: function () {
  209. },
  210. /**
  211. * 生命周期函数--监听页面卸载
  212. */
  213. onUnload: function () {
  214. },
  215. /**
  216. * 页面相关事件处理函数--监听用户下拉动作
  217. */
  218. onPullDownRefresh: function () {
  219. },
  220. /**
  221. * 页面上拉触底事件的处理函数
  222. */
  223. onReachBottom: function () {
  224. },
  225. // onShareTimeline: function () {
  226. // this.evidencesharetap();
  227. // var img = this.data.evidencemsg.difference == 1 ? (this.data.evidencemsg.cover ? this.data.evidencemsg.cover : (this.data.evidencemsg.pics[0] + '?x-oss-process=video/snapshot,t_100,f_jpg,w_375,m_fast')) : this.data.evidencemsg.pics[0];
  228. // img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  229. // return {
  230. // title: this.data.evidencemsg.title,
  231. // imageUrl: img,
  232. // query: '/share/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  233. // }
  234. // },
  235. /**
  236. * 用户点击右上角分享
  237. */
  238. onShareAppMessage: function () {
  239. this.evidencesharetap();
  240. var img = this.data.evidencemsg.difference == 1 ? (this.data.evidencemsg.cover ? this.data.evidencemsg.cover : (this.data.evidencemsg.pics[0] + '?x-oss-process=video/snapshot,t_100,f_jpg,w_375,m_fast')) : this.data.evidencemsg.pics[0];
  241. img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  242. return {
  243. title: this.data.evidencemsg.title,
  244. imageUrl: img,
  245. path: '/share/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  246. }
  247. }
  248. })