testDetails.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="content">
  3. <view class="bg-box">
  4. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/71014b69fdcc4b56ae2a84bdc28f11c3.png"></image>
  5. <view class="title-box">
  6. <view class="title">
  7. {{item.name}}
  8. </view>
  9. </view>
  10. </view>
  11. <view class="cont">
  12. <view class="msg-box">
  13. <view class="msg">{{item.msg}}</view>
  14. </view>
  15. <view class="line"></view>
  16. <view class="desc-box">
  17. <view class="desc" v-html="item.descs"> </view>
  18. </view>
  19. <view class="btn-box">
  20. <view class="btn" @click="navTo('/pages_index/test?tempId='+item.tempId)">立即开始</view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import {getTestDetails} from '@/api/test.js'
  27. export default {
  28. data() {
  29. return {
  30. tempId:null,
  31. item:{},
  32. };
  33. },
  34. onLoad(option) {
  35. this.tempId=option.tempId;
  36. },
  37. onShow() {
  38. this.getTestDetails();
  39. },
  40. //发送给朋友
  41. onShareAppMessage(res) {
  42. if(this.$isLogin()){
  43. return {
  44. title: "健康自测",
  45. path: '/pages_index/testDetails?tempId='+this.tempId,
  46. imageUrl: 'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/sharelogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  47. }
  48. }
  49. },
  50. //分享到朋友圈
  51. onShareTimeline(res) {
  52. if(this.$isLogin()){
  53. return {
  54. title: "健康自测",
  55. imageUrl: 'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/sharelogo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  56. }
  57. }
  58. },
  59. methods:{
  60. navTo(url) {
  61. this.$isLogin().then(
  62. res => {
  63. console.log(res)
  64. if(res){
  65. uni.navigateTo({
  66. url: url
  67. })
  68. }
  69. else{
  70. uni.navigateTo({
  71. url:'/pages/auth/login'
  72. })
  73. }
  74. }
  75. );
  76. },
  77. getTestDetails(){
  78. let data = {tempId:this.tempId};
  79. getTestDetails(data).then(
  80. res => {
  81. if(res.code==200){
  82. this.item=res.data;
  83. uni.setNavigationBarTitle({
  84. title: this.item.name+"自测"
  85. });
  86. }else{
  87. uni.showToast({
  88. icon:'none',
  89. title: "请求失败",
  90. });
  91. }
  92. },
  93. rej => {}
  94. );
  95. },
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. page{
  101. height: 100%;
  102. }
  103. .content{
  104. position: relative;
  105. height: 100%;
  106. display: flex;
  107. flex-direction: column;
  108. .bg-box{
  109. position: absolute;
  110. width: 100%;
  111. height: 600rpx;
  112. .title-box{
  113. top: 50rpx;
  114. left:50rpx;
  115. position: absolute;
  116. .title{
  117. border-radius: 5rpx;
  118. border: 1rpx solid #fff;
  119. padding: 20rpx 30rpx;
  120. font-size: 36rpx;
  121. font-family: Source Han Sans CN;
  122. font-weight: bold;
  123. color: #fff;
  124. }
  125. }
  126. image{
  127. position: absolute;
  128. width: 100%;
  129. height: 100%;
  130. }
  131. }
  132. .cont{
  133. position: relative;
  134. margin-top: 550rpx;
  135. z-index: 9999;
  136. padding: 30rpx;
  137. height: 100%;
  138. display: flex;
  139. flex-direction: column;
  140. padding: 30rpx;
  141. background-color: #fff;
  142. border-radius: 30rpx 30rpx 0rpx 0rpx;
  143. .msg-box{
  144. .msg{
  145. font-size: 36rpx;
  146. font-family: Source Han Sans CN;
  147. font-weight: bold;
  148. color: #111;
  149. }
  150. }
  151. .line{
  152. margin: 15rpx 0rpx;
  153. background-color: #F6F6F6;
  154. height:5rpx;
  155. width: 100%;
  156. }
  157. .desc-box{
  158. margin-top: 20rpx;
  159. background: #FFFFFF;
  160. .desc{
  161. color: #814E1B;
  162. }
  163. }
  164. .logo{
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. margin: 60rpx 0rpx;
  169. width: 100%;
  170. image{
  171. width: 200rpx;
  172. height:100rpx;
  173. }
  174. }
  175. .btn-box{
  176. margin-top: 60rpx;
  177. height: 140upx;
  178. width: 100%;
  179. box-sizing: border-box;
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. .btn{
  184. width: 100%;
  185. height: 88upx;
  186. line-height: 88upx;
  187. text-align: center;
  188. font-size: 34upx;
  189. font-family: PingFang SC;
  190. font-weight: bold;
  191. color: #FFFFFF;
  192. background: #2583EB;
  193. border-radius: 50upx;
  194. }
  195. }
  196. }
  197. }
  198. </style>