| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- import common from '../../utils/util';
- import main from '../../utils/main';
- const app = getApp();
- var isUpdate=true;
- var historyLikeNum=0;
- Page({
- data: {
- },
- onLoad: function (options) {
- var that = this;
- that.setData({
- Containnerheight: main.getWindowHeight(),
- ID:options.ID,
- IsShare:options.Share
- });
- },
- onShow:function(){
- var that = this;
-
- if (that.data.ID){
- main.getData("GetMPSWish?WishType=person&ID="+that.data.ID, function (data2) {
- //debugger;
- if (data2 && data2.length>0) {
- app.globalData.MyWish=data2[0];
- console.log("data2[0]:"+data2[0]);
- that.setData({
- MyWish:app.globalData.MyWish,
- LikeNum:app.globalData.MyWish.LikeNum,
- ID:app.globalData.MyWish.ID,
- });
- historyLikeNum=app.globalData.MyWish.LikeNum;
- }
- });
- }
- else if (app.globalData.MyWish){
- that.setData({
- MyWish:app.globalData.MyWish,
- LikeNum:app.globalData.MyWish.LikeNum,
- UserID:app.globalData.userInfo.UserID,
- ID:app.globalData.MyWish.ID,
- });
- historyLikeNum=app.globalData.MyWish.LikeNum;
- }
- },
- onHide:function(){
- this.saveLikeNum();
- },
- onUnload:function(){
- this.saveLikeNum();
- },
- returnDefault:function(){
- wx.reLaunch({
- url: '../index/index'
- });
- },
- goto: function (e) {
- if (e.currentTarget.dataset.target=="school"){
- wx.navigateBack({
- delta: 3,
- });
- }
-
- main.goto(e);
- },
- gotoRedirectTo:function(e){
- var url=e.currentTarget.dataset.url;
- wx.redirectTo({
- url: url,
- })
- },
- clickLikeNum:function(){
- var that=this;
- that.setData({
- LikeNum:++that.data.LikeNum
- });
- if (isUpdate){
- isUpdate=false;
- setTimeout(function(){
- isUpdate=true;
- },3000);
- that.saveLikeNum();
- }
- },
- saveLikeNum:function(){
- var that = this;
- var likeNumAdd=that.data.LikeNum-historyLikeNum;
- main.getData("UpdateMPSWishLikeNum?ID="+that.data.ID+"&LikeNumAdd="+likeNumAdd, function (data2) {
- console.log(that.data.LikeNum);
- historyLikeNum=that.data.LikeNum;
- });
- },
- onShareAppMessage: function () {
- var that=this;
- var url=app.globalData.uploadImageUrl+"web/fs_a02.png";
- //debugger;
- return {
- title: that.data.MyWish.WishWhom2+that.data.MyWish.SchoolShortName,
- path: app.globalData.SharePath + '?type=wish&ID='+that.data.MyWish.ID+'&UserID=' + app.globalData.userInfo.UserID,
- imageUrl: url,
- }
- },
- })
|