questionnairePreview.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="default_page adffc" :style="{'height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='问卷预览'></cus-header>
  4. <view class="top">
  5. <view class="top-title">{{questionnaireName}}</view>
  6. <view class="top-progress adfac">
  7. <view class="top-progress-text">测评进度</view>
  8. <view class="top-progress-box">
  9. <view class="top-progress-box-current" :style="{'width':(0/total*100)+'%'}"></view>
  10. </view>
  11. <view class="top-progress-num"><span>{{0}}</span>/{{total}}</view>
  12. </view>
  13. </view>
  14. <view class="list">
  15. <div v-if="isLoading" class="loading-container adfacjc">
  16. <div class="adfac">
  17. <u-loading-icon size="42"></u-loading-icon>
  18. <text style="margin-left: 10rpx; font-size: 34rpx; color: #666666">问卷加载中...</text>
  19. </div>
  20. </div>
  21. <template v-else>
  22. <question-item v-for="(item,index) in list" :arrayKey="arrayKey" :index="index" :key="index" :item="item"></question-item>
  23. </template>
  24. </view>
  25. <view class="bottom adfacjb">
  26. <view class="zt_btn" @click="handleBack">返回</view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import QuestionItem from '@/components/QuestionItem/index3.vue'
  32. export default {
  33. components:{ QuestionItem },
  34. data(){
  35. return {
  36. type:'',
  37. questionnaireName:'',
  38. total:0,
  39. list:[],
  40. arrayKey:'userAnswer',
  41. isLoading: true,
  42. }
  43. },
  44. onLoad(options) {
  45. this.type = options.type;
  46. this.questionnaireName = options.questionnaireName;
  47. if(this.type==2) this.getData2(options.teamQuestionnaireId)
  48. else this.getData(options.teamQuestionnaireId)
  49. },
  50. methods:{
  51. getData(id){
  52. this.isLoading = true;
  53. this.$api.get(`/core/team/member/answer/listByUser/${id}`).then(({data:res})=>{
  54. if(res.code!==0) return this.$showToast(res.msg)
  55. this.list = res.data;
  56. this.total = res.data.length;
  57. this.isLoading = false;
  58. })
  59. },
  60. getData2(id){
  61. this.isLoading = true;
  62. this.$api.get(`/core/questionnaire/${id}`).then(({data:res})=>{
  63. if(res.code!==0) return this.$showToast(res.msg)
  64. this.arrayKey = 'questionOption';
  65. this.list = res.data.detailList;
  66. this.total = res.data.detailList.length;
  67. this.isLoading = false;
  68. })
  69. },
  70. handleBack(){
  71. uni.navigateBack();
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped lang="scss">
  77. .loading-container {
  78. width: 100%;
  79. height: 100%;
  80. }
  81. .default_page{
  82. padding: 0 0 192rpx;
  83. background: #FFFFFF;
  84. box-sizing: border-box;
  85. .top{
  86. padding: 40rpx 24rpx 50rpx;
  87. &-title{
  88. font-family: PingFang-SC, PingFang-SC;
  89. font-weight: bold;
  90. font-size: 40rpx;
  91. color: #002846;
  92. line-height: 51rpx;
  93. }
  94. &-progress{
  95. margin-top: 35rpx;
  96. &-text{
  97. font-family: PingFangSC, PingFang SC;
  98. font-weight: 400;
  99. font-size: 30rpx;
  100. color: #002846;
  101. line-height: 30rpx;
  102. }
  103. &-box{
  104. flex: 1;
  105. width: 100%;
  106. height: 14rpx;
  107. margin: 0 20rpx;
  108. background: #F0F2F8;
  109. border-radius: 8rpx;
  110. position: relative;
  111. &-current{
  112. height: 14rpx;
  113. background: #FFD750;
  114. border-radius: 8rpx;
  115. position: absolute;
  116. left: 0;
  117. top: 0;
  118. }
  119. }
  120. &-num{
  121. font-family: PingFangSC, PingFang SC;
  122. font-weight: 400;
  123. font-size: 26rpx;
  124. color: #667E90;
  125. line-height: 26rpx;
  126. span{
  127. font-size: 36rpx;
  128. color: #199C9C;
  129. line-height: 36rpx;
  130. }
  131. }
  132. }
  133. }
  134. .list{
  135. flex: 1;
  136. padding: 0 24rpx;
  137. overflow-y: auto;
  138. }
  139. .bottom{
  140. width: 100%;
  141. background: #FFFFFF;
  142. box-shadow: 0rpx -2rpx 6rpx 0rpx rgba(0,0,0,0.07);
  143. padding: 20rpx 40rpx 54rpx;
  144. box-sizing: border-box;
  145. position: fixed;
  146. left: 0;
  147. bottom: 0;
  148. z-index: 1000;
  149. &-right{
  150. width: 100%;
  151. height: 88rpx;
  152. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
  153. border-radius: 44rpx;
  154. font-family: PingFang-SC, PingFang-SC;
  155. font-weight: bold;
  156. font-size: 32rpx;
  157. color: #FFFFFF;
  158. line-height: 88rpx;
  159. text-align: center;
  160. letter-spacing: 2rpx;
  161. }
  162. }
  163. }
  164. </style>