| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- document.write('<script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.min.js"></script>');
- document.write('<script src="https://cdn.jsdelivr.net/npm/vant@2.4/lib/vant.min.js"></script>');
- document.write('<script src="https://cdn.jsdelivr.net/npm/@vant/touch-emulator"></script>');
- document.write('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.4/lib/index.css">');
- function filePreviewForMobile(id,filename,url,type){
- if(!type){
- // var fileName = url.substring(url.lastIndexOf('/')+1);
- var dotIndex = filename.lastIndexOf('.');
- var suffix = filename.substring(dotIndex+1);
- suffix = suffix.toLowerCase();
- if(suffix=='doc' || suffix=='docx'||suffix=='xls'||suffix=='xlsx'){
- type='office';
- }else if(suffix=='pdf'){
- type='pdf';
- }else {
- type='image';
- }
- }
- type=type.toLowerCase();
- if(type=='office'){//word excel
- $.get("weboffice/wps.do?url&_w_fname=" + filename+"&fileId="+id , function(result) {
- if(isPc()){
- window.open(result.wpsUrl);
- }else{
- location = result.wpsUrl;
- }
- },'json');
- }else if(type=='pdf'){
- var path='/hgl';
- if(typeof(webBasePath)!='undefined') {
- path=webBasePath
- }
- location=path+'/webpage/cn/com/lzt/pdf/web/pdfview.jsp?title='+encodeURI(filename)+'&file='+encodeURIComponent(url);
- }else if(type=='image'){
- vant.ImagePreview({
- images:[url]
- ,className:'imgView'
- });
- }
- }
- function isPc(){
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) { //移动端
- return false;
- }
- return true;
- }
|