homepage.vue 11 KB

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