list.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="main-container">
  3. <view class="list-img" v-if="!home">
  4. <image src="../../static/img/like.png"></image>
  5. </view>
  6. <view class="test-list">
  7. <view class="list-li" v-for="(book,index) in List" :key="index">
  8. <view @click="godetail(book)"><image :src="book.img" mode="aspectFill"></image></view>
  9. <view>
  10. <p @click="godetail(book)">{{ book.name }}</p>
  11. <p @click="godetail(book)">{{ book.content }}</p>
  12. <p>
  13. <span>{{ book.price}} 元</span>
  14. <span v-if="!home" @click="gotest(book)">立即测评</span>
  15. </p>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. components: {
  24. },
  25. props: ['home','List'],
  26. data() {
  27. return {
  28. };
  29. },
  30. onLoad() {
  31. },
  32. methods: {
  33. // 立即测评
  34. gotest(book){
  35. uni.navigateTo({
  36. url:'/pages/test/test?id='+book.id+'&time='+book.time
  37. })
  38. },
  39. // 跳转当前点击的详情
  40. godetail(book) {
  41. uni.navigateTo({
  42. url:'/pages/test-detail/test-detail?id='+book.id+'&img='+book.img
  43. })
  44. }
  45. }
  46. };
  47. </script>
  48. <style lang="scss" scoped>
  49. .main-container{
  50. // padding: 32upx 32upx 0upx 32upx;
  51. // margin-top: 20upx;
  52. .list-img{
  53. image{
  54. width: 170upx;
  55. height: 40upx;
  56. }
  57. }
  58. .test-list{
  59. .list-li{
  60. overflow: hidden;
  61. padding: 24upx 0upx;
  62. border-bottom: 2upx solid #E6E6E6;
  63. &:last-child{
  64. border-bottom: 0;
  65. }
  66. image{
  67. min-width: 186upx;
  68. max-width: 100%;
  69. height: 148upx;
  70. }
  71. view{
  72. float: left;
  73. display: inline-block;
  74. &:nth-child(1){
  75. width: 30%;
  76. }
  77. &:nth-child(2){
  78. width: 70%;
  79. text-indent: 20upx;
  80. p{
  81. text-overflow:ellipsis;
  82. white-space: nowrap;
  83. &:nth-child(1){
  84. overflow: hidden;
  85. font-size: 30upx;
  86. font-weight: 600;
  87. color: #292929;
  88. }
  89. &:nth-child(2){
  90. overflow: hidden;
  91. font-size: 26upx;
  92. font-weight: 400;
  93. color: #848484;
  94. margin: 20upx 0upx 26upx 0upx;
  95. }
  96. &:nth-child(3){
  97. position: relative;
  98. span{
  99. display: inline-block;
  100. &:nth-child(1){
  101. display: contents;
  102. font-size: 24upx;
  103. font-weight: 400;
  104. color: #FA564C;
  105. }
  106. &:nth-child(2){
  107. width: 150upx;
  108. right: 0;
  109. position: absolute;
  110. height: 50upx;
  111. line-height: 50upx;
  112. background: #EFD140;
  113. opacity: 1;
  114. border-radius: 26upx;
  115. }
  116. }
  117. }
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. </style>