index.vue 31 KB

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