index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="container">
  3. <!--用户信息-->
  4. <view class="header main-between cross-center">
  5. <view class="user-box main-left cross-center">
  6. <view class="head-img">
  7. <image src="@/static/image/default-head-img.png" />
  8. </view>
  9. <view class="nickname cross-center">未授权登陆</view>
  10. </view>
  11. <button open-type="getUserInfo" class="refresh" @click="handleGetUserInfo">刷新</button>
  12. </view>
  13. <!--充值-->
  14. <view class="recharge main-between cross-center">
  15. <view class="static-box main-left cross-center">
  16. <view class="icon">
  17. <image src="/static/image/gold-bag.png" mode="aspectFill" />
  18. </view>
  19. <view class="overage">3金币</view>
  20. </view>
  21. <view class="recharge-btn">充值</view>
  22. </view>
  23. <!--历史-->
  24. <view class="history" @click="$u.route('/pages/my/history')">
  25. <view class="header main-between cross-center">
  26. <text>历史观看记录</text>
  27. <u-icon name="arrow-right" :color="$colors.infoColor" bold />
  28. </view>
  29. <view class="content main-between cross-center">
  30. <view
  31. v-for="(item,index) in history"
  32. :key="index"
  33. class="episode"
  34. >
  35. <view class="cover-image">
  36. <image src="@/static/image/default-movie.png" mode="aspectFill" />
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!--菜单-->
  42. <view class="menu-group">
  43. <button
  44. v-for="(menu,index) in menus"
  45. :key="index"
  46. class="menu-item main-between cross-center"
  47. :open-type="menu.type ? menu.type : ''"
  48. @click="handleMenu(menu)"
  49. >
  50. <view class="left-box dir-left-nowrap cross-center">
  51. <view class="icon">
  52. <image :src="menu.icon" />
  53. </view>
  54. <text>{{ menu.name }}</text>
  55. </view>
  56. <u-icon name="arrow-right" :color="$colors.infoColor" bold />
  57. </button>
  58. </view>
  59. <!--tab bar-->
  60. <tab-bar />
  61. </view>
  62. </template>
  63. <script>
  64. import TabBar from '../../components/TabBar/index'
  65. export default {
  66. name: 'My',
  67. components: { TabBar },
  68. data() {
  69. return {
  70. history: [1, 2, 3, 4],
  71. menus: [
  72. { icon: '/static/image/my-page/order.png', name: '消费记录', href: '/pages/my/consume' },
  73. { icon: '/static/image/my-page/recharge.png', name: '充值记录', href: '/pages/my/recharge' },
  74. { icon: '/static/image/my-page/share.png', name: '分享好友', type: 'share' },
  75. { icon: '/static/image/my-page/contact.png', name: '联系客服', type: 'contact' },
  76. { icon: '/static/image/my-page/protocol.png', name: '用户协议', href: '/pages/my/protocol' }
  77. ]
  78. }
  79. },
  80. computed: {},
  81. methods: {
  82. handleMenu(menu) {
  83. if (menu.href) {
  84. this.$u.route(menu.href)
  85. }
  86. },
  87. handleGetUserInfo(detail) {
  88. uni.login({
  89. success: function(loginRes) {
  90. console.log(loginRes.authResult)
  91. // 获取用户信息
  92. uni.getUserInfo({
  93. success: function(infoRes) {
  94. console.log('-->data', infoRes)
  95. }
  96. })
  97. }
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. .container {
  105. padding: 20px 20rpx 0;
  106. font-size: 30rpx;
  107. >.header{
  108. .user-box{
  109. .head-img{
  110. image{
  111. width: 100rpx;
  112. height: 100rpx;
  113. border-radius: 50%;
  114. }
  115. }
  116. .nickname{
  117. color: $primary-color;
  118. margin-left: 30rpx;
  119. }
  120. }
  121. .refresh{
  122. background: $primary-color;
  123. color: #fff;
  124. border-radius: 30rpx;
  125. padding: 10rpx 0;
  126. width: 140rpx;
  127. text-align: center;
  128. letter-spacing: .1rem;
  129. line-height: initial;
  130. }
  131. }
  132. .recharge{
  133. background: url("/static/image/my-recharge-bg.png") no-repeat center;
  134. background-size: 100%;
  135. height: 200rpx;
  136. margin-top: 20rpx;
  137. margin-bottom: 10rpx;
  138. .static-box{
  139. margin-left: 30rpx;
  140. .icon{
  141. border-radius: 20rpx;
  142. image{
  143. width: 100rpx;
  144. height: 100rpx;
  145. }
  146. }
  147. .overage{
  148. font-weight: 800;
  149. margin-left: 20rpx;
  150. font-size: 32rpx;
  151. }
  152. }
  153. .recharge-btn{
  154. border: 1rpx solid #fff;
  155. padding: 10rpx 0 ;
  156. text-align: center;
  157. width: 140rpx;
  158. margin-right: 20rpx;
  159. border-radius: 30rpx;
  160. color: #ffffff;
  161. }
  162. }
  163. .history{
  164. background: #1B203C;
  165. height: 300rpx;
  166. border-radius: 15rpx;
  167. padding: 20rpx 30rpx;
  168. margin-bottom: 40rpx;
  169. >.header{
  170. text{
  171. color: $info-color;
  172. font-weight: 600;
  173. }
  174. }
  175. .content{
  176. margin-top: 20rpx;
  177. .episode{
  178. flex: 1;
  179. margin-left: 20rpx;
  180. &:first-child{
  181. margin-left: 0;
  182. }
  183. .cover-image{
  184. image{
  185. width: 100%;
  186. height: 200rpx;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. .menu-group{
  193. .menu-item{
  194. padding: 20rpx 0;
  195. background: transparent;
  196. border: none;
  197. text-align: unset;
  198. width: 100%;
  199. line-height: initial;
  200. font-size: initial;
  201. justify-content: space-between;
  202. &:after{
  203. content: unset;
  204. }
  205. .left-box{
  206. flex: 1;
  207. .icon{
  208. transform: translateY(4rpx);
  209. image{
  210. width: 55rpx;
  211. height: 55rpx;
  212. }
  213. }
  214. text{
  215. color: #fff;
  216. margin-left: 10rpx;
  217. }
  218. }
  219. }
  220. }
  221. }
  222. </style>