1
0

publicpraisemsg.js 9.0 KB

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