found.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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" @click="jumpUrl('/topic/contentList/contentList?code='+xbrmCode+'&title=小白入门')"></image>
  13. <image src="/static/images/tbal.png" @click="jumpUrl('/topic/contentList/contentList?code='+tbalCode+'&title=投保案例')"></image>
  14. <image src="/static/images/lpal.png" @click="jumpUrl('/topic/contentList/contentList?code='+lpalCode+'&title=理赔案例')"></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="item.contentType==2" 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="!fxContentList||fxContentList.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. xbrmCode:req.public.xbrmCode,
  80. tbalCode:req.public.tbalCode,
  81. lpalCode:req.public.lpalCode
  82. };
  83. },
  84. components: {
  85. foot
  86. },
  87. props: {},
  88. async onLoad() { // this.getList()
  89. await this.getConfig()
  90. this.getFx()
  91. },
  92. onShow() {
  93. this.setData({
  94. isUpdate: !this.isUpdate
  95. });
  96. },
  97. onReachBottom() {
  98. this.page++;
  99. this.getFxContenteList();
  100. },
  101. methods: {
  102. getConfig() {
  103. return new Promise((resolve, reject) => {
  104. req.getRequest('/api/other/config', {}, (res)=> {
  105. this.config = res;
  106. resolve(res)
  107. });
  108. });
  109. },
  110. jumpUrl(url) {
  111. // if (!req.isLogins(true)) {
  112. // return;
  113. // }
  114. uni.navigateTo({
  115. url: url
  116. });
  117. },
  118. // 获取发现
  119. async getFx(){
  120. this.fxList = await this.getContentList(req.public.fxCode)
  121. this.getFxContenteList()
  122. },
  123. // 获取文章栏目列表
  124. getContentList(code){
  125. return new Promise((r,j)=>{
  126. req.getRequest('/api/content/category/list',{parentCode:code},res=>{
  127. r(res?res:[])
  128. })
  129. })
  130. },
  131. // 发现tab切换
  132. changeFxTab(index){
  133. if(this.fxIndex==index) return false;
  134. this.fxIndex = index
  135. this.isLoad = true
  136. this.page = 1
  137. this.getFxContenteList(this.fxList[this.fxIndex].code)
  138. },
  139. // 获取发现文章列表
  140. getFxContenteList() {
  141. let that = this;
  142. let isShowLoading = false;
  143. // console.log(that.isLoad);
  144. if (!that.isLoad) return false;
  145. that.isLoad = false;
  146. let form = {
  147. page: that.page,
  148. limit: 10,
  149. code:that.fxList[that.fxIndex].code
  150. };
  151. if (form.page == 1 && !isShowLoading) {
  152. req.loadIng('加载中');
  153. isShowLoading = true;
  154. }
  155. req.getRequest('/api/content/list', form, data => {
  156. if (data && data.length == 10) that.isLoad = true;
  157. if (that.page > 1) data = that.pageList.concat(data);
  158. if (!data || data.length < 10) {
  159. that.setData({
  160. hasmore: true
  161. });
  162. }
  163. if (data) {
  164. data.map(item => {
  165. if (item.start_time) {
  166. item.time = util.transTime(item.start_time);
  167. }
  168. return item;
  169. });
  170. }
  171. // console.log(data);
  172. that.setData({
  173. fxContentList: data
  174. });
  175. if (!this.pageList) {
  176. that.setData({
  177. ishow: true
  178. });
  179. } else {
  180. that.setData({
  181. ishow: false
  182. });
  183. }
  184. if (isShowLoading) {
  185. uni.hideLoading();
  186. isShowLoading = false;
  187. }
  188. });
  189. },
  190. captureTime(time) {
  191. return util.formatTime(new Date(time.replace(/\-/g, '/'))).t2;
  192. },
  193. // 视频浏览数
  194. getBrowse(libraryId) {
  195. let params = {
  196. bindId: libraryId,
  197. type: 7,//素材
  198. behavior:4//浏览
  199. }
  200. req.postRequest('/api/v3/behavior/save', params, data => {});
  201. },
  202. // 秒转换分秒
  203. getMinuteTime(data) {
  204. let minute = parseInt(data / 60);
  205. let second = parseInt(data % 60);
  206. if (minute.toString().length == 1) minute = `0${minute}`;
  207. if (second.toString().length == 1) second = `0${second}`;
  208. return `${minute}:${second}`;
  209. },
  210. unitFormat(data){
  211. return req.unitConverter(data).text
  212. },
  213. formatTime(date){
  214. date = new Date(date.replace(/-/g, '/'))
  215. return util.formatTime(date).t3
  216. }
  217. }
  218. };
  219. </script>
  220. <style>
  221. @import "./found.css";
  222. </style>