news_detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="detail">
  5. <view class="title">
  6. {{detail.title}}
  7. </view>
  8. <view class="postMessage">
  9. <!-- <view> -->
  10. <view class="">
  11. <text class="iconfont2 icon-img">&#xe643;</text>
  12. <text>发布者:{{detail.publisher||'松河公益'}}</text>
  13. </view>
  14. <view class="">
  15. <text class="iconfont2 icon-img">&#xe66c;</text>
  16. <text>{{detail.create_time}}</text>
  17. </view>
  18. <!-- </view> -->
  19. <!-- <view @click="shareHandler">
  20. <text class="iconfont2 icon-img">&#xe615;</text>
  21. <text>分享</text>
  22. </view> -->
  23. </view>
  24. <view class="content">
  25. <view class="ql-editor-box" v-html="detail.content">
  26. </view>
  27. </view>
  28. <view class="browse">
  29. <view class="look-box">
  30. <text class="iconfont3 look-icon">&#xe63b;</text>
  31. <text>浏览量:{{detail.browse_sum||0}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="gray" v-if="recommend_goods_list.length || recommend_shop_list.length"></view>
  36. <view class="correlation" v-if="recommend_goods_list.length || recommend_shop_list.length">
  37. <view class="goods" v-if="recommend_goods_list.length">
  38. <u-section title="推荐商品" font-size="28" :bold="true" color="#1A1A1A" :show-line="true" line-color="#3775F6"
  39. :right="false">
  40. </u-section>
  41. <view class="goods-item" v-for="(v, index) in recommend_goods_list" :key="v.id" @click="goGoodsDetails(v)">
  42. <view class="goods-img">
  43. <image :src="v.cover.split(',')[0]" mode="aspectFill"></image>
  44. </view>
  45. <view class="right">
  46. <view class="goods-title">{{v.title}}</view>
  47. <view class="buy">
  48. <view class="hot-large">
  49. <rich-text :nodes="$mUtil.priceBigSmall(v.min_sale_price)"></rich-text>
  50. </view>
  51. <view class="goBuy">立即购买</view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="shop" v-if="recommend_shop_list.length">
  57. <u-section title="推荐联盟商家" font-size="28" :bold="true" color="#1A1A1A" :show-line="true" line-color="#3775F6"
  58. :right="false">
  59. </u-section>
  60. <view class="items">
  61. <view class="item" v-for="(v, index) in recommend_shop_list" :key="v.id" @click="goShopDetails(v)">
  62. <view class="shop-img">
  63. <image :src="v.logo" mode="aspectFill"></image>
  64. </view>
  65. <view class="right">
  66. <view class="title">{{v.shop_name}}</view>
  67. <view class="score-box">
  68. <view class="score">
  69. <rate :value="Math.round(v.average)"></rate>
  70. </view>
  71. <text class="score-text">{{v.average.toFixed(2)}}分</text>
  72. <text class="ju">距离:{{Math.round(v.distance/1000*100)/100}}KM</text>
  73. </view>
  74. <view class="address-box">
  75. <view class="left">
  76. <image class="location1" src="/static/shop/location-icon.png" mode="widthFix">
  77. </image>
  78. <view class="district">{{v.map_punctuation || '商户暂无地理位置'}}</view>
  79. </view>
  80. <view class="goShopping">
  81. <text class="iconfont3">&#xe787;</text>
  82. <text class="text">去逛逛</text>
  83. </view>
  84. </view>
  85. <!-- <view class="location2-box">
  86. <image class="location2" src="/static/convenienceService/location2.png" mode="widthFix">
  87. </image>
  88. <view>{{v.map_punctuation}}&gt;</view>
  89. </view> -->
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- <share ref="shares" :contentHeight="580"></share> -->
  96. </view>
  97. </template>
  98. <script>
  99. import share from "@/pages/public/share";
  100. import rate from "@/components/rate.vue"
  101. export default {
  102. components: {
  103. share,
  104. rate
  105. },
  106. data() {
  107. return {
  108. config: {
  109. back: true,
  110. title: '资讯详情',
  111. color: '#1a1a1a',
  112. backgroundColor: [1, "#fff"],
  113. statusBarFontColor: '#1A1A1A',
  114. leftSlot: true
  115. },
  116. detail: {},
  117. recommend_goods_list: [],
  118. recommend_shop_list: []
  119. }
  120. },
  121. onLoad(options) {
  122. if (options && options.id) {
  123. this.getDetail(options.id)
  124. }
  125. },
  126. methods: {
  127. getDetail(id) {
  128. let locationObj = uni.getStorageSync('locationObj')
  129. console.log(locationObj, 1111)
  130. this.$http.post(`/information/infoAndDistance`, {
  131. id: id,
  132. lon: locationObj.longitude.toFixed(4),
  133. lat: locationObj.latitude.toFixed(4)
  134. }).then(res => {
  135. if (res.code === 200) {
  136. this.detail = res.data
  137. this.recommend_goods_list = res.data.recommend_goods_list || []
  138. this.recommend_shop_list = res.data.recommend_shop_list || []
  139. }
  140. })
  141. },
  142. shareHandler() {
  143. let token = uni.getStorageSync("apiToken");
  144. let user = uni.getStorageSync("personal");
  145. if (!token) {
  146. uni.navigateTo({
  147. url: "/pages/login/index",
  148. });
  149. } else {
  150. // 咨询分享
  151. // this.$http.post(`/information/share/${this.detail.id}`).then(res => {})
  152. this.$nextTick(() => {
  153. this.$refs.shares.shareInfo("/?&shareId=" + user.id, null, null, null, null, this.detail.id);
  154. });
  155. }
  156. },
  157. goGoodsDetails(v) {
  158. uni.navigateTo({
  159. url: `/pages/product/goods/goods?id=${v.id}`
  160. })
  161. },
  162. goShopDetails(v) {
  163. uni.navigateTo({
  164. url: `/pages/nearbyShop/shopDetail?shopId=${v.id}`
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .detail {
  172. padding: 20rpx 20rpx 40rpx 30rpx;
  173. .title {
  174. margin-bottom: 14rpx;
  175. font-size: 35rpx;
  176. font-family: PingFang SC, PingFang SC-Bold;
  177. font-weight: 700;
  178. color: #1a1a1a;
  179. line-height: 52rpx;
  180. letter-spacing: -0.7rpx;
  181. }
  182. .postMessage {
  183. display: flex;
  184. align-items: center;
  185. justify-content: space-between;
  186. padding: 0 10rpx;
  187. margin-bottom: 30rpx;
  188. font-size: 24rpx;
  189. font-family: PingFang SC, PingFang SC-Medium;
  190. font-weight: 500;
  191. color: #999999;
  192. & view {
  193. display: flex;
  194. align-items: center;
  195. width: 50%;
  196. text:last-child {
  197. flex: 1;
  198. overflow: hidden;
  199. white-space: nowrap;
  200. text-overflow: ellipsis;
  201. }
  202. // margin-right: 50rpx;
  203. }
  204. .mb20 {
  205. margin-bottom: 20rpx;
  206. }
  207. .icon-img {
  208. margin-right: 8rpx;
  209. color: #FA6138;
  210. font-size: 36rpx;
  211. }
  212. }
  213. .look-box {
  214. display: flex;
  215. align-items: center;
  216. .look-icon {
  217. font-size: 36rpx;
  218. margin-right: 8rpx;
  219. margin-top: 8rpx;
  220. }
  221. }
  222. * {
  223. word-break: break-all;
  224. }
  225. .content /deep/ img {
  226. max-width: 100%;
  227. }
  228. .content /deep/ .ql-align-center {
  229. text-align: center;
  230. }
  231. .content /deep/ .ql-align-right {
  232. text-align: right;
  233. }
  234. .content /deep/ blockquote {
  235. display: block;
  236. border-left: 8px solid #d0e5f2;
  237. padding: 5px 10px;
  238. margin: 10px 0;
  239. line-height: 1.4;
  240. font-size: 100%;
  241. background-color: #f1f1f1;
  242. }
  243. .content /deep/ .ql-indent-1 {
  244. margin-left: 60rpx;
  245. }
  246. .content /deep/ .ql-indent-2 {
  247. margin-left: 120rpx;
  248. }
  249. .content /deep/ .ql-indent-3 {
  250. margin-left: 180rpx;
  251. }
  252. .content /deep/ .ql-indent-4 {
  253. margin-left: 240rpx;
  254. }
  255. .content /deep/ .ql-indent-5 {
  256. margin-left: 300rpx;
  257. }
  258. .content {
  259. /deep/ .ql-editor-box {
  260. .ql-video {
  261. width: 100%;
  262. // height: 45vw;
  263. }
  264. }
  265. }
  266. .browse {
  267. margin-top: 30rpx;
  268. font-size: 24rpx;
  269. font-family: PingFang SC, PingFang SC-Medium;
  270. font-weight: 500;
  271. color: #999999;
  272. view {
  273. display: flex;
  274. align-items: center;
  275. }
  276. .icon-img {
  277. margin-right: 8rpx;
  278. color: #FA6138;
  279. font-size: 36rpx;
  280. }
  281. }
  282. }
  283. .gray {
  284. width: 100%;
  285. height: 10rpx;
  286. background: #f5f5f5;
  287. }
  288. .correlation {
  289. padding: 40rpx 30rpx;
  290. .u-section {
  291. margin-bottom: 25rpx;
  292. }
  293. }
  294. .goods {
  295. padding-bottom: 30rpx;
  296. .goods-item {
  297. display: flex;
  298. padding: 20rpx 30rpx 20rpx 20rpx;
  299. margin-bottom: 30rpx;
  300. border-radius: 16rpx;
  301. box-shadow: 0 0 20rpx rgba(0, 0, 0, .1);
  302. .goods-img {
  303. width: 169rpx;
  304. height: 169rpx;
  305. margin-right: 40rpx;
  306. border-radius: 10rpx;
  307. overflow: hidden;
  308. flex-shrink: 0;
  309. image {
  310. width: 100%;
  311. height: 100%;
  312. }
  313. }
  314. .right {
  315. flex: 1;
  316. width: 0;
  317. font-size: 28rpx;
  318. font-family: PingFang SC, PingFang SC-Regular;
  319. font-weight: 400;
  320. color: #181818;
  321. .goods-title {
  322. margin-bottom: 10rpx;
  323. overflow: hidden;
  324. -webkit-line-clamp: 2;
  325. text-overflow: ellipsis;
  326. display: -webkit-box;
  327. -webkit-box-orient: vertical;
  328. }
  329. .buy {
  330. display: flex;
  331. justify-content: space-between;
  332. align-items: center;
  333. }
  334. .hot-large {
  335. color: #FF6600;
  336. font-size: 36rpx;
  337. font-weight: Bold;
  338. line-height: 24rpx;
  339. text {
  340. font-size: 36rpx;
  341. margin-left: 10rpx;
  342. }
  343. }
  344. .goBuy {
  345. width: 182rpx;
  346. height: 63rpx;
  347. background: #FA6138;
  348. border-radius: 32rpx;
  349. font-size: 28rpx;
  350. text-align: center;
  351. line-height: 63rpx;
  352. font-family: PingFang SC, PingFang SC-Medium;
  353. font-weight: 500;
  354. color: #ffffff;
  355. }
  356. }
  357. }
  358. }
  359. .shop {
  360. .items {
  361. .item {
  362. display: flex;
  363. align-items: center;
  364. margin-bottom: 25rpx;
  365. // border-bottom: 1rpx solid #e6e6e6;
  366. .shop-img {
  367. width: 162rpx;
  368. height: 158rpx;
  369. margin-right: 40rpx;
  370. border-radius: 10rpx;
  371. overflow: hidden;
  372. flex-shrink: 0;
  373. image {
  374. width: 100%;
  375. height: 100%;
  376. }
  377. }
  378. .right {
  379. flex: 1;
  380. width: 0;
  381. .score-box,
  382. .address-box,
  383. .location2-box {
  384. display: flex;
  385. align-items: center;
  386. font-size: 24rpx;
  387. font-family: PingFang SC, PingFang SC-Regular;
  388. font-weight: 400;
  389. }
  390. .location1,
  391. .location2 {
  392. width: 20rpx;
  393. height: 27rpx;
  394. flex-shrink: 0;
  395. margin-right: 9rpx;
  396. }
  397. .light-start,
  398. .startt {
  399. width: 30rpx;
  400. height: 30rpx;
  401. margin-right: 12rpx;
  402. }
  403. .title {
  404. margin-bottom: 18rpx;
  405. font-size: 28rpx;
  406. font-family: PingFang SC, PingFang SC-Regular;
  407. color: #1a1a1a;
  408. }
  409. .score-box {
  410. display: flex;
  411. align-items: normal;
  412. margin-bottom: 10rpx;
  413. font-family: PingFang SC, PingFang SC-Semibold;
  414. color: #333333;
  415. .score {
  416. flex-shrink: 0;
  417. }
  418. .score-text {
  419. font-size: 24rpx;
  420. font-family: PingFang SC, PingFang SC-Medium;
  421. font-weight: 500;
  422. text-align: left;
  423. color: #333333;
  424. flex-shrink: 0;
  425. }
  426. .ju {
  427. margin-left: 23rpx;
  428. font-size: 24rpx;
  429. color: #808080;
  430. text-align: left;
  431. overflow: hidden;
  432. text-overflow: ellipsis;
  433. white-space: nowrap;
  434. }
  435. }
  436. .address-box {
  437. // margin-bottom: 10rpx;
  438. font-family: PingFang SC;
  439. color: #666666;
  440. justify-content: space-between;
  441. .left {
  442. flex: 1;
  443. width: 0;
  444. display: flex;
  445. align-items: center;
  446. font-size: 24rpx;
  447. font-family: PingFang SC, PingFang SC-Regular;
  448. font-weight: 400;
  449. text-align: left;
  450. color: #333333;
  451. }
  452. .goShopping {
  453. display: flex;
  454. align-items: center;
  455. font-size: 40rpx;
  456. color: #FA6138;
  457. flex-shrink: 0;
  458. .text {
  459. font-size: 24rpx;
  460. font-family: PingFang SC, PingFang SC-Medium;
  461. font-weight: 500;
  462. text-align: left;
  463. color: #666666;
  464. }
  465. }
  466. .district {
  467. color: #1a1a1a;
  468. margin-right: 40rpx;
  469. overflow: hidden;
  470. text-overflow: ellipsis;
  471. white-space: nowrap;
  472. }
  473. }
  474. .location2-box {
  475. color: #333333;
  476. view {
  477. overflow: hidden;
  478. text-overflow: ellipsis;
  479. white-space: nowrap;
  480. }
  481. }
  482. }
  483. }
  484. }
  485. }
  486. </style>