| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- 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
- });
- wx.setNavigationBarColor({
- frontColor: "#ffffff",
- backgroundColor: "#DB1824",
- });
- },
- onPullDownRefresh: function () {
- var that=this;
- that.saveLikeNum(function(){
- that.onShow();
- });
- wx.stopPullDownRefresh();
- },
- 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(e){
- var url='../index/index';
- var url1=e.currentTarget.dataset.url;
- if (url1)
- url+=url1;
- wx.reLaunch({
- url: url,
- });
- },
- goto: function (e) {
- main.goto(e);
- },
- gotoRedirectTo:function(e){
- var url=e.currentTarget.dataset.url;
- wx.redirectTo({
- url: url,
- })
- },
- clickLikeNum:function(){
- var that=this;
- this.animateSmallShow();
- var count=++that.data.LikeNum;
- if (count>9999)
- count=9999;
- that.setData({
- LikeNum:count,
- });
- if (isUpdate){
- isUpdate=false;
- setTimeout(function(){
- isUpdate=true;
- },3000);
- that.saveLikeNum();
- }
- if (count==66){
- wx.showModal({
- title: '66大顺',
- content: '一分耕耘,一分收获。祝您心想事成,鱼跃龙门,考中心仪学校。',
- showCancel: false,
- confirmText: '中',
- });
- }
- else if (count==666){
- wx.showModal({
- title: '666厉害了',
- content: '努力必有回报,祝您考中心仪学校,实现梦想,继续闪耀!',
- showCancel: false,
- confirmText: '中',
- });
- }
- },
- saveLikeNum:function(callback){
- 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;
- if (callback)
- callback();
- });
- },
- //动画缩小淡出
- animateSmallShow: function () {
- var that = this;
- var animation = wx.createAnimation({
- duration: 100,
- timingFunction: 'ease-in',
- });
-
- //this.animation = animation;
- animation.scale(1.3, 1.3).step();
- this.setData({
- animationDataShow: animation.export(),
- });
- setTimeout(function () {
- var animation2 = wx.createAnimation({
- duration: 100,
- timingFunction: 'ease-in',
- });
- that.animation = animation2;
- animation2.scale(1, 1).step();
- that.setData({
- animationDataShow: animation2.export()
- });
- }, 150);
- },
- onShareAppMessage: function () {
- var that=this;
- var url=app.globalData.uploadImageUrl+"web/fs_a02.png";
- //debugger;
- return {
- title: "中考祝福",
- path: app.globalData.SharePath + '?type=wish&ID='+that.data.MyWish.ID+'&UserID=' + app.globalData.userInfo.UserID,
- imageUrl: url,
- }
- },
- })
|