found.vue 7.2 KB

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