item.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="main-container">
  3. <view class="test-list" v-if="List.length > 0">
  4. <view class="list-li" v-for="(book,index) in List" :key="index">
  5. <view><image :src="book.img" mode="aspectFill"></image></view>
  6. <view>
  7. <p>
  8. <span>{{ book.name }}</span>
  9. <!-- <span>{{book.createtime}}</span> -->
  10. </p>
  11. <p>{{ book.content }}</p>
  12. <p>
  13. <span>{{book.price}} 元</span>
  14. <span v-if="Inv == 0" @click="goresult(book.name_id)">继续答题</span>
  15. <span v-else-if="Inv == 1" @click="goresult(book.oid)">查看结果</span>
  16. </p>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="empty" v-else>
  21. <image src="../../static/img/emptys.jpg" mode="aspectFit"></image>
  22. <view>暂无数据~</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. components: {
  29. },
  30. props: ['Inv','List'],
  31. data() {
  32. return {
  33. };
  34. },
  35. onLoad() {
  36. },
  37. methods: {
  38. goresult(oid) {
  39. console.log('this.Inv',typeof this.Inv)
  40. if(this.Inv === 0){
  41. uni.navigateTo({
  42. url: '/pages/test/test?id='+oid
  43. })
  44. } else {
  45. uni.setStorageSync('oid', oid)
  46. uni.navigateTo({
  47. url: '/pages/result/result'
  48. })
  49. }
  50. }
  51. }
  52. };
  53. </script>
  54. <style lang="scss" scoped>
  55. .main-container{
  56. height: 100%;
  57. .list-img{
  58. image{
  59. width: 170upx;
  60. height: 40upx;
  61. }
  62. }
  63. .test-list{
  64. .list-li{
  65. overflow: hidden;
  66. padding: 24upx 24upx;
  67. margin-top: 20upx;
  68. background-color: #FFFFFF;
  69. &:last-child{
  70. border-bottom: 0;
  71. }
  72. image{
  73. min-width: 186upx;
  74. max-width: 100%;
  75. height: 148upx;
  76. }
  77. view{
  78. float: left;
  79. display: inline-block;
  80. &:nth-child(1){
  81. width: 30%;
  82. }
  83. &:nth-child(2){
  84. width: 70%;
  85. text-indent: 20upx;
  86. p{
  87. text-overflow:ellipsis;
  88. white-space: nowrap;
  89. &:nth-child(1){
  90. overflow: hidden;
  91. font-size: 30upx;
  92. font-weight: 600;
  93. color: #292929;
  94. }
  95. &:nth-child(2){
  96. overflow: hidden;
  97. font-size: 26upx;
  98. font-weight: 400;
  99. color: #848484;
  100. margin: 20upx 0upx 26upx 0upx;
  101. }
  102. &:nth-child(3){
  103. position: relative;
  104. span{
  105. display: inline-block;
  106. &:nth-child(1){
  107. display: contents;
  108. font-size: 20upx;
  109. font-weight: 400;
  110. color: #FA564C;
  111. }
  112. &:nth-child(2){
  113. width: 150upx;
  114. right: 0;
  115. position: absolute;
  116. height: 50upx;
  117. line-height: 50upx;
  118. background: #EFD140;
  119. opacity: 1;
  120. border-radius: 26upx;
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. .empty{
  130. text-align: center;
  131. margin-top: 20upx;
  132. background-color: #FFFFFF;
  133. image{
  134. width: 400upx;
  135. height: 400upx;
  136. margin: 70upx auto 20upx auto;
  137. }
  138. view{
  139. text-align: center;
  140. padding-bottom: 200upx;
  141. color: #8C8C8C;
  142. }
  143. }
  144. }
  145. </style>