index.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  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'
  82. :class='active==item.id ? "wall-nav-on": ""' @click.stop="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 (this.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.triggeredDiscover = false;
  831. this.discoverList[this.categoryId].loading = false
  832. this.discoverList[this.categoryId].loadend = false
  833. this.getDiscoverList();
  834. },
  835. }
  836. }
  837. </script>
  838. <style lang="scss" scoped>
  839. /deep/.wf-page {
  840. background-color: #fff !important;
  841. }
  842. .discover_video_icon {
  843. top: 50% !important;
  844. left: 50% !important;
  845. right: 0 !important;
  846. -webkit-transform: translate(-50%, -50%);
  847. transform: translate(-50%, -50%);
  848. }
  849. .mp-header {
  850. background-color: $bg-color-primary;
  851. }
  852. .select_nav {
  853. width: 170rpx !important;
  854. height: 60rpx !important;
  855. border-radius: 33rpx;
  856. // background: rgba(255, 255, 255, 0.6);
  857. // border: 1rpx solid rgba(0, 0, 0, 0.1);
  858. color: #000;
  859. position: fixed;
  860. font-size: 18px;
  861. line-height: 58rpx;
  862. z-index: 1000;
  863. left: 14rpx;
  864. }
  865. .nav_title {
  866. // width: 200rpx;
  867. color: #fff;
  868. font-size: 36rpx;
  869. position: fixed;
  870. text-align: center;
  871. left: 0;
  872. right: 0;
  873. margin: auto;
  874. }
  875. .banner-img {
  876. width: 100%;
  877. height: 100%;
  878. }
  879. .newsTitle {
  880. font-weight: 400;
  881. font-size: 21rpx;
  882. color: #646464;
  883. }
  884. .active-topic {
  885. @include main_color(theme);
  886. @include coupons_light_color(theme);
  887. @include coupons_border_color(theme);
  888. }
  889. .padbottom {
  890. /* #ifndef H5 */
  891. padding-bottom: calc(100rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  892. padding-bottom: calc(100rpx + env(safe-area-inset-bottom)) !important;
  893. /* #endif */
  894. }
  895. .bottom {
  896. bottom: 218rpx !important;
  897. }
  898. .footerBottoms {
  899. width: 100%;
  900. /* #ifndef H5 */
  901. height: calc(200rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  902. height: calc(200rpx + env(safe-area-inset-bottom)) !important;
  903. /* #endif */
  904. /* #ifdef H5 */
  905. height: calc(100rpx+ constant(safe-area-inset-bottom)) !important; ///兼容 IOS<11.2/
  906. height: calc(100rpx + env(safe-area-inset-bottom)) !important;
  907. /* #endif */
  908. }
  909. .discover_index {
  910. /deep/.no-border {
  911. bottom: 40rpx;
  912. }
  913. /deep/.author-list {
  914. padding-left: 24rpx;
  915. padding-right: 24rpx;
  916. }
  917. }
  918. .menu {
  919. // padding: 20rpx 34rpx 0 34rpx;
  920. // box-sizing: border-box;
  921. width: 100%;
  922. }
  923. .page_con {
  924. position: fixed;
  925. top: 0;
  926. right: 0;
  927. bottom: 0;
  928. left: 0;
  929. display: flex;
  930. flex-direction: column;
  931. }
  932. .empty-boxs {
  933. margin: auto;
  934. }
  935. .goods {
  936. display: flex;
  937. flex-wrap: wrap;
  938. justify-content: space-between;
  939. padding: 24rpx 24rpx 0 24rpx;
  940. background: #ffffff;
  941. }
  942. .publish {
  943. position: fixed;
  944. z-index: 9999;
  945. width: 100rpx;
  946. height: 100rpx;
  947. opacity: 1;
  948. border-radius: 50%;
  949. bottom: 142rpx;
  950. right: 24rpx;
  951. color: #fff;
  952. line-height: 100rpx;
  953. text-align: center;
  954. @include linear-gradient(theme);
  955. .iconfont {
  956. font-size: 50rpx;
  957. }
  958. }
  959. .main {
  960. width: 100%;
  961. }
  962. .author {
  963. &-item {
  964. padding-bottom: 40rpx;
  965. }
  966. &-title {
  967. height: 120rpx;
  968. line-height: 120rpx;
  969. font-size: 32rpx;
  970. color: #333333;
  971. .iconfont {
  972. font-size: 170rpx;
  973. color: #454545;
  974. }
  975. .lefticon {
  976. transform: rotate(180deg);
  977. }
  978. }
  979. .name {
  980. margin: 0 28rpx;
  981. }
  982. &-head {
  983. width: 80rpx;
  984. height: 80rpx;
  985. border-radius: 50%;
  986. overflow: hidden;
  987. image {
  988. width: 100%;
  989. height: 100%;
  990. }
  991. margin-right: 20rpx;
  992. }
  993. &-name {
  994. font-size: 28rpx;
  995. font-family: PingFang SC-Medium, PingFang SC;
  996. font-weight: 600;
  997. color: #282828;
  998. }
  999. &-sign,
  1000. &-fans {
  1001. font-size: 22rpx;
  1002. font-family: PingFang SC-Regular, PingFang SC;
  1003. font-weight: 400;
  1004. color: #999999;
  1005. }
  1006. &-sign {
  1007. width: 370rpx;
  1008. }
  1009. &-pictrue {
  1010. width: 222rpx;
  1011. height: 222rpx;
  1012. border-radius: 10px 10px 10px 10px;
  1013. opacity: 1;
  1014. margin-right: 18rpx;
  1015. /deep/image,
  1016. /deep/.easy-loadimage,
  1017. uni-image {
  1018. width: 100%;
  1019. height: 100%;
  1020. border-radius: 10px 10px 10px 10px;
  1021. overflow: hidden;
  1022. }
  1023. }
  1024. &-pictrue:nth-of-type(3n) {
  1025. margin-right: 0;
  1026. }
  1027. }
  1028. .noContent {
  1029. /deep/.empty-box {
  1030. padding-top: 80rpx !important;
  1031. }
  1032. }
  1033. .btn {
  1034. width: 440rpx;
  1035. height: 86rpx;
  1036. line-height: 86rpx;
  1037. text-align: center;
  1038. border-radius: 43rpx 43rpx 43rpx 43rpx;
  1039. opacity: 1;
  1040. border: 1px solid #E93323;
  1041. font-size: 32rpx;
  1042. margin: auto;
  1043. font-family: PingFang SC-Medium, PingFang SC;
  1044. @include main_color(theme);
  1045. @include coupons_border_color(theme);
  1046. font-weight: 600;
  1047. }
  1048. .cart_nav {
  1049. /deep/.nav_title {
  1050. font-size: 36rpx;
  1051. color: #333333;
  1052. }
  1053. }
  1054. .discover {
  1055. &-header {
  1056. background-size: cover;
  1057. top: 0;
  1058. left: 0;
  1059. .title {
  1060. font-size: 36rpx;
  1061. color: #333333;
  1062. }
  1063. }
  1064. &-navTab {
  1065. padding: 0 34rpx 0 34rpx;
  1066. justify-content: space-between;
  1067. .icon-xiazai5 {
  1068. color: #333;
  1069. }
  1070. .nav-item {
  1071. display: inline-block;
  1072. font-weight: 500;
  1073. font-size: 31rpx;
  1074. color: #B2B2B2;
  1075. &.on {
  1076. font-weight: 600;
  1077. font-size: 35rpx;
  1078. color: #141414;
  1079. border-bottom: 5rpx solid;
  1080. border-image: linear-gradient(90deg, #FFCA5F 0%, #FF1B95 100%);
  1081. border-image-slice: 1;
  1082. }
  1083. }
  1084. .release_btn {
  1085. width: 58rpx;
  1086. height: 58rpx;
  1087. border-radius: 100%;
  1088. background-image: linear-gradient(126deg, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  1089. color: #fff;
  1090. position: absolute;
  1091. top: 20rpx;
  1092. left: 0;
  1093. .iconfont {
  1094. font-size: 28rpx;
  1095. }
  1096. }
  1097. }
  1098. &-box {
  1099. flex: 1;
  1100. min-height: 83vh;
  1101. height: auto;
  1102. width: 100%;
  1103. background-color: #fff;
  1104. left: 0;
  1105. }
  1106. }
  1107. .avatar {
  1108. width: 64rpx;
  1109. height: 64rpx;
  1110. border-radius: 50%;
  1111. }
  1112. .h96 {
  1113. height: 96rpx;
  1114. }
  1115. .h36 {
  1116. /* #ifdef H5 */
  1117. height: 28rpx;
  1118. /* #endif */
  1119. /* #ifndef H5 */
  1120. height: 18rpx;
  1121. /* #endif */
  1122. }
  1123. .longTab {
  1124. width: 100%;
  1125. background: #fff;
  1126. border-radius: 16rpx 16rpx 0 0;
  1127. .longTab-item {
  1128. /*解决ios上滑动不流畅*/
  1129. -webkit-overflow-scrolling: touch;
  1130. position: relative;
  1131. }
  1132. .longItem {
  1133. height: 50upx;
  1134. display: inline-block;
  1135. text-align: center;
  1136. font-size: 30rpx;
  1137. color: #999999;
  1138. // margin-right: 56rpx;
  1139. text {
  1140. display: block;
  1141. max-width: 326rpx;
  1142. white-space: nowrap;
  1143. overflow: hidden;
  1144. text-overflow: ellipsis;
  1145. }
  1146. &:last-child {
  1147. margin-right: 0;
  1148. }
  1149. /*解决ios上滑动不流畅*/
  1150. -webkit-overflow-scrolling: touch;
  1151. position: relative;
  1152. &.click {
  1153. background: #EEF4FF;
  1154. // font-weight: bold;
  1155. // font-size: 34rpx;
  1156. // @include main_color(theme);
  1157. // &::after {
  1158. // content: "";
  1159. // display: block;
  1160. // width: 40rpx;
  1161. // height: 5rpx;
  1162. // @include main_bg_color(theme);
  1163. // display: flex;
  1164. // position: absolute;
  1165. // left: 50%;
  1166. // margin-left: -22rpx;
  1167. // bottom: -8rpx;
  1168. // }
  1169. // .underline {
  1170. // opacity: 1;
  1171. // }
  1172. }
  1173. }
  1174. .underlineBox {
  1175. height: 3px;
  1176. width: 20%;
  1177. display: flex;
  1178. align-content: center;
  1179. justify-content: center;
  1180. .underline {
  1181. opacity: 0;
  1182. width: 60rpx;
  1183. height: 4rpx;
  1184. background-color: #e93323;
  1185. }
  1186. }
  1187. }
  1188. .author-fans {
  1189. font-size: 24rpx !important;
  1190. }
  1191. .container {
  1192. overflow: hidden;
  1193. /* 隐藏超出部分 */
  1194. }
  1195. .swiper {
  1196. display: flex;
  1197. /* 使用flex布局 */
  1198. animation: scrollRight 10s linear infinite;
  1199. /* 应用动画 */
  1200. }
  1201. .swiper-item {
  1202. flex-shrink: 0;
  1203. /* 不允许缩小 */
  1204. width: 100%;
  1205. /* 每个item占满一行 */
  1206. height: 100%;
  1207. }
  1208. @keyframes scrollRight {
  1209. from {
  1210. transform: translateX(100%);
  1211. }
  1212. /* 从右向左移动 */
  1213. to {
  1214. transform: translateX(-100%);
  1215. }
  1216. /* 移出视图 */
  1217. }
  1218. .wall-nav {
  1219. font-weight: 500;
  1220. font-size: 23rpx;
  1221. color: #999999;
  1222. }
  1223. .wall-nav~.wall-nav {
  1224. margin-left: 38rpx;
  1225. }
  1226. .wall-nav-on {
  1227. font-weight: 600;
  1228. font-size: 27rpx;
  1229. color: #141414;
  1230. }
  1231. </style>