test-detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="main-page">
  3. <view class="header">
  4. <view class="banner">
  5. <image :src="img" mode="aspectFill"></image>
  6. </view>
  7. <view class="text">
  8. <p>{{ list.name }}</p>
  9. <view class="text-deta">{{ list.content }}</view>
  10. <view class="prce-li">
  11. <view>{{ list.price }}<a>元</a></view>
  12. <view><i></i>精选{{ list.question_number }}道题 | 已测{{ list.test_number }}人</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="list-li" v-if="likeList.length > 0">
  17. <list :List="likeList"></list>
  18. </view>
  19. <view id="foot-box" class="cu-bar bg-white shadow">
  20. <view class="action" @click="toHome">
  21. <view class="cuIcon-cu-image">
  22. <image src="../../static/img/homes.png"></image>
  23. </view>
  24. <view class="text">首页</view>
  25. </view>
  26. <view class="action" @click="godetail">
  27. <view class="btns">立即测评</view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getquestionList,gettextList } from '../../api/test.js';
  34. import list from '@/components/list/list';
  35. export default {
  36. components: {
  37. list
  38. },
  39. data() {
  40. return {
  41. id: '',
  42. list: {},
  43. likeList: [],
  44. img: ''
  45. };
  46. },
  47. onLoad(option) {
  48. this.id = option.id;
  49. this.img = option.img;
  50. // 获取当前题的详情
  51. getquestionList({name_id:option.id}).then(res => {
  52. if (res.code == 1) {
  53. this.list = res.data[0].test_name
  54. }
  55. })
  56. this.getLikelist();
  57. },
  58. methods: {
  59. // 获取喜欢的列表数据
  60. getLikelist(){
  61. gettextList({nav_id:this.id}).then(res => {
  62. if (res.code == 1) {
  63. this.likeList = res.data.list
  64. }
  65. })
  66. },
  67. // 立即测评
  68. godetail() {
  69. uni.navigateTo({
  70. url:'/pages/test/test?id='+this.id+'&time='+this.list.time
  71. })
  72. },
  73. // 去首页
  74. toHome(){
  75. uni.navigateTo({
  76. url: '../home/home'
  77. })
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. page{
  84. background-color: #F7F7F7;
  85. padding-bottom: 120upx;
  86. .header{
  87. width: 100%;
  88. background-color: #FFFFFF;
  89. .banner{
  90. width: 100%;
  91. height: 320upx;
  92. }
  93. image{
  94. width: 100%;
  95. height: 100%;
  96. }
  97. .text{
  98. padding: 36upx 32upx 28upx 32upx;
  99. p{
  100. font-size: 36upx;
  101. font-weight: bold;
  102. color: #333334;
  103. }
  104. .text-deta{
  105. font-size: 28upx;
  106. font-weight: 400;
  107. margin-top: 10upx;
  108. color: #848484;
  109. line-height: 48upx;
  110. }
  111. }
  112. .prce-li{
  113. overflow: hidden;
  114. margin-top: 20upx;
  115. view{
  116. display: inline-block;
  117. &:nth-child(1){
  118. width: 20%;
  119. color: #FA564C;
  120. font-size: 32upx;
  121. font-weight: 600;
  122. a{
  123. font-weight: 500;
  124. margin-left: 5upx;
  125. font-size: 20upx;
  126. }
  127. }
  128. &:nth-child(2){
  129. width: 80%;
  130. text-align: right;
  131. color: #848484;
  132. font-size: 28upx;
  133. i{
  134. width: 20upx;
  135. height: 20upx;
  136. background: #EFD140;
  137. border-radius: 50%;
  138. margin-right: 10upx;
  139. display: inline-block;
  140. }
  141. }
  142. }
  143. }
  144. }
  145. .list-li{
  146. padding: 32upx 32upx 0upx 32upx;
  147. margin-top: 20upx;
  148. background-color: #FFFFFF;
  149. }
  150. .footer{
  151. position: fixed;
  152. bottom: 0;
  153. left: 0;
  154. right: 0;
  155. width: 100%;
  156. height: 120upx;
  157. line-height: 120upx;
  158. background: #FFFFFF;
  159. box-shadow: 0upx -2upx 8upx rgba(0, 0, 0, 0.08);
  160. view{
  161. // height: 120upx;
  162. // line-height: 120upx;
  163. display: inline-block;
  164. image{
  165. width: 54upx;
  166. height: 54upx;
  167. display: block;
  168. }
  169. span{
  170. color: #EFD140;
  171. display: block;
  172. font-size: 20upx;
  173. }
  174. &:nth-child(1){
  175. width: 20%;
  176. text-align: center;
  177. }
  178. &:nth-child(2){
  179. width: 60%;
  180. a{
  181. height: 80upx;
  182. font-size: 32upx;
  183. color: #292929;
  184. line-height: 80upx;
  185. text-align: center;
  186. background: #EFD140;
  187. opacity: 1;
  188. border-radius: 40upx;
  189. }
  190. }
  191. }
  192. }
  193. .cu-bar view{
  194. display: block;
  195. }
  196. .cu-bar uni-image{
  197. max-height: 200upx;
  198. }
  199. .cu-bar .action:first-child{
  200. // margin-left: 80upx;
  201. width: 20%;
  202. text-align: center;
  203. }
  204. .cu-bar .action:last-child{
  205. width: 80%;
  206. }
  207. #foot-box{
  208. position: fixed;
  209. bottom: 0;
  210. width: 100%;
  211. height: 120upx;
  212. // line-height: 120upx;
  213. background: #FFFFFF;
  214. box-shadow: 0upx -2upx 8upx rgba(0, 0, 0, 0.08);
  215. image{
  216. width: 54upx;
  217. height: 54upx;
  218. margin-top: 10upx;
  219. }
  220. .text{
  221. text-align: center;
  222. font-size: 20upx;
  223. font-weight: 400;
  224. color: #EFD140;
  225. }
  226. .btns{
  227. width: 100%;
  228. height: 80upx;
  229. line-height: 80upx;
  230. margin-top: 20upx;
  231. text-align: center;
  232. color: #292929;
  233. background: #EFD140;;
  234. border-radius: 40upx;
  235. }
  236. }
  237. }
  238. </style>