普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
4.3 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="问卷测评" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="transparent" />
  4. <view class="main">
  5. <view class="title">
  6. <view class="title-zh">{{ detail.title }}</view>
  7. <view class="title-en">{{ detail.enTitle }}</view>
  8. </view>
  9. <view class="flex desc">
  10. <view class="dot"></view>{{ detail.tips }}
  11. </view>
  12. </view>
  13. <view class="footer">
  14. <view class="agreement">
  15. <uv-checkbox-group
  16. v-model="checkboxValue"
  17. shape="circle"
  18. >
  19. <uv-checkbox
  20. size="40rpx"
  21. icon-size="40rpx"
  22. activeColor="#7451DE"
  23. :name="1"
  24. ></uv-checkbox>
  25. </uv-checkbox-group>
  26. <view class="desc">
  27. 我已阅读并同意
  28. <text class="highlight" @click="$refs.modal.open('user_agreement', '用户协议')">用户协议</text>
  29. <text class="highlight" @click="$refs.modal.open('privacy_policy', '隐私协议')">隐私协议</text>
  30. </view>
  31. </view>
  32. <view class="bar">
  33. <button class="btn" @click="onStart">开始答题</button>
  34. </view>
  35. </view>
  36. <agreementModal ref="modal" @confirm="onConfirmAgreement"></agreementModal>
  37. </view>
  38. </template>
  39. <script>
  40. import { mapState } from 'vuex'
  41. import agreementModal from '@/pages_order/components/agreementModal.vue'
  42. export default {
  43. components: {
  44. agreementModal,
  45. },
  46. data() {
  47. return {
  48. id: null,
  49. detail: {},
  50. checkboxValue : []
  51. }
  52. },
  53. computed: {
  54. ...mapState(['paperInfo']),
  55. },
  56. onLoad(arg) {
  57. console.log('onLoad', arg)
  58. const { id } = arg
  59. this.id = id
  60. this.getData(id)
  61. },
  62. methods: {
  63. async getData(id) {
  64. try {
  65. this.detail = await this.$fetch('getPaperDetail', { id })
  66. } catch (err) {
  67. }
  68. },
  69. async onStart(){
  70. if(!this.checkboxValue.length){
  71. return uni.showToast({
  72. title: '请先同意《用户协议》《隐私协议》',
  73. icon:'none'
  74. })
  75. }
  76. try {
  77. const reportId = await this.$fetch('startPaper', { id: this.id })
  78. this.detail.reportId = reportId
  79. this.$store.commit('setPaperInfo', this.detail)
  80. this.$utils.navigateTo('/pages_order/report/test/step?step=0')
  81. } catch (err) {
  82. }
  83. },
  84. onConfirmAgreement(confirm) {
  85. if (confirm) {
  86. this.checkboxValue = [1]
  87. } else {
  88. this.checkboxValue = []
  89. }
  90. },
  91. },
  92. }
  93. </script>
  94. <style scoped lang="scss">
  95. .page__view {
  96. width: 100vw;
  97. min-height: 100vh;
  98. background-color: $uni-bg-color;
  99. position: relative;
  100. }
  101. .main {
  102. margin-top: 448rpx;
  103. .title {
  104. text-align: center;
  105. font-family: PingFang SC;
  106. line-height: 1.4;
  107. color: #252545;
  108. &-zh {
  109. font-size: 48rpx;
  110. font-weight: 600;
  111. }
  112. &-en {
  113. font-size: 26rpx;
  114. font-weight: 400;
  115. }
  116. }
  117. .desc {
  118. margin-top: 48rpx;
  119. text-align: center;
  120. font-size: 28rpx;
  121. font-weight: 400;
  122. font-family: PingFang SC;
  123. line-height: 1.4;
  124. color: #989898;
  125. .dot {
  126. display: inline-block;
  127. width: 10rpx;
  128. height: 10rpx;
  129. border-radius: 50%;
  130. background: #989898;
  131. margin-right: 20rpx;
  132. }
  133. }
  134. }
  135. .footer {
  136. position: absolute;
  137. left: 0;
  138. bottom: 0;
  139. width: 100%;
  140. .agreement {
  141. display: flex;
  142. padding: 16rpx 40rpx;
  143. background: #EFEAFF;
  144. /deep/ .uv-checkbox-group {
  145. flex: none;
  146. }
  147. .desc {
  148. flex: 1;
  149. font-family: PingFang SC;
  150. font-size: 24rpx;
  151. font-weight: 400;
  152. line-height: 40rpx;
  153. color: #8B8B8B;
  154. }
  155. .highlight {
  156. color: $uni-color;
  157. }
  158. }
  159. .bar {
  160. padding: 24rpx 40rpx;
  161. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  162. box-sizing: border-box;
  163. // height: 200rpx;
  164. background: #FFFFFF;
  165. .btn {
  166. padding: 16rpx 0;
  167. font-family: PingFang SC;
  168. font-weight: 600;
  169. font-size: 36rpx;
  170. line-height: 1.2;
  171. color: #FFFFFF;
  172. background-image: linear-gradient(to right, #4B348F, #845CFA);
  173. border-radius: 42rpx;
  174. }
  175. }
  176. }
  177. </style>