found.vue 9.1 KB

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