一 插件
1: 插件位置:
2: 插件
见附件
二 文件
1:文件:
2:代码
search.jsp:
<input type="hidden" id="outLink" value="${outLink}" >
<button type="button" class="btn btn-link" data-clipboard-target="outLink" id="copyHref">复制连接</button>
<button type="button" id="QRcode" class="btn btn-info" >点击扫描二维码</button>
<div id="codePic"></div>
main.js:
jsUrls.push('ZeroClipboard');
jsUrls.push('qrCode');
'ZeroClipboard': '../zeroclipboard/ZeroClipboard.min',
'qrCode': '../../adminLTE/plugins/qrCode/jquery.qrcode.min'
'qrCode': {deps: ['jquery']}
common-web.property:
qrCode.href=http://localhost:8080/kf/primaryCare/outpatient/visit/add?queryString=
search.js:
$("#copyHref").click(function() {
require(['ZeroClipboard'],function (ZeroClipboard) {
var clip = new ZeroClipboard( document.getElementById("copyHref") );
});
toastr.info("内容复制到剪贴板!");
});
$("#QRcode").click(function() {
showQRCode();
});
function showQRCode() {
require(['qrCode'],function (qrCode) {
$("#codePic").empty();
var href = $("#outLink").val();
$("#codePic").qrcode({
render: "table",
width: 140,
height: 140,
text: href
});
});
}
CsSurveyController.java:
/**
* Search Home
*/
@RequestMapping("/search")
public String search(Criteria criteria, HttpServletRequest request, Model model) {
//获取二维码地址
Properties properties = PropertiesUtils.initProperties("common-web");
String qrLink = properties.getProperty("qrCode.href");
if(StringUtil.isNotEmpty(qrLink)) {
String organCode = SecurityUtils.getCurrentOrganization(request).getOrganCode();
String param = "charsetName=UTF-8&orgCode="+organCode;
String eParam = Base64Util.encrypt(param.toString(), "UTF-8");
model.addAttribute("outLink", qrLink+eParam);
}