const app = getApp(); var utils = require("../../../utils/http") const util = require("../../../utils/util") Page({ /** * 页面的初始数据 */ data: { imgUrl: app.globalData.imgUrl, eid: '', evidencemsg: {}, lastId: '', nextId: '', wshareshow: false, personMsg: app.globalData.personMsg, companyobj:app.globalData.companyobj, priceflag: false, showDsc: false, ltype:'',//不为空是从名片中点击进去 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; wx.showLoading({ title: '加载中...', }) that.setData({ eid: options.eid, ltype:options.ltype?options.ltype:'' }) that.evidencefun(); }, showDscTextFunc: function () { if (this.data.evidencemsg.desc.length > 29) { this.data.showDsc = !this.data.showDsc; this.setData({ showDsc: this.data.showDsc }) } }, priceshowtap() { this.setData({ priceflag: true }) }, closepricetap() { this.setData({ priceflag: false }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, setpostertap: function () { wx.navigateTo({ url: '/index/pages/setposter/setposter?type=materialEvidence&aid=' + this.data.eid + "&listshare=", }) }, sharetap: function () { this.setData({ wshareshow: true }) }, evidencefun: function () { var that = this; utils.$get({ url: app.globalData.webUrl + 'api/evidencedetail', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.eid, uid: app.globalData.personMsg.id, }, success: function (res) { wx.hideLoading() if (res.data.code == '0') { res.data.data.desc = res.data.data.title + '#' + res.data.data.desc + '#'; that.setData({ evidencemsg: res.data.data, lastId: res.data.lastId, nextId: res.data.nextId, }) wx.setNavigationBarTitle({ title: res.data.data.title }) if (res.data.data.difference == 1) { const videoContext = that.selectComponent('#myVideo'); videoContext.play(); } } } }) }, collectap: function () { var that = this; var list = that.data.evidencemsg; utils.$post({ url: app.globalData.webUrl + 'api/collect', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { user_id: app.globalData.personMsg.id, content_type: "materialEvidence", content_id: that.data.eid }, success: function (res) { if (res.data.code == '0') { wx.showToast({ title: res.data.msg, icon: 'none', duration: 2000 }) list.collected = !list.collected; that.setData({ evidencemsg: list }) } } }) }, shareurltap: function () { wx.showLoading({ title: '加载中...', }) util.schemefun('/share/pages/publicpraisemsg/publicpraisemsg', 'eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, this.data.eid, 'materialEvidence', ''); this.evidencesharetap(); }, sendfriendtap() { this.evidencesharetap(); }, evidencesharetap: function () { var that = this; utils.$post({ url: app.globalData.webUrl + 'api/share/addlog', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { id: that.data.eid, type: 'materialEvidence' }, success: function (r) {} }) }, pretap: function () { if (!this.data.lastId) { wx.showToast({ title: '已经第一篇了!', icon: 'none', duration: 2000 }) return false } wx.redirectTo({ url: '/index/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.lastId, }) }, nextap: function () { if (!this.data.nextId) { wx.showToast({ title: '已经最后一篇了!', icon: 'none', duration: 2000 }) return false } wx.redirectTo({ url: '/index/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.nextId, }) }, prelooktap() { if (!app.globalData.personMsg.binded.qrcode) { wx.showToast({ title: "您的二维码为空,请上传二维码!", icon: 'none', duration: 2000 }) return false; } wx.previewImage({ current: app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode, // 当前显示图片的http链接 urls: [app.globalData.imgUrl + app.globalData.personMsg.binded.qrcode] // 需要预览的图片http链接列表 }) }, callphonetap: function () { wx.makePhoneCall({ phoneNumber: app.globalData.personMsg.phone }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.setData({ companyobj:app.globalData.companyobj, personMsg: app.globalData.personMsg, }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, // onShareTimeline: function () { // this.evidencesharetap(); // 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]; // img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/'); // return { // title: this.data.evidencemsg.title, // imageUrl: img, // query: '/share/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype // } // }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { this.evidencesharetap(); 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]; img = img.replace('http://o.nczyzs.com/', 'https://o.nczyzs.com/'); return { title: this.data.evidencemsg.title, imageUrl: img, path: '/share/pages/publicpraisemsg/publicpraisemsg?eid=' + this.data.eid + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype } } })