123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- // pages/transmit/transmit.js
- const app = getApp()
- const util = require('../../utils/util.js');
- const APIClient = require('../../utils/APIClient.js');
- const login = require('../../utils/loginSchedule.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- productionData: {},
- favors: '',
- like: false
- },
- //跳转详情页
- particulars: function (e) {
- const postId = e.currentTarget.dataset.postsid;
- wx.navigateTo({
- url: '../../pages/particulars/particulars?postId=' + postId + '&type=2'
- })
- },
- /*预览图片*/
- listenerButtonPreviewImage: function(e) {
- let imgUrl = [];
- imgUrl.push(e.target.dataset.img);
- wx.previewImage({
- current: '', // 当前显示图片的http链接
- urls: imgUrl, // 需要预览的图片http链接列表
- //这根本就不走
- success: function(res) {
- //console.log(res);
- },
- //也根本不走
- fail: function() {
- //console.log('fail')
- }
- })
- },
- /*点赞接口*/
- like: function () {
- const postsId = util.getUrl().postId;
- //判断分享过来的参数是否有postId查询单挑显示
- if(postsId) {
- login.getOpenidSessionKey(res => {
- APIClient.getLikeSchedule({
- uid: res.data.data.uid
- }, {
- postsId,
- }).success(res => {
- console.log(res.data)
- if(res.data.success) {
- this.setData({
- favors: res.data.data.favors,
- like: true
- })
- }
- })
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- };
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const postsId = options.postId || '';
- //判断分享过来的参数是否有postId查询单挑显示
-
- if(postsId) {
- login.getOpenidSessionKey(res => {
- APIClient.getOneSchedule({
- uid: res.data.data.uid
- }, {
- postsId,
- }).success(res => {
- console.log(res.data)
- if(res.data.success) {
- this.setData({
- productionData: res.data.data,
- favors:res.data.data.postsAttributeInfo.favors
- })
- }
- })
- }, function() {
- wx.showModal({
- title: '提示',
- content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
- showCancel: false,
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- });
- };
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- })
|