uni-events-helper-wx
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.

140 lines
3.4 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <view class="content">
  3. <view class="login-box flex_col flex_start">
  4. <image class="bg" src="../../static/images/index/index_bg.png" mode="aspectFit"></image>
  5. <view class="login-info flex_col" v-if="hasLogin">
  6. <text>{{userInfo.mobile||"-"}}</text>
  7. <text>您好!</text>
  8. </view>
  9. <view class="button-login " v-else @click="jumpPage('login')">前往登录</view>
  10. </view>
  11. <view class="item flex_row flex_start bg-white padding solid-bottom" @click="jumpPage('messageList')">
  12. <image src="../../static/images/index/index_bell.png" mode=""></image>
  13. <view class="text-m text-left">消息中心</view>
  14. <view class="bandage" v-if="unReadNum">{{unReadNum}}</view>
  15. <image src="../../static/images/index/arrow_right.png" mode=""></image>
  16. </view>
  17. <view class="item flex_row flex_start bg-white padding solid-bottom" @click="clickEvent">
  18. <image src="../../static/images/index/index_cup.png" mode=""></image>
  19. <view class="text-m text-left">活动赛事</view>
  20. <image src="../../static/images/index/arrow_right.png" mode=""></image>
  21. </view>
  22. <view class="item flex_row flex_start bg-white padding solid-bottom" v-if="hasLogin" @click="logout">
  23. <image src="../../static/images/index/index_logout.png" mode=""></image>
  24. <view class="text-m text-left" >退出登录</view>
  25. <image src="../../static/images/index/arrow_right.png" mode=""></image>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { mapState,mapActions,mapGetters } from 'vuex'
  31. import {msgNum} from "../../nxTemp/apis/userAPI.js"
  32. export default {
  33. data() {
  34. return {
  35. address:"",
  36. login:false,
  37. unReadNum:""
  38. };
  39. },
  40. computed:{
  41. ...mapState(['userInfo']),
  42. ...mapGetters(['hasLogin']),
  43. },
  44. onLoad(opt) {
  45. this.updateMsgNum()
  46. },
  47. onUnload() {
  48. },
  49. methods: {
  50. ...mapActions(['getUserInfo','logoutUser']),
  51. jumpPage(name){
  52. this.$Router.push({name:name})
  53. },
  54. updateMsgNum(){
  55. console.log(123);
  56. msgNum(this.postData).then(res => {
  57. this.unReadNum = res
  58. }).catch(e=>{
  59. this.$tools.showNone(e.errMsg)
  60. })
  61. },
  62. async clickEvent(){
  63. if(this.hasLogin)this.jumpPage('eventList');
  64. else await this.$tools.showModal("该功能需要登录后才能查看,是否跳转去登录界面?",()=>{this.jumpPage('login')})
  65. },
  66. async logout(){
  67. await this.$tools.showModal("真的要退出登录?",this.logoutUser)
  68. },
  69. }
  70. }
  71. </script>
  72. <style lang="less" scoped>
  73. .content{
  74. .login-box{
  75. position: relative;
  76. width: 750rpx;
  77. height: 480rpx;
  78. > image ,.bg{
  79. width: 100%;height: 100%;
  80. position: absolute;
  81. z-index: 1;
  82. }
  83. .button-login{
  84. margin-top: 132rpx;
  85. color: #009874;
  86. z-index: 20;
  87. width: 240rpx;
  88. height: 96rpx;
  89. background: #FFFFFF;
  90. border-radius: 48rpx;
  91. text-align: center;
  92. line-height: 96rpx;
  93. font-weight: 900;
  94. font-size: 36rpx;
  95. letter-spacing: -0.2rpx;
  96. }
  97. .login-info{
  98. margin-top: 132rpx;
  99. z-index: 20;
  100. font-size: 40rpx;
  101. color: #FFFFFF;
  102. font-weight: 900;
  103. }
  104. }
  105. .item{
  106. color: #333333;
  107. position: relative;
  108. > image:first-child{
  109. width: 52rpx;
  110. height: 52rpx;
  111. margin-right: 14rpx;
  112. }
  113. > image:last-child{
  114. width: 30rpx;
  115. height: 30rpx;
  116. position: absolute;
  117. right: 20rpx;
  118. }
  119. .bandage{
  120. width: 34rpx;
  121. height: 34rpx;
  122. position: absolute;
  123. right: 60rpx;
  124. background: #EA5061;
  125. border-radius: 50%;
  126. font-size: 24rpx;
  127. color: white;
  128. text-align: center;
  129. line-height: 34rpx;
  130. }
  131. }
  132. }
  133. </style>