123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- 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
- }
- }
- })
|