zc.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <view class="content">
  3. <view class="vheigh"></view>
  4. <view class="top-bg">
  5. <view class="top" @click="clickSearch()">
  6. <view class="top-icon"><image src="../../static/icon/icon.png" mode=""></image></view>
  7. <view class="top-main">输入关键词搜索</view>
  8. </view>
  9. </view>
  10. <view class="navbar">
  11. <view class="nav-item" :class="{ current: tabCurrentIndex === 0 }" @click="tabClick('0')">笔记素材</view>
  12. <view class="nav-item" :class="{ current: tabCurrentIndex === 1 }" @click="tabClick('1')">买家反馈</view>
  13. </view>
  14. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" @change="changeTab">
  15. <swiper-item class="tab-content">
  16. <scroll-view scroll-y="true" class="list-scroll-content">
  17. <view class="main" v-for="(item, index) in bjsclist" :key="index" @click="navTo('/pages/zc/wzDetail?id=' + item.id)">
  18. <view class="main-userInfo">
  19. <view class="avatar"><image src="../../static/icon/fire.png" mode=""></image></view>
  20. <view class="main-user-info">
  21. <view class="main-userName">{{ item.author }}</view>
  22. <view class="main-user-time">2022-12-20 20:52</view>
  23. </view>
  24. </view>
  25. <sunuiGrand :content="item.synopsis" clamp="4" expandText="全文" shinkText="收起" bg="#ffffff"></sunuiGrand>
  26. <!-- <view class="imagebox">
  27. <view class="image-item" v-for="(itm, inx) in item.share_images"><image :src="itm" mode=""></image></view>
  28. </view> -->
  29. <view class="main-bottom flex">
  30. <view class="main-bottom-item" @click.stop="navTo('/pages/zc/wzshare?id=' + item.id)">
  31. <view class="main-bottom-icon"><image src="../../static/icon/pyq.png" mode=""></image></view>
  32. <view class="main-bottom-font">朋友圈</view>
  33. </view>
  34. <button class="main-bottom-item" open-type="share" @click.stop="seave(item)">
  35. <view class="main-bottom-icon1"><image src="../../static/icon/wxhy.png" mode=""></image></view>
  36. <view class="main-bottom-font">微信好友</view>
  37. </button>
  38. <view class="main-bottom-item" @click.stop="wzdz(item)">
  39. <view class="main-bottom-icon" v-if="item.user_good == 1"><image src="../../static/icon/zanguo.png" mode=""></image></view>
  40. <view class="main-bottom-icon" v-else><image src="../../static/icon/zan.png" mode=""></image></view>
  41. <view class="main-bottom-font">{{ item.goods_count }}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. </swiper-item>
  47. <swiper-item class="tab-content">
  48. <scroll-view scroll-y="true" class="list-scroll-content">
  49. <view class="info">
  50. <view class="info-item" v-for="(item, index) in mjfklist" :key="index" @click="navTo('/pages/zc/plDetail?id=' + item.id)">
  51. <view class="info-image"><image :src="item.main_pic" mode=""></image></view>
  52. <view class="info-name clamp">{{ item.title }}</view>
  53. <view class="info-userinfo flex">
  54. <view class="info-left">
  55. <view class="info-avatar"><image :src="item.avatar" mode=""></image></view>
  56. <view class="info-userinfo-name">{{ item.nickname }}</view>
  57. </view>
  58. <view class="info-right" @click="pldz(item)">
  59. <view class="info-avatar" v-if="item.user_good == 0"><image src="../../static/icon/zan.png" mode=""></image></view>
  60. <view class="info-avatar" v-if="item.user_good == 1"><image src="../../static/icon/zanguo.png" mode=""></image></view>
  61. <view class="info-userinfo-name">{{ item.goods_count }}</view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. </swiper-item>
  68. </swiper>
  69. </view>
  70. </template>
  71. <script>
  72. import { articleList } from '@/api/user.js';
  73. import { reply_list } from '@/api/product.js';
  74. import { article_good, reply_good } from '@/api/activity.js';
  75. import sunuiGrand from '@/components/sunui-grand/sunui-grand.vue';
  76. export default {
  77. // #ifdef MP
  78. onShareAppMessage: function(res) {
  79. console.log(this.share);
  80. if (res.from === 'button') {
  81. // 来自页面内分享按钮
  82. let pages = getCurrentPages();
  83. // 获取当前页面
  84. let page = pages[pages.length - 1];
  85. let path = '/' + page.route + '?';
  86. // 保存传值
  87. for (let i in page.options) {
  88. path += i + '=' + page.options[i] + '&';
  89. }
  90. // 保存邀请人
  91. let data = {
  92. path: path,
  93. imageUrl: this.share.image_input[0],
  94. title: this.share.title
  95. };
  96. console.log('data', data);
  97. return data;
  98. }
  99. },
  100. // #endif
  101. components: {
  102. sunuiGrand
  103. },
  104. data() {
  105. return {
  106. tabCurrentIndex: 0,
  107. height: '',
  108. bjsclist: '',
  109. mjfklist: '',
  110. share: ''
  111. };
  112. },
  113. onLoad() {},
  114. onShow() {
  115. this.loadData();
  116. },
  117. onReachBottom() {},
  118. onReady(res) {
  119. var _this = this;
  120. uni.getSystemInfo({
  121. success: resu => {
  122. const query = uni.createSelectorQuery();
  123. query.select('.swiper-box').boundingClientRect();
  124. query.exec(function(res) {
  125. _this.height = resu.windowHeight - res[0].top + 'px';
  126. console.log('打印页面的剩余高度', _this.height);
  127. });
  128. },
  129. fail: res => {}
  130. });
  131. },
  132. methods: {
  133. seave(item) {
  134. this.share = item;
  135. },
  136. clickSearch() {
  137. uni.navigateTo({
  138. url: '/pages/product/search'
  139. });
  140. },
  141. changeTab(e) {
  142. this.tabCurrentIndex = e.target.current;
  143. this.loadData();
  144. },
  145. tabClick(index) {
  146. this.tabCurrentIndex = index;
  147. this.loadData();
  148. },
  149. // 文章点赞
  150. wzdz(item) {
  151. article_good({}, item.id).then(e => {
  152. if (item.user_good == 0) {
  153. item.user_good = 1;
  154. item.goods_count += 1;
  155. } else {
  156. item.user_good = 0;
  157. item.goods_count -= 1;
  158. }
  159. });
  160. },
  161. // 评论点赞
  162. pldz(item) {
  163. reply_good({}, item.id).then(e => {
  164. if (item.user_good == 0) {
  165. item.user_good = 1;
  166. item.goods_count += 1;
  167. } else {
  168. item.user_good = 0;
  169. item.goods_count -= 1;
  170. }
  171. });
  172. },
  173. navTo(url) {
  174. uni.navigateTo({
  175. url
  176. });
  177. },
  178. async loadData(source) {
  179. let obj = this;
  180. if (this.tabCurrentIndex == 0) {
  181. articleList(
  182. {
  183. page: 1,
  184. limit: 1000
  185. },
  186. 1
  187. )
  188. .then(({ data }) => {
  189. this.bjsclist = data;
  190. })
  191. .catch(e => {
  192. console.log(e);
  193. });
  194. } else {
  195. reply_list(
  196. {
  197. page: 1,
  198. limit: 1000
  199. },
  200. 0
  201. )
  202. .then(({ data }) => {
  203. this.mjfklist = data;
  204. })
  205. .catch(e => {
  206. console.log(e);
  207. });
  208. }
  209. }
  210. }
  211. };
  212. </script>
  213. <style lang="scss">
  214. .vheigh {
  215. height: var(--status-bar-height);
  216. background-color: #ffffff;
  217. }
  218. button {
  219. padding: 0;
  220. margin: 0;
  221. border: none;
  222. background-color: #ffffff;
  223. line-height: 1;
  224. height: auto;
  225. }
  226. button::after {
  227. border: none;
  228. }
  229. page,
  230. .content {
  231. min-height: 100%;
  232. height: auto;
  233. }
  234. .top-bg {
  235. padding-top: 20rpx;
  236. background: #ffffff;
  237. }
  238. .list-scroll-content {
  239. background: #ffffff;
  240. height: 100%;
  241. .yan {
  242. padding-bottom: 100rpx;
  243. }
  244. }
  245. .top {
  246. width: 689rpx;
  247. height: 58rpx;
  248. background: #ededed;
  249. border-radius: 29rpx;
  250. margin: 0 auto;
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. .top-icon {
  255. width: 32rpx;
  256. height: 32rpx;
  257. image {
  258. width: 100%;
  259. height: 100%;
  260. }
  261. }
  262. .top-main {
  263. margin-left: 20rpx;
  264. font-size: 28rpx;
  265. font-family: PingFang SC;
  266. font-weight: 500;
  267. color: #cbcbcb;
  268. }
  269. }
  270. .navbar {
  271. display: flex;
  272. height: 88rpx;
  273. padding: 0 5px;
  274. background: #ffffff;
  275. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  276. position: relative;
  277. z-index: 10;
  278. .nav-item {
  279. flex: 1;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. height: 100%;
  284. font-size: 15px;
  285. color: #999999;
  286. position: relative;
  287. &.current {
  288. color: #000;
  289. &:after {
  290. content: '';
  291. position: absolute;
  292. left: 50%;
  293. bottom: 0;
  294. transform: translateX(-50%);
  295. width: 44px;
  296. height: 0;
  297. border-bottom: 2px solid #000000;
  298. }
  299. }
  300. }
  301. }
  302. .main {
  303. margin-top: 20rpx;
  304. padding: 35rpx 20rpx 24rpx;
  305. background: #ffffff;
  306. image {
  307. width: 100%;
  308. height: 100%;
  309. }
  310. .main-userInfo {
  311. display: flex;
  312. align-items: center;
  313. .avatar {
  314. width: 80rpx;
  315. height: 80rpx;
  316. background: #ffffff;
  317. border-radius: 50%;
  318. }
  319. .main-user-info {
  320. margin-left: 14rpx;
  321. line-height: 1;
  322. .main-userName {
  323. font-size: 28rpx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #000000;
  327. }
  328. .main-user-time {
  329. margin-top: 14rpx;
  330. font-size: 21rpx;
  331. font-family: PingFang SC;
  332. font-weight: 500;
  333. color: #666666;
  334. }
  335. }
  336. }
  337. .imagebox {
  338. margin-top: 40rpx;
  339. display: flex;
  340. align-items: center;
  341. flex-wrap: wrap;
  342. .image-item {
  343. margin: 10rpx;
  344. width: 30%;
  345. height: 230rpx;
  346. }
  347. }
  348. .main-bottom {
  349. margin-top: 60rpx;
  350. .main-bottom-item {
  351. padding: 30rpx 0;
  352. width: 33%;
  353. display: flex;
  354. justify-content: center;
  355. align-items: center;
  356. .main-bottom-icon {
  357. width: 36rpx;
  358. height: 36rpx;
  359. }
  360. .main-bottom-icon1 {
  361. width: 43rpx;
  362. height: 36rpx;
  363. }
  364. .main-bottom-icon2 {
  365. width: 36rpx;
  366. height: 36rpx;
  367. }
  368. .main-bottom-font {
  369. margin-left: 17rpx;
  370. font-size: 22rpx;
  371. font-family: PingFang SC;
  372. font-weight: 500;
  373. color: #333333;
  374. }
  375. }
  376. }
  377. }
  378. .info {
  379. padding: 10rpx;
  380. display: flex;
  381. flex-wrap: wrap;
  382. justify-content: space-between;
  383. image {
  384. width: 100%;
  385. height: 100%;
  386. }
  387. .info-item {
  388. width: 48%;
  389. padding-bottom: 20rpx;
  390. .info-image {
  391. width: 100%;
  392. height: 480rpx;
  393. }
  394. .info-name {
  395. margin-top: 20rpx;
  396. padding: 0 10rpx;
  397. font-size: 26rpx;
  398. font-family: PingFang SC;
  399. font-weight: bold;
  400. color: #000000;
  401. }
  402. .info-userinfo {
  403. margin-top: 20rpx;
  404. padding: 0 10rpx;
  405. .info-left {
  406. display: flex;
  407. align-items: center;
  408. .info-avatar {
  409. width: 32rpx;
  410. height: 32rpx;
  411. }
  412. }
  413. .info-userinfo-name {
  414. margin-left: 10rpx;
  415. font-size: 24rpx;
  416. font-family: PingFang SC;
  417. font-weight: bold;
  418. color: #999999;
  419. }
  420. .info-right {
  421. display: flex;
  422. align-items: center;
  423. .info-avatar {
  424. width: 30rpx;
  425. height: 30rpx;
  426. }
  427. }
  428. }
  429. }
  430. }
  431. </style>