found.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <view class="search-box ddflex">
  5. <view class="search-input ddflex fflex">
  6. <image src="/static/images/ssico.png"></image>
  7. <input @confirm="searchFn" confirm-type="search" @input="searchFn" v-model="searchVal" class="fflex"
  8. placeholder="请输入关键词" />
  9. </view>
  10. </view>
  11. <view class="image-nav ddflex">
  12. <image src="/static/images/xbrm.png"></image>
  13. <image src="/static/images/tbal.png"></image>
  14. <image src="/static/images/lpal.png"></image>
  15. </view>
  16. <view class="map-ac">
  17. <scroll-view scroll-x="true" class="map-acs ddflex" style="height: 70rpx;">
  18. <view :class="'fx-nav '+(fxIndex==index?'fx-nav-active':'')" v-for="item,index in fxList" @click="changeFxTab(index)">{{item.name}}</view>
  19. </scroll-view>
  20. </view>
  21. </view>
  22. <view style="height: 400rpx;"></view>
  23. <view class="list">
  24. <view class="video-box" v-if="fxContentList&&fxContentList.length > 0">
  25. <view class="video-card" v-for="(item, index) in fxContentList" :key="index" @click="jumpUrl('/topic/content/content?id='+item.id)">
  26. <view class="video-cover">
  27. <view class="video">
  28. <image mode="aspectFill" style="max-width: 100%;max-height: 100%;" :src="item.pic"></image>
  29. </view>
  30. <image v-if="index==1" class="video-play" src="/static/images/video_play.png"></image>
  31. </view>
  32. <view class="video-info">
  33. <view class="video-name tovers">{{item.title}}</view>
  34. <view class="video-info-desc">
  35. <view class="ddflex" style="overflow: hidden;">
  36. {{formatTime(item.createDate)}}
  37. </view>
  38. <view class="ddflex">
  39. <image style="width: 27rpx;height: 20rpx;margin-right: 10rpx" src="/static/images/eyes.png"></image>
  40. <view>{{unitFormat(item.browse)}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="nodata" v-if="!videoList||videoList.length==0">
  47. <image :src="picUrlss+'empty_zb.png'"></image>
  48. <text>暂无资讯</text>
  49. </view>
  50. </view>
  51. <foot channel="found" :isUpdate="isUpdate"></foot>
  52. </view>
  53. </template>
  54. <script>
  55. // pages/live/live.js
  56. const app = getApp();
  57. const req = require("../../utils/request.js");
  58. const util = require("../../utils/util.js");
  59. import foot from "../../components/nav-bar/index";
  60. export default {
  61. data() {
  62. return {
  63. picUrlss: req.public.picUrls,
  64. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  65. page: 1,
  66. pageList: [],
  67. isLoad: true,
  68. isUpdate: false, // 是否更新消息
  69. hasmore: false,
  70. ishow: false,
  71. videoList:[],
  72. videoCurrent:null,//当前正在播放的视频下标
  73. config:{},
  74. isFullScreen:false,//是否正在全屏播放
  75. swiperPlayIndex:0,
  76. fxList:[],
  77. fxContentList:[],
  78. fxIndex:0
  79. };
  80. },
  81. components: {
  82. foot
  83. },
  84. props: {},
  85. async onLoad() { // this.getList()
  86. await this.getConfig()
  87. this.getFx()
  88. },
  89. onShow() {
  90. this.setData({
  91. isUpdate: !this.isUpdate
  92. });
  93. },
  94. onReachBottom() {
  95. this.page++;
  96. this.getFxContenteList();
  97. },
  98. methods: {
  99. getConfig() {
  100. return new Promise((resolve, reject) => {
  101. req.getRequest('/api/other/config', {}, (res)=> {
  102. this.config = res;
  103. resolve(res)
  104. });
  105. });
  106. },
  107. jumpUrl(url) {
  108. // if (!req.isLogins(true)) {
  109. // return;
  110. // }
  111. uni.navigateTo({
  112. url: url
  113. });
  114. },
  115. // 获取发现
  116. async getFx(){
  117. this.fxList = await this.getContentList(req.public.fxCode)
  118. this.getFxContenteList()
  119. },
  120. // 获取文章栏目列表
  121. getContentList(code){
  122. return new Promise((r,j)=>{
  123. req.getRequest('/api/content/category/list',{parentCode:code},res=>{
  124. r(res?res:[])
  125. })
  126. })
  127. },
  128. // 发现tab切换
  129. changeFxTab(index){
  130. if(this.fxIndex==index) return false;
  131. this.fxIndex = index
  132. this.isLoad = true
  133. this.page = 1
  134. this.getFxContenteList(this.fxList[this.fxIndex].code)
  135. },
  136. // 获取发现文章列表
  137. getFxContenteList() {
  138. let that = this;
  139. let isShowLoading = false;
  140. // console.log(that.isLoad);
  141. if (!that.isLoad) return false;
  142. that.isLoad = false;
  143. let form = {
  144. page: that.page,
  145. limit: 10,
  146. code:that.fxList[that.fxIndex].code
  147. };
  148. if (form.page == 1 && !isShowLoading) {
  149. req.loadIng('加载中');
  150. isShowLoading = true;
  151. }
  152. req.getRequest('/api/content/list', form, data => {
  153. if (data && data.length == 10) that.isLoad = true;
  154. if (that.page > 1) data = that.pageList.concat(data);
  155. if (!data || data.length < 10) {
  156. that.setData({
  157. hasmore: true
  158. });
  159. }
  160. if (data) {
  161. data.map(item => {
  162. if (item.start_time) {
  163. item.time = util.transTime(item.start_time);
  164. }
  165. return item;
  166. });
  167. }
  168. // console.log(data);
  169. that.setData({
  170. fxContentList: data
  171. });
  172. if (!this.pageList) {
  173. that.setData({
  174. ishow: true
  175. });
  176. } else {
  177. that.setData({
  178. ishow: false
  179. });
  180. }
  181. if (isShowLoading) {
  182. uni.hideLoading();
  183. isShowLoading = false;
  184. }
  185. });
  186. },
  187. captureTime(time) {
  188. return util.formatTime(new Date(time.replace(/\-/g, '/'))).t2;
  189. },
  190. // 视频浏览数
  191. getBrowse(libraryId) {
  192. let params = {
  193. bindId: libraryId,
  194. type: 7,//素材
  195. behavior:4//浏览
  196. }
  197. req.postRequest('/api/v3/behavior/save', params, data => {});
  198. },
  199. // 秒转换分秒
  200. getMinuteTime(data) {
  201. let minute = parseInt(data / 60);
  202. let second = parseInt(data % 60);
  203. if (minute.toString().length == 1) minute = `0${minute}`;
  204. if (second.toString().length == 1) second = `0${second}`;
  205. return `${minute}:${second}`;
  206. },
  207. unitFormat(data){
  208. return req.unitConverter(data).text
  209. },
  210. formatTime(date){
  211. date = new Date(date.replace(/-/g, '/'))
  212. return util.formatTime(date).t3
  213. }
  214. }
  215. };
  216. </script>
  217. <style>
  218. @import "./found.css";
  219. </style>