homepage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <!-- title="我的" -->
  3. <view class="full-container">
  4. <uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()"
  5. color="#000000" fixed="true" :border="false">
  6. <!-- <view slot="left">
  7. <view class=" flex align-center margin-left">
  8. <image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
  9. </view>
  10. </view> -->
  11. <view slot="middle">
  12. <view class="flex justify-center align-center"
  13. style="margin-left: 250rpx; ">
  14. <view class="flex align-center" style="margin-right: 40rpx; padding: 0 18px; height: 56rpx; background-color: rgba(183,183,183,0.33); border-radius: 13.5px;">
  15. <image class="png-more" style="margin-right: 16rpx;"
  16. src="/static/common/sideBar/sGold.png"></image>
  17. <view class="text-14px" style="line-height: 28rpx;">{{cGold}}</view>
  18. </view>
  19. <view class="flex align-center" style="padding: 0 18px; height: 56rpx; background-color: rgba(183,183,183,0.33); border-radius: 13.5px;">
  20. <image class="png-more" style="margin-right: 16rpx; "
  21. src="/static/common/sideBar/sDiamond.png"></image>
  22. <view class="text-14px" style="line-height: 28rpx;">{{cDiamond}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. </uni-nav-bar>
  27. <!-- <view class="cu-bar ">
  28. <view class="action">
  29. </view>
  30. <view class="action">
  31. <text class="text-df text-purple" @tap="onNavUser">编辑</text>
  32. </view>
  33. </view> -->
  34. <image class="bg-image" src="../../../static/loginBg.png" mode="aspectFill"></image>
  35. <scroll-view style="border: 1rpx solid #000000;" :style="{ height: scrollviewHight + 'px' }" scroll-y="true">
  36. <view class="card-view flex align-center " style="position: relative; margin-top: 113px;">
  37. <view class="avatar-size">
  38. <image class="avatar-img round" :src="avatarUrl"></image>
  39. </view>
  40. <view class="avatar-group text-upload">
  41. <view class="text-lg flex justify-between align-center justify-center">
  42. <text class="text-black text-bold">{{userName}}</text>
  43. <view style="width: 126rpx;height: 50rpx; position: relative;" class="flex align-center justify-center" >
  44. <image style="height: 100%; width: 100%;" src="/static/bg-days.png"></image>
  45. <text class="text-white text-13px text-center" style="line-height: 50rpx; position: absolute;top: 0;right: 10rpx;">{{days}}天</text>
  46. </view>
  47. </view>
  48. <!-- <view class="text-xs padding-top">
  49. <text class="text-black">{{days}}</text>
  50. </view> -->
  51. <view class="text-gray padding-top">{{signature}}</view>
  52. </view>
  53. <view class="only-arrow" @tap="onNavUser"></view>
  54. </view>
  55. <view class="card-view flex align-center " style="position: relative; height: 132rpx; margin-top: 8px;">
  56. <image class="achievement-img round" src="../../../static/achievement/11-01@2x.png"></image>
  57. <view class="text-lg flex justify-between align-center justify-center">
  58. <text class="text-gray text-14px">我的成就</text>
  59. </view>
  60. <view class="only-arrow" @tap="onNavAchievement"></view>
  61. </view>
  62. <view class="card-view article ">
  63. <view class="title">
  64. 最近在玩
  65. </view>
  66. <view class="cu-item shadow">
  67. <view class="cu-form-group margin-top">
  68. <view v-if="playGames.length!=0" class="grid col-3 homepage-grid-square flex-sub ">
  69. <view v-for="(item,index) in playGames" :key="index" v-if="index<6" @tap="onViewImage(item)">
  70. <image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
  71. <view class="border text-center text-cut">{{item.gameName}}</view>
  72. </view>
  73. </view>
  74. <view v-else class="text-center text-gray" :style="{width:'100%'}">去玩吧~</view>
  75. <view v-if="playGames.length!=0" class="homepage-arrow" @tap="onNavList('recently')"></view>
  76. </view>
  77. </view>
  78. </view>
  79. <view v-if="favoriteGames.length==0" class="card-view flex align-center">
  80. <view class="content flex flex-direction align-start margin-top">
  81. <view class="title">关注</view>
  82. <view class="text-grey" style="margin: 0rpx 40rpx 40rpx;">有好多好玩的视频等着你关注哦</view>
  83. </view>
  84. <view class=" margin-sm button-fav " @tap="onGoToFollow">
  85. <image style="width: 21px;height: 21px; margin-right: 12rpx;" src="../../../static/add_w.png"></image>
  86. 去关注
  87. </view>
  88. </view>
  89. <view v-else class="card-view article">
  90. <view class="title">
  91. 已关注的
  92. </view>
  93. <view class="cu-item shadow">
  94. <view class="cu-form-group margin-top">
  95. <view v-if="favoriteGames.length!=0" class="grid col-3 homepage-grid-square flex-sub ">
  96. <view class="text-center " v-for="(item,index) in favoriteGames" :key="index" v-if="index<6" @tap="onViewImage(item)">
  97. <image class="item-img" :src="item.gameIcon" mode="aspectFill"></image>
  98. <view class="border text-cut">{{item.gameName}}</view>
  99. </view>
  100. </view>
  101. <view v-else class="text-center text-gray" :style="{width:'100%'}">去关注更多的游戏吧~</view>
  102. <view v-if="favoriteGames.length!=0" class="homepage-arrow" @tap="onNavList('watchGame')"></view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="homepage-action-row">
  107. <view class=" ">哔蹦</view>
  108. <view class="text-bold text-decoration" style="
  109. color: #007AFF; border-bottom: solid 1rpx #007AFF;" @tap="onSwitchAgree('agreement')">用户协议</view>
  110. <view class=" ">和</view>
  111. <view class="text-bold text-decoration" style="
  112. color: #007AFF; border-bottom: solid 1rpx #007AFF;" @tap="onSwitchAgree('privacy')">隐私政策</view>
  113. </view>
  114. </scroll-view>
  115. </view>
  116. </template>
  117. <script>
  118. import config from '../../../common/config.js';
  119. import reqUtil from "@/util/util-js/requstUtil.js";
  120. import {
  121. mapState
  122. } from 'vuex'
  123. export default {
  124. computed: mapState(['forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'playGames', 'favoriteGames', 'days',
  125. 'signature','platform','gamePlatform','cGold','cDiamond',
  126. 'systemInfo','navHeight','tabbarHeight',
  127. ]),
  128. data() {
  129. return {
  130. scrollviewHight:0
  131. }
  132. },
  133. onLoad() {
  134. let that = this;
  135. reqUtil.requestData(config.URL.RECENTLYPLAYINGGETBYPLATFORM).then(res => {
  136. console.log('RECENTLYPLAYINGGETBYPLATFORM =====', res);
  137. if (res.code == 0) {
  138. that.$store.state.playGames = res.data.gameList;
  139. }
  140. },
  141. e => {
  142. console.log(e)
  143. });
  144. reqUtil.requestData(config.URL.FAVORITESGETBYPLATFORM).then(res => {
  145. console.log('FAVORITESGETBYPLATFORM =====', res);
  146. if (res.code == 0) {
  147. that.$store.state.favoriteGames = res.data.gameList;
  148. }
  149. },
  150. e => {
  151. console.log(e)
  152. });
  153. },
  154. onReady() {
  155. let phoneHeight = this.systemInfo.windowHeight;
  156. // 计算组件的高度
  157. this.scrollviewHight = phoneHeight - this.navHeight - this.tabbarHeight;
  158. },
  159. methods: {
  160. onViewImage(item) {
  161. let temItem = encodeURIComponent(JSON.stringify(item));
  162. uni.navigateTo({
  163. url: "../../game-page/game-detail/game-detail?item=" + temItem
  164. })
  165. },
  166. onNavUser() {
  167. uni.navigateTo({
  168. url: '../userInfo/userInfo'
  169. });
  170. },
  171. onNavAchievement(){
  172. uni.navigateTo({
  173. url: '../achievement/achievement'
  174. });
  175. },
  176. onNavList(type) {
  177. if (type == "recently" && this.playGames.length == 0) {
  178. uni.showModal({
  179. title: "提示",
  180. content: "没有最近在玩的游戏数据"
  181. })
  182. return;
  183. } else if (type == "watchGame" && this.favoriteGames.length == 0) {
  184. uni.showModal({
  185. title: "提示",
  186. content: "没有关注的游戏数据"
  187. })
  188. return;
  189. }
  190. uni.navigateTo({
  191. url: '../../personal-page/list/list?type='+type
  192. });
  193. },
  194. onGoToFollow() {
  195. // uni.showModal({
  196. // title: "提示",
  197. // content: "功能尚未开放"
  198. // })
  199. uni.navigateTo({
  200. url: '../../game-page/game/game'
  201. });
  202. },
  203. onBack(){
  204. uni.navigateBack({
  205. delta:1
  206. })
  207. },
  208. onSwitchAgree(data) {
  209. uni.navigateTo({
  210. url: "../../login-page/userAgreement/userAgreement?type=" + data
  211. })
  212. },
  213. }
  214. }
  215. </script>
  216. <style>
  217. .avatar-group {
  218. display: flex;
  219. flex-direction: column;
  220. /* justify-content: center; */
  221. /* align-items: center; */
  222. text-align: start;
  223. background-color: #FFFFFF;
  224. display: block;
  225. border-radius: 10rpx;
  226. margin: 0 54rpx 0 30rpx;
  227. width: 100%;
  228. }
  229. .avatar-size {
  230. position: relative;
  231. margin-left: 47rpx;
  232. width: 140rpx;
  233. height: 140rpx;
  234. flex-shrink: 0;
  235. }
  236. .avatar-img {
  237. position: absolute;
  238. top: 0px;
  239. left: 0;
  240. width: 140rpx;
  241. height: 140rpx;
  242. }
  243. .achievement-img{
  244. margin: 0 26rpx 0 46rpx;
  245. width: 82rpx;
  246. height: 82rpx;
  247. }
  248. .text-upload {
  249. font-size: 13px;
  250. color: rgba(166, 166, 166, 1);
  251. padding: 40px 35rpx 40px 0;
  252. }
  253. .homepage-grid-square {
  254. width: 250rpx;
  255. /* height: 250rpx; */
  256. align-items: start;
  257. }
  258. .homepage-grid-square image {
  259. width: 176rpx;
  260. height: 176rpx;
  261. }
  262. .homepage-arrow {
  263. position: relative;
  264. width: 35rpx;
  265. }
  266. .homepage-arrow::before {
  267. position: absolute;
  268. top: 0;
  269. right: 0upx;
  270. bottom: 0;
  271. display: block;
  272. margin: auto;
  273. width: 30upx;
  274. height: 30upx;
  275. color: #8799a3;
  276. content: "\e6a3";
  277. text-align: center;
  278. font-size: 34upx;
  279. font-family: cuIcon;
  280. line-height: 30upx
  281. }
  282. .button-fav {
  283. background-color: rgba(153, 150, 252, 255);
  284. color: #FFFFFF;
  285. border-radius: 10px;
  286. width: 184rpx;
  287. height: 90rpx;
  288. display: flex;
  289. justify-content: center;
  290. text-align: center;
  291. align-items: center;
  292. }
  293. .title {
  294. text-align: justify;
  295. /* padding: 40rpx 30rpx; */
  296. font-size: 15px;
  297. position: relative;
  298. height: 30px;
  299. line-height: 60upx;
  300. margin: 20rpx 40rpx;
  301. font-weight: 400;
  302. color: rgba(26, 26, 26, 1);
  303. }
  304. .bg-image {
  305. position: fixed;
  306. top: 46px;
  307. left: 0;
  308. width: 100%;
  309. height: 164px;
  310. opacity: 1;
  311. }
  312. .border{
  313. width: 176rpx;
  314. font-size: 30rpx;
  315. color:rgba(175, 175, 175, 1);
  316. font-weight: 400;
  317. text-align: center;
  318. margin-top: 22rpx;
  319. margin-bottom: 40rpx;
  320. }
  321. .item-img{
  322. border-radius: 20rpx;
  323. /* border: 1rpx solid #EEEEEE; */
  324. box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23);
  325. }
  326. .homepage-action-row{
  327. margin-top: 25px;
  328. display: flex;
  329. flex-direction: row;
  330. justify-content: center;
  331. padding: 20px;
  332. }
  333. </style>