123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- 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: '',
- urls: imgUrl,
-
- success: function(res) {
-
- },
-
- fail: function() {
-
- }
- })
- },
-
- like: function () {
- const postsId = util.getUrl().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 || '';
-
-
- 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 () {
-
- },
- })
|