12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- Namespace.register("U.UF.OT"); //第三方接口
- /**
- * 生成微信二维码
- *
- * @bindel {element} 绑定点击的元素 必填
- * @href {string} 分享的地址 选填 默认值:当前游览器网页地址
- * return {element} 返回创建好得元素
- */
- U.UF.OT.weChatShareCode = function codeLayout(bindel, href, parent) {
- if (typeof bindel != 'object') //判断bindel是否是元素
- return false;
- parent = parent ? parent : document.body; //parente默认为document.body
- var _codeBox;
- if (!$('#wxfrom', parent)[0]) {// 判断二维码是否存在
- _codeBox = $$('div', { id: "wxfrom", style: { cssText: 'display: none; position:fixed; top:0; left:0; bottom:0; right:0; margin:auto; width:251px; height:332px; padding:10px; background-color: #f4f4f4; border: 1px solid #b9b9b9;'} }, parent || document.body);
- $$('span', { innerText: "分享到微信朋友圈", style: { cssText: 'font-weight: bold'} }, _codeBox);
- $$('span', { innerText: 'x', style: { cssText: 'margin-left:140px; font-size: 18px; font-weight: bold; cursor:pointer' }, onclick: function () {
- _codeBox.style.display = 'none';
- }
- }, _codeBox);
- var _codeShowArea = $$('div', { style: { cssText: "padding:20px 10px;"} }, _codeBox);
- // U.UF.QR.generate("230", "235", "black", "#f4f4f4", href || window.location.href, _codeShowArea);
- $$('div', { innerHTML: "打开微信,点击底部的“发现”,<br/>使用“扫一扫”即可将网页分享至朋友圈。" }, _codeBox);
- } else {
- _codeBox = U.selectEl('#wxfrom', parent)[0];
- }
- U.selectEl(bindel).bind({
- click: function () {
- U.UF.QR.generate("230", "235", "black", "#f4f4f4", href || window.location.href, _codeShowArea);
- _codeBox.style.display = '';
- }
- })
- return _codeBox;
- }
- /**
- * qq好友分享
- *
- * @url {string} 分享的网页地址
- * @title {string} 标题
- * @pic {string} 图片绝对路径
- * @desc {string} 分享介绍
- * @summary {string} 分享内容
- */
- U.UF.OT.qqFriendShare = function (url, title, pic, desc, summary) {
- var _sharesinastring = 'https://connect.qq.com/widget/shareqq/index.html?url=' + encodeURIComponent(url || window.location.href)
- + '&title=' + encodeURIComponent(title || '这文件超棒的,分享给你看看!')
- + '&pic=' + pic || ""
- + '&desc=' + desc || ""
- + '&summary=' + summary || "";
- window.open(_sharesinastring, 'newwindow', 'height=600,width=864,top=300,left=300');
- }
- /**
- * 新浪微博分享
- *
- * @url {string} 分享的网页地址
- * @title {string} 标题
- * @pic {string} 图片绝对路径
- */
- U.UF.OT.weiboShare = function (url, title, pic) {
- var _sharesinastring = 'http://v.t.sina.com.cn/share/share.php?url=' + encodeURIComponent(url || window.location.href)
- + '&title=' + encodeURIComponent(title || '这文件超棒的,分享给你看看!') + '&content=utf-8'
- + '&pic=' + pic || "";
- window.open(_sharesinastring, 'newwindow', 'height=500,width=800,top=300,left=300');
- }
|