homepage.vue 7.8 KB

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