articleDetail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view>
  3. <!-- pages/me.wxml -->
  4. <view class="container">
  5. <h1 class="title">{{ detailInfo.titleName }}</h1>
  6. <view class="wenzhangLy">
  7. <!-- 头像昵称 -->
  8. <view class="txTime">
  9. <!-- <img-->
  10. <!-- class="uni-header-image"-->
  11. <!-- :src="initInfo.headImg == null || initInfo.headImg == '' ? initImgPath : loadImgSrcLocalhost(initInfo.headImg)"-->
  12. <!-- />-->
  13. <view class="time">
  14. <!-- <p>{{ initInfo.name == null || initInfo.name == '' ? initInfo.wechatName : initInfo.name }}</p>-->
  15. <span>{{ detailInfo.createTime }}</span>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="wenzhangCont article">
  20. <span v-html="detailInfo.textDetails">
  21. </span>
  22. <view>
  23. <!-- 图片轮播 -->
  24. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration"
  25. :circular="circular">
  26. <block v-for="(one, index) in detailInfo.urls" :key="index">
  27. <swiper-item>
  28. <image :src="loadImgSrcLocalhost(one)" style="background-size: 100% 100%;"></image>
  29. </swiper-item>
  30. </block>
  31. </swiper>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. getUserInfo
  40. } from '@/api/me/me.js'
  41. export default {
  42. data() {
  43. return {
  44. anwserVal: '',
  45. anwserList: [
  46. {
  47. deptName: '国家乡村振兴局',
  48. updateTime: '2023-2-27 16:04',
  49. desc: '用好政策效果评估成果,进一步优化巩固拓展脱贫攻坚成果同乡村振兴有效衔接政策供给,为推动工作提质增效提供有力支撑保障。',
  50. }
  51. ],
  52. isCollection: false,
  53. isAdopt: false,
  54. adoptTopSize: '115',
  55. adoptIndex: null,
  56. detailInfo: {},
  57. initInfo: {
  58. userId: null,
  59. scoreNum: 0,
  60. wechatName: "微信用户",
  61. name: null,
  62. headImg: null,
  63. },
  64. };
  65. },
  66. methods: {
  67. // 评论回答
  68. answerFunc() {
  69. this.anwserList.push({
  70. deptName: '国家烟草局',
  71. updateTime: new Date().getFullYear() + "-" + new Date().getMonth() + "-" + new Date().getDay() + " " + (new Date().getHours() < 10 ? "0" + new Date().getHours() : new Date().getHours()) + ':' + (new Date().getMinutes() < 10 ? "0" + new Date().getMinutes() : new Date().getMinutes()),
  72. desc: this.anwserVal,
  73. })
  74. this.anwserVal = null
  75. },
  76. adoptFunc(idx) {
  77. this.adoptIndex = idx
  78. this.isAdopt = true
  79. },
  80. // 标记喜欢
  81. collectionFunc() {
  82. this.isCollection = !this.isCollection
  83. },
  84. // 加工图片路径
  85. srcExcutedFunc(html) {
  86. let newReg = /(?<=(src="))[^"]*?(?=")/ig;
  87. let newHtml = html
  88. var allSrc = html.match(newReg);
  89. try {
  90. if (allSrc.length != 0) {
  91. allSrc.forEach(e => {
  92. newHtml = newHtml.replace(e, this.loadImgSrc(e))
  93. })
  94. }
  95. } catch (e) {
  96. //TODO handle the exception
  97. }
  98. return newHtml
  99. },
  100. getUserInfoByUserId(userId) {
  101. getUserInfo(userId).then(res => {
  102. this.initInfo = res.data;
  103. })
  104. },
  105. }
  106. /**
  107. * 生命周期函数--监听页面加载
  108. */,
  109. onLoad(option) {
  110. let result = JSON.parse(decodeURIComponent(option.data))
  111. this.detailInfo = result
  112. },
  113. /**
  114. * 生命周期函数--监听页面初次渲染完成
  115. */
  116. onReady(e) {
  117. this.userId = getApp().globalData.userId
  118. this.getUserInfoByUserId(this.userId)
  119. },
  120. /**
  121. * 生命周期函数--监听页面显示
  122. */
  123. onShow() {
  124. },
  125. /**
  126. * 生命周期函数--监听页面隐藏
  127. */
  128. onHide() {
  129. },
  130. /**
  131. * 生命周期函数--监听页面卸载
  132. */
  133. onUnload() {
  134. },
  135. /**
  136. * 页面相关事件处理函数--监听用户下拉动作
  137. */
  138. onPullDownRefresh() {
  139. },
  140. /**
  141. * 页面上拉触底事件的处理函数
  142. */
  143. onReachBottom() {
  144. },
  145. /**
  146. * 用户点击右上角分享
  147. */
  148. onShareAppMessage() {
  149. },
  150. };
  151. </script>
  152. <style lang="scss">
  153. @import 'articleDetail.css';
  154. .collect {
  155. .icon-shoucang:before {
  156. color: red;
  157. }
  158. }
  159. .not-collect {
  160. }
  161. .effectBix {
  162. width: 56px;
  163. height: 56px;
  164. border-radius: 50px;
  165. font-family: 'Bebas Neue', cursive;
  166. background: linear-gradient(45deg, transparent 5%, #FF013C 5%);
  167. border: 0;
  168. color: #fff;
  169. text-align: center;
  170. line-height: 56px;
  171. outline: transparent;
  172. position: absolute;
  173. transform: rotate(-30deg);
  174. right: 3%;
  175. top: -5%;
  176. }
  177. .effectBox, .effectBox::after {
  178. width: 56px;
  179. height: 56px;
  180. border-radius: 50px;
  181. font-size: 16px;
  182. font-family: 'Bebas Neue', cursive;
  183. background: linear-gradient(45deg, transparent 5%, #FF013C 5%);
  184. border: 0;
  185. color: #fff;
  186. opacity: 1;
  187. letter-spacing: 3px;
  188. text-align: center;
  189. line-height: 56px;
  190. outline: transparent;
  191. position: relative;
  192. left: 78%;
  193. top: 113%;
  194. transform: rotate(-30deg);
  195. z-index: 1;
  196. }
  197. .effectBox::after {
  198. --slice-0: inset(50% 50% 50% 50%);
  199. --slice-1: inset(80% -6px 0 0);
  200. --slice-2: inset(50% -6px 30% 0);
  201. --slice-3: inset(10% -6px 85% 0);
  202. --slice-4: inset(40% -6px 43% 0);
  203. --slice-5: inset(80% -6px 5% 0);
  204. content: 'AVAILABLE NOW';
  205. display: block;
  206. position: absolute;
  207. top: 0;
  208. left: 0;
  209. right: 0;
  210. bottom: 0;
  211. background: linear-gradient(45deg, transparent 3%, #00E6F6 3%, #00E6F6 5%, #FF013C 5%);
  212. text-shadow: -3px -3px 0px #F8F005, 3px 3px 0px #00E6F6;
  213. clip-path: var(--slice-0);
  214. }
  215. .effectBox:hover::after {
  216. animation: 1s glitch;
  217. animation-timing-function: steps(2, end);
  218. }
  219. @keyframes glitch {
  220. 0% {
  221. clip-path: var(--slice-1);
  222. transform: translate(-20px, -10px);
  223. }
  224. 10% {
  225. clip-path: var(--slice-3);
  226. transform: translate(10px, 10px);
  227. }
  228. 20% {
  229. clip-path: var(--slice-1);
  230. transform: translate(-10px, 10px);
  231. }
  232. 30% {
  233. clip-path: var(--slice-3);
  234. transform: translate(0px, 5px);
  235. }
  236. 40% {
  237. clip-path: var(--slice-2);
  238. transform: translate(-5px, 0px);
  239. }
  240. 50% {
  241. clip-path: var(--slice-3);
  242. transform: translate(5px, 0px);
  243. }
  244. 60% {
  245. clip-path: var(--slice-4);
  246. transform: translate(5px, 10px);
  247. }
  248. 70% {
  249. clip-path: var(--slice-2);
  250. transform: translate(-10px, 10px);
  251. }
  252. 80% {
  253. clip-path: var(--slice-5);
  254. transform: translate(20px, -10px);
  255. }
  256. 90% {
  257. clip-path: var(--slice-1);
  258. transform: translate(-10px, 0px);
  259. }
  260. 100% {
  261. clip-path: var(--slice-1);
  262. transform: translate(0);
  263. }
  264. }
  265. </style>