Skip to content

Commit

Permalink
fix: 去掉上传微信多媒体文件的编译警告 & 多语言切换判断url
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizzercn committed Mar 22, 2017
1 parent 2b6e84c commit 313f761
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 8 deletions.
32 changes: 30 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<url>http://www.wizzer.cn</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty-version>9.2.21.v20170120</jetty-version>
<jetty-version>9.4.2.v20170220</jetty-version>
<nutz-version>1.r.61-SNAPSHOT</nutz-version>
</properties>
<developers>
Expand Down Expand Up @@ -345,6 +345,35 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -368,7 +397,6 @@
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>

</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public Object index(@Param("action") String action, HttpServletRequest req) {
@At
@Ok("json")
@RequiresAuthentication
@SuppressWarnings("deprecation")
public Object uploadimage(@Param("Filedata") TempFile tf, HttpServletRequest req, AdaptorErrorContext err) {
String wxid = Strings.sBlank(req.getSession().getAttribute("wxid"));
NutMap nutMap = new NutMap();
Expand Down Expand Up @@ -69,9 +70,6 @@ public Object uploadimage(@Param("Filedata") TempFile tf, HttpServletRequest req
} catch (Exception e) {
nutMap.addv("state", "FAIL");
return nutMap;
} catch (Throwable e) {
nutMap.addv("state", "FAIL");
return nutMap;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.nutz.weixin.spi.WxResp;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -140,6 +141,7 @@ public Object newsDetail(String id, HttpServletRequest req) {
@At("/uploadThumb/?")
@Ok("json")
@RequiresAuthentication
@SuppressWarnings("deprecation")
//AdaptorErrorContext必须是最后一个参数
public Object uploadThumb(String wxid, @Param("Filedata") TempFile tf, HttpServletRequest req, AdaptorErrorContext err) {
try {
Expand Down
2 changes: 1 addition & 1 deletion wk-app/wk-web/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ log4j.logger.org.apache.shiro.mgt=error
log4j.logger.org.apache.shiro.cache.ehcache=error
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d %l %-5p - %m%n
log4j.appender.Console.layout.ConversionPattern=[%-5p] %d %l - %m%n

Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ <h6>${msg['index.layout']}</h6>
<%}%>
<ul class="dropdown-menu dropdown-menu-right animated fadeInUp">
<li>
<a href="?lang=en_US">
<a href="javascript:sublime.changeLang('en_US');">
<img src="${base!}/assets/img/flags/us.png" class="flag">
<span class="language">English</span>
</a>
</li>
<li>
<a href="?lang=zh_CN">
<a href="javascript:sublime.changeLang('zh_CN');">
<img src="${base!}/assets/img/flags/cn.png" class="flag">
<span class="language">中文</span>
</a>
Expand Down
20 changes: 20 additions & 0 deletions wk-app/wk-web/src/main/webapp/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ function removeHTMLTag(str) {
str=str.replace(/&nbsp;/ig,'');//去掉&nbsp;
return str;
}
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]);
return "";
}
var sublime = function () {
var linkLocation, searchOpen = false, app = $(".app"), maxHeight = 0;
var sidebar=false,boxed=false,scroll=false;
Expand Down Expand Up @@ -532,6 +539,19 @@ var sublime = function () {
initTheme();
},
initIcheck : initIcheck,//初始化复选框控件
changeLang:function(lang){
var url = window.location.href;
if(url.indexOf("lang=")>0){
url=url.replace("?lang="+GetQueryString("lang"),"").replace("&lang="+GetQueryString("lang"),"");
console.log(url);
} console.log(url);
if(url.indexOf("?")>0){
url+="&lang="+lang;
}else {
url+="?lang="+lang;
}
window.location.href=url;
},
changeTheme:function(obj){
jQuery.post(base+"/platform/login/theme", {loginTheme:obj});
},
Expand Down

0 comments on commit 313f761

Please sign in to comment.