publicpraisemsg.js 9.2 KB

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