123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- <template>
- <home-frame @toPath="toPath">
- <view class="main">
- <view class="one">
- <view class="one_1">
- <input type="text" placeholder="搜索视频" @tap="toCommon('pagesVideo/search/index','')">
- </view>
- <view class="one_2">
- <button size="mini" @tap="toCommon('pagesVideo/search/index','')">筛选</button>
- </view>
- </view>
- <view class="two">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="two_0 two_1">
- <swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000">
- <swiper-item class="list" v-for="(item,index) in bannerList" :key="index"
- @tap="toWeb(item)">
- <image class="image"
- :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
- </image>
- </swiper-item>
- </swiper>
- </view>
- <view class="two_0 two_2">
- <view class="list textOver" v-for="(item,index) in linkList" :key="index"
- @tap="toWeb(item)">
- <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''"
- mode="">
- </image>
- <view class="name">
- {{item.title}}
- </view>
- </view>
- </view>
- <view class="two_0 two_4">
- <view class="top">
- <view class="top_1 textOver">
- <span>最新</span>
- </view>
- <view class="top_2">
- <span @tap="toCommon('pagesVideo/more/index',``)">
- 更多
- <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
- </span>
- </view>
- </view>
- <view class="info">
- <view class="list" v-for="(item,index) in nvideoList" :key="index"
- @tap="videoView(item)">
- <image class="image"
- :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
- </image>
- <view class="name textOver">
- {{item.title}}
- </view>
- <view class="other">
- <view class="other_1">
- <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
- {{item.view_num}}
- </view>
- <view class="other_2">
- {{item.time_num}}
- </view>
- </view>
- <view class="vip" v-if="item.is_vip=='1'">
- <span>VIP</span>
- </view>
- </view>
- </view>
- <view class="btn">
- <button @tap="toCommon('pagesVideo/more/index',``)">查看更多</button>
- </view>
- </view>
- <view class="two_0 two_5">
- <view class="top">
- <view class="top_1 textOver">
- <span>Hot</span>
- </view>
- <view class="top_2">
- <span @tap="toCommon('pagesVideo/more/index',`is_hot=1`)">
- 更多
- <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
- </span>
- </view>
- </view>
- <view class="info">
- <view class="list" v-for="(item,index) in hotList" :key="index" @tap="videoView(item)">
- <image class="image"
- :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
- </image>
- <view class="name textOver">
- {{item.title}}
- </view>
- <view class="other">
- <view class="other_1">
- <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
- {{item.view_num}}
- </view>
- <view class="other_2">
- {{item.time_num}}
- </view>
- </view>
- <view class="vip" v-if="item.is_vip=='1'">
- <span>VIP</span>
- </view>
- </view>
- </view>
- <view class="btn">
- <button @tap="toCommon('pagesVideo/more/index',`is_hot=1`)">查看更多</button>
- </view>
- </view>
- <view class="two_0 two_5">
- <view class="top">
- <view class="top_1 textOver">
- <span>{{one_title}}</span>
- </view>
- <view class="top_2">
- <span @tap="toCommon('pagesVideo/more/index',`type_id=63f7154721efa85eb49b8bb7`)">
- 更多
- <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
- </span>
- </view>
- </view>
- <view class="info">
- <view class="list" v-for="(item,index) in oneList" :key="index" @tap="videoView(item)">
- <image class="image"
- :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
- </image>
- <view class="name textOver">
- {{item.title}}
- </view>
- <view class="other">
- <view class="other_1">
- <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
- {{item.view_num}}
- </view>
- <view class="other_2">
- {{item.time_num}}
- </view>
- </view>
- <view class="vip" v-if="item.is_vip=='1'">
- <span>VIP</span>
- </view>
- </view>
- </view>
- <view class="btn">
- <button
- @tap="toCommon('pagesVideo/more/index',`type_id=63f7154721efa85eb49b8bb7`)">查看更多</button>
- </view>
- </view>
- <view class="two_0 two_6">
- <view class="top">
- <view class="top_1 textOver">
- <span>{{two_title}}</span>
- </view>
- <view class="top_2">
- <span @tap="toCommon('pagesVideo/more/index',`type_id=63f7150321efa85eb49b8b7f`)">
- 更多
- <uni-icons color="var(--rgbfff)" size="12" type="forward"></uni-icons>
- </span>
- </view>
- </view>
- <view class="info">
- <view class="list" v-for="(item,index) in twoList" :key="index" @tap="videoView(item)">
- <image class="image"
- :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
- </image>
- <view class="name textOver">
- {{item.title}}
- </view>
- <view class="other">
- <view class="other_1">
- <uni-icons type="eye" color="var(--rgbfff)" size="12"></uni-icons>
- {{item.view_num}}
- </view>
- <view class="other_2">
- {{item.time_num}}
- </view>
- </view>
- <view class="vip" v-if="item.is_vip=='1'">
- <span>VIP</span>
- </view>
- </view>
- </view>
- <view class="btn">
- <button
- @tap="toCommon('pagesVideo/more/index',`type_id=63f7150321efa85eb49b8b7f`)">查看更多</button>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </home-frame>
- </template>
- <script>
- import homeFrame from "../components/home-frame.vue";
- export default {
- components: {
- homeFrame
- },
- data() {
- return {
- bannerList: [],
- linkList: [],
- nvideoList: [],
- hotList: [],
- one_title: '',
- oneList: [],
- two_title: '',
- twoList: []
- };
- },
- onLoad() {
- const that = this;
- that.search()
- },
- onShow() {},
- methods: {
- async search() {
- const that = this;
- // 轮播图
- let res;
- res = await that.$api('appbanner', 'GET', {
- place: '0',
- is_use: '0'
- });
- if (res.errcode == '0') that.$set(that, `bannerList`, res.data)
- // 热门链接
- res = await that.$api('hotlink', 'GET', {
- place: '0',
- is_use: '0'
- });
- if (res.errcode == '0') that.$set(that, `linkList`, res.data)
- // 最新视频
- res = await that.$api('videos', 'GET', {
- skip: 0,
- limit: 6,
- is_use: '0'
- })
- if (res.errcode == '0') that.$set(that, `nvideoList`, res.data)
- // 热推视频
- res = await that.$api('videos', 'GET', {
- skip: 0,
- limit: 6,
- is_use: '0',
- is_hot: '1'
- })
- if (res.errcode == '0') that.$set(that, `hotList`, res.data)
- // 惊悚
- res = await that.$api('scenedata/63f7154721efa85eb49b8bb7', 'GET', {});
- if (res.errcode == '0') {
- that.$set(that, `one_title`, res.data.title);
- res = await that.$api('videos', 'GET', {
- skip: 0,
- limit: 4,
- is_use: '0',
- type_id: res.data._id
- })
- if (res.errcode == '0') that.$set(that, `oneList`, res.data)
- }
- // 动作
- res = await that.$api('scenedata/63f7150321efa85eb49b8b7f', 'GET', {});
- if (res.errcode == '0') {
- that.$set(that, `two_title`, res.data.title);
- res = await that.$api('videos', 'GET', {
- skip: 0,
- limit: 4,
- is_use: '0',
- type_id: res.data._id
- })
- if (res.errcode == '0') that.$set(that, `twoList`, res.data)
- }
- },
- toWeb(e) {
- const that = this;
- let system = that.$config.system
- if (system.uniPlatform == 'app') {
- plus.runtime.openURL(e.web_url)
- } else if (system.uniPlatform == 'mp-weixin') {
- uni.showToast({
- title: '小程序无法打开链接,请打开app进行跳转',
- icon: "none"
- })
- }
- },
- toCommon(route, query) {
- uni.navigateTo({
- url: `/${route}?${query}`
- })
- },
- // 视频查看
- videoView(e) {
- uni.navigateTo({
- url: `/pagesVideo/video/index?id=${e._id}`
- })
- },
- // 跳转页面
- toPath(e) {
- let url = `/${e.route}`;
- if (e.type == '0') uni.navigateTo({
- url
- })
- else if (e.type == '1') uni.redirectTo({
- url
- })
- else if (e.type == '2') uni.reLaunch({
- url
- })
- else if (e.type == '3') uni.switchTab({
- url
- })
- }
- },
- };
- </script>
- <style lang="scss">
- .main {
- background-color: var(--rgb000);
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 92vh;
- .one {
- background-color: var(--rgb111);
- display: flex;
- padding: 8px;
- .one_1 {
- flex-grow: 1;
- input {
- border: 1px solid var(--rgbf1f);
- height: 30px;
- border-radius: 2px;
- padding: 0 5px;
- font-size: 12px;
- }
- }
- .one_2 {
- button {
- height: 100%;
- background-color: var(--rgbfa4);
- color: var(--rgbfff);
- }
- }
- }
- .two {
- position: relative;
- flex-grow: 1;
- .two_0 {
- margin: 0 0 10px 0;
- padding: 0 8px;
- .top {
- margin: 0 0 10px 0;
- display: flex;
- padding: 5px 0;
- .top_1 {
- flex-grow: 1;
- span {
- color: var(--rgbfff);
- font-size: 20px;
- font-family: monospace;
- font-weight: bold;
- }
- }
- .top_2 {
- span {
- color: var(--rgbfff);
- font-size: 14px;
- }
- }
- }
- .info {
- margin: 0 0 10px 0;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- .list {
- position: relative;
- width: 48%;
- margin: 0 0 10px 0;
- .image {
- width: 100%;
- height: 100px;
- overflow: hidden;
- border-radius: 5px;
- }
- .name {
- font-size: 14px;
- color: var(--rgbfff);
- }
- .other {
- display: flex;
- color: var(--rgbfff);
- font-size: 12px;
- justify-content: space-between;
- }
- .vip {
- position: absolute;
- top: 0;
- left: 1vw;
- span {
- font-size: 14px;
- font-weight: bold;
- color: var(--rgbffd);
- }
- }
- }
- }
- .btn {
- button {
- border-radius: 25px;
- background-color: var(--rgbfa4);
- color: var(--rgbfff);
- font-size: 14px;
- }
- }
- }
- .two_1 {
- .swiper {
- height: 200px;
- overflow: hidden;
- }
- .list {
- .image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .two_2 {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: space-between;
- .list {
- text-align: center;
- width: 18%;
- margin: 0 0 10px 0;
- .image {
- width: 100%;
- height: 64px;
- border-radius: 90%;
- margin: 0 0 5px 0;
- }
- .name {
- font-size: 12px;
- color: #ffffff;
- }
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: column;
- }
- }
- </style>
|