index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="content">
  3. <foot-tabs></foot-tabs>
  4. <div class="self-inf">
  5. <view class="img-name-box" v-if="!isAuth">
  6. <button @click="goAuthPage()" class="auth-btn">点击去授权</button>
  7. </view>
  8. <div class="img-name-box" v-if="isAuth">
  9. <image :src="userHeadImg" alt="" class="heade-img" mode="aspectFill"></image>
  10. <p class="nickname">{{userNickName}}</p>
  11. </div>
  12. <image class="bg-img" :src="swiperBackground" mode="aspectFill"></image>
  13. <image src="../../static/Intersect.svg" class="groove-img"></image>
  14. </div>
  15. <div class="options">
  16. <div v-for="(item, idx) in list" :key="idx" class="options-item">
  17. <div class="img-box">
  18. <img :src="item.icoin" alt="" class="options-item-img" /><span></span>
  19. </div>
  20. <div
  21. class="options-item-name"
  22. :class="{ fontGrey: idx == list.length - 1 }"
  23. >
  24. {{ item.name }}
  25. </div>
  26. </div>
  27. </div>
  28. </view>
  29. </template>
  30. <script>
  31. import md5 from '@/common/md5.js';
  32. export default {
  33. data() {
  34. return {
  35. message: "我的",
  36. isAuth:getApp().globalData.isAuth,
  37. userHeadImg:getApp().globalData.user_headUrl,
  38. userNickName:getApp().globalData.user_name,
  39. list: [
  40. { icoin: "/static/selfCenter/suggest.png", name: "我的建议" },
  41. { icoin: "/static/selfCenter/sign.png", name: "我的报名" },
  42. { icoin: "/static/selfCenter/collection.png", name: "我的收藏" },
  43. { icoin: "/static/selfCenter/back.png", name: "退出登录" },
  44. ],
  45. swiperBackground:'',
  46. };
  47. },
  48. onLoad() {
  49. this.getSwiperList();
  50. },
  51. onShow() {
  52. this.isAuth = getApp().globalData.isAuth;
  53. if(this.isAuth){
  54. this.userHeadImg = getApp().globalData.user_headUrl;
  55. this.userNickName = getApp().globalData.user_name;
  56. }
  57. },
  58. methods: {
  59. goAuthPage(){
  60. uni.navigateTo({
  61. url:'../auth/index'
  62. })
  63. },
  64. getSwiperList(){
  65. let md5Sign = md5("method="+'common'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
  66. let url = getApp().globalData.shareUrl+'api/api.php'+'?method=common&source=main_pics&action=list&timestamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
  67. uni.request({
  68. url:url,
  69. method: 'POST',
  70. header: {
  71. 'content-type': 'application/x-www-form-urlencoded'
  72. },
  73. data: {
  74. order_by:"weight desc",
  75. s_status:1,
  76. },
  77. success: (res) => {
  78. if(res.data.code === 200){
  79. this.swiperBackground = getApp().globalData.shareUrl + res.data.data.list[0].pic_path
  80. }
  81. },
  82. fail: () => {
  83. console.log("连接失败");
  84. }
  85. });
  86. },
  87. },
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .content {
  92. display: flex;
  93. flex-direction: column;
  94. .self-inf {
  95. position: relative;
  96. height: 440rpx;
  97. width: 100%;
  98. display: flex;
  99. margin-bottom: 80rpx;
  100. border-radius: 0rpx 0rpx 100% 100%;
  101. .img-name-box {
  102. height: 150rpx;
  103. margin-top: 70rpx;
  104. display: flex;
  105. align-items: center;
  106. .auth-btn {
  107. margin-left: 80rpx;
  108. margin-top: 50rpx;
  109. font-size: 28rpx;
  110. background-color: #02A7F0;
  111. color: #fff;
  112. }
  113. .heade-img {
  114. z-index: 1;
  115. width: 100rpx;
  116. height: 100rpx;
  117. border-radius: 50%;
  118. margin-left: 80rpx;
  119. }
  120. }
  121. .bg-img {
  122. z-index: -1;
  123. position: absolute;
  124. width: 100%;
  125. height: 100%;
  126. // border-radius: 0rpx 0rpx 70rpx 70rpx;
  127. }
  128. .groove-img {
  129. width: 100%;
  130. height: 100rpx;
  131. bottom: -22rpx;
  132. position: absolute;
  133. }
  134. .nickname {
  135. font-weight: 600;
  136. font-size: 28rpx;
  137. margin-left: 30rpx;
  138. margin-top: 20rpx;
  139. color: #ffffff;
  140. letter-spacing: 1rpx;
  141. }
  142. }
  143. .options {
  144. padding: 70rpx;
  145. z-index: 99;
  146. position: relative;
  147. top: -270rpx;
  148. .options-item {
  149. background-color: #fff;
  150. display: flex;
  151. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  152. border-radius: 32rpx;
  153. margin-top: 20px;
  154. height: 150rpx;
  155. align-items: center;
  156. .img-box {
  157. margin-left: 40rpx;
  158. .options-item-img {
  159. width: 56rpx;
  160. height: 56rpx;
  161. }
  162. }
  163. .options-item-name {
  164. margin-left: 40rpx;
  165. font-weight: 600;
  166. font-size: 30rpx;
  167. margin-bottom: 10rpx;
  168. }
  169. }
  170. }
  171. }
  172. .fontGrey {
  173. color: $uni-text-color-grey;
  174. }
  175. </style>