zc.vue 9.9 KB

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