accompanyingCamp.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <view class="shopping-wrapper">
  4. <view class="wz-cover " :style="{backgroundImage:`url(${item.cover})`, backgroundSize: 'cover'}" v-for="(item, index) in newsList" :key="index" @click="toDetail(item)">
  5. <view class="title mb5 display-flex">
  6. {{item.name}} <view class="ml8"><u-icon name="arrow-right" color="#333333" size="14"></u-icon></view>
  7. </view>
  8. <view class="remark">
  9. {{item.remark}}
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import {getNewsList} from "@/common/api/news";
  17. import {getData} from "@/common/api";
  18. export default {
  19. data() {
  20. return {
  21. cid: 5,
  22. newsList:[],
  23. page: 1,
  24. pageSize: 9999,
  25. };
  26. }
  27. ,onShow() {
  28. this.getData()
  29. },
  30. methods: {
  31. getData(){
  32. getNewsList(
  33. {
  34. "cid": this.cid,
  35. "page": this.page,
  36. "pageSize": this.pageSize
  37. }).then(({ data })=>{
  38. if ( data.list){
  39. this.newsList=data.list
  40. }
  41. })
  42. },
  43. toDetail(item){
  44. uni.navigateTo({
  45. url: "/subPages/accompanyingCamp/accompanyingCampDetail?id=" + item.id,
  46. });
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. .shopping-wrapper {
  53. width: 690rpx;
  54. margin: 10rpx auto 0rpx;
  55. padding: 0rpx 30rpx 178rpx;
  56. .wz-cover{
  57. width: calc(100% - 340rpx);
  58. height: 144rpx;
  59. margin-top: 20rpx;
  60. padding-left:330rpx;
  61. padding-right:10rpx;
  62. display: inline-block;
  63. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  64. border-radius: 15rpx;
  65. display: flex; /* 设置为 Flex 容器 */
  66. flex-direction: column; /* 垂直排列子元素 */
  67. justify-content: center; /* 垂直居中子元素 */
  68. text-align: center; /* 文字居中 */
  69. .title {
  70. font-family: PingFang SC-Bold, PingFang SC;
  71. font-weight: 600;
  72. font-size: 32rpx;
  73. color: #333333;
  74. line-height: 40rpx;
  75. text-align: left;
  76. font-style: normal;
  77. text-transform: none;
  78. }
  79. .remark{
  80. font-family: PingFang SC-Medium, PingFang SC;
  81. font-weight: 400;
  82. font-size: 22rpx;
  83. color: #666666;
  84. line-height: 32rpx;
  85. text-align: left;
  86. font-style: normal;
  87. text-transform: none;
  88. white-space: nowrap; /* 防止文本换行 */
  89. overflow: hidden; /* 隐藏溢出的文本 */
  90. text-overflow: ellipsis;
  91. }
  92. }
  93. }
  94. </style>