companystrengthmsg.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. wshareshow: false,
  16. personMsg: app.globalData.personMsg,
  17. showDsc: false,
  18. showTask: true,
  19. datashow: false,
  20. companyobj: app.globalData.companyobj,
  21. type: '',
  22. bType: "",
  23. pType: "",
  24. playflag: 2,//1是播放中,2是暂停
  25. showCutImage: false,
  26. loading: false,
  27. showApproval: false,
  28. isfullScreen: false,
  29. remark: "",
  30. trackimgarr: [],
  31. nowimagearr: [],
  32. shareApprovallist: [],
  33. isBroker: false
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function (options) {
  39. if (!!options.clg && options.clg == 4) {
  40. wx.reLaunch({
  41. url: '/pages/index/index?clientype=' + options.cty + "&cid=" + options.cid + "&clg=4",
  42. })
  43. return false;
  44. }
  45. var that = this;
  46. wx.showLoading({
  47. title: '加载中...',
  48. })
  49. that.setData({
  50. eid: options.eid
  51. })
  52. if (options.type) {
  53. this.setData({
  54. type: options.type
  55. })
  56. }
  57. if (!!options.tp) {
  58. this.setData({
  59. pType: options.tp
  60. })
  61. }
  62. if (!!options.ty) {
  63. this.setData({
  64. bType: options.ty,
  65. showTask: false
  66. })
  67. }
  68. if (app.globalData.brokeruserId) {
  69. that.setData({
  70. isBroker: true
  71. })
  72. } else {
  73. that.setData({
  74. isBroker: false
  75. })
  76. }
  77. that.evidencefun();
  78. },
  79. getPhoneNumberTap: function (res) {
  80. var that = this;
  81. if (res.detail.errMsg == 'getPhoneNumber:ok') {
  82. that.setData({
  83. loading: true,
  84. })
  85. utils.$post({
  86. url: app.globalData.webUrl + 'api/users/setUserMobile',
  87. data: {
  88. encryptedData: res.detail.encryptedData,
  89. iv: res.detail.iv
  90. },
  91. header: {
  92. 'Authorization': 'bearer ' + app.globalData.token
  93. },
  94. success: function (r) {
  95. if (r.data.code == '0') {
  96. that.submitMsg(r.data.mobile);
  97. }
  98. }
  99. })
  100. }
  101. },
  102. /**
  103. * 提交注册数据
  104. */
  105. submitMsg(mobile) {
  106. var that = this;
  107. utils.$post({
  108. url: app.globalData.webUrl + 'api/agents/add_agents',
  109. header: {
  110. 'Authorization': 'bearer ' + app.globalData.token
  111. },
  112. data: {
  113. name: '',
  114. phone: mobile,
  115. employee_id: app.globalData.brokerEmployeeId,
  116. wechat: '',
  117. type: app.globalData.brokerType
  118. },
  119. success: function (res) {
  120. if (res.data.code == '0') {
  121. app.globalData.brokeruserId = res.data.data;
  122. that.setData({
  123. isBroker: true,
  124. loading: false,
  125. wshareshow: true
  126. })
  127. }
  128. }
  129. })
  130. },
  131. onFullScreenChange(e) {
  132. let isBol = e.detail.detail.fullScreen;
  133. this.setData({
  134. isfullScreen: isBol
  135. })
  136. },
  137. /**
  138. * 生命周期函数--监听页面初次渲染完成
  139. */
  140. onReady: function () {
  141. },
  142. videotap(){
  143. videoContext.play();
  144. wx.showLoading()
  145. },
  146. bindprogress(){
  147. wx.hideLoading();
  148. this.setData({
  149. playflag:1
  150. })
  151. },
  152. showDscContent: function () {
  153. if (this.data.evidencemsg.desc.length > 28) {
  154. this.data.showDsc = !this.data.showDsc;
  155. this.setData({
  156. showDsc: this.data.showDsc
  157. })
  158. }
  159. },
  160. setpostertap: function () {
  161. if (this.data.bType == 'b') {
  162. wx.navigateTo({
  163. url: '/index/pages/setposter/setposter?type=CompanyStrength&aid=' + this.data.eid + "&ty=b&listshare=",
  164. })
  165. } else {
  166. wx.navigateTo({
  167. url: '/index/pages/setposter/setposter?type=CompanyStrength&aid=' + this.data.eid + "&listshare=",
  168. })
  169. }
  170. },
  171. sharetap: function () {
  172. this.setData({
  173. wshareshow: true
  174. })
  175. },
  176. evidencefun: function () {
  177. var that = this;
  178. utils.$get({
  179. url: app.globalData.webUrl + 'api/company_strength/read',
  180. header: {
  181. 'Authorization': 'bearer ' + app.globalData.token
  182. },
  183. data: {
  184. id: that.data.eid,
  185. uid: app.globalData.personMsg.id,
  186. },
  187. success: function (res) {
  188. wx.hideLoading()
  189. if (res.data.code == '0') {
  190. res.data.data.desc = res.data.data.title + '#' + res.data.data.desc + '#';
  191. that.setData({
  192. evidencemsg: res.data.data,
  193. })
  194. wx.setNavigationBarTitle({
  195. title: res.data.data.title
  196. })
  197. if (res.data.data.difference == 1) {
  198. videoContext = that.selectComponent('#myVideo');
  199. videoContext.play();
  200. }
  201. }
  202. }
  203. })
  204. },
  205. collectap: function () {
  206. var that = this;
  207. var list = that.data.evidencemsg;
  208. let weburl = '';
  209. if (that.data.evidencemsg.collect) {
  210. weburl = 'api/companyStrength/no_collect'
  211. } else {
  212. weburl = 'api/companyStrength/collect'
  213. }
  214. utils.$post({
  215. url: app.globalData.webUrl + weburl,
  216. header: {
  217. 'Authorization': 'bearer ' + app.globalData.token
  218. },
  219. data: {
  220. id: that.data.eid
  221. },
  222. success: function (res) {
  223. if (res.data.code == '0') {
  224. wx.showToast({
  225. title: res.data.msg,
  226. icon: 'none',
  227. duration: 2000
  228. })
  229. list.collect = !list.collect;
  230. that.setData({
  231. evidencemsg: list
  232. })
  233. }
  234. }
  235. })
  236. },
  237. shareurltap: function () {
  238. wx.showLoading({
  239. title: '加载中...',
  240. })
  241. if (this.data.bType == 'b') {
  242. util.schemefun('/share/pages/companystrengthmsg/companystrengthmsg', 'eid=' + this.data.eid + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + '&agid=' + app.globalData.brokeruserId, this.data.eid, 'CompanyStrength', '');
  243. } else {
  244. util.schemefun('/share/pages/companystrengthmsg/companystrengthmsg', 'eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, this.data.eid, 'CompanyStrength', '');
  245. }
  246. this.evidencesharetap();
  247. },
  248. sendfriendtap() {
  249. this.evidencesharetap();
  250. },
  251. evidencesharetap: function () {
  252. var that = this;
  253. utils.$post({
  254. url: app.globalData.webUrl + 'api/share/addlog',
  255. header: {
  256. 'Authorization': 'bearer ' + app.globalData.token
  257. },
  258. data: {
  259. id: that.data.eid,
  260. type: 'CompanyStrength',
  261. alertshow: '456'
  262. },
  263. success: function (r) {
  264. }
  265. })
  266. },
  267. prelooktap() {
  268. if (!app.globalData.personMsg.binded.qrcode) {
  269. wx.showToast({
  270. title: "您的二维码为空,请上传二维码!",
  271. icon: 'none',
  272. duration: 2000
  273. })
  274. return false;
  275. }
  276. wx.previewImage({
  277. current: app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode, // 当前显示图片的http链接
  278. urls: [app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode]// 需要预览的图片http链接列表
  279. })
  280. },
  281. callphonetap: function () {
  282. wx.makePhoneCall({
  283. phoneNumber: app.globalData.personMsg.phone
  284. })
  285. },
  286. /**
  287. * 生命周期函数--监听页面显示
  288. */
  289. onShow: function () {
  290. this.setData({
  291. companyobj: app.globalData.companyobj,
  292. })
  293. },
  294. /**
  295. * 生命周期函数--监听页面隐藏
  296. */
  297. onHide: function () {
  298. },
  299. /**
  300. * 生命周期函数--监听页面卸载
  301. */
  302. onUnload: function () {
  303. },
  304. /**
  305. * 页面相关事件处理函数--监听用户下拉动作
  306. */
  307. onPullDownRefresh: function () {
  308. },
  309. /**
  310. * 页面上拉触底事件的处理函数
  311. */
  312. onReachBottom: function () {
  313. },
  314. /**
  315. * 用户点击右上角分享
  316. */
  317. onShareAppMessage: function () {
  318. this.evidencesharetap();
  319. 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 + '?x-oss-process=video/snapshot,t_100,f_jpg,w_375,m_fast')) : this.data.evidencemsg.cover;
  320. img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  321. if (this.data.bType == 'b') {
  322. return {
  323. title: this.data.evidencemsg.title,
  324. imageUrl: img,
  325. path: '/share/pages/companystrengthmsg/companystrengthmsg?eid=' + this.data.eid + '&uid=' + app.globalData.agentEmployeEid + '&ctp=' + app.globalData.clientype + '&agid=' + app.globalData.brokeruserId
  326. }
  327. } else {
  328. return {
  329. title: this.data.evidencemsg.title,
  330. imageUrl: img,
  331. path: '/share/pages/companystrengthmsg/companystrengthmsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
  332. }
  333. }
  334. },
  335. onAddToFavorites(res) {
  336. 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 + '?x-oss-process=video/snapshot,t_100,f_jpg,w_375,m_fast')) : this.data.evidencemsg.cover;
  337. img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/');
  338. return {
  339. title: this.data.evidencemsg.title,
  340. imageUrl: img,
  341. query: 'cid=' + this.data.eid + '&cty=' + app.globalData.clientype + '&clg=4',
  342. }
  343. }
  344. })