普兆健康管家前端代码仓库
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.

207 lines
4.5 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. const { id } = arg
  58. this.id = id
  59. this.getData(id)
  60. },
  61. methods: {
  62. async getData(id) {
  63. try {
  64. this.detail = await this.$fetch('getPaperDetail', { id })
  65. } catch (err) {
  66. }
  67. },
  68. async onStart(){
  69. if(!this.checkboxValue.length){
  70. return uni.showToast({
  71. title: '请先同意《用户协议》《隐私协议》',
  72. icon:'none'
  73. })
  74. }
  75. try {
  76. const reportId = await this.$fetch('startPaper', { id: this.id })
  77. this.detail.reportId = reportId
  78. this.$store.commit('setPaperInfo', this.detail)
  79. const defaultPaperTags = this.detail.category.map(category => {
  80. return category.questionsList.map(() => [])
  81. })
  82. this.$store.commit('setPaperTags', defaultPaperTags)
  83. this.$utils.navigateTo('/pages_order/report/test/step?step=0')
  84. } catch (err) {
  85. }
  86. },
  87. onConfirmAgreement(confirm) {
  88. if (confirm) {
  89. this.checkboxValue = [1]
  90. } else {
  91. this.checkboxValue = []
  92. }
  93. },
  94. },
  95. }
  96. </script>
  97. <style scoped lang="scss">
  98. .page__view {
  99. width: 100vw;
  100. min-height: 100vh;
  101. background-color: $uni-bg-color;
  102. position: relative;
  103. }
  104. .main {
  105. margin-top: 448rpx;
  106. .title {
  107. text-align: center;
  108. font-family: PingFang SC;
  109. line-height: 1.4;
  110. color: #252545;
  111. &-zh {
  112. font-size: 48rpx;
  113. font-weight: 600;
  114. }
  115. &-en {
  116. font-size: 26rpx;
  117. font-weight: 400;
  118. }
  119. }
  120. .desc {
  121. margin-top: 48rpx;
  122. text-align: center;
  123. font-size: 28rpx;
  124. font-weight: 400;
  125. font-family: PingFang SC;
  126. line-height: 1.4;
  127. color: #989898;
  128. .dot {
  129. display: inline-block;
  130. width: 10rpx;
  131. height: 10rpx;
  132. border-radius: 50%;
  133. background: #989898;
  134. margin-right: 20rpx;
  135. }
  136. }
  137. }
  138. .footer {
  139. position: absolute;
  140. left: 0;
  141. bottom: 0;
  142. width: 100%;
  143. .agreement {
  144. display: flex;
  145. padding: 16rpx 40rpx;
  146. background: #EFEAFF;
  147. /deep/ .uv-checkbox-group {
  148. flex: none;
  149. }
  150. .desc {
  151. flex: 1;
  152. font-family: PingFang SC;
  153. font-size: 24rpx;
  154. font-weight: 400;
  155. line-height: 40rpx;
  156. color: #8B8B8B;
  157. }
  158. .highlight {
  159. color: $uni-color;
  160. }
  161. }
  162. .bar {
  163. padding: 24rpx 40rpx;
  164. padding-bottom: calc(env(safe-area-inset-bottom) + 24rpx);
  165. box-sizing: border-box;
  166. // height: 200rpx;
  167. background: #FFFFFF;
  168. .btn {
  169. padding: 16rpx 0;
  170. font-family: PingFang SC;
  171. font-weight: 600;
  172. font-size: 36rpx;
  173. line-height: 1.2;
  174. color: #FFFFFF;
  175. background-image: linear-gradient(to right, #4B348F, #845CFA);
  176. border-radius: 42rpx;
  177. }
  178. }
  179. }
  180. </style>