Live.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!-- 底部-直播 -->
  2. <template>
  3. <view class="live">
  4. <view class="navBar">
  5. <div class="top">
  6. <img class="logo" src="/static/logo_big.png" alt="" />
  7. <u--image
  8. class="border"
  9. :showLoading="true"
  10. :src="info.avatar || '/static/image/match/teams_avatar_ico@2x.png'"
  11. @click="go('/pages/Match/member/usermanger', true)"
  12. width="24px"
  13. height="24px"
  14. shape="circle"
  15. ></u--image>
  16. </div>
  17. </view>
  18. <div class="list-swiper" v-if="bannerList.length" :class="{'fadeInBtm': animationLoaded}">
  19. <swiper
  20. class="swiper"
  21. radius="24rpx"
  22. bgColor="#ffffff"
  23. circular
  24. previous-margin="30rpx"
  25. next-margin="30rpx"
  26. :indicator-dots="false"
  27. :autoplay="true"
  28. :interval="2000"
  29. :duration="500"
  30. >
  31. <swiper-item
  32. class="swiper-item"
  33. v-for="(item, index) in bannerList"
  34. :key="index"
  35. @click="swiperClick(item)"
  36. >
  37. <div class="img-box">
  38. <u--image
  39. mode="aspectFill"
  40. :showLoading="true"
  41. :src="item.img"
  42. width="100%"
  43. height="42.05vw"
  44. >
  45. <template v-slot:loading>
  46. <image
  47. class="loading-banner-img"
  48. src="/static/image/common/video-banner-bg.png"
  49. ></image>
  50. </template>
  51. </u--image>
  52. </div>
  53. </swiper-item>
  54. </swiper>
  55. </div>
  56. <tournamentList ref="tournamentList"></tournamentList>
  57. <div class="ad-list">
  58. <div class="item" v-for="item in adList" :key="item.id" @click="adClick(item)">
  59. <img class="ad" :src="item.img" alt="">
  60. </div>
  61. </div>
  62. <todayList ref="todayList"></todayList>
  63. <historyMainList></historyMainList>
  64. <div class="news-install">
  65. <install></install>
  66. </div>
  67. </view>
  68. </template>
  69. <script>
  70. import todayList from "./compontent/todayList.vue";
  71. import tournamentList from "./compontent/tournamentList.vue";
  72. import historyMainList from "./compontent/historyMainList.vue";
  73. import install from "@/components/install/install.vue";
  74. import animationMixin from '@/pages/mixins/animation'
  75. export default {
  76. components: {
  77. todayList,
  78. historyMainList,
  79. tournamentList,
  80. install,
  81. },
  82. mixins: [animationMixin],
  83. data() {
  84. return {
  85. bannerList: [],
  86. adList: [],
  87. liveList: [],
  88. current: 0,
  89. tokenIsLogin: "",
  90. homeShow: false,
  91. intervalTimer: null,
  92. homeList: [
  93. "Streamer application",
  94. this.$t("member.concerns"),
  95. this.$t("member.message"),
  96. this.$t("member.settings"),
  97. ],
  98. };
  99. },
  100. computed: {
  101. info() {
  102. return this.$store.state.info;
  103. },
  104. isLogin() {
  105. return this.$store.state.isLogin;
  106. },
  107. },
  108. onReachBottom() {
  109. // if(this.current == 0){
  110. // this.$refs['list'+this.current].getList(this.current)
  111. // }
  112. },
  113. created() {
  114. this.getBanner();
  115. this.getAd()
  116. this.intervalTimer = setInterval(() => {
  117. this.getBanner()
  118. this.$refs['tournamentList'].getList()
  119. this.$refs['todayList'].getList()
  120. }, 10000)
  121. },
  122. activated() {
  123. this.intervalTimer = setInterval(() => {
  124. this.getBanner()
  125. this.$refs['tournamentList'].getList()
  126. this.$refs['todayList'].getList()
  127. }, 10000)
  128. },
  129. deactivated() {
  130. clearInterval(this.intervalTimer)
  131. this.intervalTimer = null
  132. },
  133. methods: {
  134. getBanner() {
  135. uni.$u.http
  136. .get("/api/banner/getBannerList", {
  137. params: {
  138. banner_type: 1,
  139. type: 1,
  140. },
  141. })
  142. .then((res) => {
  143. this.bannerList = res || [];
  144. })
  145. .catch((res) => {
  146. }).finally(() => {
  147. if (this.animationLoaded) {
  148. return
  149. }
  150. this.animationLoaded = true
  151. this.$nextTick(() => {
  152. this.scrollFun()
  153. })
  154. })
  155. },
  156. getAd() {
  157. uni.$u.http
  158. .get("/api/banner/getBannerList", {
  159. params: {
  160. banner_type: 2,
  161. },
  162. })
  163. .then((res) => {
  164. this.adList = res || []
  165. })
  166. .catch((res) => {
  167. }).finally(() => {
  168. })
  169. },
  170. toUrl(url) {
  171. if (this.isLogin == 2) {
  172. this.$toUrl("/pages/login/login");
  173. } else {
  174. this.$toUrl(url);
  175. }
  176. },
  177. getList3() {
  178. let data = {
  179. type: 2,
  180. };
  181. uni.$u.http
  182. .get("/api/live_streaming/getLiveList", { params: data })
  183. .then((res) => {
  184. this.liveList = res.data || [];
  185. });
  186. },
  187. // 跳转个人中心
  188. userClick() {
  189. uni.navigateTo({
  190. url: "/pages/Match/member/infomation",
  191. });
  192. },
  193. go(url, login) {
  194. if (this.isLogin == 2 && login) {
  195. this.$toUrl('/pages/login/login')
  196. return
  197. }
  198. this.$toUrl(url)
  199. },
  200. adClick(item) {
  201. if (item.url) {
  202. uni.$u.http
  203. .post("/api/live_streaming/click_adv", {
  204. type: 2,
  205. id: item.id,
  206. url: item.url
  207. })
  208. .then((res) => {
  209. }).finally(() => {
  210. });
  211. window.open(item.url)
  212. }
  213. },
  214. swiperClick(item) {
  215. if (item.url) {
  216. uni.$u.http
  217. .post("/api/live_streaming/click_adv", {
  218. type: 1,
  219. id: item.id,
  220. url: item.url
  221. })
  222. .then((res) => {
  223. }).finally(() => {
  224. });
  225. window.open(item.url)
  226. return
  227. }
  228. if (item.anchor_id) {
  229. uni.navigateTo({
  230. url: `./live-detail?id=${item.anchor_id}&ID=${item.id}`,
  231. });
  232. return;
  233. }
  234. if (item.param_id) {
  235. uni.navigateTo({
  236. url: "/pages/Match/match-detail?id=" + item.param_id,
  237. });
  238. return;
  239. }
  240. },
  241. },
  242. };
  243. </script>
  244. <style lang="scss">
  245. page {
  246. background-color: #f3f3f7;
  247. }
  248. .live {
  249. padding-bottom: var(--window-bottom);
  250. }
  251. .navBar {
  252. position: sticky;
  253. top: 0;
  254. z-index: 10;
  255. background-color: #10044a;
  256. .top {
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. padding: 8rpx 16px 16rpx;
  261. .border {
  262. border: 1px solid #cc2900;
  263. border-radius: 50%;
  264. }
  265. }
  266. .logo {
  267. height: 24px;
  268. }
  269. }
  270. .list-swiper {
  271. padding: 20rpx 0;
  272. .swiper {
  273. height: 42.05vw;
  274. }
  275. .swiper-item {
  276. padding: 0 12rpx;
  277. box-sizing: border-box;
  278. }
  279. .img-box {
  280. border-radius: 24rpx;
  281. overflow: hidden;
  282. }
  283. }
  284. .ad-list {
  285. .item {
  286. padding-top: 4.43vw;
  287. .ad {
  288. display: block;
  289. width: 100%;
  290. }
  291. }
  292. }
  293. .news-install {
  294. position: sticky;
  295. bottom: var(--window-bottom);
  296. z-index: 200;
  297. }
  298. </style>