companystrengthmsg.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. showDsc: false,
  17. companyobj: app.globalData.companyobj,
  18. type: ''
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad: function (options) {
  24. var that = this;
  25. wx.showLoading({
  26. title: '加载中...',
  27. })
  28. that.setData({
  29. eid: options.eid
  30. })
  31. if (options.type) {
  32. this.setData({
  33. type: options.type
  34. })
  35. }
  36. that.evidencefun();
  37. },
  38. /**
  39. * 生命周期函数--监听页面初次渲染完成
  40. */
  41. onReady: function () {
  42. },
  43. showDscContent: function () {
  44. if (this.data.evidencemsg.desc.length > 28) {
  45. this.data.showDsc = !this.data.showDsc;
  46. this.setData({
  47. showDsc: this.data.showDsc
  48. })
  49. }
  50. },
  51. setpostertap: function () {
  52. wx.navigateTo({
  53. url: '/index/pages/setposter/setposter?type=CompanyStrength&aid=' + this.data.eid + "&listshare=",
  54. })
  55. },
  56. sharetap: function () {
  57. this.setData({
  58. wshareshow: true
  59. })
  60. },
  61. evidencefun: function () {
  62. var that = this;
  63. utils.$get({
  64. url: app.globalData.webUrl + 'api/company_strength/read',
  65. header: {
  66. 'Authorization': 'bearer ' + app.globalData.token
  67. },
  68. data: {
  69. id: that.data.eid,
  70. uid: app.globalData.personMsg.id,
  71. },
  72. success: function (res) {
  73. wx.hideLoading()
  74. if (res.data.code == '0') {
  75. res.data.data.desc = res.data.data.title + '#' + res.data.data.desc + '#';
  76. that.setData({
  77. evidencemsg: res.data.data,
  78. })
  79. wx.setNavigationBarTitle({
  80. title: res.data.data.title
  81. })
  82. if (res.data.data.difference == 1) {
  83. const videoContext = that.selectComponent('#myVideo');
  84. videoContext.play();
  85. }
  86. }
  87. }
  88. })
  89. },
  90. collectap: function () {
  91. var that = this;
  92. var list = that.data.evidencemsg;
  93. let weburl = '';
  94. if (that.data.evidencemsg.collect) {
  95. weburl = 'api/companyStrength/no_collect'
  96. } else {
  97. weburl = 'api/companyStrength/collect'
  98. }
  99. utils.$post({
  100. url: app.globalData.webUrl + weburl,
  101. header: {
  102. 'Authorization': 'bearer ' + app.globalData.token
  103. },
  104. data: {
  105. id: that.data.eid
  106. },
  107. success: function (res) {
  108. if (res.data.code == '0') {
  109. wx.showToast({
  110. title: res.data.msg,
  111. icon: 'none',
  112. duration: 2000
  113. })
  114. list.collect = !list.collect;
  115. that.setData({
  116. evidencemsg: list
  117. })
  118. }
  119. }
  120. })
  121. },
  122. shareurltap: function () {
  123. wx.showLoading({
  124. title: '加载中...',
  125. })
  126. util.schemefun('/share/pages/companystrengthmsg/companystrengthmsg', 'eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, this.data.eid, 'CompanyStrength', '');
  127. this.evidencesharetap();
  128. },
  129. sendfriendtap() {
  130. this.evidencesharetap();
  131. },
  132. evidencesharetap: function () {
  133. var that = this;
  134. utils.$post({
  135. url: app.globalData.webUrl + 'api/share/addlog',
  136. header: {
  137. 'Authorization': 'bearer ' + app.globalData.token
  138. },
  139. data: {
  140. id: that.data.eid,
  141. type: 'CompanyStrength',
  142. alertshow: '456'
  143. },
  144. success: function (r) {
  145. }
  146. })
  147. },
  148. prelooktap() {
  149. if (!app.globalData.personMsg.binded.qrcode) {
  150. wx.showToast({
  151. title: "您的二维码为空,请上传二维码!",
  152. icon: 'none',
  153. duration: 2000
  154. })
  155. return false;
  156. }
  157. wx.previewImage({
  158. current: app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode, // 当前显示图片的http链接
  159. urls: [app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode]// 需要预览的图片http链接列表
  160. })
  161. },
  162. callphonetap: function () {
  163. wx.makePhoneCall({
  164. phoneNumber: app.globalData.personMsg.phone
  165. })
  166. },
  167. /**
  168. * 生命周期函数--监听页面显示
  169. */
  170. onShow: function () {
  171. this.setData({
  172. companyobj: app.globalData.companyobj,
  173. })
  174. },
  175. /**
  176. * 生命周期函数--监听页面隐藏
  177. */
  178. onHide: function () {
  179. },
  180. /**
  181. * 生命周期函数--监听页面卸载
  182. */
  183. onUnload: function () {
  184. },
  185. /**
  186. * 页面相关事件处理函数--监听用户下拉动作
  187. */
  188. onPullDownRefresh: function () {
  189. },
  190. /**
  191. * 页面上拉触底事件的处理函数
  192. */
  193. onReachBottom: function () {
  194. },
  195. /**
  196. * 用户点击右上角分享
  197. */
  198. onShareAppMessage: function () {
  199. this.evidencesharetap();
  200. var img = this.data.evidencemsg.difference == 1 ? (this.data.evidencemsg.cover ? this.data.evidencemsg.cover : (this.data.evidencemsg.pics + '?x-oss-process=video/snapshot,t_100,f_jpg,w_375,m_fast')) : this.data.evidencemsg.cover;
  201. img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  202. return {
  203. title: this.data.evidencemsg.title,
  204. imageUrl: img,
  205. path: '/share/pages/companystrengthmsg/companystrengthmsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  206. }
  207. }
  208. })