diff --git a/bjyy-core/pom.xml b/bjyy-core/pom.xml index 05c9ec0..4ea5787 100644 --- a/bjyy-core/pom.xml +++ b/bjyy-core/pom.xml @@ -175,15 +175,18 @@ test - + prod prod + + true + diff --git a/bjyy-core/src/main/java/com/wmeimob/bjyy/common/BaseController.java b/bjyy-core/src/main/java/com/wmeimob/bjyy/common/BaseController.java index 600248d..9a98fd2 100644 --- a/bjyy-core/src/main/java/com/wmeimob/bjyy/common/BaseController.java +++ b/bjyy-core/src/main/java/com/wmeimob/bjyy/common/BaseController.java @@ -1,5 +1,6 @@ package com.wmeimob.bjyy.common; +import lombok.extern.log4j.Log4j; import org.springframework.web.bind.annotation.ExceptionHandler; import com.wmeimob.bjyy.weixin.WeChatUtil; @@ -11,6 +12,7 @@ import com.wmeimob.wechat.core.WeChatBuilder; /** * 父类Controller */ +@Log4j public class BaseController { public static final WeChat WECHAT = WeChatBuilder.newBuilder(WeChatUtil.APP_ID, WeChatUtil.APP_SECRET) @@ -22,7 +24,9 @@ public class BaseController { * @return */ @ExceptionHandler(value = Exception.class) - public String exceptionHandler() { + public String exceptionHandler(Exception e) { + e.printStackTrace(); + log.error(e); return "error/error"; } } diff --git a/bjyy-core/src/main/java/com/wmeimob/bjyy/util/UploadFileUtil_Servlet3.java b/bjyy-core/src/main/java/com/wmeimob/bjyy/util/UploadFileUtil_Servlet3.java new file mode 100644 index 0000000..f6f7375 --- /dev/null +++ b/bjyy-core/src/main/java/com/wmeimob/bjyy/util/UploadFileUtil_Servlet3.java @@ -0,0 +1,142 @@ +package com.wmeimob.bjyy.util; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; + +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.Part; +import java.io.*; +import java.net.URLEncoder; +import java.util.Date; + +@Slf4j +public class UploadFileUtil_Servlet3 { + /** + * Servlet3.0文件上传 (生成uuid.txt文件) + * @param part Servlet3.0 API ---> Part + * @param allowedExts 允许的后缀名 + * @param dir 目录 + * @return 文件名 + * @throws IOException + */ + public static String uploadFile(Part part, String allowedExts, String dir) + throws IOException{ + String extraPath = DateUtil.format(new Date(), "yyyyMMdd"); + + //1.判断是否为空 + if (part == null) { + return null; + } + + //2.生成文件名 [uuid.ext] + String original = getFileNameByPart(part); + String ext = FileUtil.extName(original); + if (StrUtil.isEmpty(ext) || !allowedExts.contains(ext)){ + throw new RuntimeException("不支持的格式类型: " + ext); + } + String path = extraPath + File.separator + IdUtil.simpleUUID() + "." + ext; + //3.创建必要的目录 + File tmpFile = new File(dir); + if (!tmpFile.exists()) { + tmpFile.mkdirs(); + } + + //4.写入磁盘 + String fullPath = dir + File.separator + path; + //part.write(path); //需要配置临时路径 + //saveFileFromInputStream(part.getInputStream(),dir,name); + FileUtil.writeFromStream(part.getInputStream(),fullPath); + + return path; + } + + public static byte[] uploadFile(Part part) + throws IOException { + //1.判断是否为空 + if (part == null) { + return null; + } + + //2.读取文件 + InputStream is = part.getInputStream(); + byte[] bytes = new byte[is.available()]; + is.read(bytes); + + return bytes; + } + + /** + * 根据请求头解析出文件名 + * 请求头的格式:火狐和google浏览器下:form-data; name="file"; filename="snmp4j--api.zip" + * IE浏览器下:form-data; name="file"; filename="E:\snmp4j--api.zip" + * @param part 包含请求头 + * @return 文件名 + */ + public static String getFileNameByPart(Part part) { + String header = part.getHeader("content-disposition"); + /** + * String[] tempArr1 = header.split(";");代码执行完之后,在不同的浏览器下,tempArr1数组里面的内容稍有区别 + * 火狐或者google浏览器下:tempArr1={form-data,name="file",filename="snmp4j--api.zip"} + * IE浏览器下:tempArr1={form-data,name="file",filename="E:\snmp4j--api.zip"} + */ + String[] tempArr1 = header.split(";"); + /** + *火狐或者google浏览器下:tempArr2={filename,"snmp4j--api.zip"} + *IE浏览器下:tempArr2={filename,"E:\snmp4j--api.zip"} + */ + String[] tempArr2 = tempArr1[2].split("="); + //获取文件名,兼容各种浏览器的写法 + String fileName = tempArr2[1].substring(tempArr2[1].lastIndexOf("\\")+1).replaceAll("\"", ""); + return fileName; + } + + public static void download(HttpServletResponse response, String path, String fileName) throws Exception{ + File file = new File(path); + // 如果文件存在,则进行下载 + if (!file.exists()) { + log.info("该路径不存在:{}",path); + return; + } + // 配置文件下载 + response.setHeader("content-type", "application/octet-stream"); + response.setContentType("application/octet-stream"); + // 下载文件能正常显示中文 + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, CharsetUtil.UTF_8)); + // 实现文件下载 + byte[] buffer = new byte[1024]; + FileInputStream fis = null; + BufferedInputStream bis = null; + try { + fis = new FileInputStream(file); + bis = new BufferedInputStream(fis); + OutputStream os = response.getOutputStream(); + int i = bis.read(buffer); + while (i != -1) { + os.write(buffer, 0, i); + i = bis.read(buffer); + } + + } finally { + if (bis != null) { + try { + bis.close(); + } catch (IOException e) { + log.error("关闭流异常", e); + } + } + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + log.error("关闭流异常", e); + } + } + } + + + } +} diff --git a/bjyy-core/src/main/resources/dev/jdbc.properties b/bjyy-core/src/main/resources/dev/jdbc.properties index d2cbf2b..21fbb15 100644 --- a/bjyy-core/src/main/resources/dev/jdbc.properties +++ b/bjyy-core/src/main/resources/dev/jdbc.properties @@ -1,5 +1,4 @@ jdbc.driver=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://127.0.0.1:3306/yanyuan?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true +jdbc.url=jdbc:mysql://test.tall.wiki:3306/yanyuan?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true jdbc.username=root -#jdbc.password=po3OynBO[M3579p6L7)o -jdbc.password= \ No newline at end of file +jdbc.password=po3OynBO[M3579p6L7)o \ No newline at end of file diff --git a/bjyy-core/src/main/resources/dev/redis.properties b/bjyy-core/src/main/resources/dev/redis.properties index 45ac5a5..ff8b4bb 100644 --- a/bjyy-core/src/main/resources/dev/redis.properties +++ b/bjyy-core/src/main/resources/dev/redis.properties @@ -1,5 +1,5 @@ redis.host=127.0.0.1 redis.port=6379 #redis.password=keepAwayFromGithub&CodeSave -redis.password=areowqr!@43ef -redis.index=6 \ No newline at end of file +redis.password= +redis.index=1 \ No newline at end of file diff --git a/bjyy-core/src/main/resources/dev/wechat.properties b/bjyy-core/src/main/resources/dev/wechat.properties index 8e9a923..39804b0 100644 --- a/bjyy-core/src/main/resources/dev/wechat.properties +++ b/bjyy-core/src/main/resources/dev/wechat.properties @@ -6,4 +6,8 @@ #wechat.CallbackDomain=https://lyb-yanyuan.f.wmeimob.com wechat.AppID=wx7af1bf1e14facf82 wechat.AppSecret=a6613fae11b497639c0224b820aaf6d9 -wechat.CallbackDomain=https://www.tall.wiki \ No newline at end of file +wechat.CallbackDomain=https://www.tall.wiki +filePath=D:/git/bjyy/bjyy-weixin/target/bjyy-weixin/ +domain=http://localhost:8080/bjyy_weixin/ +logoPath=D:/git/bjyy/bjyy-weixin/src/main/webapp/static/images/logo.jpg +projectPath=D:/git/bjyy/bjyy-weixin/target/bjyy-weixin/ \ No newline at end of file diff --git a/bjyy-core/src/main/resources/prod/redis.properties b/bjyy-core/src/main/resources/prod/redis.properties index 56234de..bdafd55 100644 --- a/bjyy-core/src/main/resources/prod/redis.properties +++ b/bjyy-core/src/main/resources/prod/redis.properties @@ -1,5 +1,5 @@ redis.host=127.0.0.1 redis.port=6379 #redis.password=keepAwayFromGithub&CodeSave -redis.password= -redis.index=4 \ No newline at end of file +redis.password=areowqr!@43ef +redis.index=1 \ No newline at end of file diff --git a/bjyy-core/src/main/resources/prod/wechat.properties b/bjyy-core/src/main/resources/prod/wechat.properties index 8e9a923..af91890 100644 --- a/bjyy-core/src/main/resources/prod/wechat.properties +++ b/bjyy-core/src/main/resources/prod/wechat.properties @@ -6,4 +6,9 @@ #wechat.CallbackDomain=https://lyb-yanyuan.f.wmeimob.com wechat.AppID=wx7af1bf1e14facf82 wechat.AppSecret=a6613fae11b497639c0224b820aaf6d9 -wechat.CallbackDomain=https://www.tall.wiki \ No newline at end of file +wechat.CallbackDomain=https://www.tall.wiki + +filePath=/home/staticrec/ +domain=https://www.tall.wiki/ +logoPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/static/images/logo.jpg +projectPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/ \ No newline at end of file diff --git a/bjyy-core/src/main/resources/test/jdbc.properties b/bjyy-core/src/main/resources/test/jdbc.properties index 7aa4fb1..bf7116f 100644 --- a/bjyy-core/src/main/resources/test/jdbc.properties +++ b/bjyy-core/src/main/resources/test/jdbc.properties @@ -1,5 +1,4 @@ jdbc.driver=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://test.tall.wiki:3306/yanyuan?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true +jdbc.url=jdbc:mysql://127.0.0.1:3306/yanyuan?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true jdbc.username=root -jdbc.password=po3OynBO[M3579p6L7)o -#jdbc.password= \ No newline at end of file +jdbc.password= \ No newline at end of file diff --git a/bjyy-core/src/main/resources/test/redis.properties b/bjyy-core/src/main/resources/test/redis.properties index 49a3a3d..91f7863 100644 --- a/bjyy-core/src/main/resources/test/redis.properties +++ b/bjyy-core/src/main/resources/test/redis.properties @@ -2,4 +2,4 @@ redis.host=127.0.0.1 redis.port=6379 redis.password= #redis.password= -redis.index=5 \ No newline at end of file +redis.index=1 \ No newline at end of file diff --git a/bjyy-core/src/main/resources/test/wechat.properties b/bjyy-core/src/main/resources/test/wechat.properties index a0f0f6e..f776c3b 100644 --- a/bjyy-core/src/main/resources/test/wechat.properties +++ b/bjyy-core/src/main/resources/test/wechat.properties @@ -7,7 +7,7 @@ wechat.CallbackDomain=https://www.tall.wiki #wechat.AppID=wxbcda0257af55982a #wechat.AppSecret=818724f3ef23895c1b46b4bae75a1a50 #wechat.CallbackDomain=https://lyb-yanyuan.f.wmeimob.com -filePath=D:/git/bjyy/bjyy-weixin/target/bjyy-weixin/ -domain=http://localhost:8080/bjyy_weixin/ -logoPath=D:/git/bjyy/bjyy-weixin/src/main/webapp/static/images/logo.jpg -projectPath=D:/git/bjyy/bjyy-weixin/target/bjyy-weixin/ +filePath=/home/staticrec/ +domain=https://www.tall.wiki/ +logoPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/static/images/logo.jpg +projectPath=/home/tomcat/apache-tomcat-8.5.61/webapps/bjyy-weixin/ diff --git a/bjyy-dal/pom.xml b/bjyy-dal/pom.xml index 6a362f4..719e540 100644 --- a/bjyy-dal/pom.xml +++ b/bjyy-dal/pom.xml @@ -18,10 +18,6 @@ - - ${project.groupId} - bjyy-core - org.springframework spring-jdbc diff --git a/bjyy-dal/src/main/java/com/wmeimob/bjyy/dao/TrainDao.java b/bjyy-dal/src/main/java/com/wmeimob/bjyy/dao/TrainDao.java index 091c5bf..3a1bbd6 100644 --- a/bjyy-dal/src/main/java/com/wmeimob/bjyy/dao/TrainDao.java +++ b/bjyy-dal/src/main/java/com/wmeimob/bjyy/dao/TrainDao.java @@ -18,7 +18,8 @@ public interface TrainDao { /** * 根据用户ID查看最新的训练内容 * @param userId 用户ID + * @param testId 测评ID * @return 训练内容 */ - List queryLastPractice(@Param("userId") String userId); + List queryLastPractice(@Param("userId") String userId, @Param("testId") String testId); } diff --git a/bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml b/bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml index 2127277..c45c79a 100644 --- a/bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml +++ b/bjyy-dal/src/main/java/com/wmeimob/bjyy/mapping/TrainDao.xml @@ -60,7 +60,12 @@ + + diff --git a/bjyy-weixin/src/main/webapp/static/exam4/test30.html b/bjyy-weixin/src/main/webapp/static/exam4/test30.html index 9f3a434..b8b0267 100644 --- a/bjyy-weixin/src/main/webapp/static/exam4/test30.html +++ b/bjyy-weixin/src/main/webapp/static/exam4/test30.html @@ -116,7 +116,7 @@ url:contextPath+"/wx/mental/submitMental", type:'post', data:$("form[name='firstBasicForm']").serialize(), - success:function(result){ + success:function(result){ if (result.code==0) { window.location.href=contextPath+"/wx/mental/mentalResult"; }else if(result.code==1){ diff --git a/bjyy-weixin/src/main/webapp/static/js/h5share.js b/bjyy-weixin/src/main/webapp/static/js/h5share.js index 12bb64f..2b2acbc 100644 --- a/bjyy-weixin/src/main/webapp/static/js/h5share.js +++ b/bjyy-weixin/src/main/webapp/static/js/h5share.js @@ -31,6 +31,9 @@ // 插入空图片 function insertShareImg(img_url){ + alert("img"); + alert(window); + console.info(window, window.document) var div = doc.createElement('div'); div.style.position = 'absolute'; div.style.opacity = '0'; @@ -38,6 +41,8 @@ var img = new Image(); img.src = img_url; div.appendChild(img); + + console.info(doc,doc.body); doc.body.insertBefore(div,doc.body.children[0]); } @@ -106,6 +111,7 @@ h5share.prototype.shareWX = function(){ var that = this; + alert(wx); // 旧wechat接口 document.addEventListener('WeixinJSBridgeReady', function () { WeixinJSBridge.on("menu:share:timeline", function(e) { @@ -368,7 +374,9 @@ var that = this; switch(getPlatform()){ case 'wechat': + console.info("微信") loadscript('http://res.wx.qq.com/open/js/jweixin-1.0.0.js',function(){ + console.info("加载微信成功") that.shareWX(); }); break; diff --git a/bjyy-weixin/src/main/webapp/static/js/share/css/share.min.css b/bjyy-weixin/src/main/webapp/static/js/share/css/share.min.css new file mode 100644 index 0000000..fc7285b --- /dev/null +++ b/bjyy-weixin/src/main/webapp/static/js/share/css/share.min.css @@ -0,0 +1 @@ +@font-face{font-family:"socialshare";src:url("../fonts/iconfont.eot");src:url("../fonts/iconfont.eot?#iefix") format("embedded-opentype"),url("../fonts/iconfont.woff") format("woff"),url("../fonts/iconfont.ttf") format("truetype"),url("../fonts/iconfont.svg#iconfont") format("svg")}.social-share{font-family:"socialshare" !important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:0.2px;-moz-osx-font-smoothing:grayscale}.social-share *{font-family:"socialshare" !important}.social-share .icon-tencent:before{content:"\f07a"}.social-share .icon-qq:before{content:"\f11a"}.social-share .icon-weibo:before{content:"\f12a"}.social-share .icon-wechat:before{content:"\f09a"}.social-share .icon-douban:before{content:"\f10a"}.social-share .icon-heart:before{content:"\f20a"}.social-share .icon-like:before{content:"\f00a"}.social-share .icon-qzone:before{content:"\f08a"}.social-share .icon-linkedin:before{content:"\f01a"}.social-share .icon-diandian:before{content:"\f05a"}.social-share .icon-facebook:before{content:"\f03a"}.social-share .icon-google:before{content:"\f04a"}.social-share .icon-twitter:before{content:"\f06a"}.social-share a{position:relative;text-decoration:none;margin:4px;display:inline-block;outline:none}.social-share .social-share-icon{position:relative;display:inline-block;width:32px;height:32px;font-size:20px;border-radius:50%;line-height:32px;border:1px solid #666;color:#666;text-align:center;vertical-align:middle;transition:background 0.6s ease-out 0s}.social-share .social-share-icon:hover{background:#666;color:#fff}.social-share .icon-weibo{color:#ff763b;border-color:#ff763b}.social-share .icon-weibo:hover{background:#ff763b}.social-share .icon-tencent{color:#56b6e7;border-color:#56b6e7}.social-share .icon-tencent:hover{background:#56b6e7}.social-share .icon-qq{color:#56b6e7;border-color:#56b6e7}.social-share .icon-qq:hover{background:#56b6e7}.social-share .icon-qzone{color:#FDBE3D;border-color:#FDBE3D}.social-share .icon-qzone:hover{background:#FDBE3D}.social-share .icon-douban{color:#33b045;border-color:#33b045}.social-share .icon-douban:hover{background:#33b045}.social-share .icon-linkedin{color:#0077B5;border-color:#0077B5}.social-share .icon-linkedin:hover{background:#0077B5}.social-share .icon-facebook{color:#44619D;border-color:#44619D}.social-share .icon-facebook:hover{background:#44619D}.social-share .icon-google{color:#db4437;border-color:#db4437}.social-share .icon-google:hover{background:#db4437}.social-share .icon-twitter{color:#55acee;border-color:#55acee}.social-share .icon-twitter:hover{background:#55acee}.social-share .icon-diandian{color:#307DCA;border-color:#307DCA}.social-share .icon-diandian:hover{background:#307DCA}.social-share .icon-wechat{position:relative;color:#7bc549;border-color:#7bc549}.social-share .icon-wechat:hover{background:#7bc549}.social-share .icon-wechat .wechat-qrcode{display:none;border:1px solid #eee;position:absolute;z-index:9;top:-205px;left:-84px;width:200px;height:192px;color:#666;font-size:12px;text-align:center;background-color:#fff;box-shadow:0 2px 10px #aaa;transition:all 200ms;-webkit-tansition:all 350ms;-moz-transition:all 350ms}.social-share .icon-wechat .wechat-qrcode.bottom{top:40px;left:-84px}.social-share .icon-wechat .wechat-qrcode.bottom:after{display:none}.social-share .icon-wechat .wechat-qrcode h4{font-weight:normal;height:26px;line-height:26px;font-size:12px;background-color:#f3f3f3;margin:0;padding:0;color:#777}.social-share .icon-wechat .wechat-qrcode .qrcode{width:105px;margin:10px auto}.social-share .icon-wechat .wechat-qrcode .qrcode table{margin:0 !important}.social-share .icon-wechat .wechat-qrcode .help p{font-weight:normal;line-height:16px;padding:0;margin:0}.social-share .icon-wechat .wechat-qrcode:after{content:'';position:absolute;left:50%;margin-left:-6px;bottom:-13px;width:0;height:0;border-width:8px 6px 6px 6px;border-style:solid;border-color:#fff transparent transparent transparent}.social-share .icon-wechat:hover .wechat-qrcode{display:block} diff --git a/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.eot b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.eot new file mode 100644 index 0000000..cfa57e1 Binary files /dev/null and b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.eot differ diff --git a/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.svg b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.svg new file mode 100644 index 0000000..0c1b8ac --- /dev/null +++ b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.svg @@ -0,0 +1,88 @@ + + + + +Created by FontForge 20120731 at Sat Nov 28 22:48:50 2015 + By Ads + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.ttf b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.ttf new file mode 100644 index 0000000..515b493 Binary files /dev/null and b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.ttf differ diff --git a/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.woff b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.woff new file mode 100644 index 0000000..ed12916 Binary files /dev/null and b/bjyy-weixin/src/main/webapp/static/js/share/fonts/iconfont.woff differ diff --git a/bjyy-weixin/src/main/webapp/static/js/share/js/jquery.share.min.js b/bjyy-weixin/src/main/webapp/static/js/share/js/jquery.share.min.js new file mode 100644 index 0000000..addc467 --- /dev/null +++ b/bjyy-weixin/src/main/webapp/static/js/share/js/jquery.share.min.js @@ -0,0 +1 @@ +!function(a){"use strict";function u(r,t,e,n){var o=a(e,t);o.addData(r),o.make(),n=n||0;var i=o.getModuleCount(),h=o.getModuleCount()+2*n;this.text=r,this.level=t,this.version=e,this.moduleCount=h,this.isDark=function(r,t){return t-=n,!((r-=n)<0||i<=r||t<0||i<=t)&&o.isDark(r,t)},this.addBlank=function(a,u,f,c){var s=this.isDark,l=1/h;this.isDark=function(r,t){var e=t*l,n=r*l,o=e+l,i=n+l;return s(r,t)&&(o")[0].getContext("2d");i.font=o;var a=i.measureText(e.label).width,u=e.mSize,f=a/n,c=(1-f)*e.mPosX,s=(1-u)*e.mPosY,l=c+f,h=s+u;1===e.mode?r.addBlank(0,s-.01,n,h+.01):r.addBlank(c-.01,s-.01,.01+l,h+.01),t.fillStyle=e.fontcolor,t.font=o,t.fillText(e.label,c*n,s*n+.75*e.mSize*n)}(r,t,e):3!==n&&4!==n||function(r,t,e){var n=e.size,o=e.image.naturalWidth||1,i=e.image.naturalHeight||1,a=e.mSize,u=a*o/i,f=(1-u)*e.mPosX,c=(1-a)*e.mPosY,s=f+u,l=c+a;3===e.mode?r.addBlank(0,c-.01,n,l+.01):r.addBlank(f-.01,c-.01,.01+s,l+.01),t.drawImage(e.image,f*n,c*n,u*n,a*n)}(r,t,e)}function c(r,t,e,n,o,i,a,u){r.isDark(a,u)&&t.rect(n,o,i,i)}function s(r,t,e,n,o,i,a,u){var f=r.isDark,c=n+i,s=o+i,l=e.radius*i,h=a-1,g=a+1,d=u-1,v=u+1,p=f(a,u),w=f(h,d),m=f(h,u),y=f(h,v),k=f(a,v),T=f(g,v),b=f(g,u),C=f(g,d),B=f(a,d);p?function(r,t,e,n,o,i,a,u,f,c){a?r.moveTo(t+i,e):r.moveTo(t,e),u?(r.lineTo(n-i,e),r.arcTo(n,e,n,o,i)):r.lineTo(n,e),f?(r.lineTo(n,o-i),r.arcTo(n,o,t,o,i)):r.lineTo(n,o),c?(r.lineTo(t+i,o),r.arcTo(t,o,t,e,i)):r.lineTo(t,o),a?(r.lineTo(t,e+i),r.arcTo(t,e,n,e,i)):r.lineTo(t,e)}(t,n,o,c,s,l,!m&&!B,!m&&!k,!b&&!k,!b&&!B):function(r,t,e,n,o,i,a,u,f,c){a&&(r.moveTo(t+i,e),r.lineTo(t,e),r.lineTo(t,e+i),r.arcTo(t,e,t+i,e,i)),u&&(r.moveTo(n-i,e),r.lineTo(n,e),r.lineTo(n,e+i),r.arcTo(n,e,n-i,e,i)),f&&(r.moveTo(n-i,o),r.lineTo(n,o),r.lineTo(n,o-i),r.arcTo(n,o,n-i,o,i)),c&&(r.moveTo(t+i,o),r.lineTo(t,o),r.lineTo(t,o-i),r.arcTo(t,o,t+i,o,i))}(t,n,o,c,s,l,m&&B&&w,m&&k&&y,b&&k&&T,b&&B&&C)}function e(r,t){var e=g(t.text,t.ecLevel,t.minVersion,t.maxVersion,t.quiet);if(!e)return null;var n=d(r).data("qrcode",e),o=n[0].getContext("2d");return i(e,o,t),function(r,t,e){var n,o,i=r.moduleCount,a=e.size/i,u=c;for(l&&0").attr("width",r.size).attr("height",r.size),r)}function n(r){return o&&"canvas"===r.render?t(r):o&&"image"===r.render?function(r){return d("").attr("src",t(r)[0].toDataURL("image/png"))}(r):function(r){var t=g(r.text,r.ecLevel,r.minVersion,r.maxVersion,r.quiet);if(!t)return null;var e,n,o=r.size,i=r.background,a=Math.floor,u=t.moduleCount,f=a(o/u),c=a(.5*(o-f*u)),s={position:"relative",left:0,top:0,padding:0,margin:0,width:o,height:o},l={position:"absolute",padding:0,margin:0,width:f,height:f,"background-color":r.fill},h=d("
").data("qrcode",t).css(s);for(i&&h.css("background-color",i),e=0;e").css(l).css({left:c+n*f,top:c+e*f}).appendTo(h);return h}(r)}var r,d=jQuery,o=(r=document.createElement("canvas"),Boolean(r.getContext&&r.getContext("2d"))),l="[object Opera]"!==Object.prototype.toString.call(window.opera),f={render:"canvas",minVersion:1,maxVersion:40,ecLevel:"L",left:0,top:0,size:200,fill:"#000",background:null,text:"no text",radius:0,quiet:0,mode:0,mSize:.1,mPosX:.5,mPosY:.5,label:"no label",fontname:"sans",fontcolor:"#000",image:null};d.fn.qrcode=function(r){var t=d.extend({},f,r);return this.each(function(){"canvas"===this.nodeName.toLowerCase()?e(this,t):d(this).append(n(t))})}}(function(){var r,t=function(){function w(n,o){if(void 0===n.length)throw new Error(n.length+"/"+o);var t=function(){for(var r=0;r>e&1);s[Math.floor(e/3)][e%3+l-8-3]=n}for(e=0;e<18;e+=1){n=!r&&1==(t>>e&1);s[e%3+l-8-3][Math.floor(e/3)]=n}},d=function(r,t){for(var e=a<<3|t,n=T.getBCHTypeInfo(e),o=0;o<15;o+=1){var i=!r&&1==(n>>o&1);o<6?s[o][8]=i:o<8?s[o+1][8]=i:s[l-15+o][8]=i}for(o=0;o<15;o+=1){i=!r&&1==(n>>o&1);o<8?s[8][l-o-1]=i:o<9?s[8][15-o-1+1]=i:s[8][15-o-1]=i}s[l-8][8]=!r},v=function(r,t){for(var e=-1,n=l-1,o=7,i=0,a=T.getMaskFunction(t),u=l-1;0>>o&1)),a(n,u-f)&&(c=!c),s[n][u-f]=c,-1==(o-=1)&&(i+=1,o=7)}if((n+=e)<0||l<=n){n-=e,e=-e;break}}},p=function(r,t,e){for(var n=C.getRSBlocks(r,t),o=B(),i=0;i8*u)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*u+")");for(o.getLengthInBits()+4<=8*u&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*u)&&(o.put(236,8),!(o.getLengthInBits()>=8*u));)o.put(17,8);return function(r,t){for(var e=0,n=0,o=0,i=new Array(t.length),a=new Array(t.length),u=0;u',e+="";for(var n=0;n";for(var o=0;o';e+=""}return(e+="")+""},f.createImgTag=function(o,r){o=o||2,r=void 0===r?4*o:r;var t=f.getModuleCount()*o+2*r,i=r,a=t-r;return A(t,t,function(r,t){if(i<=r&&r>>8),t.push(255&o)):t.push(a)}}return t}};function g(){var e=new Array,o={writeByte:function(r){e.push(255&r)},writeShort:function(r){o.writeByte(r),o.writeByte(r>>>8)},writeBytes:function(r,t,e){t=t||0,e=e||r.length;for(var n=0;n>>t!=0)throw new Error("length over");for(;8<=n+t;)e.writeByte(255&(r<>>=8-n,n=o=0;o|=r<>>7-r%8&1)},put:function(r,t){for(var e=0;e>>t-e-1&1))},getLengthInBits:function(){return n},putBit:function(r){var t=Math.floor(n/8);e.length<=t&&e.push(0),r&&(e[t]|=128>>>n%8),n+=1}};return o},L=function(r){var t=a,e=o.stringToBytes(r),n={getMode:function(){return t},getLength:function(r){return e.length},write:function(r){for(var t=0;t=e.length){if(0==i)return-1;throw new Error("unexpected end of file./"+i)}var r=e.charAt(n);if(n+=1,"="==r)return i=0,-1;r.match(/^\s$/)||(o=o<<6|a(r.charCodeAt(0)),i+=6)}var t=o>>>i-8&255;return i-=8,t}},a=function(r){if(65<=r&&r<=90)return r-65;if(97<=r&&r<=122)return r-97+26;if(48<=r&&r<=57)return r-48+52;if(43==r)return 62;if(47==r)return 63;throw new Error("c:"+r)};return t},A=function(r,t,e,n){for(var o=h(r,t),i=0;i>>o-6),o-=6},r.flush=function(){if(0"};function x(r){for(var t=0;0!=r;)t+=1,r>>>=1;return t}return o}();return r=function(){return t},"function"==typeof define&&define.amd?define([],r):"object"==typeof exports&&(module.exports=r()),t.stringToBytes=function(r){return function(r){for(var t=[],e=0;e>6,128|63&n):n<55296||57344<=n?t.push(224|n>>12,128|n>>6&63,128|63&n):(e++,n=65536+((1023&n)<<10|1023&r.charCodeAt(e)),t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return t}(r)},t}()),function(f){f.fn.share=function(r){var t=f(document.head),e={url:location.href,site_url:location.origin,source:t.find("[name=site], [name=Site]").attr("content")||document.title,title:t.find("[name=title], [name=Title]").attr("content")||document.title,description:t.find("[name=description], [name=Description]").attr("content")||"",image:f("img:first").prop("src")||"",imageSelector:void 0,weiboKey:"",wechatQrcodeTitle:"微信扫一扫:分享",wechatQrcodeHelper:"

微信里点“发现”,扫一下

二维码便可将本文分享至朋友圈。

",wechatQrcodeSize:100,mobileSites:[],sites:["weibo","qq","wechat","tencent","douban","qzone","linkedin","diandian","facebook","twitter","google"],disabled:[],initialized:!1},n=f.extend({},e,r),a={qzone:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}&pics={{IMAGE}}",qq:"http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}",tencent:"http://share.v.t.qq.com/index.php?c=share&a=index&title={{TITLE}}&url={{URL}}&pic={{IMAGE}}",weibo:"https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}",wechat:"javascript:;",douban:"http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11",diandian:"http://www.diandian.com/share?lo={{URL}}&ti={{TITLE}}&type=link",linkedin:"http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin",facebook:"https://www.facebook.com/sharer/sharer.php?u={{URL}}&title={{TITLE}}&description={{DESCRIPTION}}&caption={{SUBHEAD}}&link={{URL}}&picture={{IMAGE}}",twitter:"https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{SITE_URL}}",google:"https://plus.google.com/share?url={{URL}}"},u={qzone:"QQ空间",qq:"QQ",tencent:"腾讯微博",weibo:"微博",wechat:"微信",douban:"豆瓣",diandian:"点点",linkedin:"LinkedIn",facebook:"Facebook",twitter:"Twitter",google:"Google"};this.each(function(){if(f(this).data("initialized"))return!0;var r=f.extend({},n,f(this).data());r.imageSelector&&(r.image=f(r.imageSelector).map(function(){return f(this).prop("src")}).get().join("||"));var t=f(this).addClass("share-component social-share");!function(o,i){var r=function(r){0===r.mobileSites.length&&r.sites.length&&(r.mobileSites=r.sites);var n=(f(window).width()<=768?r.mobileSites:r.sites.length?r.sites:[]).slice(0),t=r.disabled;"string"==typeof n&&(n=n.split(/\s*,\s*/));"string"==typeof t&&(t=t.split(/\s*,\s*/));/MicroMessenger/i.test(navigator.userAgent)&&t.push("wechat");return t.length&&f.each(t,function(r,t){var e=f.inArray(t,n);-1!==e&&n.splice(e,1)}),n}(i);if("prepend"==i.mode&&r.reverse(),!r.length)return;f.each(r,function(r,t){var e=function(r,t){var e=a[r];for(var n in t.summary=t.description,t)if(t.hasOwnProperty(n)){var o=r+n.replace(/^[a-z]/,function(r){return r.toUpperCase()}),i=encodeURIComponent(void 0===t[o]?t[n]:t[o]);e=e.replace(new RegExp("{{"+n.toUpperCase()+"}}","g"),i)}return e}(t,i),n=i.initialized?o.find(".icon-"+t):f('');if(!n.length)return!0;n.prop("aria-label","分享到 "+u[t]),n.prop("href",e),"wechat"===t?n.prop("tabindex",-1):n.prop("target","_blank"),i.initialized||("prepend"==i.mode?o.prepend(n):o.append(n))})}(t,r),function(r,t){var e=r.find("a.icon-wechat");if(!e.length)return;e.append('

'+t.wechatQrcodeTitle+'

'+t.wechatQrcodeHelper+"
"),e.find(".qrcode").qrcode({render:"image",size:t.wechatQrcodeSize,text:t.url}),e.offset().top<100&&e.find(".wechat-qrcode").addClass("bottom")}(t,r),f(this).data("initialized",!0)})},f(function(){f(".share-component,.social-share").share()})}(jQuery); \ No newline at end of file diff --git a/bjyy-weixin/src/main/webapp/static/js/share/js/social-share.min.js b/bjyy-weixin/src/main/webapp/static/js/share/js/social-share.min.js new file mode 100644 index 0000000..3be3d12 --- /dev/null +++ b/bjyy-weixin/src/main/webapp/static/js/share/js/social-share.min.js @@ -0,0 +1 @@ +var QRCode;!function(){function r(t){this.mode=o.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e>>18,i[1]=128|(258048&n)>>>12,i[2]=128|(4032&n)>>>6,i[3]=128|63&n):2048>>12,i[1]=128|(4032&n)>>>6,i[2]=128|63&n):128>>6,i[1]=128|63&n):i[0]=n,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function h(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}r.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=i}for(r=0;r<18;r++){i=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=i}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,i=v.getBCHTypeInfo(r),n=0;n<15;n++){var o=!t&&1==(i>>n&1);n<6?this.modules[n][8]=o:n<8?this.modules[n+1][8]=o:this.modules[this.moduleCount-15+n][8]=o}for(n=0;n<15;n++){o=!t&&1==(i>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=o:n<9?this.modules[8][15-n-1+1]=o:this.modules[8][15-n-1]=o}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,i=this.moduleCount-1,n=7,o=0,a=this.moduleCount-1;0>>n&1)),v.getMask(e,i,a-s)&&(h=!h),this.modules[i][a-s]=h,-1==--n&&(o++,n=7)}if((i+=r)<0||this.moduleCount<=i){i-=r,r=-r;break}}}},h.PAD0=236,h.PAD1=17,h.createData=function(t,e,r){for(var i=p.getRSBlocks(t,e),n=new m,o=0;o8*s)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*s+")");for(n.getLengthInBits()+4<=8*s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*s||(n.put(h.PAD0,8),n.getLengthInBits()>=8*s));)n.put(h.PAD1,8);return h.createBytes(n,i)},h.createBytes=function(t,e){for(var r=0,i=0,n=0,o=new Array(e.length),a=new Array(e.length),s=0;s>>=1;return e},getPatternPosition:function(t){return v.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case i:return(e+r)%2==0;case n:return e%2==0;case a:return r%3==0;case l:return(e+r)%3==0;case u:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case c:return e*r%2+e*r%3==0;case f:return(e*r%2+e*r%3)%2==0;case d:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new w([1],0),r=0;r>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var _=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function C(){var t=!1,e=navigator.userAgent;if(/android/i.test(e)){t=!0;var r=e.toString().match(/android ([0-9]\.[0-9])/i);r&&r[1]&&(t=parseFloat(r[1]))}return t}var y=(e.prototype.draw=function(t){var e=this._htOption,r=this._el,i=t.getModuleCount();function n(t,e){var r=document.createElementNS("http://www.w3.org/2000/svg",t);for(var i in e)e.hasOwnProperty(i)&&r.setAttribute(i,e[i]);return r}Math.floor(e.width/i),Math.floor(e.height/i),this.clear();var o=n("svg",{viewBox:"0 0 "+String(i)+" "+String(i),width:"100%",height:"100%",fill:e.colorLight});o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),r.appendChild(o),o.appendChild(n("rect",{fill:e.colorLight,width:"100%",height:"100%"})),o.appendChild(n("rect",{fill:e.colorDark,width:"1",height:"1",id:"template"}));for(var a=0;a'],s=0;s");for(var h=0;h');a.push("")}a.push(""),r.innerHTML=a.join("");var l=r.childNodes[0],u=(e.width-l.offsetWidth)/2,c=(e.height-l.offsetHeight)/2;0微信里点“发现”,扫一下

二维码便可将本文分享至朋友圈。

",wechatQrcodeSize:100,sites:["weibo","qq","wechat","douban","qzone","linkedin","facebook","twitter","google"],mobileSites:[],disabled:[],initialized:!1},p={qzone:"http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}&pics={{IMAGE}}",qq:'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}&summary="{{SUMMARY}}"',weibo:"https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}",wechat:"javascript:",douban:"http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11",linkedin:"http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin",facebook:"https://www.facebook.com/sharer/sharer.php?u={{URL}}",twitter:"https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{ORIGIN}}",google:"https://plus.google.com/share?url={{URL}}"};function m(t){return(o.querySelectorAll||r.jQuery||r.Zepto||function(i){var n=[];return C(i.split(/\s*,\s*/),function(t){var e=t.match(/([#.])(\w+)/);if(null===e)throw Error("Supports only simple single #ID or .CLASS selector.");if(e[1]){var r=o.getElementById(e[2]);r&&n.push(r)}n=n.concat(w(i))}),n}).call(o,t)}function v(t){return(o.getElementsByName(t)[0]||0).content}function w(t,e,r){if(t.getElementsByClassName)return t.getElementsByClassName(e);var i=[],n=t.getElementsByTagName(r||"*");return e=" "+e+" ",C(n,function(t){0<=(" "+(t.className||"")+" ").indexOf(e)&&i.push(t)}),i}function _(t){var e=o.createElement("div");return e.innerHTML=t,e.childNodes}function C(t,e){var r=t.length;if(r===a){for(var i in t)if(t.hasOwnProperty(i)&&!1===e.call(t[i],t[i],i))break}else for(var n=0;n