index.vue 34 KB

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