index.vue 31 KB

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