Model13.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="model-13">
  3. <view class="notice-box notice-box-1" :style="{backgroundColor:editablePageConfig.editable_page_config_content.back_color}">
  4. <view class="notice-con">
  5. <view class="notice-con-icon">
  6. <image mode="aspectFit" class="img" :src="notice_image">
  7. </view>
  8. <view class="notice-con-split">
  9. </view>
  10. <view class="notice-slid" :style="{top}">
  11. <view class="notice-con-font" @click="goAdUrl(v.link)" v-for="(v,index) in editablePageConfig.editable_page_config_content.notice_title" :key="index">{{v.text}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { env } from '../../../../static/config'
  19. export default {
  20. name: 'Model13',
  21. data () {
  22. return {
  23. activeIndex: 0
  24. }
  25. },
  26. props: ['editablePageConfig','editablePage'],
  27. computed: {
  28. top () {
  29. return -this.activeIndex * 39 + 'px'
  30. },
  31. notice_image(){
  32. if(this.editablePageConfig.editable_page_config_content['notice_image']){
  33. return this.editablePageConfig.editable_page_config_content['notice_image']
  34. }else{
  35. return env.SITE_URL+'/static/home/images/editable_page/ds-notice.png'
  36. }
  37. }
  38. },
  39. beforeDestroy: function () {
  40. clearInterval(this.time_interval)
  41. },
  42. mounted () {
  43. let _this = this
  44. this.time_interval = setInterval(function () {
  45. if (_this.activeIndex < _this.editablePageConfig.editable_page_config_content.notice_title.length-1) {
  46. _this.activeIndex += 1
  47. } else {
  48. _this.activeIndex = 0
  49. }
  50. }, 2000)
  51. },
  52. methods: {
  53. goAdUrl (url) {
  54. uni.navigateTo({url:url})
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .model-13 .notice-box-1 {
  61. padding: 10px;
  62. border-radius:5px;
  63. }
  64. .model-13 .notice-box-1 .notice-con {
  65. display: flex;
  66. align-items: center;
  67. height: 39px;
  68. line-height: 39px;
  69. overflow: hidden;
  70. }
  71. .model-13 .notice-box-1 .notice-con-icon {
  72. flex-shrink: 0;
  73. height: 12px;
  74. text-align: center;
  75. line-height: 18px;
  76. width: 3.5rem;
  77. }
  78. .model-13 .notice-box-1 .notice-con-icon .img {
  79. height: 12px;
  80. vertical-align: top;
  81. }
  82. .model-13 .notice-box-1 .notice-con-split {
  83. width: 1px;
  84. height: 13px;
  85. background-color: #E4E4E4;
  86. margin: 0 11px;
  87. }
  88. .model-13 .notice-box-1 .notice-slid{
  89. position: relative;
  90. transition: top .5s;
  91. flex: 1;
  92. align-self: flex-start;
  93. }
  94. .model-13 .notice-box-1 .notice-con-font {
  95. font-size: 14px;
  96. color: #333;
  97. flex: 1;
  98. overflow: hidden;
  99. white-space: nowrap;
  100. text-overflow: ellipsis;
  101. }
  102. </style>