index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. <template>
  2. <view :style="viewColor">
  3. <view class="page_con">
  4. <view class="grass_header" :style="{'background-image': `url(${domain}/static/images/grass_header.png)`}">
  5. <view v-if="!navShow" class="header">
  6. <view class="navTab">
  7. <view v-if="community_status == 1" @click="goRelease" class="release_btn acea-row row-center-wrapper">
  8. <text class="iconfont icon-fabu"></text></view>
  9. <view class="acea-row row-center-wrapper">
  10. <view :class="tabActive == 0 ? 'on' : ''" class="nav-item" @click="tabActive=0;">关注</view>
  11. <view :class="tabActive == 1 ? 'on' : ''" class="nav-item" @click="tabActive=1;">发现</view>
  12. </view>
  13. <navigator v-if="isLogin && community_status == 1" :url="'/pages/plantGrass/plant_user/index?id='+userInfo.uid">
  14. <image class="avatar" :src="userInfo.avatar ? userInfo.avatar : '/static/images/f.png'"></image>
  15. </navigator>
  16. </view>
  17. <view class="search_count">
  18. <navigator url="/pages/plantGrass/plant_search/index" hover-class="none" class="search"><text class="iconfont icon-xiazai5"></text>搜索想看的文章</navigator>
  19. <navigator class="search_topic" url="/pages/plantGrass/plant_topic/index">
  20. <image class="topic_icon" :src="`${domain}/static/images/topic_cate.png`"></image>
  21. </navigator>
  22. </view>
  23. </view>
  24. <view class="longTab" v-if="tabActive == 1">
  25. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex;" scroll-with-animation class="menu" :scroll-left="tabLeft" show-scrollbar="true">
  26. <view class="longItem"
  27. :data-index="index"
  28. :class="index === tabClick ? 'click' : ''"
  29. v-for="(item, index) in menuList"
  30. :key="index"
  31. :id="'id' + index"
  32. @click.stop="selectMenu(item, index, true)">{{ item.cate_name }}</view>
  33. </scroll-view>
  34. </view>
  35. </view>
  36. <scroll-view class="main" :class="{'scroll-main' : tabActive == 0}" scroll-y="true" @scroll="followScroll">
  37. <view class="tab-cont" id="main" @touchmove="onTouchmove">
  38. <!-- 关注 -->
  39. <view v-if="tabActive === 0">
  40. <view v-if="isLogin && followList.length > 0" class="follow_count" :class="(newData.status && newData.status.status && showTab) ? 'showFoot' : ''">
  41. <block v-for="(item, index) in followList" :key="index">
  42. <view class="list_count">
  43. <view class="title">
  44. <navigator hover-class="none" :url="'/pages/plantGrass/plant_user/index?id='+item.uid" v-if="item.author" class="author">
  45. <easy-loadimage class="picture" mode="widthFix" :image-src="item.author&&item.author.avatar || '/static/images/f.png'"></easy-loadimage>
  46. <text class="name">{{item.author.nickname || ''}}</text>
  47. </navigator>
  48. <view class="time">{{item.time}}</view>
  49. </view>
  50. <view class="product">
  51. <productConSwiper v-if="item.is_type == 1" :imgUrls="item.image"></productConSwiper>
  52. <view v-else class="videoSwiper" @click="goVideo(item)">
  53. <image class="image" :src="item.image[0]"></image>
  54. <image v-if="item.is_type == 2" class="video_img" src="../../static/images/stop.png"></image>
  55. </view>
  56. </view>
  57. <view class="pro_describle">
  58. <view class="mentioned" v-if="item.relevance && item.relevance.length > 0" @click="openMore(item)">
  59. <text class="title">查看TA提到的宝贝({{item.relevance.length}})</text>
  60. <view class="product_more">
  61. <view class="item">
  62. <easy-loadimage v-if="indexn<4" v-for="(itemn, indexn) in item.relevance" :key="indexn" mode="widthFix" :image-src="(itemn.spu && itemn.spu.image) || itemn.image" class="more_image"></easy-loadimage>
  63. </view>
  64. <text class="iconfont icon-gengduo3"></text>
  65. </view>
  66. </view>
  67. <view v-if="!item.show && item.content.length > 110" class="product_info">
  68. <text class="text">
  69. {{item.content.substring(0,90)+'...'}}
  70. </text>
  71. <text @click.stop="showMore(item)" class="unfold_btn">展开</text>
  72. </view>
  73. <view v-else class="product_info">
  74. <text class="text">
  75. {{item.content}}
  76. </text>
  77. </view>
  78. <navigator v-if="item.topic" hover-class="none" class="product_cate" :url="'/pages/plantGrass/plant_search_list/index?id='+item.topic.topic_id">
  79. <view>
  80. <text class="icon">#</text><text class="text">{{item.topic.topic_name}}</text>
  81. </view>
  82. </navigator>
  83. <view class="foot_bar">
  84. <!-- #ifdef MP -->
  85. <button class="time iconfont icon-fenxiang2" open-type="share" hover-class='none' @click="shareFriend(item)"></button>
  86. <!-- #endif -->
  87. <!-- #ifndef MP -->
  88. <button></button>
  89. <!-- #endif -->
  90. <view class="item">
  91. <view class="item_count" @click.stop="likeToggle(item)">
  92. <text class="iconfont" :class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
  93. <text>{{item.count_start > 0 ? item.count_start : '点赞'}}</text>
  94. </view>
  95. <view v-if="community_reply_status == 1" class="item_count" @click.stop="openCommon(item,index)">
  96. <text class="iconfont icon-pinglun"></text>
  97. <text>{{item.count_reply > 0 ? item.count_reply : '评论'}}</text>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </block>
  104. </view>
  105. <view v-if="followList.length == 0 && !focusLoading && isLogin" class="empty">
  106. <image :src="`${domain}/static/images/no_thing.png`"></image>
  107. <text>暂无内容~</text>
  108. </view>
  109. <view v-if="!isLogin" class="empty no_login">
  110. <image :src="`${domain}/static/images/no_login.png`"></image>
  111. <view class="title">暂未登录</view>
  112. <text>登录后可查看关注用户的发布哦~</text>
  113. <button class="login_btn" @click="authOpen">立即登录</button>
  114. </view>
  115. </view>
  116. <!-- 发现 -->
  117. <view v-show="tabActive === 1">
  118. <!-- 商品 -->
  119. <swiper :interval="interval" indicator-color="rgba(255,255,255,0.6)" :current="swiperCurrent" @change="swiperChange" :style="'height:'+swiperHeight+'px;'" >
  120. <block v-for="(item,index) in menuList" :key="index">
  121. <swiper-item :item-id="`${item.category_id}`">
  122. <scroll-view @scroll="scrollLeft" scroll-y="true" :style="'height:'+swiperHeight+'px'" id="goods"
  123. refresher-enabled="true" :refresher-threshold="100"
  124. :refresher-triggered="triggeredDiscover"
  125. @refresherrefresh="onRefreshDiscover" @refresherpulling="onPulling"
  126. @refresherrestore="onRestore" @refresherabort="onAbort">
  127. <view v-if="cateGoods[item.category_id] && cateGoods[item.category_id].goods.length" class="goods-wrap" id="goods">
  128. <view class="goods">
  129. <WaterfallsFlow :isShow="false" :wfList='cateGoods[item.category_id].goods' :isFind="true" @likeToggle="likeToggle"/>
  130. </view>
  131. </view>
  132. <view :hidden="cateGoods[item.category_id] && !cateGoods[item.category_id].goodsLoading" class="acea-row row-center-wrapper loadingicon">
  133. <text class="iconfont icon-jiazai loading"></text>{{!cateGoods[item.category_id] ? 0 : cateGoods[item.category_id].goodsLoading}}
  134. </view>
  135. <view v-if="cateGoods[item.category_id] && cateGoods[item.category_id].goods.length == 0 && !cateGoods[item.category_id].goodsLoading" class="empty">
  136. <image :src="`${domain}/static/images/no_thing.png`"></image>
  137. <text>{{item.category_id == -1 ? '暂无视频' : '暂无文章'}}~</text>
  138. </view>
  139. </scroll-view>
  140. </swiper-item>
  141. </block>
  142. </swiper>
  143. </view>
  144. </view>
  145. </scroll-view>
  146. </view>
  147. <!-- 他提到的宝贝弹窗 -->
  148. <mentioned ref="mentioned" :isHome="true" @close="closePopup" :list="moreList" :uid="authorUid"></mentioned>
  149. <!-- 评论弹窗 -->
  150. <comment ref="comment" :isShow="showComment" :userInfo="userInfo" :bottom="bottom" @successFul="commentSucces" @close="close"></comment>
  151. <!--自定义底部tab栏-->
  152. <customTab :newData="newData" :activeRouter="activeRouter"></customTab>
  153. </view>
  154. </template>
  155. <script>
  156. // +----------------------------------------------------------------------
  157. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  158. // +----------------------------------------------------------------------
  159. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  160. // +----------------------------------------------------------------------
  161. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  162. // +----------------------------------------------------------------------
  163. // | Author: CRMEB Team <admin@crmeb.com>
  164. // +----------------------------------------------------------------------
  165. import WaterfallsFlow from '@/components/plantWaterfallsFlow/WaterfallsFlow.vue'
  166. import mentioned from '@/components/mentioned.vue';
  167. import comment from '@/components/comment.vue';
  168. import { getNavigation } from '@/api/public.js';
  169. import customTab from '@/components/customTab';
  170. import { graphicLstApi, getTopicList, graphicStartApi, focusArticleLst } from '@/api/community.js';
  171. import { getUserInfo } from '@/api/user.js';
  172. import { mapGetters } from "vuex";
  173. import productConSwiper from '@/components/plantConSwiper';
  174. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  175. import { HTTP_REQUEST_URL } from '@/config/app';
  176. import { toLogin } from '@/libs/login.js';
  177. import { configMap } from '@/utils';
  178. const app = getApp();
  179. export default {
  180. components: {
  181. WaterfallsFlow,
  182. productConSwiper,
  183. mentioned,
  184. comment,
  185. easyLoadimage,
  186. customTab
  187. },
  188. data() {
  189. return {
  190. domain: HTTP_REQUEST_URL,
  191. // #ifdef MP
  192. menuButtonInfo: uni.getMenuButtonBoundingClientRect(),
  193. // #endif
  194. tabClick: 0,
  195. tabLeft: 0,
  196. isLeft: 0, //导航栏下划线位置
  197. isWidth: 0, //每个导航栏占位
  198. windowHeight: 0,
  199. swiperHeight: 0,
  200. childIndex: 0,
  201. showComment: false,
  202. triggered: false,
  203. triggeredDiscover: false,
  204. userInfo: {},
  205. goods: [], // 商铺商品
  206. followList: [], //关注列表
  207. menuList: [],
  208. moreList: [],
  209. commList: [], //评论列表
  210. goodsList: [],
  211. navShow: false,
  212. navActive: 0,
  213. tabActive: 1, // 底部切换
  214. keyword: '',
  215. sortPrice: true, // 价格排序
  216. focusLoading: false,
  217. goodsLoading: false,
  218. goodsLoaded: false,
  219. focusLoaded: false,
  220. loadTitle: '加载更多',
  221. where: {
  222. category_id: 0,
  223. page: 1,
  224. limit: 30
  225. },
  226. focusWhere: {
  227. page: 1,
  228. limit: 30
  229. },
  230. storeScroll: true,
  231. _freshing: false,
  232. storeTop: 0,
  233. storeHeight: 0,
  234. navHeight: 0,
  235. avatar: '',
  236. hederBg: '../static/images/plant_header.png',
  237. top: 300,
  238. shareInfo: {},
  239. actionSheetHidden: true,
  240. authorUid: 0,
  241. swiperCur: 0,
  242. circular: true,
  243. isScroll: false,
  244. interval: 3000,
  245. currentItemId: 0,
  246. swiperCurrent: 0,
  247. scrollTop: 0,
  248. cateGoods:{},
  249. newData: {},
  250. activeRouter: '',
  251. showTab: false,
  252. //#ifdef MP||APP-PLUS
  253. bottom: 0,
  254. //#endif
  255. //#ifndef MP||APP-PLUS
  256. bottom: 90,
  257. //#endif
  258. }
  259. },
  260. // 滚动监听
  261. onPageScroll({scrollTop}) {
  262. uni.$emit('scroll');
  263. },
  264. created() {
  265. var that = this;
  266. // 获取设备宽度
  267. uni.getSystemInfo({
  268. success(e) {
  269. that.isWidth = e.windowWidth / 6;
  270. that.windowHeight = e.windowHeight;
  271. // that.swiperHeight = that.windowHeight - 205
  272. that.$set(that, 'swiperHeight', that.windowHeight-150);
  273. }
  274. });
  275. },
  276. computed: {
  277. ...mapGetters(['isLogin', 'uid', 'viewColor']),
  278. ...configMap({community_reply_status: 0,community_app_switch: [],community_status: 0,navigation: {}})
  279. },
  280. watch: {},
  281. onLoad: function(options) {
  282. let that = this;
  283. uni.$on('startLike',function(data){
  284. for(var i = 0; i < that.cateGoods[that.currentItemId]['goods'].length; i++){
  285. let item = that.cateGoods[that.currentItemId]['goods'][i]
  286. if(data.community_id == item['community_id']){
  287. item['count_start'] = data.relevance_id ? item['count_start']+1 : item['count_start']-1
  288. item['relevance_id'] = data.relevance_id ? true : false
  289. }
  290. }
  291. })
  292. },
  293. onShow() {
  294. app.getConfigData();
  295. this.getCateList();
  296. this.getGoods();
  297. let that = this
  298. let routes = getCurrentPages();
  299. let curRoute = routes[routes.length - 1].route
  300. this.activeRouter = '/' + curRoute
  301. this.getNav();
  302. if (that.isLogin) {
  303. that.focusLoading = false;
  304. that.focusLoaded = false;
  305. that.focusWhere.page = 1;
  306. that.followList = [];
  307. this.getUserInfo();
  308. this.getFocusArtical();
  309. } else {
  310. this.userInfo = {}
  311. }
  312. },
  313. mounted: function() {
  314. const query = uni.createSelectorQuery().in(this);
  315. query.select('#main').boundingClientRect(data => {
  316. this.storeHeight = data.height;
  317. this.storeTop = data.top;
  318. }).exec();
  319. },
  320. /**
  321. * 用户点击右上角分享
  322. */
  323. // #ifdef MP
  324. onShareAppMessage: function() {
  325. let that = this;
  326. that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
  327. return {
  328. title: that.shareInfo.title || '',
  329. imageUrl: that.shareInfo.image[0] || '',
  330. path: '/pages/plantGrass/plant_detail/index?id=' + that.shareInfo.community_id + '&spid=' + that.uid,
  331. }
  332. },
  333. onShareTimeline: function() {
  334. let that = this;
  335. that.$set(that, 'actionSheetHidden', !that.actionSheetHidden);
  336. return {
  337. title: that.shareInfo.title || '',
  338. query: {
  339. id: that.shareInfo.community_id,
  340. spid: that.uid
  341. },
  342. imageUrl: that.shareInfo.image[0] || ''
  343. }
  344. },
  345. // #endif
  346. methods: {
  347. getNav() {
  348. getNavigation().then(res => {
  349. this.newData = res.data
  350. if (this.newData.status && this.newData.status.status) {
  351. uni.hideTabBar()
  352. this.$set(this, 'swiperHeight', this.windowHeight-50);
  353. } else {
  354. uni.showTabBar()
  355. }
  356. })
  357. },
  358. goRelease(){
  359. if(this.isLogin){
  360. uni.navigateTo({
  361. url: '/pages/plantGrass/plant_release/index'
  362. });
  363. }else{
  364. toLogin()
  365. }
  366. },
  367. followScroll(e){
  368. uni.$emit('scroll');
  369. },
  370. //分享信息
  371. shareFriend(item){
  372. this.shareInfo = item
  373. },
  374. // 打开授权
  375. authOpen: function() {
  376. toLogin()
  377. },
  378. /**
  379. * 获取个人用户信息
  380. */
  381. getUserInfo: function() {
  382. let that = this;
  383. getUserInfo().then(res => {
  384. that.userInfo = res.data
  385. });
  386. },
  387. /*获取分类列表*/
  388. getCateList(){
  389. getTopicList().then(res => {
  390. let data = [{cate_name: "推荐",category_id: 0,children: []}]
  391. if(this.community_app_switch.length == 2 || this.community_app_switch[0]==2){
  392. data = [{cate_name: "推荐",category_id: 0,children: []},{cate_name: "视频",category_id: -1,children: []}]
  393. }
  394. this.menuList = Array.from(new Set([...data,...res.data]));
  395. })
  396. },
  397. swiperChange(e) {
  398. let { current, source, currentItemId } = e.detail;
  399. if (source === 'autoplay' || source === 'touch') {
  400. this.currentItemId = currentItemId;
  401. this.swiperCur = current
  402. this.selectMenu(this.menuList[this.swiperCur],this.swiperCur,false)
  403. if (this.menuList.length > 6) {
  404. var tempIndex = this.swiperCur - 2;
  405. tempIndex = tempIndex <= 0 ? 0 : tempIndex;
  406. let tabLeft = (this.swiperCur - 2) * this.isWidth; //设置下划线位置
  407. this.$nextTick(function() {
  408. this.$set(this, 'tabLeft', tabLeft);
  409. });
  410. }
  411. }
  412. },
  413. // 点击列表头部
  414. selectMenu(item, index, isScroll) {
  415. this.currentItemId = item.category_id;
  416. this.swiperCurrent = index;
  417. this.swiperCur = index
  418. this.isScroll = isScroll;
  419. this.tabClick = index; //设置导航点击了哪一个
  420. this.isLeft = index * this.isWidth; //设置下划线位置
  421. this.setMenuLeft(index);
  422. },
  423. /*导航栏移动位置*/
  424. setMenuLeft(index) {
  425. this.getGoods();
  426. },
  427. showMore(item){
  428. this.$set(item,'show', true);
  429. },
  430. scrollLeft: function(e){
  431. uni.$emit('scroll');
  432. this.scrollTop = e.detail.scrollTop
  433. this.navShow = e.detail.scrollTop >= this.storeHeight - 200;
  434. if(this.navShow){
  435. this.$set(this, 'swiperHeight', this.windowHeight-50);
  436. }
  437. if(e.detail.scrollTop > e.detail.scrollHeight - 1500){
  438. this.getGoods();
  439. }
  440. },
  441. // 获取发现商品
  442. getGoods: function() {
  443. let that = this;
  444. if(!this.cateGoods[this.currentItemId]) {
  445. this.$set(this.cateGoods, this.currentItemId, {
  446. where: {...this.where, category_id: this.currentItemId},
  447. goods: []
  448. })
  449. }
  450. const data = this.cateGoods[this.currentItemId];
  451. const cateId = this.currentItemId;
  452. if (data.goodsLoading || data.goodsLoaded) return;
  453. data.goodsLoading = true;
  454. data.loadTitle = "";
  455. graphicLstApi(data.where).then(res => {
  456. data.goodsLoading = false;
  457. data.goodsLoaded = res.data.list.length < that.where.limit;
  458. if(data.where.page == 1 ){
  459. data.goods = [];
  460. }
  461. data.goods.push.apply(data.goods, res.data.list);
  462. data.where.page = data.where.page + 1;
  463. this.$set(this.cateGoods,cateId, {...data});
  464. this.triggeredDiscover = false;
  465. this.$forceUpdate()
  466. }).catch(err => {
  467. data.goodsLoading = false;
  468. uni.showToast({
  469. title: err,
  470. icon: 'none'
  471. })
  472. this.$set(this.cateGoods,cateId, data);
  473. });
  474. },
  475. /*获取关注的人的文章列表*/
  476. getFocusArtical(){
  477. let that = this;
  478. if (that.focusLoading || that.focusLoaded) return;
  479. that.focusLoading = true;
  480. that.loadTitle = "";
  481. focusArticleLst(that.focusWhere).then(res => {
  482. that.focusLoading = false;
  483. that.focusLoaded = res.data.list.length < that.focusWhere.limit;
  484. res.data.list.forEach((item)=>{
  485. item.show = false
  486. })
  487. that.followList.push.apply(that.followList, res.data.list);
  488. that.focusWhere.page = that.focusWhere.page + 1;
  489. }).catch(err => {
  490. that.focusLoading = false;
  491. uni.showToast({
  492. title: err,
  493. icon: 'none'
  494. })
  495. });
  496. },
  497. onPulling(e) {
  498. if (e.detail.deltaY < 0) return // 防止上滑页面也触发下拉
  499. if (this.tabActive == 1) {
  500. this.triggeredDiscover = true;
  501. } else {
  502. this.triggered = true;
  503. }
  504. },
  505. onRefreshDiscover() {
  506. if (this._freshing) return;
  507. this._freshing = true;
  508. setTimeout(() => {
  509. this._freshing = false;
  510. this.cateGoods = {}
  511. this.getGoods();
  512. this.triggeredDiscover = false;
  513. this.scrollTop = 0;
  514. uni.stopPullDownRefresh();
  515. this._freshing = false;
  516. }, 1000)
  517. },
  518. onRefresh() {
  519. if (this._freshing) return;
  520. this._freshing = true;
  521. setTimeout(() => {
  522. this.loadendfollow = false;
  523. this.loadend = false;
  524. this.followList = [];
  525. this.focusWhere.page = 1;
  526. this.params.page = 1;
  527. this.getFocusArtical();
  528. setTimeout(() => {
  529. if(this.followList.length === 0 || this.focusLoaded) this.getGoods();
  530. }, 400)
  531. this.triggered = false
  532. uni.stopPullDownRefresh();
  533. this._freshing = false;
  534. }, 1000)
  535. },
  536. onRestore() {
  537. this.triggeredDiscover = false;
  538. },
  539. onAbort() {
  540. console.log("onAbort");
  541. },
  542. // 商铺首页滚动 navbar 吸顶
  543. scrollHome: function(e) {
  544. this.navShow = e.detail.scrollTop >= this.storeHeight - 20;
  545. },
  546. likeToggle(item){
  547. let status = item.relevance_id ? 0 : 1
  548. graphicStartApi(item.community_id,{status: status}).then(res => {
  549. if(item.relevance_id){
  550. item.count_start--;
  551. item.count_start = item.count_start == 0 ? 0 : item.count_start
  552. item.relevance_id = false
  553. }else{
  554. item.count_start++;
  555. item.relevance_id = true
  556. }
  557. });
  558. },
  559. /*查看提到的宝贝*/
  560. openMore(item){
  561. this.$refs.mentioned.showPopup()
  562. this.moreList = item.relevance;
  563. this.authorUid = item.uid
  564. },
  565. openCommon(item,index){
  566. this.switchTab(0);
  567. this.showComment = true
  568. this.$refs.comment.getData(item,index);
  569. },
  570. commentSucces(index){
  571. this.followList[index]['count_reply']++
  572. },
  573. closePopup(){
  574. this.$refs.mentioned.closePopup()
  575. },
  576. close(){
  577. this.switchTab(1);
  578. this.showComment = false;
  579. },
  580. onTouchmove(e){
  581. const query = uni.createSelectorQuery().in(this);
  582. query.select('#goods').boundingClientRect(data => {
  583. if(data.bottom < 1500) {
  584. if(this.tabActive == 1){
  585. this.getGoods();
  586. }else{
  587. this.getFocusArtical();
  588. }
  589. }
  590. }).exec();
  591. // 模拟触底刷新
  592. },
  593. switchTab(type){ //1打开0关闭
  594. this.newData = this.navigation
  595. if (this.newData.status && this.newData.status.status) {
  596. if(type == 1){
  597. this.showTab = true;
  598. uni.hideTabBar()
  599. }else{
  600. this.showTab = false;
  601. uni.hideTabBar()
  602. }
  603. } else {
  604. if(type == 1){
  605. this.showTab = false;
  606. uni.showTabBar()
  607. }else{
  608. this.showTab = false;
  609. uni.hideTabBar()
  610. }
  611. }
  612. },
  613. goVideo(item) {
  614. uni.navigateTo({
  615. //#ifdef APP
  616. url: '/pages/short_video/appSwiper/index?id='+item.community_id
  617. //#endif
  618. //#ifndef APP
  619. url: '/pages/short_video/nvueSwiper/index?id='+item.community_id
  620. //#endif
  621. });
  622. },
  623. },
  624. onReachBottom() {
  625. if(this.tabActive == 1){
  626. this.getGoods();
  627. }else{
  628. this.getFocusArtical();
  629. }
  630. },
  631. beforeDestroy() {
  632. uni.$off('startLike');
  633. }
  634. }
  635. </script>
  636. <style lang="scss" scoped>
  637. page{
  638. background: #fff;
  639. }
  640. .page_con{
  641. position: fixed;
  642. top: 0;
  643. right: 0;
  644. bottom: 0;
  645. left: 0;
  646. display: flex;
  647. flex-direction: column;
  648. background-color: #fff;
  649. }
  650. .longTab {
  651. display: flex;
  652. width: 100%;
  653. background: #fff;
  654. border-radius: 16rpx 16rpx 0 0;
  655. padding: 20rpx;
  656. .longItem {
  657. height: 50upx;
  658. display: inline-block;
  659. line-height: 50upx;
  660. text-align: center;
  661. font-size: 30rpx;
  662. color: #999999;
  663. max-width: 160rpx;
  664. white-space: nowrap;
  665. overflow: hidden;
  666. text-overflow: ellipsis;
  667. overflow-x: scroll;
  668. overflow-y: hidden;
  669. margin-right: 56rpx;
  670. &:last-child{
  671. margin-right: 0;
  672. }
  673. /*解决ios上滑动不流畅*/
  674. -webkit-overflow-scrolling: touch;
  675. position: relative;
  676. &.click {
  677. font-weight: bold;
  678. font-size: 34rpx;
  679. color: var(--view-theme);
  680. &::after{
  681. content: "";
  682. display: block;
  683. width: 60rpx;
  684. height: 4rpx;
  685. background-color: var(--view-theme);
  686. display: flex;
  687. position: absolute;
  688. left: 50%;
  689. margin-left: -32rpx;
  690. bottom: 0rpx;
  691. }
  692. .underline {
  693. opacity: 1;
  694. }
  695. }
  696. }
  697. .underlineBox {
  698. height: 3px;
  699. width: 20%;
  700. display: flex;
  701. align-content: center;
  702. justify-content: center;
  703. .underline {
  704. opacity: 0;
  705. width: 60rpx;
  706. height: 4rpx;
  707. background-color: #e93323;
  708. }
  709. }
  710. }
  711. .tab-cont{
  712. border-radius: 16rpx 16rpx 0 0;
  713. }
  714. .showFoot{
  715. padding: 20rpx 20rpx calc(120rpx+ constant(safe-area-inset-bottom));
  716. padding: 20rpx 20rpx calc(120rpx + env(safe-area-inset-bottom));
  717. }
  718. .follow_count{
  719. background: #ffffff;
  720. /* #ifndef MP */
  721. padding: 20rpx 20rpx 100rpx;
  722. /* #endif */
  723. /* #ifdef MP */
  724. padding: 20rpx 20rpx calc(0rpx+ constant(safe-area-inset-bottom));
  725. padding: 20rpx 20rpx calc(0rpx + env(safe-area-inset-bottom));
  726. /* #endif */
  727. .title{
  728. display: flex;
  729. align-items: center;
  730. justify-content: space-between;
  731. }
  732. .author{
  733. display: flex;
  734. align-items: center;
  735. .picture{
  736. width: 78rpx;
  737. height: 78rpx;
  738. border-radius: 100%;
  739. overflow: hidden;
  740. }
  741. /deep/image,/deep/.easy-loadimage,uni-image{
  742. height: 78rpx;
  743. }
  744. .name{
  745. margin-left: 20rpx;
  746. color: #333333;
  747. font-size: 32rpx;
  748. font-weight: bold;
  749. }
  750. }
  751. .time{
  752. color: #999999;
  753. font-size: 24rpx;
  754. }
  755. .product{
  756. margin-top: 20rpx;
  757. border-radius: 16rpx;
  758. }
  759. .icon-fenxiang2{
  760. color: #282828;
  761. font-size: 46rpx;
  762. background: transparent;
  763. }
  764. }
  765. .list_count{
  766. margin-bottom: 70rpx;
  767. &:last-child{
  768. margin-bottom: 0;
  769. }
  770. }
  771. .videoSwiper{
  772. width: 710rpx;
  773. height: 710rpx;
  774. position: relative;
  775. border-radius: 16rpx;
  776. .image{
  777. width: 710rpx;
  778. height: 710rpx;
  779. border-radius: 16rpx;
  780. }
  781. .video_img{
  782. width: 100rpx;
  783. height: 100rpx;
  784. position: absolute;
  785. top: 50%;
  786. left: 50%;
  787. margin-left: -50rpx;
  788. margin-top: -50rpx;
  789. z-index: 10;
  790. }
  791. }
  792. .pro_describle{
  793. .mentioned{
  794. padding: 20rpx 0;
  795. display: flex;
  796. align-items: center;
  797. justify-content: space-between;
  798. border-bottom: 1px solid #F5F5F5;
  799. .title{
  800. color: #666666;
  801. font-size: 26rpx;
  802. }
  803. }
  804. .product_more{
  805. max-width: 360rpx;
  806. display: flex;
  807. align-items: center;
  808. .more_image{
  809. width: 58rpx;
  810. height: 58rpx;
  811. border-radius: 5rpx;
  812. margin-right: 12rpx;
  813. display: inline-block;
  814. border: 1px solid #BBBBBB;
  815. }
  816. /deep/image,/deep/.easy-loadimage,uni-image{
  817. width: 58rpx;
  818. height: 58rpx;
  819. }
  820. .iconfont{
  821. color: #CCCCCC;
  822. margin-left: 10rpx;
  823. }
  824. }
  825. .product_info{
  826. line-height: 45rpx;
  827. margin: 20rpx 0;
  828. .text{
  829. font-size: 28rpx;
  830. color: #282828;
  831. }
  832. .unfold_btn{
  833. margin-left: 30rpx;
  834. font-size: 30rpx;
  835. color: #282828;
  836. font-weight: bold;
  837. }
  838. }
  839. .product_cate{
  840. margin: 20rpx 0;
  841. display: inline-block;
  842. >view{
  843. display: flex;
  844. align-items: center;
  845. background: var(--view-minorColor);
  846. border-radius: 30rpx;
  847. padding: 0 25rpx;
  848. line-height: 56rpx;
  849. height: 56rpx;
  850. color: var(--view-theme);
  851. .text{
  852. font-size: 28rpx;
  853. }
  854. .icon{
  855. font-size: 35rpx;
  856. font-weight: bold;
  857. margin-right: 10rpx;
  858. }
  859. }
  860. }
  861. .foot_bar{
  862. display: flex;
  863. align-items: center;
  864. justify-content: space-between;
  865. .item{
  866. display: flex;
  867. align-items: center;
  868. color: #282828;
  869. &.icon-fenxiang2{
  870. font-size: 46rpx;
  871. }
  872. }
  873. .item_count{
  874. font-size: 26rpx;
  875. display: flex;
  876. align-items: center;
  877. &:first-child{
  878. margin-right: 30rpx;
  879. }
  880. .iconfont{
  881. font-size: 40rpx;
  882. margin-right: 5rpx;
  883. }
  884. .icon-shoucang1{
  885. color: var(--view-priceColor);
  886. }
  887. }
  888. }
  889. }
  890. .grass_header {
  891. display: flex;
  892. flex-direction: column;
  893. background-size: cover;
  894. background-color: #ffffff;
  895. width: 100%;
  896. z-index: 10;
  897. }
  898. .header {
  899. padding: 0 30rpx 20rpx;
  900. .navTab{
  901. position: relative;
  902. padding: 20rpx 0 40rpx 0;
  903. .nav-item{
  904. font-size: 32rpx;
  905. color: #666666;
  906. &:first-child{
  907. margin-right: 70rpx;
  908. }
  909. &.on{
  910. font-size: 38rpx;
  911. color: #282828;
  912. font-weight: bold;
  913. }
  914. }
  915. .release_btn{
  916. width: 58rpx;
  917. height: 58rpx;
  918. border-radius: 100%;
  919. background-image: linear-gradient(126deg, var(--view-bntColor21) 0%, var(--view-bntColor22) 100%);
  920. color: #fff;
  921. position: absolute;
  922. top: 20rpx;
  923. left: 0;
  924. .iconfont{
  925. font-size: 28rpx;
  926. }
  927. }
  928. .avatar{
  929. width: 58rpx;
  930. height: 58rpx;
  931. border-radius: 100%;
  932. border: 3rpx solid rgba(0,0,0,.05);
  933. position: absolute;
  934. top: 20rpx;
  935. right: 0;
  936. }
  937. }
  938. .search_count{
  939. display: flex;
  940. align-items: center;
  941. justify-content: space-between;
  942. .search_topic{
  943. width: 46rpx;
  944. height: 46rpx;
  945. image,.topic_icon,uni-image{
  946. width: 46rpx;
  947. height: 46rpx;
  948. }
  949. }
  950. }
  951. .search {
  952. display: flex;
  953. align-items: center;
  954. min-width: 0;
  955. height: 58rpx;
  956. border-radius: 29rpx;
  957. background-color: #FFFFFF;
  958. font-weight: 500;
  959. font-size: 24rpx;
  960. color: #999999;
  961. width: 609rpx;
  962. .iconfont {
  963. margin-right: 13rpx;
  964. margin-left: 30rpx;
  965. font-size: 24rpx;
  966. }
  967. }
  968. }
  969. .main_count{
  970. background-color: #ffffff;
  971. padding: 30rpx 20rpx;
  972. .list{
  973. width: 710rpx;
  974. height: 280rpx;
  975. margin-bottom: 30rpx;
  976. position: relative;
  977. .picture{
  978. width: 710rpx;
  979. height: 280rpx;
  980. border-radius: 16rpx;
  981. }
  982. }
  983. }
  984. .main {
  985. flex: 1;
  986. height: auto;
  987. &.scroll-main{
  988. min-height: 60vh;
  989. }
  990. }
  991. .nav.fixed {
  992. position: fixed;
  993. left: 0;
  994. width: 100%;
  995. .nav-cont {
  996. position: absolute;
  997. width: 100%;
  998. }
  999. }
  1000. .goods {
  1001. display: flex;
  1002. flex-wrap: wrap;
  1003. justify-content: space-between;
  1004. padding: 0 20rpx;
  1005. background: #ffffff;
  1006. width: 750rpx;
  1007. /* #ifdef H5 */
  1008. padding-bottom: 100rpx;
  1009. padding-bottom: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1010. padding-bottom: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1011. /* #endif */
  1012. .item {
  1013. width: 345rpx;
  1014. border-radius: 16rpx;
  1015. margin-bottom: 20rpx;
  1016. background-color: #FFFFFF;
  1017. overflow: hidden;
  1018. /deep/.image,/deep/.easy-loadimage,uni-image {
  1019. width: 345rpx;
  1020. height: 345rpx;
  1021. image {
  1022. display: block;
  1023. width: 100%;
  1024. height: 100%;
  1025. }
  1026. }
  1027. .text {
  1028. padding: 20rpx 20rpx 25rpx;
  1029. .name {
  1030. font-weight: 500;
  1031. font-size: 30rpx;
  1032. line-height: 1;
  1033. color: #222222;
  1034. display: flex;
  1035. align-items: center;
  1036. .name_text{
  1037. display: inline-block;
  1038. max-width: 400rpx;
  1039. }
  1040. }
  1041. .money-wrap {
  1042. display: flex;
  1043. align-items: center;
  1044. margin-top: 43rpx;
  1045. .money {
  1046. font-weight: bold;
  1047. font-size: 26rpx;
  1048. color: $theme-color;
  1049. text {
  1050. font-size: 34rpx;
  1051. line-height: 1;
  1052. }
  1053. }
  1054. .ticket {
  1055. height: 26rpx;
  1056. padding-right: 9rpx;
  1057. padding-left: 9rpx;
  1058. border: 1px solid $theme-color;
  1059. border-radius: 4rpx;
  1060. margin-left: 10rpx;
  1061. font-weight: 500;
  1062. font-size: 20rpx;
  1063. line-height: 24rpx;
  1064. color: $theme-color;
  1065. }
  1066. }
  1067. .score {
  1068. margin-top: 20rpx;
  1069. font-weight: 500;
  1070. font-size: 20rpx;
  1071. line-height: 1;
  1072. color: #737373;
  1073. }
  1074. }
  1075. .foot {
  1076. display: flex;
  1077. justify-content: center;
  1078. align-items: center;
  1079. height: 52rpx;
  1080. background: linear-gradient(to right, #F11B09, #F67A38);
  1081. font-weight: 500;
  1082. font-size: 24rpx;
  1083. color: #FFFFFF;
  1084. .iconfont {
  1085. margin-right: 10rpx;
  1086. font-size: 22rpx;
  1087. line-height: 1;
  1088. }
  1089. }
  1090. }
  1091. }
  1092. .empty{
  1093. width: 100%;
  1094. text-align: center;
  1095. position:relative;
  1096. top: 200rpx;
  1097. /* #ifdef MP */
  1098. // top: 100rpx;
  1099. /* #endif */
  1100. image,uni-image{
  1101. display: inline-block;
  1102. width: 414rpx;
  1103. height: 305rpx;
  1104. }
  1105. .title{
  1106. font-size: 28rpx;
  1107. color: #282828;
  1108. font-weight: bold;
  1109. margin-bottom: 14rpx;
  1110. }
  1111. text{
  1112. display: block;
  1113. color: #999999;
  1114. font-size: 26rpx;
  1115. }
  1116. .login_btn{
  1117. width: 440rpx;
  1118. text-align: center;
  1119. height: 76rpx;
  1120. line-height: 76rpx;
  1121. color: var(--view-theme);
  1122. border: 1px solid var(--view-theme);
  1123. border-radius: 40rpx;
  1124. margin: 44rpx auto 0;
  1125. font-size: 32rpx;
  1126. }
  1127. }
  1128. .page-footer {
  1129. position: fixed;
  1130. bottom: 0;
  1131. z-index: 30;
  1132. display: flex;
  1133. align-items: center;
  1134. justify-content: space-around;
  1135. width: 100%;
  1136. height: 98rpx;
  1137. height: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1138. height: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1139. box-sizing: border-box;
  1140. border-top: solid 1px #F3F3F3;
  1141. background-color: #fff;
  1142. box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  1143. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  1144. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  1145. .foot-item {
  1146. display: flex;
  1147. width: max-content;
  1148. align-items: center;
  1149. justify-content: center;
  1150. flex-direction: column;
  1151. position: relative;
  1152. .count-num {
  1153. position: absolute;
  1154. display: flex;
  1155. justify-content: center;
  1156. align-items: center;
  1157. width: 40rpx;
  1158. height: 40rpx;
  1159. top: 0rpx;
  1160. right: -15rpx;
  1161. color: #fff;
  1162. font-size: 20rpx;
  1163. background-color: #FD502F;
  1164. border-radius: 50%;
  1165. padding: 4rpx;
  1166. }
  1167. }
  1168. .foot-item image {
  1169. height: 50rpx;
  1170. width: 50rpx;
  1171. text-align: center;
  1172. margin: 0 auto;
  1173. }
  1174. .foot-item .txt {
  1175. font-size: 24rpx;
  1176. }
  1177. }
  1178. </style>