dedsudiyu 2 years ago
parent
commit
2cda89276d
1 changed files with 93 additions and 9 deletions
  1. 93 9
      src/views/codeHtml.vue

+ 93 - 9
src/views/codeHtml.vue

@@ -2,7 +2,7 @@
 <template>
   <div id="codeHtml"
        v-loading="loading">
-    <div class="w-e-text" v-html="text" v-if="type==1"></div>
+    <div class="w-e-text w-e-text-box" v-html="text" v-if="type==1"></div>
     <div v-if="type==2" class="pdf-max-box">
       <!--<pdf-->
         <!--ref="pdf"-->
@@ -72,25 +72,90 @@
       //加载接口
       hazard_book_lookUp(id){
         hazard_book_lookUp(id).then( data => {
-          console.log('1',unescape(data.data.content))
           this.text = unescape(data.data.content);
-          console.log('2',this.form.content)
           this.loading = false;
         });
       },
       safe_book(id){
         safe_book(id).then( data => {
-          console.log('1',unescape(data.data.content))
           this.form.content = window.location.href.split('://')[0]+'://'  + process.env.VUE_APP_BASE_API + '/' + unescape(data.data.content);
-          console.log('2',this.form.content)
           this.getNumPages();
         });
       },
       hazardLookUp(id){
         hazardLookUp(id).then( data => {
-          console.log('1',unescape(data.data.content))
           this.text = unescape(data.data.content);
-          console.log('2',this.form.content)
+          let list = this.text.split('font-size:');
+          let newText = "";
+          for (let i=0;i<list.length;i++){
+            if(
+              (list[i][0] == '0' || list[i][0] == '1' || list[i][0] == '2' || list[i][0] == '3' || list[i][0] == '4' || list[i][0] == '5' || list[i][0] == '6' || list[i][0] == '7' || list[i][0] == '8' || list[i][0] == '9')&&
+              (list[i][1] == 'p')&&
+              (list[i][2] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][0]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(1)
+              newText = newText + 'font-size:'+num+textNew;
+            }else if(
+              (list[i][0] == ' ')&&
+              (list[i][1] == '0' || list[i][1] == '1' || list[i][1] == '2' || list[i][1] == '3' || list[i][1] == '4' || list[i][1] == '5' || list[i][1] == '6' || list[i][1] == '7' || list[i][1] == '8' || list[i][1] == '9')&&
+              (list[i][2] == 'p')&&
+              (list[i][3] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][1]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(2)
+              newText = newText + 'font-size:'+num+textNew;
+            }else if(
+              (list[i][0] == '0' || list[i][0] == '1' || list[i][0] == '2' || list[i][0] == '3' || list[i][0] == '4' || list[i][0] == '5' || list[i][0] == '6' || list[i][0] == '7' || list[i][0] == '8' || list[i][0] == '9')&&
+              (list[i][1] == '0' || list[i][1] == '1' || list[i][1] == '2' || list[i][1] == '3' || list[i][1] == '4' || list[i][1] == '5' || list[i][1] == '6' || list[i][1] == '7' || list[i][1] == '8' || list[i][1] == '9')&&
+              (list[i][2] == 'p')&&
+              (list[i][3] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][0]+list[i][1]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(2)
+              newText = newText + 'font-size:'+num+textNew;
+            }else if(
+              (list[i][0] == ' ')&&
+              (list[i][1] == '0' || list[i][1] == '1' || list[i][1] == '2' || list[i][1] == '3' || list[i][1] == '4' || list[i][1] == '5' || list[i][1] == '6' || list[i][1] == '7' || list[i][1] == '8' || list[i][1] == '9')&&
+              (list[i][2] == '0' || list[i][2] == '1' || list[i][2] == '2' || list[i][2] == '3' || list[i][2] == '4' || list[i][2] == '5' || list[i][2] == '6' || list[i][2] == '7' || list[i][2] == '8' || list[i][2] == '9')&&
+              (list[i][3] == 'p')&&
+              (list[i][4] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][1]+list[i][2]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(3)
+              newText = newText + 'font-size:'+num+textNew;
+            }else if(
+              (list[i][0] == '0' || list[i][0] == '1' || list[i][0] == '2' || list[i][0] == '3' || list[i][0] == '4' || list[i][0] == '5' || list[i][0] == '6' || list[i][0] == '7' || list[i][0] == '8' || list[i][0] == '9')&&
+              (list[i][1] == '0' || list[i][1] == '1' || list[i][1] == '2' || list[i][1] == '3' || list[i][1] == '4' || list[i][1] == '5' || list[i][1] == '6' || list[i][1] == '7' || list[i][1] == '8' || list[i][1] == '9')&&
+              (list[i][2] == '0' || list[i][2] == '1' || list[i][2] == '2' || list[i][2] == '3' || list[i][2] == '4' || list[i][2] == '5' || list[i][2] == '6' || list[i][2] == '7' || list[i][2] == '8' || list[i][2] == '9')&&
+              (list[i][3] == 'p')&&
+              (list[i][4] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][0]+list[i][1]+list[i][2]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(3)
+              newText = newText + 'font-size:'+num+textNew;
+            }else if(
+              (list[i][0] == ' ')&&
+              (list[i][1] == '0' || list[i][1] == '1' || list[i][1] == '2' || list[i][1] == '3' || list[i][1] == '4' || list[i][1] == '5' || list[i][1] == '6' || list[i][1] == '7' || list[i][1] == '8' || list[i][1] == '9')&&
+              (list[i][2] == '0' || list[i][2] == '1' || list[i][2] == '2' || list[i][2] == '3' || list[i][2] == '4' || list[i][2] == '5' || list[i][2] == '6' || list[i][2] == '7' || list[i][2] == '8' || list[i][2] == '9')&&
+              (list[i][3] == '0' || list[i][3] == '1' || list[i][3] == '2' || list[i][3] == '3' || list[i][3] == '4' || list[i][3] == '5' || list[i][3] == '6' || list[i][3] == '7' || list[i][3] == '8' || list[i][3] == '9')&&
+              (list[i][4] == 'p')&&
+              (list[i][5] == 'x')
+            ){
+              let num = this.accMul(parseInt(list[i][1]+list[i][2]+list[i][3]),6);
+              num = num>140?140:num;
+              let textNew = list[i].slice(4)
+              newText = newText + 'font-size:'+num+textNew;
+            }else{
+              newText = newText + list[i]
+            }
+          }
+          this.$set(this,'text',newText);
           this.loading = false;
         });
       },
@@ -118,11 +183,30 @@
       // pdf加载时
       loadPdfHandler (e) {
         this.currentPage = 1 // 加载的时候先加载第一页
-      }
+      },
+      accMul(arg1,arg2){
+        var m=0,s1=arg1.toString(),s2=arg2.toString();
+        try{m+=s1.split(".")[1].length}catch(e){}
+        try{m+=s2.split(".")[1].length}catch(e){}
+        return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
+      },
     }
   };
 </script>
-
+<style lang="scss">
+  #codeHtml{
+    font-size:80px;
+    video{
+      width:1860px;
+      height:1050px;
+      margin:20px;
+    }
+    img{
+      width:1500px;
+      margin:20px 200px;
+    }
+  }
+</style>
 <style scoped lang="scss">
   #codeHtml {
     height:100%;