questionnairePreview.vue 4.5 KB

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