index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  1. <template>
  2. <view :data-theme="theme" class="discover_index">
  3. <view class="page_con" :style="{height: windowHeight + 'px'}">
  4. <view class="discover-header relative z-999">
  5. <!-- #ifdef APP || MP -->
  6. <view class="mp-header" :style="{ height: navH + 'rpx'}">
  7. <view class="sys-head" :style="{ height: sysHeight+'px' }"></view>
  8. <view class="select_nav flex justify-center align-center" id="home" :style="{top: sysHeight+6+'px'}">
  9. <text class="iconfont icon-fanhui2 px-20" @tap="returns"></text>
  10. <image @click="goUser" class="avatar" :src="userInfo.avatar ? userInfo.avatar : urlDomain+'crmebimage/presets/morenT.png'">
  11. </image>
  12. <!-- <text class="iconfont icon-gengduo5 px-20" @tap.stop="showNav"></text> -->
  13. <text class="nav_line"></text>
  14. </view>
  15. <view class="nav_title" :style="{ height: '80rpx',lineHeight: '80rpx', color: '#fff'}">
  16. 表白墙
  17. </view>
  18. </view>
  19. <!-- #endif -->
  20. <view class="discover-navTab acea-row row-middle bg--w111-fff" style="margin: 4rpx 0;">
  21. <view class="acea-row row-center-wrapper" :style="[textBoxStyle]">
  22. <view style="margin-right: 52rpx;" :class="tabActive == 0 ? 'on' : ''" class="nav-item" @click="tabActive=0;showCateDrawer = false">本校</view>
  23. <view :class="tabActive == 1 ? 'on' : ''" class="nav-item pb-10" @click="tabActive=1;">同城</view>
  24. </view>
  25. <!-- #ifndef MP -->
  26. <view style="width: 32rpx;"></view>
  27. <!-- #endif -->
  28. </view>
  29. <!-- 话题分类 -->
  30. <view class="longTab mb-10" scroll-y enhanced>
  31. <view class="flex h-116">
  32. <view class="flex-1 h-full flex-center longTab-item" :style="{background: index === tabClick ? '#EEF4FF' : ''}"
  33. v-for="(item, index) in categoryList" :key="index" :id="'id' + index" @click.stop="selectMenu(item, index, true)">
  34. <view class="flex-col flex-center">
  35. <image class="w-44 h-44 mb-10" :src="item.icon" mode=""></image>
  36. <view class="wall-font f-s-24 f-w-500">{{item.name}}</view>
  37. </view>
  38. </view>
  39. <view class="flex-1 h-full flex-center longTab-item">
  40. <navigator hover-class='none' url='/pages/merchant/user_sgin/index' class="item">
  41. <view class="flex-col flex-center">
  42. <image class="w-44 h-44 mb-10" :src="'/static/img/ic-wall-type-4.png'" mode=""></image>
  43. <view class="wall-font f-s-24 f-w-500">签到</view>
  44. </view>
  45. </navigator>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- banner轮播图 -->
  50. <view class="mb-10" v-if="bannerList.length">
  51. <swiper :indicator-dots="true" :autoplay="true" :interval="2500" :duration="500" circular="true">
  52. <block v-for="(item,index) in bannerList" :key='item.id'>
  53. <swiper-item>
  54. <view class="swiper-item">
  55. <image class="banner-img" :src="item.imageUrl" mode="scaleToFill" />
  56. </view>
  57. </swiper-item>
  58. </block>
  59. </swiper>
  60. </view>
  61. <!-- 提示 -->
  62. <view v-if="wallHeadline.length" class="flex-y-center bg--w111-fff mb-10 pl-32">
  63. <!-- 左侧固定图片 -->
  64. <text class='iconfont icon-laba ' style="font-size: 24rpx;margin-right: 20rpx;"></text>
  65. <!-- 右侧文字轮播区域 -->
  66. <view class="flex-1 h-40 mt-10" style="overflow: hidden;">
  67. <swiper class="swiper" :indicator-dots="false" circular :autoplay="true" :interval="3000" vertical>
  68. <block v-for="(item,index) in wallHeadline" :key='index'>
  69. <swiper-item catchtouchmove='catchTouchMove'>
  70. <view class='newsTitle swiper-item'>
  71. {{item.synopsis}}
  72. </view>
  73. </swiper-item>
  74. </block>
  75. </swiper>
  76. </view>
  77. </view>
  78. <scroll-view class="bg--w111-fff pt-10 pb-10 pl-32" scroll-x style="white-space: nowrap; vertical-align: middle;border-top-right-radius: 23rpx;"
  79. show-scrollbar="false">
  80. <view class='flex-y-center'>
  81. <text v-for="(item,index) in navList" :key="index" class='wall-nav' :class='active==item.id ? "wall-nav-on": ""'
  82. @click.stop="tabSelect(item.id, index)">
  83. <text>{{item.name}}</text>
  84. </text>
  85. </view>
  86. </scroll-view>
  87. </view>
  88. <view class="discover-boxsss">
  89. <!-- 发现 -->
  90. <scroll-view scroll-y="true" @scroll="followScroll" class="main h-full">
  91. <view class="tab-cont h-full" id="main">
  92. <!-- 发现 -->
  93. <view class="h-full" v-if="tabActive === 1">
  94. <swiper class="h-full" :interval="interval" indicator-color="rgba(255,255,255,0.6)" :current="swiperCurrent"
  95. @change="swiperChange">
  96. <block v-for="(item,index) in categoryList" :key="index">
  97. <swiper-item class="h-full" :item-id="`${item.id}`">
  98. <scroll-view @scroll="scrollLeft" scroll-y="true" :show-scrollbar="false" class="scroll-view h-full" id="goods"
  99. refresher-enabled="true" :refresher-threshold="100" :refresher-triggered="triggeredDiscover"
  100. @refresherrefresh="onRefreshDiscover" @refresherpulling="onPulling" @refresherrestore="onRestore"
  101. @refresherabort="onAbort">
  102. <view class="goods padbottom">
  103. <view class="goods-wrap flex-1" id="goods" v-if="discoverList[item.id] && discoverList[item.id].goods.length">
  104. <view>
  105. <WaterfallsFlow :column="true" v-if="discoverList[item.id].goods.length" :wfList="discoverList[item.id].goods"
  106. :fromType="1">
  107. </WaterfallsFlow>
  108. </view>
  109. </view>
  110. <view class='loadingicon acea-row row-center-wrapper'>
  111. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{discoverList[item.id] &&discoverList[item.id].goods.length>0?loadTitle:''}}
  112. </view>
  113. <view class="empty-boxs noContent" v-if="discoverList[item.id] && discoverList[item.id].goods.length == 0 && !loading">
  114. <emptyPage title="暂无内容~" mTop="13%" :imgSrc="urlDomain+'crmebimage/presets/noguanzhu.png'">
  115. </emptyPage>
  116. </view>
  117. <view class="footerBottoms"></view>
  118. </view>
  119. </scroll-view>
  120. </swiper-item>
  121. </block>
  122. </swiper>
  123. </view>
  124. <!-- 关注 登录后 -->
  125. <view id="goods" v-if="isLogin&&tabActive == 0" class="discover-detail h-full">
  126. <scroll-view scroll-y="true" :show-scrollbar="false" class="scroll-view recommendList h-full" id="recommendList"
  127. @scrolltolower="onTouchmoveRecommend" :refresher-threshold="100" @scroll="followScroll" refresher-enabled="true"
  128. :refresher-triggered="triggered" @refresherrefresh="onRefresh" @refresherpulling="onPulling" @refresherrestore="onRestore"
  129. @refresherabort="onAbort">
  130. <view class="goods padbottom">
  131. <view class="goods-wrap flex-1" id="goods" v-if="noteRecommendList.length">
  132. <view>
  133. <WaterfallsFlow v-if="noteRecommendList.length" :wfList="noteRecommendList" :fromType="1">
  134. </WaterfallsFlow>
  135. </view>
  136. </view>
  137. <view :hidden='loadingfollow==false' class='loadingicon acea-row row-center-wrapper'>
  138. <text class='loading iconfont icon-jiazai'></text>{{noteRecommendList.length>0?loadTitleFollow:''}}
  139. </view>
  140. <view v-if="isLogin&&tabActive == 0 && noteRecommendList.length===0 &&!loadingfollow" class="empty-boxs noContent">
  141. <emptyPage title="暂无更多内容~" mTop="0%" :imgSrc="urlDomain+'crmebimage/presets/noguanzhu.png'"></emptyPage>
  142. </view>
  143. </view>
  144. <!-- <discover-details v-if="noteRecommendList.length>0" type="follow"
  145. :noteRecommendList="noteRecommendList" @getComment="getComment"
  146. @getPro="getPro"></discover-details> -->
  147. <!-- 为你推荐 -->
  148. <view v-if="authorList.length>0 && !loadingfollow" class="author-list mt-24">
  149. <title-box title="为你推荐"></title-box>
  150. <view v-for="(item, index) in authorList" :key="item.authorId" class="author-item" @click="goAuthor(item)">
  151. <view class="acea-row row-between row-middle mb30">
  152. <view class="acea-row row-middle">
  153. <view class="author-head">
  154. <image :src="item.authorAvatar"></image>
  155. </view>
  156. <view class="author-info">
  157. <view class="author-name">{{item.authorName}}</view>
  158. <view v-show="item.authorSignature" class="author-sign line1">
  159. {{item.authorSignature}}
  160. </view>
  161. <view class="author-fans">
  162. 粉丝<text class="text-333 ml-8">{{ item.fansNum < 10000 ? item.fansNum : (item.fansNum / 10000).toFixed(2) }}</text>
  163. </view>
  164. </view>
  165. </view>
  166. <view @click.stop="followAuthor(item, index)" class="author-follow acea-row" :class="item.isConcerned ? 'focusBtn' : ''">
  167. <text v-if="!item.isConcerned" class="iconfont icon-shangpinshuliang-jia"></text>
  168. {{!item.isConcerned ? '关注' : '已关注'}}
  169. </view>
  170. </view>
  171. <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-full" show-scrollbar="false">
  172. <view class="inline-block mr-20" v-for="items in item.noteList" :key="items.id">
  173. <view class="relative">
  174. <easy-loadimage :image-src="items.cover" width="184rpx" height="254rpx" :radius="8"></easy-loadimage>
  175. <view class="discover_video_icon" v-show="items.type == 2">
  176. <text class="iconfont icon-24gf-play"></text>
  177. </view>
  178. </view>
  179. </view>
  180. </scroll-view>
  181. </view>
  182. <view class='loadingicon acea-row row-center-wrapper'>
  183. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{authorList.length>0?loadTitle:''}}
  184. </view>
  185. </view>
  186. <view class="footerBottoms"></view>
  187. </scroll-view>
  188. </view>
  189. <!-- 关注未登录 -->
  190. <view class="empty-boxs" v-if="!isLogin&&tabActive == 0">
  191. <emptyPage title="登录后可查看关注用户的内容哦~" mTop="30%" :imgSrc="urlDomain+'crmebimage/presets/nodenglu.png'"></emptyPage>
  192. <view class="btn" @click="openAuto">立即登录</view>
  193. </view>
  194. </view>
  195. </scroll-view>
  196. </view>
  197. <view class="publish" @click="publish" :class="bottomNavigationIsCustom?'bottom':''">
  198. <image class="w-116 h-116" src="/static/img/ic-fatie.png" mode=""></image>
  199. </view>
  200. </view>
  201. <!-- <pageFooter v-if="isShowFooter"></pageFooter> -->
  202. <!-- 评论 -->
  203. <uni-popup type="bottom" ref="comment">
  204. <view :style="'width: '+ windowWidth +'px; background-color: #fff; border-top-left-radius: 10px; border-top-right-radius: 10px;'">
  205. <discoverComment v-if="showComment" @getReplyNum="getReplyNum" :noteId="noteDetails.id" :noteDetails="noteDetails"
  206. @close="close">
  207. </discoverComment>
  208. </view>
  209. </uni-popup>
  210. <!-- 商品列表 -->
  211. <uni-popup type="bottom" ref="goods">
  212. <mentioned v-if="popupShow" :list="proList" @close="popup" class=""></mentioned>
  213. </uni-popup>
  214. <!-- 学校 -->
  215. <uni-popup ref="schoolRef" :is-mask-click="false">
  216. <view class="w-full flex-center" :style="{height: windowHeight + 'px'}">
  217. <navigator hover-class='none' url='/pages/discover/discover_user/index'>
  218. <image src="/static/img/ic-school.png" mode="heightFix" style="height: 694rpx;width: 616rpx;"></image>
  219. </navigator>
  220. </view>
  221. </uni-popup>
  222. </view>
  223. </template>
  224. <script>
  225. import {
  226. mapGetters
  227. } from "vuex";
  228. import {
  229. toLogin
  230. } from '@/libs/login.js';
  231. import {
  232. BACK_URL
  233. } from '@/config/cache';
  234. import {
  235. communityCategoryListApi,
  236. recommendAuthorListApi,
  237. discoverListApi,
  238. followListApi,
  239. getCommunityInfo
  240. } from '@/api/discover.js';
  241. import {
  242. discoverFollowAuthor,
  243. } from '@/libs/follow.js';
  244. import {
  245. tokenIsExistApi
  246. } from '@/api/api.js';
  247. import {
  248. silenceBindingSpread,
  249. getUserSpread
  250. } from '@/utils/index.js';
  251. import onShare from "@/mixins/onShare";
  252. import discoverComment from '@/components/discoverComment/index.vue';
  253. import animationType from '@/utils/animationType.js'
  254. import pageFooter from "@/components/pageFooter/index.vue";
  255. import navBar from '@/components/navBar';
  256. import emptyPage from '@/components/emptyPage.vue';
  257. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  258. import WaterfallsFlow from '@/components/WaterfallsFlow/WaterfallsFlow.vue'
  259. import WaterfallsFlowItem from '@/components/discoverFlowItem/discoverFlowItem.vue'
  260. import discoverDetails from '@/components/discoverDetails/index.vue'
  261. import mentioned from '@/components/mentioned.vue';
  262. import TitleBox from '@/components/titleBox/index.vue';
  263. let app = getApp();
  264. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  265. export default {
  266. mixins: [onShare],
  267. components: {
  268. pageFooter,
  269. navBar,
  270. emptyPage,
  271. easyLoadimage,
  272. WaterfallsFlowItem,
  273. WaterfallsFlow,
  274. discoverDetails,
  275. discoverComment,
  276. mentioned,
  277. TitleBox
  278. },
  279. computed: {
  280. ...mapGetters(['globalData', 'isLogin', 'userInfo', 'bottomNavigationIsCustom']),
  281. headerBoxStyle() {
  282. return {
  283. // #ifndef MP
  284. paddingTop: '4rpx',
  285. // #endif
  286. // #ifdef MP
  287. paddingTop: this.marTop + "px",
  288. marginRight: this.statusWidth + this.searchRight + 'px',
  289. // #endif
  290. }
  291. },
  292. textBoxStyle() {
  293. return {
  294. // #ifdef MP
  295. width: '100%',
  296. height: this.searchHeight + 'rpx',
  297. // lineHeight: this.searchHeight + 'rpx',
  298. // #endif
  299. }
  300. }
  301. },
  302. onLoad(options) {
  303. //分销码
  304. getUserSpread(options);
  305. this.windowWidth = uni.getSystemInfoSync().screenWidth; //获取屏幕宽度
  306. tokenIsExistApi().then(res => {
  307. this.tokenIsExist = res.data;
  308. if (this.tokenIsExist && this.isLogin) {
  309. this.getFollowList();
  310. setTimeout(() => {
  311. if (this.noteRecommendList.length === 0 || this.loadendfollow) this
  312. .getRecommendAuthorList();
  313. }, 500)
  314. }
  315. if (!this.tokenIsExist) {
  316. this.$store.commit('UPDATE_LOGIN', '');
  317. this.$store.commit('UPDATE_USERINFO', {});
  318. }
  319. })
  320. this.getDiscoverList();
  321. this.getCommunityCategoryList();
  322. this._freshing = false;
  323. },
  324. data() {
  325. return {
  326. returnShow: false,
  327. urlDomain: this.$Cache.get("imgHost"),
  328. sysHeight: sysHeight,
  329. navH: '',
  330. windowWidth: 0, //获取屏幕宽度🌟💗
  331. interval: 3000,
  332. swiperHeight: 0,
  333. listMarTop: 0,
  334. tabClick: 0, //设置导航点击了哪一个
  335. tabLeft: 0, //设置下划线位置
  336. isLeft: 0, //导航栏下划线位置
  337. isWidth: 0, //每个导航栏占位
  338. tabActive: 1, // 顶部关注、发现切换
  339. windowHeight: 0,
  340. theme: app.globalData.theme,
  341. marTop: 0,
  342. categoryList: [], //分类列表
  343. categoryId: '-1', //分类id
  344. swiperCurrent: 0, //分类索引
  345. isScroll: false, //是否是滑动
  346. params: { //推荐作者
  347. page: 1,
  348. limit: 10
  349. },
  350. followParams: { //关注内容
  351. page: 1,
  352. limit: 10
  353. },
  354. noteRecommendList: [], //关注内容
  355. loadendfollow: false, //关注内容
  356. loadingfollow: false, //关注内容
  357. where: {
  358. categoryId: 0,
  359. page: 1,
  360. limit: 10
  361. },
  362. loadend: false,
  363. loading: false,
  364. loadTitle: '加载更多',
  365. loadTitleFollow: '加载更多',
  366. onnnn: {
  367. good: [{
  368. authorId: 1
  369. }]
  370. },
  371. discoverList: {}, //内容信息
  372. authorList: [], //推荐作者列表
  373. isOpenRefresh: true, // 是否开启下拉
  374. triggered: false,
  375. triggeredDiscover: false,
  376. isShow: false, //加载完成
  377. tokenIsExist: false, //校验token是否有效,true为有效,false为无效
  378. isRefresher: false, //下拉刷新状态
  379. noteDetails: {}, //内容详情
  380. popupShow: false, //商品弹窗
  381. showComment: false, //评论弹窗
  382. proList: [], //提到的商品
  383. isShowFooter: true,
  384. loadingAuthor: false, //推荐作者
  385. showCateDrawer: false, //分类下拉展示
  386. searchRight: 0,
  387. statusWidth: 0,
  388. searchHeight: 0,
  389. bannerList: [],
  390. wallHeadline: [],
  391. navList: [{
  392. id: 0,
  393. name: '默认'
  394. }, {
  395. id: 1,
  396. name: '评论'
  397. }, {
  398. id: 2,
  399. name: '点赞'
  400. }, {
  401. id: 3,
  402. name: '有图'
  403. }],
  404. active: 0,
  405. }
  406. },
  407. // 滚动监听
  408. onPageScroll(e) {
  409. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  410. uni.$emit('scroll');
  411. },
  412. onShow() {
  413. this.getHandInfo();
  414. // this.reFresh()
  415. this.showCateDrawer = false;
  416. this.getTokenIsExist();
  417. //分销绑定
  418. silenceBindingSpread(this.isLogin, this.globalData.spread);
  419. },
  420. mounted() {
  421. this.$nextTick(function() {
  422. const query = uni.createSelectorQuery().in(this);
  423. query.select('.discover-header').boundingClientRect(data => {
  424. // #ifndef H5
  425. this.listMarTop = data.height
  426. // #endif
  427. // #ifdef H5
  428. this.listMarTop = data.height
  429. // #endif
  430. }).exec();
  431. });
  432. },
  433. created() {
  434. var pages = getCurrentPages();
  435. this.returnShow = pages.length === 1 ? false : true;
  436. var that = this;
  437. // 获取设备宽度
  438. uni.getSystemInfo({
  439. success(e) {
  440. that.isWidth = e.windowWidth / 6;
  441. that.windowHeight = e.windowHeight;
  442. that.swiperHeight = that.windowHeight - 205
  443. that.$set(that, 'swiperHeight', that.windowHeight - 55);
  444. }
  445. });
  446. // #ifdef MP || APP-PLUS
  447. // 获取导航高度;
  448. this.navH = this.globalData.navHeight;
  449. // #endif
  450. // #ifdef H5
  451. this.navH = 80;
  452. // #endif
  453. that.getNavH()
  454. // #ifdef MP
  455. const res = uni.getMenuButtonBoundingClientRect()
  456. const jnHeight = res.height //胶囊高度
  457. const statusHeight = res.top //胶囊距离顶部
  458. const statusRight = res.right //胶囊右边界坐标
  459. this.statusWidth = res.width
  460. this.searchHeight = 96
  461. console.log('999', statusHeight, this.sysHeight);
  462. this.marTop = statusHeight - this.sysHeight
  463. //搜索框宽度计算
  464. uni.getSystemInfo({
  465. success: res => {
  466. this.searchRight = res.windowWidth - statusRight
  467. }
  468. })
  469. // #endif
  470. },
  471. //uniapp小程序用deep重写组件样式不生效
  472. options: {
  473. styleIsolation: 'shared'
  474. },
  475. methods: {
  476. returns: function() {
  477. if (this.returnShow) {
  478. uni.navigateBack(-1);
  479. } else {
  480. uni.switchTab({
  481. url: '/pages/index/index'
  482. })
  483. }
  484. },
  485. getHandInfo() {
  486. getCommunityInfo().then(res => {
  487. this.bannerList = res.data.banner
  488. this.wallHeadline = res.data.headline
  489. console.log(res.data, 111111111111111)
  490. if (!res.data.school) {
  491. // this.$refs.schoolRef.open('top')
  492. } else {
  493. this.$refs.schoolRef.close()
  494. }
  495. }).catch(err => {
  496. console.log(err)
  497. })
  498. },
  499. getNavH(marTop) {
  500. // #ifdef H5
  501. this.marTop = 30;
  502. // #endif
  503. // #ifdef APP
  504. this.marTop = marTop - 60;
  505. // #endif
  506. },
  507. getPro(item) {
  508. this.noteDetails = item;
  509. this.proList = item.productList;
  510. this.$refs.goods.open('bottom');
  511. this.popupShow = true;
  512. setTimeout(() => {
  513. if (!this.bottomNavigationIsCustom) {
  514. uni.hideTabBar();
  515. } else {
  516. this.isShowFooter = false;
  517. }
  518. }, 50)
  519. },
  520. popup() {
  521. if (!this.bottomNavigationIsCustom) {
  522. uni.showTabBar();
  523. } else {
  524. this.isShowFooter = true;
  525. }
  526. setTimeout(() => {
  527. this.$refs.goods.close();
  528. this.popupShow = false;
  529. }, 100)
  530. },
  531. close() {
  532. if (!this.bottomNavigationIsCustom) {
  533. uni.showTabBar();
  534. } else {
  535. this.isShowFooter = true;
  536. }
  537. setTimeout(() => {
  538. this.$refs.comment.close();
  539. this.showComment = false;
  540. }, 100);
  541. },
  542. getReplyNum(n) {
  543. this.noteDetails.replyNum = n;
  544. },
  545. getComment(item) {
  546. this.noteDetails = item;
  547. this.$refs.comment.open('bottom');
  548. this.showComment = true;
  549. setTimeout(() => {
  550. if (!this.bottomNavigationIsCustom) {
  551. uni.hideTabBar();
  552. } else {
  553. this.isShowFooter = false;
  554. }
  555. }, 50)
  556. },
  557. //校验token是否有效,true为有效,false为无效
  558. getTokenIsExist() {
  559. tokenIsExistApi().then(res => {
  560. this.tokenIsExist = res.data;
  561. if (!this.tokenIsExist) {
  562. this.$store.commit('UPDATE_LOGIN', '');
  563. this.$store.commit('UPDATE_USERINFO', {});
  564. }
  565. })
  566. },
  567. // 去推荐作者个人主人
  568. goAuthor(item) {
  569. // #ifdef MP || H5
  570. uni.navigateTo({
  571. url: `/pages/discover/discover_user/index?id=${item.authorId}`
  572. })
  573. // #endif
  574. // #ifdef APP-PLUS
  575. uni.navigateTo({
  576. animationType: animationType.type,
  577. animationDuration: animationType.duration,
  578. url: `/pages/discover/discover_user/index?id=${item.authorId}`
  579. })
  580. // #endif
  581. },
  582. // 自定义下拉刷新被中止
  583. onAbort() {
  584. console.error("onAbort");
  585. },
  586. onPulling(e) {
  587. if (e.detail.deltaY < 0) return // 防止上滑页面也触发下拉
  588. if (this.tabActive == 1) {
  589. this.triggeredDiscover = true;
  590. } else {
  591. this.triggered = true;
  592. }
  593. },
  594. // 下拉刷新触发
  595. refresherpullingFun() {
  596. this.isRefresher = true
  597. },
  598. onRefreshDiscover() {
  599. if (this._freshing) return;
  600. this._freshing = true;
  601. setTimeout(() => {
  602. this._freshing = false;
  603. this.discoverList = {}
  604. this.getDiscoverList();
  605. this.triggeredDiscover = false;
  606. uni.stopPullDownRefresh();
  607. this._freshing = false;
  608. }, 1000)
  609. },
  610. onRefresh() {
  611. if (this._freshing) return;
  612. this._freshing = true;
  613. setTimeout(() => {
  614. this.loadendfollow = false;
  615. this.loadend = false;
  616. this.noteRecommendList = [];
  617. this.followParams.page = 1;
  618. this.authorList = [];
  619. this.params.page = 1;
  620. this.getFollowList();
  621. setTimeout(() => {
  622. if (this.noteRecommendList.length === 0 || this.loadendfollow) this
  623. .getRecommendAuthorList();
  624. }, 400)
  625. this.triggered = false
  626. uni.stopPullDownRefresh();
  627. this._freshing = false;
  628. }, 1000)
  629. },
  630. onRestore() {
  631. this.triggeredDiscover = false;
  632. },
  633. //关注内容
  634. getFollowList() {
  635. if (this.loadendfollow) {
  636. this.triggered = false;
  637. return;
  638. }
  639. this.loadingfollow = true;
  640. followListApi(this.followParams).then(res => {
  641. this.$set(this.followParams, 'page', this.followParams.page + 1);
  642. this.loadendfollow = this.followParams.page > res.data.totalPage;
  643. this.loadTitleFollow = this.loadendfollow ? '' : '加载更多';
  644. this.noteRecommendList = this.noteRecommendList.concat(res.data.list || []);
  645. this.loadingfollow = false
  646. this.triggered = false;
  647. }).catch(err => {
  648. this.loadingfollow = false;
  649. this.triggered = false;
  650. uni.showToast({
  651. title: err,
  652. icon: 'none'
  653. })
  654. });
  655. },
  656. // 关注作者
  657. followAuthor(item) {
  658. if (this.isLogin) {
  659. discoverFollowAuthor(item.authorId).then(() => {
  660. this.$set(item, 'isConcerned', !item.isConcerned);
  661. });
  662. } else {
  663. toLogin();
  664. }
  665. },
  666. //回退页面之后重新加载页面
  667. reFresh() {
  668. this.loading = true
  669. this.discoverList = {};
  670. this.getDiscoverList();
  671. },
  672. //发布内容
  673. publish() {
  674. if (this.isLogin) {
  675. // #ifdef MP || H5
  676. uni.navigateTo({
  677. url: `/pages/discover/discover_release/index`
  678. })
  679. // #endif
  680. // #ifdef APP-PLUS
  681. uni.navigateTo({
  682. animationType: animationType.type,
  683. animationDuration: animationType.duration,
  684. url: `/pages/discover/discover_release/index`
  685. })
  686. // #endif
  687. } else {
  688. toLogin();
  689. }
  690. },
  691. /**
  692. * 发现列表滑动中用到的方法
  693. */
  694. followScroll() {
  695. uni.$emit('scroll');
  696. },
  697. onTouchmoveRecommend(e) {
  698. if (!this.loadendfollow) this.getFollowList();
  699. if (this.loadendfollow && !this.loadend) this.getRecommendAuthorList();
  700. },
  701. onTouchmove(e) {
  702. this.getDiscoverList();
  703. },
  704. scrollLeft: function(e) {
  705. uni.$emit('scroll');
  706. if (e.detail.scrollTop > e.detail.scrollHeight - 1500) {
  707. this.getDiscoverList();
  708. }
  709. this.swiperHeight = this.windowHeight - 55
  710. },
  711. swiperChange(e) {
  712. let {
  713. current,
  714. source,
  715. currentItemId
  716. } = e.detail;
  717. if (source === 'autoplay' || source === 'touch') {
  718. this.categoryId = currentItemId;
  719. this.swiperCur = current
  720. this.selectMenu(this.categoryList[this.swiperCur], this.swiperCur, false)
  721. if (this.categoryList.length > 3) {
  722. var tempIndex = this.swiperCur - 2;
  723. tempIndex = tempIndex <= 0 ? 0 : tempIndex;
  724. let tabLeft = (this.swiperCur - 2) * this.isWidth; //设置下划线位置
  725. this.$nextTick(function() {
  726. this.$set(this, 'tabLeft', tabLeft);
  727. });
  728. }
  729. }
  730. },
  731. /*******************发现列表滑动中用到的方法结束*********************/
  732. // 去个人主人
  733. goUser() {
  734. if (!this.isLogin) {
  735. this.openAuto();
  736. } else {
  737. // #ifdef MP || H5
  738. uni.navigateTo({
  739. url: '/pages/discover/discover_user/index'
  740. })
  741. // #endif
  742. // #ifdef APP-PLUS
  743. uni.navigateTo({
  744. animationType: animationType.type,
  745. animationDuration: animationType.duration,
  746. url: '/pages/discover/discover_user/index'
  747. })
  748. // #endif
  749. }
  750. },
  751. // 打开授权
  752. openAuto() {
  753. this.$Cache.set(BACK_URL, '')
  754. toLogin();
  755. },
  756. //发现列表
  757. getDiscoverList() {
  758. let that = this;
  759. this.isShow = false;
  760. if (!this.discoverList[this.categoryId]) {
  761. this.$set(this.discoverList, this.categoryId, {
  762. where: {
  763. ...this.where,
  764. categoryId: this.categoryId,
  765. secondType: this.active
  766. },
  767. goods: []
  768. })
  769. }
  770. const data = this.discoverList[this.categoryId];
  771. const cateId = this.categoryId;
  772. if (data.loading || data.loadend) {
  773. this.triggeredDiscover = false;
  774. return
  775. };
  776. data.loading = true
  777. this.loading = true
  778. this.loadTitle = '';
  779. if (data.where.categoryId === 0) data.where.categoryId = ''
  780. discoverListApi(data.where).then(res => {
  781. data.loadend = res.data.list.length < that.where.limit;
  782. if (data.where.page == 1) {
  783. data.goods = [];
  784. }
  785. this.loadTitle = data.loadend ? '没有了' : '加载更多';
  786. data.goods.push.apply(data.goods, res.data.list);
  787. data.where.page = data.where.page + 1;
  788. that.$nextTick(() => {
  789. that.$set(that.discoverList, cateId, {
  790. ...data
  791. });
  792. });
  793. data.loading = false;
  794. this.loading = false;
  795. this.triggeredDiscover = false;
  796. this.$forceUpdate()
  797. console.log(that.discoverList)
  798. }).catch(err => {
  799. data.loading = false;
  800. this.loading = false;
  801. uni.showToast({
  802. title: err,
  803. icon: 'none'
  804. })
  805. this.$set(this.discoverList, cateId, data);
  806. });
  807. },
  808. //推荐作者列表
  809. getRecommendAuthorList() {
  810. if (this.loadend) return;
  811. this.loading = true
  812. recommendAuthorListApi(this.params).then(res => {
  813. this.$set(this.params, 'page', this.params.page + 1);
  814. this.loadend = this.params.page > res.data.totalPage;
  815. this.authorList = this.authorList.concat(res.data.list || []);
  816. this.loadTitle = this.loadend ? '没有了' : '加载更多';
  817. this.loading = false
  818. })
  819. },
  820. //分类列表
  821. getCommunityCategoryList() {
  822. let data = [{
  823. name: "全部",
  824. id: '-1',
  825. icon: '/static/img/ic-wall-type--1.png'
  826. }];
  827. communityCategoryListApi().then(res => {
  828. this.categoryList = Array.from(new Set([...data, ...res.data]));
  829. })
  830. },
  831. // 点击列表头部
  832. selectMenu(item, index, isScroll) {
  833. if (this.tabClick == index) return
  834. this.active = 0
  835. this.triggeredDiscover = false;
  836. this.categoryId = item.id;
  837. this.swiperCurrent = index;
  838. this.isScroll = isScroll;
  839. this.tabClick = index; //设置导航点击了哪一个
  840. this.isLeft = index * this.isWidth; //设置下划线位置
  841. this.where.categoryId = item.id;
  842. this.showCateDrawer = false
  843. this.getDiscoverList();
  844. },
  845. tabSelect(active, e) {
  846. if (this.active == active) return
  847. this.active = active;
  848. this.triggeredDiscover = false;
  849. this.discoverList[this.categoryId].loading = false
  850. this.discoverList[this.categoryId].loadend = false
  851. this.discoverList[this.categoryId].where.page = 1
  852. this.discoverList[this.categoryId].where.secondType = active
  853. this.getDiscoverList();
  854. },
  855. }
  856. }
  857. </script>
  858. <style lang="scss" scoped>
  859. /deep/.wf-page {
  860. background-color: #fff !important;
  861. }
  862. .discover_video_icon {
  863. top: 50% !important;
  864. left: 50% !important;
  865. right: 0 !important;
  866. -webkit-transform: translate(-50%, -50%);
  867. transform: translate(-50%, -50%);
  868. }
  869. .mp-header {
  870. background-color: $bg-color-primary;
  871. }
  872. .select_nav {
  873. width: 170rpx !important;
  874. height: 60rpx !important;
  875. border-radius: 33rpx;
  876. // background: rgba(255, 255, 255, 0.6);
  877. // border: 1rpx solid rgba(0, 0, 0, 0.1);
  878. color: #000;
  879. position: fixed;
  880. font-size: 18px;
  881. line-height: 58rpx;
  882. z-index: 1000;
  883. left: 14rpx;
  884. }
  885. .nav_title {
  886. // width: 200rpx;
  887. color: #fff;
  888. font-size: 36rpx;
  889. position: fixed;
  890. text-align: center;
  891. left: 0;
  892. right: 0;
  893. margin: auto;
  894. }
  895. .banner-img {
  896. width: 100%;
  897. height: 100%;
  898. }
  899. .newsTitle {
  900. font-weight: 400;
  901. font-size: 21rpx;
  902. color: #646464;
  903. }
  904. .active-topic {
  905. @include main_color(theme);
  906. @include coupons_light_color(theme);
  907. @include coupons_border_color(theme);
  908. }
  909. .padbottom {
  910. /* #ifndef H5 */
  911. padding-bottom: calc(100rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  912. padding-bottom: calc(100rpx + env(safe-area-inset-bottom)) !important;
  913. /* #endif */
  914. }
  915. .bottom {
  916. bottom: 218rpx !important;
  917. }
  918. .footerBottoms {
  919. width: 100%;
  920. /* #ifndef H5 */
  921. height: calc(200rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  922. height: calc(200rpx + env(safe-area-inset-bottom)) !important;
  923. /* #endif */
  924. /* #ifdef H5 */
  925. height: calc(100rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  926. height: calc(100rpx + env(safe-area-inset-bottom)) !important;
  927. /* #endif */
  928. }
  929. .discover_index {
  930. /deep/.no-border {
  931. bottom: 40rpx;
  932. }
  933. /deep/.author-list {
  934. padding-left: 24rpx;
  935. padding-right: 24rpx;
  936. }
  937. }
  938. .menu {
  939. // padding: 20rpx 34rpx 0 34rpx;
  940. // box-sizing: border-box;
  941. width: 100%;
  942. }
  943. .page_con {
  944. // position: fixed;
  945. top: 0;
  946. right: 0;
  947. bottom: 0;
  948. left: 0;
  949. display: flex;
  950. flex-direction: column;
  951. }
  952. .empty-boxs {
  953. margin: auto;
  954. }
  955. .goods {
  956. display: flex;
  957. flex-direction: column;
  958. justify-content: space-between;
  959. padding: 24rpx 24rpx 0 24rpx;
  960. background: #ffffff;
  961. }
  962. .publish {
  963. position: fixed;
  964. z-index: 999;
  965. width: 100rpx;
  966. height: 100rpx;
  967. opacity: 1;
  968. border-radius: 50%;
  969. bottom: 142rpx;
  970. right: 24rpx;
  971. color: #fff;
  972. line-height: 100rpx;
  973. text-align: center;
  974. @include linear-gradient(theme);
  975. .iconfont {
  976. font-size: 50rpx;
  977. }
  978. }
  979. .main {
  980. width: 100%;
  981. }
  982. .author {
  983. &-item {
  984. padding-bottom: 40rpx;
  985. }
  986. &-title {
  987. height: 120rpx;
  988. line-height: 120rpx;
  989. font-size: 32rpx;
  990. color: #333333;
  991. .iconfont {
  992. font-size: 170rpx;
  993. color: #454545;
  994. }
  995. .lefticon {
  996. transform: rotate(180deg);
  997. }
  998. }
  999. .name {
  1000. margin: 0 28rpx;
  1001. }
  1002. &-head {
  1003. width: 80rpx;
  1004. height: 80rpx;
  1005. border-radius: 50%;
  1006. overflow: hidden;
  1007. image {
  1008. width: 100%;
  1009. height: 100%;
  1010. }
  1011. margin-right: 20rpx;
  1012. }
  1013. &-name {
  1014. font-size: 28rpx;
  1015. font-family: PingFang SC-Medium, PingFang SC;
  1016. font-weight: 600;
  1017. color: #282828;
  1018. }
  1019. &-sign,
  1020. &-fans {
  1021. font-size: 22rpx;
  1022. font-family: PingFang SC-Regular, PingFang SC;
  1023. font-weight: 400;
  1024. color: #999999;
  1025. }
  1026. &-sign {
  1027. width: 370rpx;
  1028. }
  1029. &-pictrue {
  1030. width: 222rpx;
  1031. height: 222rpx;
  1032. border-radius: 10px 10px 10px 10px;
  1033. opacity: 1;
  1034. margin-right: 18rpx;
  1035. /deep/image,
  1036. /deep/.easy-loadimage,
  1037. uni-image {
  1038. width: 100%;
  1039. height: 100%;
  1040. border-radius: 10px 10px 10px 10px;
  1041. overflow: hidden;
  1042. }
  1043. }
  1044. &-pictrue:nth-of-type(3n) {
  1045. margin-right: 0;
  1046. }
  1047. }
  1048. .noContent {
  1049. /deep/.empty-box {
  1050. padding-top: 80rpx !important;
  1051. }
  1052. }
  1053. .btn {
  1054. width: 440rpx;
  1055. height: 86rpx;
  1056. line-height: 86rpx;
  1057. text-align: center;
  1058. border-radius: 43rpx 43rpx 43rpx 43rpx;
  1059. opacity: 1;
  1060. border: 1px solid #E93323;
  1061. font-size: 32rpx;
  1062. margin: auto;
  1063. font-family: PingFang SC-Medium, PingFang SC;
  1064. @include main_color(theme);
  1065. @include coupons_border_color(theme);
  1066. font-weight: 600;
  1067. }
  1068. .cart_nav {
  1069. /deep/.nav_title {
  1070. font-size: 36rpx;
  1071. color: #333333;
  1072. }
  1073. }
  1074. .discover {
  1075. &-header {
  1076. background-size: cover;
  1077. top: 0;
  1078. left: 0;
  1079. .title {
  1080. font-size: 36rpx;
  1081. color: #333333;
  1082. }
  1083. }
  1084. &-navTab {
  1085. padding: 0 34rpx 0 34rpx;
  1086. justify-content: space-between;
  1087. .icon-xiazai5 {
  1088. color: #333;
  1089. }
  1090. .nav-item {
  1091. display: inline-block;
  1092. font-weight: 500;
  1093. font-size: 31rpx;
  1094. color: #B2B2B2;
  1095. &.on {
  1096. font-weight: 600;
  1097. font-size: 35rpx;
  1098. color: #141414;
  1099. border-bottom: 5rpx solid;
  1100. border-image: linear-gradient(90deg, #FFCA5F 0%, #FF1B95 100%);
  1101. border-image-slice: 1;
  1102. }
  1103. }
  1104. .release_btn {
  1105. width: 58rpx;
  1106. height: 58rpx;
  1107. border-radius: 100%;
  1108. background-image: linear-gradient(126deg, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  1109. color: #fff;
  1110. position: absolute;
  1111. top: 20rpx;
  1112. left: 0;
  1113. .iconfont {
  1114. font-size: 28rpx;
  1115. }
  1116. }
  1117. }
  1118. &-box {
  1119. flex: 1;
  1120. min-height: 83vh;
  1121. height: auto;
  1122. width: 100%;
  1123. background-color: #fff;
  1124. left: 0;
  1125. }
  1126. }
  1127. .avatar {
  1128. width: 64rpx;
  1129. height: 64rpx;
  1130. border-radius: 50%;
  1131. }
  1132. .h96 {
  1133. height: 96rpx;
  1134. }
  1135. .h36 {
  1136. /* #ifdef H5 */
  1137. height: 28rpx;
  1138. /* #endif */
  1139. /* #ifndef H5 */
  1140. height: 18rpx;
  1141. /* #endif */
  1142. }
  1143. .longTab {
  1144. width: 100%;
  1145. background: #fff;
  1146. border-radius: 16rpx 16rpx 0 0;
  1147. .longTab-item {
  1148. /*解决ios上滑动不流畅*/
  1149. -webkit-overflow-scrolling: touch;
  1150. position: relative;
  1151. }
  1152. .longItem {
  1153. height: 50upx;
  1154. display: inline-block;
  1155. text-align: center;
  1156. font-size: 30rpx;
  1157. color: #999999;
  1158. // margin-right: 56rpx;
  1159. text {
  1160. display: block;
  1161. max-width: 326rpx;
  1162. white-space: nowrap;
  1163. overflow: hidden;
  1164. text-overflow: ellipsis;
  1165. }
  1166. &:last-child {
  1167. margin-right: 0;
  1168. }
  1169. /*解决ios上滑动不流畅*/
  1170. -webkit-overflow-scrolling: touch;
  1171. position: relative;
  1172. &.click {
  1173. background: #EEF4FF;
  1174. // font-weight: bold;
  1175. // font-size: 34rpx;
  1176. // @include main_color(theme);
  1177. // &::after {
  1178. // content: "";
  1179. // display: block;
  1180. // width: 40rpx;
  1181. // height: 5rpx;
  1182. // @include main_bg_color(theme);
  1183. // display: flex;
  1184. // position: absolute;
  1185. // left: 50%;
  1186. // margin-left: -22rpx;
  1187. // bottom: -8rpx;
  1188. // }
  1189. // .underline {
  1190. // opacity: 1;
  1191. // }
  1192. }
  1193. }
  1194. .underlineBox {
  1195. height: 3px;
  1196. width: 20%;
  1197. display: flex;
  1198. align-content: center;
  1199. justify-content: center;
  1200. .underline {
  1201. opacity: 0;
  1202. width: 60rpx;
  1203. height: 4rpx;
  1204. background-color: #e93323;
  1205. }
  1206. }
  1207. }
  1208. .author-fans {
  1209. font-size: 24rpx !important;
  1210. }
  1211. .container {
  1212. overflow: hidden;
  1213. /* 隐藏超出部分 */
  1214. }
  1215. .swiper {
  1216. display: flex;
  1217. /* 使用flex布局 */
  1218. animation: scrollRight 10s linear infinite;
  1219. /* 应用动画 */
  1220. }
  1221. .swiper-item {
  1222. flex-shrink: 0;
  1223. /* 不允许缩小 */
  1224. width: 100%;
  1225. /* 每个item占满一行 */
  1226. height: 100%;
  1227. }
  1228. @keyframes scrollRight {
  1229. from {
  1230. transform: translateX(100%);
  1231. }
  1232. /* 从右向左移动 */
  1233. to {
  1234. transform: translateX(-100%);
  1235. }
  1236. /* 移出视图 */
  1237. }
  1238. .wall-nav {
  1239. font-weight: 500;
  1240. font-size: 23rpx;
  1241. color: #999999;
  1242. }
  1243. .wall-nav~.wall-nav {
  1244. margin-left: 38rpx;
  1245. }
  1246. .wall-nav-on {
  1247. font-weight: 600;
  1248. font-size: 27rpx;
  1249. color: #141414;
  1250. }
  1251. .discover-boxsss {
  1252. background-color: #fff;
  1253. width: 100%;
  1254. flex: 1;
  1255. }
  1256. </style>