• 滚动播报、el-scrollbar


     

     

    1. <template>
    2. <div>
    3. <div id="filePageTool" class="filePageTool" v-show="filePageToolFlag">
    4. <div
    5. class="ftitle"
    6. @click="
    7. changeShowBtn;
    8. fbodyShow = !fbodyShow;
    9. "
    10. >
    11. <img
    12. src="@/assets/img/gonggaoguanli@2x.png"
    13. width="20px"
    14. style="padding-left: 15px"
    15. alt=""
    16. />
    17. <span> 通知公告span>
    18. div>
    19. <div
    20. @click="
    21. changeShowBtn;
    22. fbodyShow = !fbodyShow;
    23. "
    24. >
    25. <img
    26. :src="
    27. fbodyShow
    28. ? require('@/assets/img/收起@2x.png')
    29. : require('@/assets/img/展开@2x.png')
    30. "
    31. width="18px"
    32. style="position: absolute; right: 10px; top: 11px"
    33. alt=""
    34. />
    35. div>
    36. <div class="notice-body" v-if="fbodyShow">
    37. <div class="fbody">
    38. <el-scrollbar style="height: 100%" ref="scroball">
    39. <table>
    40. <tr
    41. class="pageList"
    42. v-for="m in tableDataList"
    43. @mouseleave="mouseTableLeave"
    44. @mouseover="mouseTableOver"
    45. :key="m.id"
    46. :title="m.fileTitle"
    47. >
    48. <td>
    49. <div style="width: 100%" class="noticeActiveDiv">
    50. <a
    51. target="_blank"
    52. class="noticeActive"
    53. @click="toDetail(m)"
    54. >
    55. <div
    56. class="notice"
    57. style="
    58. line-height: 35px;
    59. font-size: 14px;
    60. font-weight: 500;
    61. "
    62. >
    63. {{ m.fileTitle }}
    64. div>
    65. <div style="line-height: 15px; color: #dbfdf9">
    66. {{ m.publishingTime }}
    67. div>
    68. a>
    69. div>
    70. td>
    71. tr>
    72. table>
    73. el-scrollbar>
    74. div>
    75. div>
    76. <p class="more-notice" @click="more" v-show="tableDataList.length > 1">
    77. 更多>>
    78. p>
    79. div>
    80. div>
    81. template>
    82. <script>
    83. import { mapActions } from "vuex";
    84. import http from "@/service/interface.js";
    85. export default {
    86. name: "layout",
    87. data() {
    88. return {
    89. filePageToolFlag: true,
    90. activeMenuList: undefined,
    91. fbodyShow: true,
    92. tableDataList: [],
    93. menuList: [],
    94. scrolHeight: 0,
    95. };
    96. },
    97. methods: {
    98. async initPolicy() {
    99. let params = {
    100. pageNum: 1,
    101. pageSize: 999999,
    102. // userId: localStorage.getItem("userId"),
    103. userId: localStorage.getItem("id"),
    104. fileType: "通知公告",
    105. key: "",
    106. };
    107. let res = await http.getPolicyPageList(params);
    108. if (res.status === 200) {
    109. this.tableDataList = res.data.records;
    110. localStorage.setItem("recordsInfo", this.tableDataList);
    111. this.tableDataList.forEach((item) => {
    112. item.src = `通知公告/${item.filePath}`;
    113. });
    114. if (this.tableDataList.length == 0) {
    115. this.tableDataList = [
    116. {
    117. fileTitle: "暂无公告",
    118. publishingTime: "",
    119. src: "",
    120. },
    121. ];
    122. }
    123. console.log(this.tableDataList, "通知公告====");
    124. }
    125. },
    126. toDetail(row) {
    127. console.log(row,'=====row');
    128. if (this.tableDataList.length > 1) {
    129. localStorage.setItem("detailsParam", JSON.stringify(row));
    130. this.$router.push("/policyAnnouncements/details");
    131. }
    132. },
    133. more() {
    134. let routeUrl = this.$router.resolve({
    135. name: "policyAnnouncements",
    136. });
    137. window.open(routeUrl.href, "_blank");
    138. },
    139. // 关闭公告
    140. changeShowBtn() {
    141. this.filePageToolFlag = !this.filePageToolFlag;
    142. },
    143. creteTableInterval(scrolHeight) {
    144. if (this.tableInterval) {
    145. clearInterval(this.tableInterval);
    146. }
    147. let scrolMax;
    148. this.$nextTick(() => {
    149. if (this.$refs.scroball?.wrap) {
    150. scrolMax = this.$refs.scroball.wrap.scrollHeight;
    151. }
    152. });
    153. this.tableInterval = setInterval(() => {
    154. this.$nextTick(() => {
    155. this.scrolHeight++;
    156. if (scrolMax - this.scrolHeight < 220) {
    157. this.scrolHeight = 0;
    158. }
    159. if (this.$refs.scroball?.wrap) {
    160. this.$refs.scroball.wrap.scrollTop = this.scrolHeight;
    161. }
    162. });
    163. }, 50);
    164. },
    165. mouseTableLeave() {
    166. setTimeout(() => {
    167. this.creteTableInterval(this.scrolHeight);
    168. }, 1000);
    169. },
    170. mouseTableOver() {
    171. clearInterval(this.tableInterval);
    172. this.$nextTick(() => {debugger
    173. this.scrolHeight = this.$refs.scroball?.wrap.scrollTop;
    174. });
    175. },
    176. },
    177. mounted() {
    178. this.creteTableInterval(0);
    179. this.initPolicy();
    180. },
    181. watch: {},
    182. };
    183. script>
    184. <style scoped>
    185. .filePageNotice {
    186. position: absolute;
    187. top: 15px;
    188. right: 15px;
    189. width: 25px;
    190. height: 25px;
    191. background-color: rgba(92, 87, 87, 0.3);
    192. background: rgba(0, 23, 46, 0.8);
    193. border: 1px solid #15d0ba;
    194. border-radius: 2px;
    195. color: #fff;
    196. }
    197. .filePageNotice button {
    198. background: linear-gradient(180deg, #006b6e 0%, #00a771 100%);
    199. }
    200. .filePageTool {
    201. position: absolute;
    202. top: 15px;
    203. right: 15px;
    204. background-color: rgba(92, 87, 87, 0.3);
    205. width: 239px;
    206. /* height: 337px; */
    207. background: rgba(0, 23, 46, 0.8);
    208. border-radius: 1px;
    209. border: 1px solid #15d0ba;
    210. border-radius: 2px;
    211. cursor: default;
    212. }
    213. .filePageTool .ftitle {
    214. width: 239px;
    215. line-height: 38px;
    216. background: linear-gradient(180deg, #006b6e 0%, #00a771 100%);
    217. border-radius: 1px;
    218. color: aliceblue;
    219. font-size: 15px;
    220. font-weight: 700;
    221. color: #fff;
    222. }
    223. .notice-body {
    224. padding: 15px;
    225. }
    226. .filePageTool .fbody {
    227. height: 270px;
    228. }
    229. .filePageTool .fbody table .pageList td .noticeActiveDiv .noticeActive .notice {
    230. line-height: 35px;
    231. font-size: 14px;
    232. font-weight: 500;
    233. white-space: nowrap;
    234. overflow: hidden;
    235. text-overflow: ellipsis;
    236. width: 200px;
    237. }
    238. .more-notice {
    239. height: 30px;
    240. line-height: 30px;
    241. color: #fff;
    242. text-align: right;
    243. margin-right: 10px;
    244. cursor: pointer;
    245. }
    246. .pageList {
    247. height: 40px;
    248. border-bottom: 1px solid #000;
    249. color: #fff;
    250. }
    251. .filePageTool .text {
    252. color: aliceblue;
    253. width: 100px;
    254. font-size: 25px;
    255. line-height: 40px;
    256. text-align: center;
    257. font-weight: 800;
    258. }
    259. .filePageTool ul {
    260. padding-top: 100px;
    261. }
    262. .noticeActive {
    263. color: white;
    264. text-decoration: none;
    265. }
    266. .noticeActive:link {
    267. color: #fff;
    268. text-decoration: none;
    269. }
    270. /* 未访问的链接 */
    271. .noticeActive:visited {
    272. color: #fff;
    273. text-decoration: none;
    274. }
    275. /* 已访问的链接 */
    276. .noticeActive:hover {
    277. color: greenyellow;
    278. text-decoration: underline;
    279. }
    280. /* 鼠标移动到链接上 */
    281. .noticeActive:active {
    282. color: #f00;
    283. }
    284. /* 选定的链接 */
    285. style>

  • 相关阅读:
    YOLOv5改进Neck系列:新颖的Gather-and-Distribute机制,特征新颖融合,增强了多尺度特征融合能力,实现了延迟和准确性的理想平衡
    基于达梦数据库开发-C#篇
    Vue的模块与模块化、组件与组件化
    初识 - Linux
    北京旅游HTML学生网页设计作品 dreamweaver作业静态HTML网页设计模板 北京旅游景点网页作业制作 HTML+CSS+JS
    Qt之自定义带游标的QSlider
    Jmeter性能测试 —— TPS拐点寻找
    四、nginx反向代理
    vlog常用参数解析
    Blazor和Vue对比学习(基础1.5):双向绑定
  • 原文地址:https://blog.csdn.net/ANNENBERG/article/details/126138886