|
@@ -1,37 +1,8 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="one">
|
|
|
- <input type="text" v-model="searchInfo.name" @blur="toInput" placeholder="搜索名称">
|
|
|
- </view>
|
|
|
- <view class="two">
|
|
|
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
|
|
|
- <view class="list-scroll-view">
|
|
|
- <view class="list" v-for="(item, index) in list" :key="index">
|
|
|
- <view class="name">
|
|
|
- <text>{{ index + 1 }}.</text>
|
|
|
- <text>{{ item.name }}</text>
|
|
|
- </view>
|
|
|
- <view class="other">
|
|
|
- <view class="other_1">
|
|
|
- <text>节目类型:</text>
|
|
|
- <text>{{ getDict(item.type,'typeList') }}</text>
|
|
|
- </view>
|
|
|
- <view class="other_1">
|
|
|
- <text>视频流:</text>
|
|
|
- <text>{{ item.path||'暂无视频流' }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="btn">
|
|
|
- <button type="primary" size="mini" @tap="toPlay(item)">
|
|
|
- 播放视频
|
|
|
- </button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </scroll-view>
|
|
|
- </view>
|
|
|
- <view class="is_bottom" v-if="is_bottom">
|
|
|
- <text>到底了,嘻嘻!</text>
|
|
|
+ <button type="primary" size="mini" @tap="toCommon('pagesHome/video/index')">电视节目</button>
|
|
|
+ <button type="primary" size="mini" @tap="toCommon('pagesHome/prize/index')">抽奖</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -40,112 +11,18 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- // 查询
|
|
|
- searchInfo: {},
|
|
|
- list: [],
|
|
|
- total: 0,
|
|
|
- page: 0,
|
|
|
- skip: 0,
|
|
|
- limit: 10,
|
|
|
- // 数据是否触底
|
|
|
- is_bottom: false,
|
|
|
- scrollTop: 0,
|
|
|
- // 节目类型
|
|
|
- typeList: this.$config.pro_type
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
const that = this;
|
|
|
- that.search();
|
|
|
- },
|
|
|
- onPullDownRefresh: async function() {
|
|
|
- const that = this;
|
|
|
- that.clearPage();
|
|
|
- await that.search();
|
|
|
- uni.stopPullDownRefresh();
|
|
|
+ // that.toCommon('pagesHome/prize/index')
|
|
|
},
|
|
|
methods: {
|
|
|
- async search() {
|
|
|
- const that = this;
|
|
|
- let info = {
|
|
|
- skip: that.skip,
|
|
|
- limit: that.limit,
|
|
|
- is_use: "0"
|
|
|
- };
|
|
|
- let res = await that.$api("program", "GET", {
|
|
|
- ...info,
|
|
|
- ...that.searchInfo
|
|
|
- });
|
|
|
- if (res.errcode == '0') {
|
|
|
- let list = [...that.list, ...res.data]
|
|
|
- that.$set(that, `list`, list)
|
|
|
- that.$set(that, `total`, res.total)
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.errmsg,
|
|
|
- icon: 'icon'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- // 分页
|
|
|
- toPage() {
|
|
|
- const that = this;
|
|
|
- let list = that.list;
|
|
|
- let limit = that.limit;
|
|
|
- if (that.total > list.length) {
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中',
|
|
|
- mask: true
|
|
|
- })
|
|
|
- let page = that.page + 1;
|
|
|
- that.$set(that, `page`, page)
|
|
|
- let skip = page * limit;
|
|
|
- that.$set(that, `skip`, skip)
|
|
|
- that.search();
|
|
|
- uni.hideLoading();
|
|
|
-
|
|
|
- } else that.$set(that, `is_bottom`, true)
|
|
|
- },
|
|
|
- toScroll(e) {
|
|
|
- const that = this;
|
|
|
- let up = that.scrollTop;
|
|
|
- that.$set(that, `scrollTop`, e.detail.scrollTop);
|
|
|
- let num = Math.sign(up - e.detail.scrollTop);
|
|
|
- if (num == 1) that.$set(that, `is_bottom`, false);
|
|
|
- },
|
|
|
- // 输入框
|
|
|
- toInput(e) {
|
|
|
- const that = this;
|
|
|
- if (e.detail.value) that.$set(that.searchInfo, `name`, e.detail.value);
|
|
|
- else that.$set(that, `searchInfo`, {});
|
|
|
- that.clearPage();
|
|
|
- that.search();
|
|
|
- },
|
|
|
- toPlay(e) {
|
|
|
- if (e.path) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pagesHome/home/video?id=${e._id}`,
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '暂无视频流,无法播放',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- getDict(value, model) {
|
|
|
- const that = this;
|
|
|
- let data = that[model].find(i => i.dict_value == value);
|
|
|
- if (data) return data.dict_label
|
|
|
- else return '暂无'
|
|
|
- },
|
|
|
- // 清空列表
|
|
|
- clearPage() {
|
|
|
- const that = this;
|
|
|
- that.$set(that, `list`, [])
|
|
|
- that.$set(that, `skip`, 0)
|
|
|
- that.$set(that, `limit`, 10)
|
|
|
- that.$set(that, `page`, 0)
|
|
|
+ toCommon(e) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/${e}`
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
};
|
|
@@ -154,85 +31,12 @@
|
|
|
<style lang="scss">
|
|
|
.content {
|
|
|
.one {
|
|
|
- border-bottom: 1px solid #000000;
|
|
|
-
|
|
|
- input {
|
|
|
- padding: 2vw;
|
|
|
- background-color: #f1f1f1;
|
|
|
- font-size: 14px;
|
|
|
- border-radius: 5px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .two {
|
|
|
- position: relative;
|
|
|
- flex-grow: 1;
|
|
|
- padding: 0 10px;
|
|
|
-
|
|
|
- .list {
|
|
|
- // width: 90%;
|
|
|
- margin: 10px 0 0 0;
|
|
|
- padding: 10px;
|
|
|
- border-radius: 5px;
|
|
|
- box-shadow: 0 0 5px #cccccc;
|
|
|
-
|
|
|
- .name {
|
|
|
- font-size: 16px;
|
|
|
- font-weight: bold;
|
|
|
- margin: 0 0 5px 0;
|
|
|
- }
|
|
|
-
|
|
|
- .other {
|
|
|
- margin: 0 0 10px 0;
|
|
|
+ margin: 2vw;
|
|
|
+ text-align: center;
|
|
|
|
|
|
- .other_1 {
|
|
|
- margin: 0 0 5px 0;
|
|
|
-
|
|
|
- text {
|
|
|
- font-size: 14px;
|
|
|
- color: #858585;
|
|
|
- }
|
|
|
-
|
|
|
- text:last-child {
|
|
|
- color: #000000;
|
|
|
- word-break: break-all;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .btn {
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
+ button {
|
|
|
+ margin: 0.5vw;
|
|
|
}
|
|
|
-
|
|
|
- .list:last-child {
|
|
|
- margin: 10px 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .scroll-view {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
-
|
|
|
- .list-scroll-view {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- padding: 0 10px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .is_bottom {
|
|
|
- text-align: center;
|
|
|
-
|
|
|
- text {
|
|
|
- padding: 2vw 0;
|
|
|
- display: inline-block;
|
|
|
- color: #858585;
|
|
|
- font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
</style>
|