found.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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">
  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'+(config.greyTheme==1?' grayTheme':'')">
  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 tovers3">{{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. searchVal:'',
  68. isLoad: true,
  69. isUpdate: false, // 是否更新消息
  70. hasmore: false,
  71. ishow: false,
  72. videoList:[],
  73. videoCurrent:null,//当前正在播放的视频下标
  74. config:{},
  75. isFullScreen:false,//是否正在全屏播放
  76. swiperPlayIndex:0,
  77. fxList:[],
  78. fxContentList:[],
  79. fxIndex:0,
  80. xbrmCode:req.public.xbrmCode,
  81. tbalCode:req.public.tbalCode,
  82. lpalCode:req.public.lpalCode
  83. };
  84. },
  85. components: {
  86. foot
  87. },
  88. props: {},
  89. async onLoad() { // this.getList()
  90. await this.getConfig()
  91. this.getFx()
  92. },
  93. onShow() {
  94. this.setData({
  95. isUpdate: !this.isUpdate
  96. });
  97. },
  98. onReachBottom() {
  99. this.page++;
  100. this.getFxContenteList();
  101. },
  102. methods: {
  103. getConfig() {
  104. return new Promise((resolve, reject) => {
  105. req.getRequest('/api/other/config', {}, (res)=> {
  106. this.config = res;
  107. resolve(res)
  108. });
  109. });
  110. },
  111. jumpUrl(url) {
  112. // if (!req.isLogins(true)) {
  113. // return;
  114. // }
  115. uni.navigateTo({
  116. url: url
  117. });
  118. },
  119. // 获取发现
  120. async getFx(){
  121. this.fxList = await this.getContentList(req.public.fxCode)
  122. this.getFxContenteList()
  123. },
  124. // 获取文章栏目列表
  125. getContentList(code){
  126. return new Promise((r,j)=>{
  127. req.getRequest('/api/content/category/list',{parentCode:code},res=>{
  128. r(res?res:[])
  129. })
  130. })
  131. },
  132. // 发现tab切换
  133. changeFxTab(index){
  134. if(this.fxIndex==index) return false;
  135. this.fxIndex = index
  136. this.isLoad = true
  137. this.page = 1
  138. this.getFxContenteList(this.fxList[this.fxIndex].code)
  139. },
  140. // 获取发现文章列表
  141. getFxContenteList() {
  142. let that = this;
  143. let isShowLoading = false;
  144. // console.log(that.isLoad);
  145. if (!that.isLoad) return false;
  146. that.isLoad = false;
  147. let form = {
  148. page: that.page,
  149. limit: 10,
  150. code:that.fxList[that.fxIndex].code
  151. };
  152. if(this.searchVal){
  153. form.title=this.searchVal
  154. }else{
  155. delete form.title
  156. }
  157. if (form.page == 1 && !isShowLoading) {
  158. req.loadIng('加载中');
  159. isShowLoading = true;
  160. }
  161. if(req.getStorage("shareId")){
  162. form.shareSaleNo = req.getStorage("shareId")
  163. }
  164. req.getRequest('/api/content/list', form, data => {
  165. if (data && data.length == 10) that.isLoad = true;
  166. if (that.page > 1) data = that.pageList.concat(data);
  167. if (!data || data.length < 10) {
  168. that.setData({
  169. hasmore: true
  170. });
  171. }
  172. if (data) {
  173. data.map(item => {
  174. if (item.start_time) {
  175. item.time = util.transTime(item.start_time);
  176. }
  177. return item;
  178. });
  179. }
  180. // console.log(data);
  181. that.setData({
  182. fxContentList: data
  183. });
  184. if (!this.pageList) {
  185. that.setData({
  186. ishow: true
  187. });
  188. } else {
  189. that.setData({
  190. ishow: false
  191. });
  192. }
  193. if (isShowLoading) {
  194. uni.hideLoading();
  195. isShowLoading = false;
  196. }
  197. });
  198. },
  199. searchFn(){
  200. this.isLoad = true
  201. this.page = 1
  202. this.getFxContenteList(this.fxList[this.fxIndex].code)
  203. },
  204. captureTime(time) {
  205. return util.formatTime(new Date(time.replace(/\-/g, '/'))).t2;
  206. },
  207. // 视频浏览数
  208. getBrowse(libraryId) {
  209. let params = {
  210. bindId: libraryId,
  211. type: 7,//素材
  212. behavior:4//浏览
  213. }
  214. req.postRequest('/api/v3/behavior/save', params, data => {});
  215. },
  216. // 秒转换分秒
  217. getMinuteTime(data) {
  218. let minute = parseInt(data / 60);
  219. let second = parseInt(data % 60);
  220. if (minute.toString().length == 1) minute = `0${minute}`;
  221. if (second.toString().length == 1) second = `0${second}`;
  222. return `${minute}:${second}`;
  223. },
  224. unitFormat(data){
  225. return req.unitConverter(data).text
  226. },
  227. formatTime(date){
  228. date = new Date(date.replace(/-/g, '/'))
  229. return util.formatTime(date).t3
  230. }
  231. }
  232. };
  233. </script>
  234. <style>
  235. @import "./found.css";
  236. </style>