|
楼主 |
发表于 2016-4-24 17:22:21
|
显示全部楼层
define(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
var Baas = require("$UI/demo/baas/baas");
var base = require('$UI/system/api/native/base');
var share = require('$UI/system/api/native/share');
var Model = function() {
this.callParent();
this._userPhotoURL = "";
this.ready = justep.Bind.observable(false);
};
Model.prototype.modelLoad = function(event) {
var self = this;
if (this._userPhotoURL) {
$(this.getElementByXid("photoImage")).attr("src", this._userPhotoURL);
} else {
$(this.getElementByXid("photoDiv")).hide();
}
base.ready(function() {
self.ready.set(true);
});
};
Model.prototype.pengyouquanclick = function(event) {
share.onMenuShareTimeline({
title : '互联网之子',
link : 'http://qssh-hh.com',
imgUrl : 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg',
trigger : function(res) {
alert('用户点击分享到朋友圈');
},
success : function(res) {
alert('已分享');
},
cancel : function(res) {
alert('已取消');
},
fail : function(res) {
alert(JSON.stringify(res));
}
});
//this.comp("popOver1").hide();
};//分享到微信朋友圈
Model.prototype.weixinclick = function(event) {
share.onMenuShareAppMessage({
title : '互联网之子',
desc : '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
link : 'http://movie.douban.com/subject/25785114/',
imgUrl : 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg',
trigger : function(res) {
// 不要尝试在trigger中使用ajax异步请求修改本次分享的内容,因为客户端分享操作是一个同步操作,这时候使用ajax的回包会还没有返回
alert('用户点击发送给朋友');
},
success : function(res) {
alert('已分享');
},
cancel : function(res) {
alert('已取消');
},
fail : function(res) {
alert(JSON.stringify(res));
}
});
//this.comp("popOver1").hide();
};
|
|