index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. </view>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'My',
  64. data() {
  65. return {
  66. history: [1, 2, 3, 4],
  67. menus: [
  68. { icon: '/static/image/my-page/order.png', name: '消费记录', href: '/pages/my/consume' },
  69. { icon: '/static/image/my-page/recharge.png', name: '充值记录', href: '/pages/my/recharge' },
  70. { icon: '/static/image/my-page/share.png', name: '分享好友', type: 'share' },
  71. { icon: '/static/image/my-page/contact.png', name: '联系客服', type: 'contact' },
  72. { icon: '/static/image/my-page/protocol.png', name: '用户协议', href: '/pages/my/protocol' }
  73. ]
  74. }
  75. },
  76. computed: {},
  77. methods: {
  78. handleMenu(menu) {
  79. if (menu.href) {
  80. this.$u.route(menu.href)
  81. }
  82. },
  83. handleGetUserInfo(detail) {
  84. uni.login({
  85. success: function(loginRes) {
  86. console.log(loginRes.authResult)
  87. // 获取用户信息
  88. uni.getUserInfo({
  89. success: function(infoRes) {
  90. console.log('-->data', infoRes)
  91. }
  92. })
  93. }
  94. })
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .container {
  101. padding: 20px 20rpx 0;
  102. font-size: 30rpx;
  103. >.header{
  104. .user-box{
  105. .head-img{
  106. image{
  107. width: 100rpx;
  108. height: 100rpx;
  109. border-radius: 50%;
  110. }
  111. }
  112. .nickname{
  113. color: $primary-color;
  114. margin-left: 30rpx;
  115. }
  116. }
  117. .refresh{
  118. background: $primary-color;
  119. color: #fff;
  120. border-radius: 30rpx;
  121. padding: 10rpx 0;
  122. width: 140rpx;
  123. text-align: center;
  124. letter-spacing: .1rem;
  125. line-height: initial;
  126. }
  127. }
  128. .recharge{
  129. background: url("/static/image/my-recharge-bg.png") no-repeat center;
  130. background-size: 100%;
  131. height: 200rpx;
  132. margin-top: 20rpx;
  133. margin-bottom: 10rpx;
  134. .static-box{
  135. margin-left: 30rpx;
  136. .icon{
  137. border-radius: 20rpx;
  138. image{
  139. width: 100rpx;
  140. height: 100rpx;
  141. }
  142. }
  143. .overage{
  144. font-weight: 800;
  145. margin-left: 20rpx;
  146. font-size: 32rpx;
  147. }
  148. }
  149. .recharge-btn{
  150. border: 1rpx solid #fff;
  151. padding: 10rpx 0 ;
  152. text-align: center;
  153. width: 140rpx;
  154. margin-right: 20rpx;
  155. border-radius: 30rpx;
  156. color: #ffffff;
  157. }
  158. }
  159. .history{
  160. background: #1B203C;
  161. height: 300rpx;
  162. border-radius: 15rpx;
  163. padding: 20rpx 30rpx;
  164. margin-bottom: 40rpx;
  165. >.header{
  166. text{
  167. color: $info-color;
  168. font-weight: 600;
  169. }
  170. }
  171. .content{
  172. margin-top: 20rpx;
  173. .episode{
  174. flex: 1;
  175. margin-left: 20rpx;
  176. &:first-child{
  177. margin-left: 0;
  178. }
  179. .cover-image{
  180. image{
  181. width: 100%;
  182. height: 200rpx;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. .menu-group{
  189. .menu-item{
  190. padding: 20rpx 0;
  191. background: transparent;
  192. border: none;
  193. text-align: unset;
  194. width: 100%;
  195. line-height: initial;
  196. font-size: initial;
  197. justify-content: space-between;
  198. &:after{
  199. content: unset;
  200. }
  201. .left-box{
  202. flex: 1;
  203. .icon{
  204. transform: translateY(4rpx);
  205. image{
  206. width: 55rpx;
  207. height: 55rpx;
  208. }
  209. }
  210. text{
  211. color: #fff;
  212. margin-left: 10rpx;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. </style>