found.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. <update-userinfonew :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfonew>
  55. </view>
  56. </template>
  57. <script>
  58. // pages/live/live.js
  59. const app = getApp();
  60. const req = require("../../utils/request.js");
  61. const util = require("../../utils/util.js");
  62. import foot from "../../components/nav-bar/index";
  63. export default {
  64. data() {
  65. return {
  66. picUrlss: req.public.picUrls,
  67. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  68. page: 1,
  69. pageList: [],
  70. searchVal:'',
  71. isLoad: true,
  72. isUpdate: false, // 是否更新消息
  73. hasmore: false,
  74. ishow: false,
  75. videoList:[],
  76. videoCurrent:null,//当前正在播放的视频下标
  77. config:{},
  78. isFullScreen:false,//是否正在全屏播放
  79. swiperPlayIndex:0,
  80. fxList:[],
  81. fxContentList:[],
  82. fxIndex:0,
  83. xbrmCode:req.public.xbrmCode,
  84. tbalCode:req.public.tbalCode,
  85. lpalCode:req.public.lpalCode,
  86. recommendList:[],
  87. isShowUpdate: false, //是否显示更新信息弹窗
  88. isUpdateInfo: false,//更新用户信息
  89. isUpdateMobile: false,//绑定手机号
  90. };
  91. },
  92. components: {
  93. foot
  94. },
  95. props: {},
  96. async onLoad() { // this.getList()
  97. await this.getConfig()
  98. this.getFx()
  99. this.getRecommendList()
  100. req.saveBehaviorNew('',14,4)
  101. },
  102. onShow() {
  103. this.setData({
  104. isUpdate: !this.isUpdate
  105. });
  106. this.getUpdate()
  107. },
  108. onReachBottom() {
  109. this.page++;
  110. this.getFxContenteList();
  111. },
  112. methods: {
  113. // 获取文章栏目推荐列表
  114. getRecommendList(){
  115. return new Promise((r,j)=>{
  116. req.getRequest('/api/content/category/list',{isRecommend:1},res=>{
  117. this.recommendList = res?res:[]
  118. // this.recommendList = this.fxList
  119. r(res?res:[])
  120. })
  121. })
  122. },
  123. getConfig() {
  124. return new Promise((resolve, reject) => {
  125. req.getRequest('/api/other/config', {}, (res)=> {
  126. this.config = res;
  127. resolve(res)
  128. });
  129. });
  130. },
  131. jumpUrl(url) {
  132. // if (!req.isLogins(true)) {
  133. // return;
  134. // }
  135. uni.navigateTo({
  136. url: url
  137. });
  138. },
  139. // 获取发现
  140. async getFx(){
  141. this.fxList = await this.getContentList(req.public.fxCode)
  142. this.getFxContenteList()
  143. },
  144. // 获取文章栏目列表
  145. getContentList(code){
  146. return new Promise((r,j)=>{
  147. req.getRequest('/api/content/category/list',{parentCode:code},res=>{
  148. r(res?res:[])
  149. })
  150. })
  151. },
  152. // 发现tab切换
  153. changeFxTab(index){
  154. if(this.fxIndex==index) return false;
  155. this.fxIndex = index
  156. this.isLoad = true
  157. this.page = 1
  158. this.getFxContenteList(this.fxList[this.fxIndex].code)
  159. },
  160. // 获取发现文章列表
  161. getFxContenteList() {
  162. let that = this;
  163. let isShowLoading = false;
  164. // console.log(that.isLoad);
  165. if (!that.isLoad) return false;
  166. that.isLoad = false;
  167. let form = {
  168. page: that.page,
  169. limit: 10,
  170. code:that.fxList[that.fxIndex].code
  171. };
  172. if(this.searchVal){
  173. form.title=this.searchVal
  174. }else{
  175. delete form.title
  176. }
  177. if (form.page == 1 && !isShowLoading) {
  178. req.loadIng('加载中');
  179. isShowLoading = true;
  180. }
  181. if(req.getStorage("shareId")){
  182. form.shareSaleNo = req.getStorage("shareId")
  183. }
  184. req.getRequest('/api/content/list', form, data => {
  185. if (data && data.length == 10) that.isLoad = true;
  186. if (that.page > 1) data = that.pageList.concat(data);
  187. if (!data || data.length < 10) {
  188. that.setData({
  189. hasmore: true
  190. });
  191. }
  192. if (data) {
  193. data.map(item => {
  194. if (item.start_time) {
  195. item.time = util.transTime(item.start_time);
  196. }
  197. return item;
  198. });
  199. }
  200. // console.log(data);
  201. that.setData({
  202. fxContentList: data
  203. });
  204. if (!this.pageList) {
  205. that.setData({
  206. ishow: true
  207. });
  208. } else {
  209. that.setData({
  210. ishow: false
  211. });
  212. }
  213. if (isShowLoading) {
  214. uni.hideLoading();
  215. isShowLoading = false;
  216. }
  217. });
  218. },
  219. searchFn(){
  220. this.isLoad = true
  221. this.page = 1
  222. this.getFxContenteList(this.fxList[this.fxIndex].code)
  223. },
  224. captureTime(time) {
  225. return util.formatTime(new Date(time.replace(/\-/g, '/'))).t2;
  226. },
  227. // 视频浏览数
  228. getBrowse(libraryId) {
  229. let params = {
  230. bindId: libraryId,
  231. type: 7,//素材
  232. behavior:4//浏览
  233. }
  234. req.postRequest('/api/v3/behavior/save', params, data => {});
  235. },
  236. // 秒转换分秒
  237. getMinuteTime(data) {
  238. let minute = parseInt(data / 60);
  239. let second = parseInt(data % 60);
  240. if (minute.toString().length == 1) minute = `0${minute}`;
  241. if (second.toString().length == 1) second = `0${second}`;
  242. return `${minute}:${second}`;
  243. },
  244. unitFormat(data){
  245. return req.unitConverter(data).text
  246. },
  247. formatTime(date){
  248. date = new Date(date.replace(/-/g, '/'))
  249. return util.formatTime(date).t3
  250. },
  251. closeUpdate(){
  252. this.isShowUpdate = false
  253. },
  254. updateInfo(e){
  255. this.isUpdateInfo = e;
  256. },
  257. updateMobile(e){
  258. this.isUpdateMobile = e;
  259. },
  260. getUpdate() {
  261. console.log('getUpdate')
  262. let userInfos = req.getStorage('userInfo')
  263. // if ((!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || !userInfos.nickName || userInfos.nickName.indexOf('用户') > -1) ) {
  264. // console.log('没有昵称')
  265. // this.isShowUpdate = true;
  266. // this.isUpdateInfo = true;
  267. // return false;
  268. // }
  269. if(!userInfos.mobile){
  270. console.log('没有手机号')
  271. this.isShowUpdate = true
  272. this.isUpdateMobile = true
  273. return false;
  274. }
  275. return true;
  276. },
  277. }
  278. };
  279. </script>
  280. <style>
  281. @import "./found.css";
  282. </style>