lrf 1 tuần trước cách đây
mục cha
commit
4858cdc77c

+ 7 - 0
src/utils/getContent.ts

@@ -0,0 +1,7 @@
+export default (htmlString: string) => { 
+  let parser = new DOMParser()
+  let doc = parser.parseFromString(htmlString, 'text/html');
+  let text = doc.body.textContent || ""
+  text = text.replace(/\s*/g, "");
+  return text;
+}

+ 4 - 1
src/views/win/introduceParts/combriefIndex.vue

@@ -20,7 +20,8 @@
           <!-- <el-col :span="24" class="title">
             {{ info.title }}
           </el-col> -->
-          <el-col :span="24" class="brief" v-html="info.txt"> </el-col>
+          <!-- <el-col :span="24" class="brief" v-html="info.txt"> </el-col> -->
+          <el-col :span="24" class="brief">{{ getContent(info.txt) }} </el-col>
           <el-col :span="24" class="btns">
             <el-button type="primary" size="default" @click="toOpen()">查看详情</el-button>
           </el-col>
@@ -36,6 +37,8 @@ import { ref, onMounted } from 'vue'
 import dividerIndex from '../../../components/windows/dividerIndex.vue'
 import { jtjs } from '@/api/api'
 import { get, head } from 'lodash-es'
+import getContent from '@/utils/getContent'
+
 // eslint-disable-next-line @typescript-eslint/no-explicit-any
 const list = ref<any[]>([])
 const active = ref('1')

+ 4 - 1
src/views/win/newsParts/listIndex.vue

@@ -32,7 +32,9 @@
             <el-col :span="24" class="title">
               {{ item.title }}
             </el-col>
-            <el-col :span="24" class="brief" v-html="item.brief"> </el-col>
+            <!-- <el-col :span="24" class="brief" v-html="item.brief"> </el-col> -->
+            <el-col :span="24" class="brief"> {{ getContent(item.brief) }}</el-col>
+            
           </el-col>
           <el-col :span="6" class="imgs">
             <el-image class="images" :src="item.url || defUrl"></el-image>
@@ -49,6 +51,7 @@
 <script setup lang="ts">
 import { ref, onMounted } from 'vue'
 import dayjs from 'dayjs'
+import getContent from '@/utils/getContent'
 
 /* 分页 */
 import pagesIndex from '../../../components/windows/pagesIndex.vue'

+ 3 - 1
src/views/win/queryParts/listIndex.vue

@@ -16,7 +16,8 @@
             {{ tf(item.release_date) }}
           </el-col>
         </el-row>
-        <el-row class="list_2" v-html="item.txt"> </el-row>
+        <!-- <el-row class="list_2" v-html="item.txt"> </el-row> -->
+        <el-row class="list_2"> {{ getContent(item.txt) }}</el-row>
       </el-col>
     </el-col>
     <el-col :span="24" class="pages">
@@ -27,6 +28,7 @@
 
 <script setup lang="ts">
 import { ref, onMounted, computed } from 'vue'
+import getContent from '@/utils/getContent'
 /* 分页 */
 import pagesIndex from '../../../components/windows/pagesIndex.vue'
 import { get } from 'lodash-es'

+ 10 - 6
src/views/winParts/newsIndex.vue

@@ -29,7 +29,9 @@
                   <!-- item.ext.title -->
                   <el-col :span="24" class="title textOver">{{ getProp(item, 'title') }}</el-col>
                   <!-- item.txt.txt -->
-                  <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col>
+                  <!-- <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col> -->
+                  <el-col :span="24" class="brief">{{ getContent(getProp(item, 'brief')) }}</el-col>
+
                   <!-- item.ext.release_date -->
                   <el-col :span="24" class="date">{{ getProp(item, 'date') }}</el-col>
                 </el-col>
@@ -54,7 +56,8 @@
                 </el-col>
                 <el-col :span="18" class="mess">
                   <el-col :span="24" class="title textOver">{{ getProp(item, 'title') }}</el-col>
-                  <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col>
+                  <!-- <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col> -->
+                  <el-col :span="24" class="brief">{{ getContent(getProp(item, 'brief')) }}</el-col>
                   <el-col :span="24" class="date">{{ getProp(item, 'date') }}</el-col>
                 </el-col>
               </el-col>
@@ -78,7 +81,8 @@
                 </el-col>
                 <el-col :span="18" class="mess">
                   <el-col :span="24" class="title textOver">{{ getProp(item, 'title') }}</el-col>
-                  <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col>
+                  <!-- <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col> -->
+                  <el-col :span="24" class="brief">{{ getContent(getProp(item, 'brief')) }}</el-col>
                   <el-col :span="24" class="date">{{ getProp(item, 'date') }}</el-col>
                 </el-col>
               </el-col>
@@ -102,7 +106,8 @@
                 </el-col>
                 <el-col :span="18" class="mess">
                   <el-col :span="24" class="title textOver">{{ getProp(item, 'title') }}</el-col>
-                  <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col>
+                  <!-- <el-col :span="24" class="brief" v-html="getProp(item, 'brief')"></el-col> -->
+                  <el-col :span="24" class="brief">{{ getContent(getProp(item, 'brief')) }}</el-col>
                   <el-col :span="24" class="date">{{ getProp(item, 'date') }}</el-col>
                 </el-col>
               </el-col>
@@ -124,7 +129,7 @@ import { index } from '@/api/api'
 import dividerIndex from '../../components/windows/dividerIndex.vue'
 import { get } from 'lodash-es'
 import { tf } from '@/utils/timeFormat'
-
+import getContent from '@/utils/getContent'
 const leftUrl = ref('news1.png')
 
 const activeName = ref('first')
@@ -161,7 +166,6 @@ const zcfgList: any = ref([])
 const zbcgList: any = ref([])
 /**集团要闻 */
 const jtxwList: any = ref([])
-
 /* 选项卡切换,换数据 */
 const handleClick = (tab: TabsPaneContext, event: Event) => {
   console.log(tab, event)