history.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="art-wrap">
  3. <view class="tabs">
  4. <view class="tab" v-for="(tab,index) in tabs" :key="index" @click="changeTab(tab)" :class="tab.artCatId===artCatId?'active':''">{{tab.artCatTitle}}</view>
  5. </view>
  6. <view class="tab-container">
  7. <view class="item" v-for="(item,idx) in artList" :key="idx">
  8. <view class="content card" @click="showDetail(item)">
  9. <view class="top">
  10. <view class="lf">
  11. <view class="tag">{{item.artCatTitle}}</view>
  12. <view class="author" v-if="item.editorName">{{item.editorName}}</view>
  13. </view>
  14. <view class="rt"><span>{{MessageTimeFormat(item.issuedAt)}}</span></view>
  15. </view>
  16. <view class="info">
  17. <view class="title" v-if="item.artTitle">{{item.artTitle}}</view>
  18. <view class="footer">
  19. <view class="author">{{item.artAuthor?item.artAuthor:'未知'}}</view>
  20. <view class="time">{{item.issuedAt}}</view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {getToken} from '@/libs/auth.js';
  30. import {MessageTimeFormat} from '@/libs/index.js';
  31. import {getArtCatTop,getArtByList} from '@/api/system/art.js'
  32. export default {
  33. data() {
  34. return {
  35. artCatId:"",
  36. tabs:[],
  37. artList:[]
  38. }
  39. },
  40. onShow() {
  41. this.getArtCatTop()
  42. },
  43. methods:{
  44. MessageTimeFormat,
  45. changeTab(item){
  46. this.artCatId=item.artCatId
  47. this.getArtByList()
  48. },
  49. getArtCatTop(){
  50. getArtCatTop().then((res)=>{
  51. this.tabs=res.data
  52. if(res.data.length>0){
  53. this.artCatId=res.data[0].artCatId
  54. this.getArtByList()
  55. }
  56. })
  57. },
  58. getArtByList(){
  59. getArtByList({
  60. artCatId:this.artCatId
  61. }).then((res)=>{
  62. this.artList=res.data
  63. })
  64. },
  65. showDetail(){
  66. let baseUrl="http://h5.xazhyc.com"
  67. uni.navigateTo({
  68. url:`/pages/webview/webview?href=${baseUrl}/art/views/detail.html&artId=473700&name=通讯录`
  69. })
  70. }
  71. },
  72. onPullDownRefresh() {
  73. this.getArtCatTop()
  74. uni.stopPullDownRefresh()
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .art-wrap{
  80. padding: 24rpx;
  81. background-color: #f2f2f2;
  82. .tabs{
  83. overflow-x: auto;
  84. overflow-y: hidden;
  85. display: flex;
  86. background-color: #fff;
  87. border-radius: 16rpx;
  88. .tab{
  89. height: 88rpx;
  90. line-height: 88rpx;
  91. display: inline-block;
  92. padding: 0 32rpx;
  93. flex: 1 0 auto;
  94. font-size: 28rpx;
  95. color: #35364F;
  96. position: relative;
  97. &::after{
  98. display: block;
  99. width: 50%;
  100. border-bottom: 2px solid transparent;
  101. position: absolute;
  102. bottom: 0;
  103. left: 50%;
  104. transform: translateX(-50%);
  105. content: "";
  106. }
  107. &.active{
  108. font-size: 34rpx;
  109. font-weight: 700;
  110. &::after{
  111. border-bottom: 2px solid #15CD85;
  112. }
  113. }
  114. }
  115. }
  116. .tab-container{
  117. background-color: #f2f2f2;
  118. .item{
  119. margin-top: 20rpx;
  120. .card{
  121. background: #FFFFFF;
  122. border-radius: 10rpx;
  123. padding: 24rpx;
  124. .top{
  125. display: flex;
  126. justify-content: space-between;
  127. align-items: center;
  128. padding-bottom: 20rpx;
  129. .lf{
  130. flex: 1;
  131. display: flex;
  132. align-items: center;
  133. .tag{
  134. display: inline-block;
  135. padding:10rpx 16rpx;
  136. border: 1px solid #15CD85;
  137. line-height: 1;
  138. color: #15CD85;
  139. border-radius: 4rpx;
  140. }
  141. .author{
  142. display: inline-block;
  143. padding-left: 5px;
  144. line-height: 1;
  145. color: #666;
  146. }
  147. }
  148. }
  149. .info{
  150. font-size: 24rpx;
  151. font-weight: 500;
  152. color: #B0B0B0;
  153. line-height:1;
  154. padding-top: 0.22rem;
  155. .title{
  156. font-size:32rpx;
  157. font-family: PingFang SC;
  158. font-weight: bold;
  159. color: #000000;
  160. line-height:48rpx;
  161. text-overflow: ellipsis;
  162. overflow: hidden;
  163. -webkit-line-clamp: 2;
  164. display: -webkit-box;
  165. -webkit-box-orient: vertical;
  166. }
  167. .footer{
  168. display: flex;
  169. justify-content: space-between;
  170. align-items: center;
  171. padding-top: 10rpx;
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. </style>