room.wxml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template name="ranking">
  2. <!-- <view wx:if="{{isSelf}}" class="ranking-self-bg" animation="{{animation.answerRightText}}">
  3. <view class="ranking-self">我</view>
  4. <view class="ranking-num" style="color:white;margin-left: 10rpx;">{{index}}</view>
  5. <view class="ranking-name" style="color:white;">{{name}}</view>
  6. <view class="ranking-count" style="color:white">{{count}}</view>
  7. </view> -->
  8. <view class="ranking" style="{{style}}" hidden="{{isSelf}}">
  9. <image class="ranking-avatar" src="{{a}}"></image>
  10. <view class="ranking-num">{{i}}</view>
  11. <view class="ranking-name">{{n}}</view>
  12. <view class="ranking-count">{{c}}</view>
  13. </view>
  14. </template>
  15. <template name="ranking-row">
  16. <view class="ranking-row">
  17. <template is="ranking" data="{{i: indexL, a: avatarL, n: nameL, c: countL, isSelf: isSelfL, name: name, index: index, count: count}}"/>
  18. <template is="ranking" data="{{i: indexR, a: avatarR, n: nameR, isSelf: isSelfR, name: name, index: index, count: count, c: countR, style:'margin-left: auto;'}}"/>
  19. </view>
  20. </template>
  21. <scroll-view scroll-y>
  22. <!-- 头部 -->
  23. <view class="head-{{adapter.animation}}-{{status}}" style="{{adapter.head}}">
  24. <view class="take-part-view">
  25. <block wx:for="012345" wx:for-index="i" wx:key=" ">
  26. <image class="take-part-avatar" src="{{headUser[i].headImg}}"></image>
  27. </block>
  28. </view>
  29. <view class="take-part">当前有{{numOfPeople}}人参与</view>
  30. </view>
  31. <!-- 开始前赞助块 -->
  32. <image class="sponsor-bg" src="../../resource/room_sponsor.png" hidden="{{status != 0}}"></image>
  33. <view class="sponsor" hidden="{{status != 0}}">
  34. <image class="sponsor-icon" src="{{sponsor.icon}}"></image>
  35. <view class="sponsor-title">{{roomInfo.title}}</view>
  36. <view class="sponsor-name">{{sponsor.name}}</view>
  37. </view>
  38. <!-- 开始前倒计时 -->
  39. <view class="avatar-bg" hidden="{{status != 0}}">
  40. <view class="avatar-middle"></view>
  41. <image class="avatar" src="{{roomInfo.logo}}"></image>
  42. </view>
  43. <view class="answer" hidden="{{status != 0}}">
  44. <view class="answer-bonus-bg">
  45. <view class="answer-bonus-text-bg">
  46. <view class="answer-bonus-small" style="margin-left: 40rpx;">前</view>
  47. <view class="answer-bonus-big">{{roomInfo.awardUser}}</view>
  48. <view class="answer-bonus-small">名有奖,总奖金</view>
  49. <view class="answer-bonus-big">{{roomInfo.awardFee}}</view>
  50. <view class="answer-bonus-small" style="margin-right: 40rpx;">元</view>
  51. </view>
  52. </view>
  53. <view class="answer-count-down-bg">
  54. <view class="answer-count-down-view">
  55. <view class="answer-count-down-title">抢奖金倒计时</view>
  56. <view class="answer-count-down">
  57. <view class="answer-count-down-n" style="{{countDownStyle}}">{{countDown}}</view>
  58. <view class="answer-count-down-u" style="{{countDownStyle}}">秒</view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="answer-bottom-view">
  63. <view class="answer-bottom-button-bg" open-type="share" >{{invite.shareButton}}
  64. <button class="answer-bottom-button" open-type="share" hover-class="none" plain="true" style="border-color: rgba(0, 0, 0, 0)"></button>
  65. </view>
  66. <view class="answer-bottom-tips-f">{{invite.shareTips1}}</view>
  67. <view class="answer-bottom-tips-s">{{invite.shareTips2}}</view>
  68. </view>
  69. </view>
  70. <!-- 开始后赞助块 -->
  71. <view class="sponsor-begin" style="{{adapter.sponsor}}" hidden="{{status == 0}}">
  72. <image class="sponsor-icon" src="{{sponsor.icon}}"></image>
  73. <view class="sponsor-begin-name">{{roomInfo.title}} {{sponsor.name}}</view>
  74. </view>
  75. <!-- 开始后答题块 -->
  76. <view class="avatar-begin-bg" style="{{adapter.avatar}}" hidden="{{status == 0}}">
  77. <view class="avatar-begin-middle"></view>
  78. <image class="avatar-begin" src="{{roomInfo.logo}}"></image>
  79. </view>
  80. <view class="answer-begin" style="{{adapter.answer}}" hidden="{{status == 0}}">
  81. <view class="answer-begin-bonus-bg">
  82. <view class="answer-begin-bonus-text-bg" style="{{adapter.bonus}}">
  83. <view class="answer-begin-bonus-small" style="margin-left: 40rpx;">前</view>
  84. <view class="answer-begin-bonus-big">{{roomInfo.awardUser}}</view>
  85. <view class="answer-begin-bonus-small">名有奖,总奖金</view>
  86. <view class="answer-begin-bonus-big">{{roomInfo.awardFee}}</view>
  87. <view class="answer-begin-bonus-small" style="margin-right: 40rpx;">元</view>
  88. </view>
  89. </view>
  90. <!-- 答题前 -->
  91. <image class="answer-begin-question-type-bg" src="../../resource/room_q_type.png" hidden="{{status != 4}}"></image>
  92. <view class="answer-begin-question-type" hidden="{{status != 4}}">{{question.t}}</view>
  93. <view wx:if="{{lastQuestion}}" class="answer-begin-last" hidden="{{status != 4}}">{{question.n}}</view>
  94. <view wx:else class="answer-begin-num" hidden="{{status != 4}}">{{question.n}}</view>
  95. <image wx:if="{{lastQuestion}}" class="answer-begin-double-score" src="../../resource/room_double_score.png" hidden="{{status != 4}}"></image>
  96. <!-- 答题 -->
  97. <view class="answer-num" style="{{adapter.num}}" hidden="{{status != 1}}">第 {{questionNum}}/{{roomInfo.questionC}} 题</view>
  98. <view class="answer-begin-count-down-bg">
  99. <view class="answer-begin-count-down" hidden="{{status != 1}}">
  100. <view class="answer-begin-count-down-text">{{answer.tips}}:{{countDown}}秒</view>
  101. </view>
  102. </view>
  103. <view class="answer-options-bg" hidden="{{status != 1}}">
  104. <view class="answer-question-bg">
  105. <view class="answer-question">{{question.q}}</view>
  106. </view>
  107. <view class="answer-options-row-top">
  108. <view class="answer-options-left-{{optionsStyle[0]}}" id="0" bindtap="answer">
  109. <view class="answer-options-{{optionsStyle[0]}}" id="0" catchtap="answer">{{question.o[0]}}</view>
  110. </view>
  111. <view class="answer-options-right-{{optionsStyle[1]}}" id="1" bindtap="answer">
  112. <view class="answer-options-{{optionsStyle[1]}}" id="1" catchtap="answer">{{question.o[1]}}</view>
  113. </view>
  114. </view>
  115. <view class="answer-options-row-bottom">
  116. <view class="answer-options-left-{{optionsStyle[2]}}" id="2" bindtap="answer">
  117. <view class="answer-options-{{optionsStyle[2]}}" id="2" catchtap="answer">{{question.o[2]}}</view>
  118. </view>
  119. <view class="answer-options-right-{{optionsStyle[3]}}" id="3" bindtap="answer">
  120. <view class="answer-options-{{optionsStyle[3]}}" id="3" catchtap="answer">{{question.o[3]}}</view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 答题结束 -->
  125. <view class="result-ranking" style="{{adapter.resultRanking}}" hidden="{{status != 2 && status != 3}}">{{result.tips}}</view>
  126. <view class="result-middle-bg" style="{{adapter.resultMiddle}}" hidden="{{status != 2 && status != 3}}">
  127. <view class="result-bonus-bg" hidden="{{status != 2}}">
  128. <view class="result-bonus">
  129. <view class="result-bonus-small">奖金</view>
  130. <view class="result-bonus-big" animation="{{rollAnimation}}">{{result.bonus}}</view>
  131. <view class="result-bonus-small">元</view>
  132. </view>
  133. </view>
  134. <view class="result-tips" hidden="{{status != 2}}">已存入你的奖金账户</view>
  135. <image class="result-false-img" src="../../resource/brain_doctor.png" mode="aspectFit" hidden="{{status != 3}}"></image>
  136. </view>
  137. <view class="result-share" style="{{adapter.resultShare}}" hidden="{{status != 2 && status != 3}}">{{result.shareButton}}
  138. <button wx:if="{{result.openType == ''}}" class="result-share-button" bindtap="createImage" hover-class="none" plain="true" style="border-color: rgba(0, 0, 0, 0)"></button>
  139. <button wx:else class="result-share-button" open-type="{{result.openType}}" hover-class="none" plain="true" style="border-color: rgba(0, 0, 0, 0)"></button>
  140. </view>
  141. <view class="result-share-tips" hidden="{{status != 2 && status != 3}}">{{result.shareTips}}</view>
  142. <!-- 分享成功 -->
  143. <image class="result-share-bg" src="../../resource/room_bg.png" mode="aspectFit" hidden="{{share.s == 0}}">
  144. <block wx:if="{{share.s == 2}}">
  145. <image class="result-share-double-bg" src="../../resource/room_double_bonus.png"></image>
  146. <view class="result-share-double">+{{share.bonus}}</view>
  147. </block>
  148. <block wx:elif="{{share.s == 1}}">
  149. <image class="result-share-add-bg" src="../../resource/room_add_cell.png"></image>
  150. <view class="result-add-cell-bg">
  151. <view class="result-add-cell">+{{tools.addCell(share.cell)}}</view>
  152. <view class="result-add-cell-unit">{{tools.addCellUnit(share.cell)}}</view>
  153. </view>
  154. </block>
  155. </image>
  156. <!-- 排行榜 -->
  157. <view class="ranking-bg">
  158. <template is="ranking-row" wx:for="{{[0, 1, 2, 3, 4]}}" wx:for-index="i" wx:key=" " data="{{...ranking[i]}}"/>
  159. <view class="ranking-self-view">
  160. <view class="ranking-self-bg" animation="{{animation.selfRanking}}">
  161. <view class="ranking-self">我</view>
  162. <view class="ranking-num" style="color:white;margin-left: 10rpx;">{{selfRanking.rank}}</view>
  163. <view class="ranking-name" style="color:white;">{{selfRanking.name}}</view>
  164. <view class="ranking-count" style="color:white">{{selfRanking.count}}</view>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 动画 -->
  170. <!-- 答对 -->
  171. <view class="animation-{{adapter.animation}}" style="{{animation.backgroundStyle}}" hidden="{{animation.status == 0}}">
  172. <!-- <view class="animation-bg-{{adapter.animation}}" animation="{{animation.background}}"></view> -->
  173. <image class="animation-answer-bg" src="../../resource/room_bg.png" mode="aspectFit" animation="{{animation.answerBg}}"></image>
  174. <view class="animation-answer-right-bg">
  175. <image class="animation-answer" src="../../resource/room_right_bg.png" mode="aspectFit" animation="{{animation.answerRightBg}}"></image>
  176. </view>
  177. <view class="animation-answer-star-bg">
  178. <image class="animation-answer" src="../../resource/room_star.png" mode="aspectFit" animation="{{animation.answerRightStar}}"></image>
  179. </view>
  180. <image class="animation-answer-hook" src="../../resource/room_right.png" mode="aspectFit" animation="{{animation.answerRightHook}}" hidden="{{animation.status != 1}}"></image>
  181. <view class="animation-answer-count" animation="{{animation.answerRightText}}" hidden="{{animation.status != 1}}">+{{answer.integral}}积分</view>
  182. </view>
  183. <!-- 答错 -->
  184. <image class="animation-answer-false-bg-{{adapter.animation}}" src="../../resource/room_bg.png" mode="aspectFit" hidden="{{animation.status != 2}}"></image>
  185. <image class="animation-answer-false-{{adapter.animation}}" src="../../resource/room_wrong.png" mode="aspectFit" hidden="{{animation.status != 2}}"></image>
  186. </scroll-view>
  187. <wxs module="tools">
  188. var addCell = function(cell) {
  189. if (cell >= 10000) {
  190. return cell / 10000
  191. }
  192. return cell
  193. }
  194. var addCellUnit = function(cell) {
  195. if (cell >= 10000) {
  196. return '亿'
  197. }
  198. return '万'
  199. }
  200. module.exports.addCell = addCell
  201. module.exports.addCellUnit = addCellUnit
  202. </wxs>