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

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