homepage.vue 11 KB

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