longTapIndex.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="index">
  3. <button type="primary" @tap="toranking">排行榜</button>
  4. <button type="primary" @tap="toupload">图片上传</button>
  5. <button type="primary" @tap="tohonour">荣耀殿堂</button>
  6. <!-- <button type="primary" @tap="toexchange">礼品兑换</button> -->
  7. <button type="primary" @tap="tostatistics">数据统计</button>
  8. <button type="primary" @tap="tosetting">设置</button>
  9. <button type="primary" @tap="toChallenge">学分挑战</button>
  10. <button type="primary" v-if="userStatus" @tap="toScore">学分账单</button>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. }
  18. },
  19. computed: {
  20. userServerInfo () { //用户服务器信息
  21. return this.$store.state.userServerInfo
  22. },
  23. userStatus () { //根据赛季阶段和用户类型,显示不同可操作项
  24. if (this.$verified()) { //如果用户已经登录,进行下一步判断
  25. if (this.userServerInfo.status) { //如果赛季已经开赛
  26. if (this.userServerInfo.status === 1) { //如果赛季正处于报名阶段
  27. if (this.userServerInfo.signuped) { //如果用户已报名
  28. return '已报名'
  29. } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
  30. if (this.userServerInfo.type === 1) {
  31. return '报名参赛'
  32. } else if (this.userServerInfo.type === 2) {
  33. return '报名参赛'
  34. } else if (this.userServerInfo.type === 3) {
  35. return ''
  36. }
  37. }
  38. } else if (this.userServerInfo.status === 2 || this.userServerInfo.status === 3 || this.userServerInfo.status === 5) { //如果赛季正处于比赛或兑奖阶段
  39. if (this.userServerInfo.signuped) { //如果用户已报名
  40. return '学分账单'
  41. } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
  42. if (this.userServerInfo.type === 1) {
  43. // return '报名截止'
  44. return ''
  45. } else if (this.userServerInfo.type === 2) {
  46. return '学分账单'
  47. } else if (this.userServerInfo.type === 3) {
  48. return ''
  49. }
  50. }
  51. } else if (this.userServerInfo.status === 4) { // 如果赛季正处于报名结束的空档期
  52. if (this.userServerInfo.signuped) { //如果用户已报名
  53. return '已报名'
  54. } else { //如果用户未报名,那么可能是 1 用户真没报名 2 批发商 3 客服
  55. if (this.userServerInfo.type === 1) {
  56. // return '报名截止'
  57. return ''
  58. } else if (this.userServerInfo.type === 2) {
  59. return '学分账单'
  60. } else if (this.userServerInfo.type === 3) {
  61. return ''
  62. }
  63. }
  64. }
  65. } else { //如果赛季暂未开赛
  66. // return '暂未开赛'
  67. return ''
  68. }
  69. } else { //如果用户未登录
  70. return '绑定账号'
  71. }
  72. }
  73. },
  74. onShow() {
  75. this.routing = false
  76. },
  77. methods: {
  78. toScore() {
  79. uni.navigateTo({ url: '../score/score' })
  80. },
  81. toChallenge() { // 点击学分挑战
  82. if (this.$verified()) { //用户是否已登录
  83. if (this.userServerInfo.signuped) { // 用户是否已经报名
  84. if (this.userServerInfo.type === 2) { // 只有批发商能够参加学分竞赛
  85. if (this.routing) { return }
  86. this.routing = true
  87. uni.navigateTo({ url: '../challengeList/challengeList' })
  88. } else { //批发商和客服不可参赛,所以提示无参赛记录
  89. // uni.showToast({ title: '只有批发商可以参与挑战', icon:"none" })
  90. // 隐藏级别
  91. uni.showToast({ title: '暂无参与挑战权限', icon:"none" })
  92. }
  93. } else {
  94. uni.showToast({ title: '您还没有报名参赛', icon:"none" })
  95. }
  96. } else { //未登录弹出登录框
  97. uni.showToast({ title: '您还未登录', icon:"none" })
  98. }
  99. },
  100. toranking () { //点击排行榜
  101. if (this.$verified()) { //用户是否已登录
  102. if (this.userServerInfo.type === 1) { //判断用户类型,普通用户需要报名后才可以查看排行榜
  103. if (this.userServerInfo.signuped) { //如果用户已报名,就跳转
  104. if (this.routing) { return }
  105. this.routing = true
  106. uni.navigateTo({ url: '../ranking/ranking' })
  107. } else { ////如果用户已报名,就提示用户没有报名
  108. uni.showToast({
  109. title: '您还没有报名参赛',
  110. icon:"none"
  111. })
  112. }
  113. } else { //批发商和客服可以直接查看排行榜页
  114. if (this.routing) { return }
  115. this.routing = true
  116. uni.navigateTo({ url: '../ranking/ranking' })
  117. }
  118. } else { //未登录弹出登录框
  119. uni.showToast({
  120. title: '您还未登录'
  121. });
  122. }
  123. },
  124. tohonour () { //点击荣誉殿堂
  125. if (this.$verified()) { //用户是否已登录
  126. if (this.userServerInfo.type === 1) { //普通用户直接跳转到荣誉殿堂页面
  127. if (this.routing) { return }
  128. this.routing = true
  129. uni.navigateTo({ url: '../honour/honour' })
  130. } else { //批发商和客服不可参赛,所以提示无参赛记录
  131. uni.showToast({
  132. title: '无参赛记录',
  133. icon:"none"
  134. });
  135. }
  136. } else { //未登录弹出登录框
  137. uni.showToast({
  138. title: '您还未登录'
  139. });
  140. }
  141. },
  142. toupload () { //点击上传图片
  143. if (this.$verified()) { //用户是否已登录
  144. if (this.userServerInfo.signuped) {
  145. if (this.userServerInfo.status === 1 || this.userServerInfo.status === 4) {
  146. uni.showToast({
  147. title: '比赛还没有开始',
  148. icon:"none"
  149. });
  150. } else if (this.userServerInfo.status === 2) {
  151. if (this.routing) { return }
  152. this.routing = true
  153. uni.navigateTo({ url: '../upload/upload' })
  154. } else if (this.userServerInfo.status === 3 || this.userServerInfo.status === 5) {
  155. uni.showToast({
  156. title: '比赛已经结束了',
  157. icon:"none"
  158. });
  159. }
  160. } else {
  161. uni.showToast({
  162. title: '您还没有报名参赛',
  163. icon:"none"
  164. });
  165. }
  166. } else { //未登录弹出登录框
  167. uni.showToast({
  168. title: '您还未登录'
  169. });
  170. }
  171. },
  172. toexchange () { //点击兑换奖品
  173. if (this.$verified()) { //用户是否已登录
  174. if (this.userServerInfo.status === 3) {
  175. if (this.routing) { return }
  176. this.routing = true
  177. uni.navigateTo({ url: '../exchange/exchange' })
  178. } else {
  179. uni.showToast({
  180. title: '礼品兑换还未开始',
  181. icon:"none"
  182. });
  183. }
  184. } else { //未登录弹出登录框
  185. uni.showToast({
  186. title: '您还未登录'
  187. });
  188. }
  189. },
  190. tosetting () { //点击设置
  191. if (this.routing) { return }
  192. this.routing = true
  193. uni.navigateTo({ url: '../setting/setting' })
  194. },
  195. tostatistics () { //点击数据统计
  196. if (this.$verified()) { //用户是否已登录
  197. if (this.routing) { return }
  198. this.routing = true
  199. uni.navigateTo({ url: '../statistics/statistics' })
  200. } else { //未登录弹出登录框
  201. uni.showToast({
  202. title: '您还未登录'
  203. });
  204. }
  205. },
  206. }
  207. }
  208. </script>
  209. <style>
  210. .index{
  211. width: 100%;
  212. height: 100%;
  213. position: relative;
  214. box-sizing: border-box;
  215. padding: 161rpx 50rpx 0;
  216. display: flex;
  217. flex-direction: column;
  218. }
  219. button {
  220. width: 100%;
  221. margin-top: 20px;
  222. }
  223. </style>