homepage.vue 11 KB

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