Browse Source

card支持换行与空格(取消默认首行缩进)

napier 2 years ago
parent
commit
0527f05eee
3 changed files with 31 additions and 18 deletions
  1. 17 7
      src/components/card.vue
  2. 0 2
      src/components/map.vue
  3. 14 9
      src/components/mobileBar.vue

+ 17 - 7
src/components/card.vue

@@ -12,7 +12,7 @@
       <div class="background">
       <div class="background">
         <div class="title" id="title">{{ title | ellipsis_title}}</div>
         <div class="title" id="title">{{ title | ellipsis_title}}</div>
 <!--        <div class="bottom clearfix">-->
 <!--        <div class="bottom clearfix">-->
-          <div class="info" id="info">{{ info | ellipsis_info}}</div>
+          <div class="info" id="info" style="white-space: pre-wrap;" >{{ info | ellipsis_info}}</div>
 <!--        </div>-->
 <!--        </div>-->
         <!-- <button id="button-show-all" class="button-show-all" onclick="">{{ '阅读全文' }}</button> -->
         <!-- <button id="button-show-all" class="button-show-all" onclick="">{{ '阅读全文' }}</button> -->
       <a
       <a
@@ -90,10 +90,20 @@ export default {
     closeCard () {
     closeCard () {
       bus.$emit('closePopup')
       bus.$emit('closePopup')
     },
     },
-    // fixText () {
-    //   var text = this.info.replace(/\n/g, '<br/>' + '        ')
-    //   this.info = text
-    // },
+
+
+    fixText () {
+      // var text = this.info.replace(/\n/g, '<br/>' + '        ')
+      // this.info = text
+
+
+      // var str = this.info
+      // var reg=new RegExp("\n","g")
+      // var reg1=new RegExp(" ","g")
+      // str = str.replace(reg,"<br/>")
+      // str = str.replace(reg1,"<p/>")
+      // this.info = str
+    },
 
 
     /**
     /**
      * @description:根据设备动态设置内部尺寸(移动端)
      * @description:根据设备动态设置内部尺寸(移动端)
@@ -279,7 +289,7 @@ export default {
     color: black;
     color: black;
     vertical-align: top;
     vertical-align: top;
     /*overflow: hidden;*/
     /*overflow: hidden;*/
-    text-indent: 30px;
+    /* text-indent: 30px; */
     overflow-y:scroll
     overflow-y:scroll
   }
   }
 
 
@@ -373,7 +383,7 @@ export default {
     margin-top: 4px;
     margin-top: 4px;
     margin-right: 12px;
     margin-right: 12px;
     margin-left: 12px;
     margin-left: 12px;
-    text-indent: 15px;
+    /* text-indent: 15px; */
     width: 216px;
     width: 216px;
     height: 68px;
     height: 68px;
     font-size: 11px;
     font-size: 11px;

+ 0 - 2
src/components/map.vue

@@ -467,8 +467,6 @@ export default {
           style = this.otherStyles
           style = this.otherStyles
           break
           break
       }
       }
-      console.log(type)
-      console.log(type + ':' + style)
       var feature = this.GeoJSON_to_Feature(geometry, style)
       var feature = this.GeoJSON_to_Feature(geometry, style)
 
 
       // 要素属性装载
       // 要素属性装载

+ 14 - 9
src/components/mobileBar.vue

@@ -88,10 +88,6 @@
 
 
           <!-- 标签栏(按钮) -->
           <!-- 标签栏(按钮) -->
           <div style="text-align:center; margin-bottom: 10px" id='list-btn-div'>
           <div style="text-align:center; margin-bottom: 10px" id='list-btn-div'>
-            <!-- <b-button size="sm" pill variant="outline-success" @click="getNoticeList()">通知</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getReportList()">报道</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getCultureList()">文化</b-button>
-            <b-button size="sm" pill variant="outline-success" @click="getOthersList()">更多</b-button> -->
             <b-form-radio-group
             <b-form-radio-group
               id="btn-radios-2"
               id="btn-radios-2"
               v-model="selected"
               v-model="selected"
@@ -236,7 +232,7 @@ export default {
       this.$axios
       this.$axios
         .get('/notice/list')
         .get('/notice/list')
         .then(function (response) {
         .then(function (response) {
-          that.listData.notice = response.data
+          that.listData.notice = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.notice))
           that.listData.current = JSON.parse(JSON.stringify(that.listData.notice))
           that.currentMsgType = 'notice'
           that.currentMsgType = 'notice'
@@ -252,7 +248,7 @@ export default {
       this.$axios
       this.$axios
         .get('/report/list')
         .get('/report/list')
         .then(function (response) {
         .then(function (response) {
-          that.listData.report = response.data
+          that.listData.report = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.report))
           that.listData.current = JSON.parse(JSON.stringify(that.listData.report))
           that.currentMsgType = 'report'
           that.currentMsgType = 'report'
@@ -267,7 +263,7 @@ export default {
       this.$axios
       this.$axios
         .get('/culture/list')
         .get('/culture/list')
         .then(function (response) {
         .then(function (response) {
-          that.listData.culture = response.data
+          that.listData.culture = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.culture))
           that.listData.current = JSON.parse(JSON.stringify(that.listData.culture))
           that.currentMsgType = 'culture'
           that.currentMsgType = 'culture'
@@ -282,13 +278,22 @@ export default {
       this.$axios
       this.$axios
         .get('/others/list')
         .get('/others/list')
         .then(function (response) {
         .then(function (response) {
-          that.listData.others = response.data
+          that.listData.others = response.data.sort(that.compare('level'))
           // 浅拷贝到当前的通知列表数组
           // 浅拷贝到当前的通知列表数组
           that.listData.current = JSON.parse(JSON.stringify(that.listData.others))
           that.listData.current = JSON.parse(JSON.stringify(that.listData.others))
-          that.currentMsgType = 'other'
+          that.currentMsgType = 'others'
         })
         })
     },
     },
 
 
+    // 比较重要级 property:为比较的字段 代码修改
+    compare(property){
+      return function(a,b){
+          var value1 = a[property];
+          var value2 = b[property];
+          return value2 - value1 ;
+      }
+    },
+
     // 按钮点击事件,更新列表
     // 按钮点击事件,更新列表
     updateList: function (value) {
     updateList: function (value) {
       switch (value) {
       switch (value) {