小说小程序前端代码仓库(小程序)
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.

162 lines
2.9 KiB

  1. <template>
  2. <view class="vote-container">
  3. <!-- Empty space at the top -->
  4. <view class="empty-space"></view>
  5. <!-- Bottom sheet with voting interface -->
  6. <view class="vote-sheet">
  7. <view class="sheet-header">
  8. <text class="sheet-title">投推荐票</text>
  9. </view>
  10. <view class="vote-options">
  11. <text class="option-label">推荐投票</text>
  12. <view class="quick-options">
  13. <view class="option-btn" @click="setVotes(1)">1</view>
  14. <view class="option-btn" @click="setVotes(5)">5</view>
  15. <view class="option-btn" @click="setVotes(10)">10</view>
  16. </view>
  17. <text class="option-label">手动设置</text>
  18. <view class="manual-input">
  19. <view class="minus-btn" @click="decreaseVotes">-</view>
  20. <view class="vote-count">
  21. <text>x{{voteCount}}</text>
  22. </view>
  23. <view class="plus-btn" @click="increaseVotes">+</view>
  24. </view>
  25. </view>
  26. <button class="submit-btn" @click="submitVote">投票</button>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. voteCount: 1
  35. }
  36. },
  37. methods: {
  38. setVotes(count) {
  39. this.voteCount = count
  40. },
  41. increaseVotes() {
  42. this.voteCount++
  43. },
  44. decreaseVotes() {
  45. if (this.voteCount > 1) {
  46. this.voteCount--
  47. }
  48. },
  49. submitVote() {
  50. // TODO: Implement vote submission
  51. uni.showToast({
  52. title: `已投${this.voteCount}`,
  53. icon: 'success'
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. .vote-container {
  61. display: flex;
  62. flex-direction: column;
  63. height: 100vh;
  64. background-color: rgba(0, 0, 0, 0.4);
  65. }
  66. .empty-space {
  67. flex: 1;
  68. }
  69. .vote-sheet {
  70. background-color: #fff;
  71. border-radius: 20rpx 20rpx 0 0;
  72. padding: 30rpx;
  73. }
  74. .sheet-header {
  75. text-align: center;
  76. margin-bottom: 40rpx;
  77. }
  78. .sheet-title {
  79. font-size: 32rpx;
  80. font-weight: 500;
  81. }
  82. .vote-options {
  83. margin-bottom: 40rpx;
  84. }
  85. .option-label {
  86. font-size: 28rpx;
  87. color: #666;
  88. margin-bottom: 20rpx;
  89. }
  90. .quick-options {
  91. display: flex;
  92. gap: 20rpx;
  93. margin-top: 30rpx;
  94. margin-bottom: 40rpx;
  95. }
  96. .option-btn {
  97. flex: 1;
  98. height: 80rpx;
  99. background-color: #f5f5f5;
  100. display: flex;
  101. align-items: center;
  102. justify-content: center;
  103. border-radius: 8rpx;
  104. font-size: 28rpx;
  105. }
  106. .manual-input {
  107. margin-top: 30rpx;
  108. display: flex;
  109. align-items: center;
  110. justify-content: center;
  111. gap: 20rpx;
  112. }
  113. .minus-btn,
  114. .plus-btn {
  115. width: 220rpx;
  116. height: 80rpx;
  117. background-color: #f5f5f5;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. border-radius: 8rpx;
  122. font-size: 32rpx;
  123. }
  124. .vote-count {
  125. width: 220rpx;
  126. height: 82rpx;
  127. background-color: #f5f5f5;
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. border-radius: 8rpx;
  132. font-size: 28rpx;
  133. }
  134. .submit-btn {
  135. width: 100%;
  136. height: 88rpx;
  137. background-color: #000033;
  138. color: #fff;
  139. border-radius: 8rpx;
  140. font-size: 32rpx;
  141. display: flex;
  142. align-items: center;
  143. justify-content: center;
  144. }
  145. </style>