testDetails.vue 4.4 KB

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