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.

195 lines
3.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="content">
  3. <topInfo :detailInfo="detailInfo"/>
  4. <view class="padding">
  5. <view class="ul" >
  6. <view class="li2 flex-b" v-for="(item,index) in detailInfo.voteResults" :key="index" :class="{active: item.voted}">
  7. <view class="proccess" :style="{width: item.itemVoteProportion}"></view>
  8. <view class="leftTxt flex">
  9. <u-icon name="checkbox-mark" color="#DE3A26" size="20" v-if="item.voted"></u-icon>
  10. <view class="name">{{ item.itemName }}</view>
  11. </view>
  12. <view class="rightTxt">{{ item.itemVoteNum }} <text>( {{item.itemVoteProportion}} )</text></view>
  13. </view>
  14. </view>
  15. <view class="novote" v-if="!detailInfo.voteResults?.length">暂无人员参与投票~</view>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import { ref } from 'vue'
  21. import { voteResult, } from '@/config/api.js'
  22. import topInfo from './comp/topInfo.vue'
  23. import { onLoad, onPullDownRefresh,} from '@dcloudio/uni-app'
  24. let voteId = ''
  25. const isCheck = ref(false)
  26. function changeRadio(val) {
  27. isCheck.value = val
  28. }
  29. const detailInfo = ref({})
  30. async function voteResultFn() {
  31. const {data: res} = await voteResult({voteId: voteId})
  32. console.log(res)
  33. detailInfo.value = res
  34. }
  35. onLoad((option)=>{
  36. voteId = option.voteId
  37. voteResultFn()
  38. })
  39. onPullDownRefresh(async()=>{
  40. await voteResultFn()
  41. uni.stopPullDownRefresh()
  42. })
  43. </script>
  44. <style lang="scss" scoped>
  45. .novote {
  46. font-size: 28rpx;
  47. color: #9C9C9C;
  48. width: 100%;
  49. text-align: center;
  50. line-height: 60rpx;
  51. }
  52. .content {
  53. width: 100%;
  54. .bg {
  55. width: 100%;
  56. background: linear-gradient(0deg, #ffffff 0%, #FFD4D3 100%);
  57. padding: 120rpx 20rpx 20rpx 20rpx;
  58. .tit {
  59. font-size: 36rpx;
  60. padding: 10rpx 0 20rpx 0;
  61. font-weight: 700;
  62. }
  63. .textCon {
  64. display: flex;
  65. .p {
  66. font-size: 24rpx;
  67. color: #9C9C9C;
  68. flex: 1;
  69. width: 0;
  70. .txt {
  71. margin-bottom: 14rpx;
  72. }
  73. }
  74. .status {
  75. width: 110rpx;
  76. font-size: 22rpx;
  77. height: 44rpx;
  78. background: #DE3A26;
  79. border-radius: 22rpx;
  80. line-height: 44rpx;
  81. text-align: center;
  82. color: #fff;
  83. }
  84. }
  85. }
  86. .row {
  87. height: 90rpx;
  88. margin-bottom: 40rpx;
  89. border-bottom: 1px solid #EFEFEF;
  90. .flex {
  91. flex: 1;
  92. width: 0;
  93. .radionItem {
  94. font-size: 28rpx;
  95. margin-right: 30rpx;
  96. color: $themC;
  97. &.hui {
  98. color: #9C9C9C;
  99. }
  100. }
  101. }
  102. .checkboxs {
  103. font-size: 28rpx;
  104. color: $themC;
  105. }
  106. }
  107. .ul {
  108. width: 100%;
  109. .li {
  110. height: 84rpx;
  111. border-radius: 10rpx;
  112. border: 1px solid #CCCCCC;
  113. line-height: 84rpx;
  114. padding: 0 20rpx;
  115. display: flex;
  116. margin-bottom: 20rpx;
  117. font-size: 28rpx;
  118. color: #333;
  119. &.active {
  120. background: #FFD3D3;
  121. border-radius: 10rpx;
  122. color: $themC;
  123. border: 1px solid #DE3A26;
  124. }
  125. }
  126. .li2 {
  127. position: relative;
  128. height: 84rpx;
  129. border-radius: 10rpx;
  130. border: 1px solid #CCCCCC;
  131. line-height: 84rpx;
  132. padding: 0 20rpx;
  133. display: flex;
  134. margin-bottom: 20rpx;
  135. font-size: 28rpx;
  136. color: #333;
  137. &.active {
  138. border-radius: 10rpx;
  139. color: $themC;
  140. .proccess {
  141. background: #FFD3D3;
  142. }
  143. }
  144. .proccess {
  145. width: 100%;
  146. height: 100%;
  147. background-color: #EFEFEF;
  148. position: absolute;
  149. left: 0;
  150. top: 0;
  151. }
  152. .leftTxt {
  153. position: relative;
  154. z-index: 9;
  155. .name {
  156. margin-left: 6rpx;
  157. }
  158. }
  159. .rightTxt {
  160. color: #9C9C9C;
  161. position: relative;
  162. z-index: 9;
  163. text {
  164. margin-left: 4rpx;
  165. }
  166. }
  167. }
  168. }
  169. .btn {
  170. padding-top: 50rpx;
  171. }
  172. }
  173. </style>