数字化园区前端项目
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <!-- 园区公告-->
  2. <template>
  3. <div class="notice">
  4. <div class="title_box">
  5. <div class="title">
  6. <span class="chinese">园区公告</span>
  7. <span class="english">park announcement</span>
  8. </div>
  9. <div class="more pointer" v-if="lists.length < 5">
  10. <img src="@assets/image/index/icon_more.png" alt="更多" />
  11. </div>
  12. </div>
  13. <template v-if="lists.length >= 5">
  14. <section class="content">
  15. <div class="main_notice pointer">
  16. <div class="notice_title">国务院关于推进物联网有序健康发展指导者</div>
  17. <div class="notice_content">
  18. 小昆山园区经过不断改革发展,园区已经具备大规模开发建设的总体框架,形成了良性循环的软硬投资环境,吸引了多地区企业的投资。园区地理交通条件优越,区内交通四通八达,道路宽敞平坦。
  19. 小昆山园区经过不断改革发展,园区已经具备大规模开发建设的总体框架,形成了良性循环的软硬投资环境,吸引了多地区企业的投资。园区地理交通条件优越,区内交通四通八达,道路宽敞平坦。
  20. </div>
  21. </div>
  22. <ul class="notice_ul">
  23. <li class="notice_item pointer" v-for="item in lists" :key="item">
  24. <div class="notice_detail">
  25. <div>
  26. {{ item }}
  27. </div>
  28. </div>
  29. <div>2022.09.17</div>
  30. </li>
  31. </ul>
  32. </section>
  33. <div class="more width_100 pointer">
  34. <img src="@assets/image/index/icon_more.png" alt="更多" />
  35. </div>
  36. </template>
  37. <template v-else>
  38. <div class="notice_box">
  39. <ul :class="['notice_list', animate ? 'content_top' : '']">
  40. <li class="notice_item " v-for="item in lists" :key="item">
  41. <div class="notice_detail">
  42. <div>
  43. {{ item }}
  44. </div>
  45. </div>
  46. <div>2022.09.17</div>
  47. </li>
  48. </ul>
  49. </div>
  50. </template>
  51. </div>
  52. </template>
  53. <script>
  54. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  55. //例如:import 《组件名称》 from '《组件路径》';
  56. export default {
  57. //import引入的组件需要注入到对象中才能使用
  58. components: {},
  59. props: ["lists"],
  60. data() {
  61. //这里存放数据
  62. return {
  63. animate: false,
  64. };
  65. },
  66. //监听属性 类似于data概念
  67. computed: {},
  68. //监控data中的数据变化
  69. watch: {},
  70. //方法集合
  71. methods: {
  72. scroll() {
  73. if (this.lists.length < 5) {
  74. this.animate = true; // 因为在消息向上滚动的时候需要添加css3过渡动画,所以这里需要设置true
  75. setTimeout(() => {
  76. // 这里直接使用了es6的箭头函数,省去了处理this指向偏移问题,代码也比之前简化了很多
  77. this.lists.push(this.lists[0]); // 将数组的第一个元素添加到数组的
  78. this.lists.shift(); //删除数组的第一个元素
  79. this.animate = false; // margin-top 为0 的时候取消过渡动画,实现无缝滚动
  80. }, 1000);
  81. }
  82. },
  83. },
  84. //生命周期 - 创建完成(可以访问当前this实例)
  85. created() {
  86. setInterval(this.scroll, 5000);
  87. },
  88. //生命周期 - 挂载完成(可以访问DOM元素)
  89. mounted() {},
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. //@import url(); 引入公共css类
  94. .notice {
  95. width: 100%;
  96. height: 100%;
  97. @include flex(column, space-between, flex-start, null);
  98. }
  99. .title_box {
  100. width: 100%;
  101. @include flex(row, space-between, center, null);
  102. margin-bottom: 30px;
  103. }
  104. .title {
  105. flex: 1;
  106. .chinese {
  107. @include font(24px, #334a5f);
  108. }
  109. .english {
  110. @include font(14px, #637485);
  111. margin-left: 10px;
  112. }
  113. }
  114. .content {
  115. width: 100%;
  116. flex: 1;
  117. background-image: linear-gradient(180deg, #e5f3fc 0%, #fcfefe 100%);
  118. padding: 35px 30px 0 40px;
  119. @include border-box;
  120. .main_notice {
  121. border-bottom: solid 1px #abcee4;
  122. padding-bottom: 12px;
  123. @include border-box;
  124. .notice_title {
  125. @include font(16px, #334a5f);
  126. font-weight: 600;
  127. padding-bottom: 15px;
  128. @include border-box;
  129. }
  130. .notice_content {
  131. height: 100%;
  132. @include font(16px, #334a5f);
  133. // padding-bottom: 12px;
  134. // @include border-box;
  135. @include text-ellipsis-multiple(2);
  136. }
  137. }
  138. .notice_ul {
  139. width: 100%;
  140. .notice_item {
  141. padding-top: 25px;
  142. @include border-box;
  143. }
  144. }
  145. }
  146. .notice_item {
  147. width: 100%;
  148. @include font(16px, #334a5f);
  149. @include flex(row, space-between, center, nowrap);
  150. }
  151. .notice_detail {
  152. overflow: hidden;
  153. flex: 1;
  154. padding: 0 40px 0 26px;
  155. position: relative;
  156. @include border-box;
  157. > div {
  158. @include text-ellipsis;
  159. }
  160. }
  161. .notice_detail::before {
  162. content: "";
  163. width: 15px;
  164. height: 15px;
  165. border: 2px solid #0086e7;
  166. border-radius: 50%;
  167. @include border-box;
  168. position: absolute;
  169. left: 0;
  170. top: 50%;
  171. transform: translateY(-50%);
  172. }
  173. .width_100 {
  174. width: 100%;
  175. padding-right: 30px;
  176. margin-top: 20px;
  177. @include border-box;
  178. }
  179. .more {
  180. height: 25px;
  181. @include flex(row, flex-end, center, null);
  182. img {
  183. width: 73px;
  184. height: 25px;
  185. }
  186. }
  187. .notice_box {
  188. @include size(100%, 60px);
  189. background: #eef7fd;
  190. padding: 0 20px;
  191. @include border-box;
  192. overflow: hidden;
  193. .notice_list {
  194. @include size(100%, 100%);
  195. overflow: hidden;
  196. li {
  197. height: 100%;
  198. }
  199. }
  200. }
  201. .content_top {
  202. transition: all 0.5s;
  203. margin-top: -60px;
  204. }
  205. </style>