detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <view class="index tn-safe-area-inset-bottom">
  3. <tn-nav-bar customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack()">
  5. <text class='icon tn-icon-left'></text>
  6. </view>
  7. <view slot="default" style="display: flex;">
  8. <view style="flex:1;">
  9. <text>速立保</text>
  10. </view>
  11. </view>
  12. </tn-nav-bar>
  13. <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  14. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm ">
  15. <!-- 图文信息 -->
  16. <block v-for="(item,index) in content" :key="item.id">
  17. <view class="blogger__item" :key="index">
  18. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  19. <view class="justify__author__info">
  20. <view class="tn-flex tn-flex-row-center">
  21. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  22. <!-- <view class="">
  23. <tn-avatar
  24. class=""
  25. shape="circle"
  26. :src="item.userAvatar"
  27. size="lg">
  28. </tn-avatar>
  29. </view> -->
  30. <view class="tn-padding-right tn-text-ellipsis">
  31. <view class="tn-padding-right tn-color-grey tn-text-lg">
  32. {{ item.company||(item.contactNickName||item.contactPerson) }}
  33. </view>
  34. <!-- <view class="tn-padding-right tn-padding-left-sm tn-padding-top-xs tn-color-gray">{{ item.date }}</view> -->
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view v-if="isNeed==1&&item.validDate"
  40. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  41. <text class="" style="background: #3F51B542;font-size: 12px;
  42. padding: 8px;
  43. color: #0000FF;
  44. border-radius: 24px;
  45. border-top-right-radius: 0;">{{item.validDate}}</text>
  46. </view>
  47. </view>
  48. <view
  49. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  50. >
  51. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  52. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand"
  53. fontColor="#3a96d7" shape="circle">{{ item.brand }}</tn-tag>
  54. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  55. fontColor="#3a96d7" shape="circle">个人</tn-tag>
  56. <text v-if="item.content"
  57. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  58. </view>
  59. <!-- 内容太多疲劳了-->
  60. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  61. :id="`blogger__content--${index}`">
  62. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true"
  63. :stripe="true" :data="item.shareExt">
  64. </basic-table>
  65. </view>
  66. <block v-if="item.imgList">
  67. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  68. >
  69. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  70. class="blogger__main-image" :class="{
  71. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  72. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  73. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  74. </view>
  75. <view v-else class="tn-padding-top-xs" @click="tn('')">
  76. <tn-grid hoverClass="none" :col="3">
  77. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  78. <!-- #ifndef MP-WEIXIN -->
  79. <tn-grid-item style="width: 30%;margin: 10rpx;">
  80. <image class="blogger__main-image blogger__main-image--3"
  81. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  82. </tn-grid-item>
  83. <!-- #endif-->
  84. <!-- #ifdef MP-WEIXIN -->
  85. <tn-grid-item style="width: 30%;margin: 10rpx;">
  86. <image class="blogger__main-image blogger__main-image--3"
  87. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  88. </tn-grid-item>
  89. <!-- #endif-->
  90. </block>
  91. </tn-grid>
  92. </view>
  93. </block>
  94. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  95. <view style="margin-top:10px">
  96. <text class="tn-icon-link"></text>
  97. <view style="display: inline-block;margin-left:8px; white-space: nowrap;
  98. text-overflow: ellipsis;
  99. width: 80%;" @click="clickLink(file.ftpUrl,file.fileName)">
  100. {{file.fileName}}</view>
  101. </view>
  102. </view>
  103. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  104. <view class="justify-content-item tn-color-gray tn-text-center">
  105. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  106. {{ item.createTime|formatDate }}
  107. </view>
  108. </view>
  109. <view class="justify-content-item tn-flex tn-flex-col-center">
  110. <text class="tn-icon-more-vertical tn-color-gray tn-text-bold tn-text-xxl"
  111. @click="showActionSheet(item)"></text>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 边距间隔 -->
  116. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  117. </block>
  118. <!-- 边距间隔 -->
  119. <!-- <view class="tn-strip-bottom"></view> -->
  120. <view v-if="showEmpty&&content.length==0" style="margin-top: 32vh;">
  121. <tn-empty mode="list"></tn-empty>
  122. </view>
  123. <!-- 广告 -->
  124. <!-- 结尾 -->
  125. </view>
  126. </view>
  127. <tn-popup v-model="showSheet" mode="center" closeBtn="true" borderRadius="16">
  128. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: 320px;"
  129. v-if="!showContact">
  130. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  131. class="tn-icon-service" style="margin-right: 12px;"></text> {{isNeed==1?'联系需方':'联系供方'}}</button>
  132. <!-- <view>联系我们帮助对接</view> -->
  133. <button v-if="!collStatus" @click="addColl"
  134. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  135. class="tn-icon-star" style="margin-right: 12px;"></text>
  136. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  137. <button v-if="collStatus" @click="delColl"
  138. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  139. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button>
  140. <button open-type="share" @click="hideSheet"
  141. style="margin-top:10px;border-radius:30px;" type="default" plain="true" :data-coupon="curItem"><text
  142. class="tn-icon-send" style="margin-right: 12px;"></text>
  143. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  144. </view>
  145. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width:320px;line-height: 24px;"
  146. v-if="showContact">
  147. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  148. <view style="margin-top:20px;
  149. font-weight: bold;
  150. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  151. <view style="margin-top:20px;font-size: 20px;font-weight: bold;" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  152. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  153. </view>
  154. </tn-popup>
  155. </view>
  156. </template>
  157. <script>
  158. import request from '../../../utils/request'
  159. export default {
  160. data() {
  161. return {
  162. bisNo:'',
  163. isNeed:'',
  164. imgList:[],
  165. fileDetailList:[],
  166. showHistory: false,
  167. content: [],
  168. contentValue:'',
  169. contactMethod:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).userName:'',
  170. typeValue:1,
  171. showEmpty: false,
  172. content:[],
  173. curItem:{},
  174. showSheet:false,
  175. collStatus:false,
  176. columns: [{
  177. fieldName: 'prodName',
  178. fieldDesc: '产品名称',
  179. }, {
  180. fieldName: 'prodSpec',
  181. fieldDesc: '规格型号',
  182. }, {
  183. fieldName: 'prodDesc',
  184. fieldDesc: '产品介绍',
  185. }],
  186. curContact:{},
  187. showContact: false,
  188. }
  189. },
  190. filters: {
  191. formatDate(value) {
  192. if (!value) return '';
  193. const date = new Date(value);
  194. const today = new Date();
  195. const yesterday = new Date(today); // 昨天的日期
  196. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  197. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  198. today.getDate()) {
  199. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  200. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  201. }
  202. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  203. .getDate() == yesterday.getDate()) {
  204. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  205. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  206. }
  207. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  208. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  209. },
  210. },
  211. created() {
  212. // uni.navigateTo({
  213. // url:'/pages/mine/addFeed'
  214. // })
  215. },
  216. methods: {
  217. showHis(){
  218. uni.navigateTo({
  219. url:'/pages/mine/feedback'
  220. })
  221. },
  222. goBack() {
  223. uni.navigateBack();
  224. uni.navigateTo({
  225. url:'/pages/index/index'
  226. })
  227. },
  228. isImage(fileName) {
  229. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  230. const extension = fileName.split('.').pop().toLowerCase();
  231. return imageExtensions.includes(extension);
  232. },
  233. showImg(items, index) {
  234. let urls = [];
  235. for (let i = 0; i < items.length; i++) {
  236. urls.push(items[i].ftpUrl);
  237. }
  238. // wx.chooseMessageFile({
  239. // count: 3, //默认100
  240. // type:'file',
  241. // extension:['.pdf','.doc'],
  242. // success: function (res) {
  243. // console.error(JSON.stringify(res));
  244. // }
  245. // });
  246. // 预览图片
  247. uni.previewImage({
  248. urls: urls,
  249. current: index,
  250. });
  251. },
  252. clickLink(url,fileName) {
  253. uni.navigateTo({
  254. url:'/pages/webview/web-view?url='+encodeURIComponent('http://slb-m.dev.ml1993.com/webview?title='+fileName+'&url='+ url),
  255. })
  256. // uni.navigateTo({
  257. // url: '/pages/webview/web-view?url=' + url,
  258. // })
  259. },
  260. hideSheet(){
  261. this.showSheet = false;
  262. },
  263. showActionSheet(item) {
  264. let that = this;
  265. console.warn(item);
  266. this.curItem = item;
  267. this.curItem.isNeed = 1;
  268. this.collStatus = false;
  269. this.showSheet = true;
  270. that.showContact = false;
  271. if (uni.getStorageSync('userNo')) {
  272. let params = {};
  273. params = {
  274. fkBisNo: that.curItem.bisNo,
  275. userNo: uni.getStorageSync('userNo'),
  276. };
  277. request.post('/slbCollect/query', params).then(res => {
  278. if (res.success) {
  279. if (res.list && res.list.length > 0) {
  280. that.collStatus = true;
  281. that.collId = res.list[0].id;
  282. }
  283. }
  284. })
  285. }
  286. },
  287. linkTel() {
  288. if (!uni.getStorageSync('userNo')) {
  289. uni.showToast({
  290. title: '请登录'
  291. })
  292. uni.navigateTo({
  293. url: '/pages/login/login'
  294. })
  295. return false;
  296. }
  297. let that = this;
  298. let params = {};
  299. params.slbBisContact = JSON.stringify({
  300. fkBisNo: that.curItem.bisNo,
  301. bisType: that.isNeed==1?'1':'2',
  302. type: '1',
  303. company: that.curItem.company,
  304. companyNo: that.curItem.companyNo,
  305. userNo: uni.getStorageSync('userNo'),
  306. });
  307. request.post('/slbBisContact/add', params).then(res => {
  308. if (res.success) {
  309. that.showContact = true;
  310. that.curContact.company = that.curItem.company;
  311. that.curContact.contactMethod = res.resultMap.contactMethod;
  312. that.curContact.contactPerson = res.resultMap.contactPerson;
  313. } else {
  314. that.showContact = false;
  315. uni.showToast({
  316. title: res.msg,
  317. icon: 'none'
  318. })
  319. }
  320. })
  321. },
  322. addColl() {
  323. if (!uni.getStorageSync('userNo')) {
  324. uni.showToast({
  325. title: '请登录'
  326. })
  327. uni.navigateTo({
  328. url: '/pages/login/login'
  329. })
  330. return false;
  331. }
  332. let that = this;
  333. let params = {};
  334. params.slbCollect = JSON.stringify({
  335. fkBisNo: that.curItem.bisNo,
  336. bisType: that.isNeed==1?'1':'2',
  337. userNo: uni.getStorageSync('userNo'),
  338. });
  339. request.post('/slbCollect/add', params).then(res => {
  340. if (res.success) {
  341. uni.showToast({
  342. title: '信息已收藏,请在我的收藏里查看阅读',
  343. duration:2500,
  344. icon: 'none'
  345. });
  346. that.showSheet = false;
  347. } else {
  348. uni.showToast({
  349. title: res.msg
  350. })
  351. }
  352. })
  353. },
  354. delColl() {
  355. let that = this;
  356. request.post('/slbCollect/del', {
  357. id: that.collId
  358. }).then(res => {
  359. if (res.success) {
  360. uni.showToast({
  361. title: '此'+(that.isNeed==1?'需求':'供应')+'信息将不会保存在我的收藏里',
  362. icon:'none',
  363. duration:2500
  364. })
  365. that.showSheet = false;
  366. } else {
  367. uni.showToast({
  368. title: res.msg
  369. })
  370. }
  371. })
  372. },
  373. loadData(){
  374. let that = this;
  375. request.post(that.isNeed==1?'/slbResourceDemand/query':'/slbResourceShare/query', {
  376. bisNo: that.bisNo
  377. }).then(res => {
  378. if (res.success) {
  379. let newList = res.list || [];
  380. for (let i = 0; i < newList.length; i++) {
  381. newList[i].imgList = [];
  382. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  383. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  384. newList[i].imgList.push(newList[i].fileDetailList[j]);
  385. }
  386. }
  387. }
  388. if (1 == 1) {
  389. that.content = newList || [];
  390. } else {
  391. that.content = that.content.concat(newList || []);
  392. }
  393. // that.showEmpty = true;
  394. }
  395. console.warn(res);
  396. })
  397. },
  398. sleep(time) {
  399. return new Promise((resolve) => setTimeout(resolve, time));
  400. },
  401. onShareAppMessage: function(option) {
  402. this.addLog(this.curItem)
  403. this.showSheet = false;
  404. this.sleep(1500);
  405. return;
  406. },
  407. addLog(shareData){
  408. const that = this;
  409. let params= {
  410. bisNo:shareData.bisNo,
  411. bisType:that.isNeed==1?'1':'2',
  412. company: shareData.company,
  413. companyNo: shareData.companyNo,
  414. userNo:uni.getStorageSync('userNo')
  415. };
  416. request.post('/slbForward/add',{slbForward:JSON.stringify(params)},{
  417. headers: {
  418. 'Content-Type': 'application/json', // 默认值
  419. },
  420. }).then(res=>{
  421. })
  422. },
  423. },
  424. onLoad(props) {
  425. this.bisNo = props.id;
  426. this.isNeed = props.isNeed;
  427. this.loadData();
  428. }
  429. }
  430. </script>
  431. <style lang="scss" scoped>
  432. /* 胶囊*/
  433. .tn-custom-nav-bar__back {
  434. width: 60%;
  435. height: 100%;
  436. position: relative;
  437. display: flex;
  438. justify-content: space-evenly;
  439. align-items: center;
  440. box-sizing: border-box;
  441. // background-color: rgba(0, 0, 0, 0.15);
  442. border-radius: 1000rpx;
  443. border: 1rpx solid rgba(255, 255, 255, 0.5);
  444. // color: #FFFFFF;
  445. font-size: 18px;
  446. .icon {
  447. display: block;
  448. flex: 1;
  449. margin: auto;
  450. text-align: center;
  451. }
  452. &:before {
  453. content: " ";
  454. width: 1rpx;
  455. height: 110%;
  456. position: absolute;
  457. top: 22.5%;
  458. left: 0;
  459. right: 0;
  460. margin: auto;
  461. transform: scale(0.5);
  462. transform-origin: 0 0;
  463. pointer-events: none;
  464. box-sizing: border-box;
  465. opacity: 0.7;
  466. background-color: #FFFFFF;
  467. }
  468. }
  469. /* 文章内容 start*/
  470. .blogger {
  471. &__item {
  472. padding: 30rpx;
  473. }
  474. &__author {
  475. &__btn {
  476. margin-right: -12rpx;
  477. opacity: 0.5;
  478. }
  479. }
  480. &__desc {
  481. line-height: 30rpx;
  482. &__label {
  483. color: #1D2541;
  484. background-color: #F3F2F7;
  485. border-radius: 10rpx;
  486. font-size: 22rpx;
  487. padding: 5rpx 15rpx;
  488. margin: 5rpx 18rpx 0 0;
  489. &--prefix {
  490. font-size: 24rpx;
  491. color: #1D2541;
  492. padding-right: 10rpx;
  493. }
  494. }
  495. &__content {
  496. line-height: 50rpx;
  497. }
  498. }
  499. &__content {
  500. margin-top: 18rpx;
  501. padding-right: 18rpx;
  502. &__data {
  503. line-height: 46rpx;
  504. text-align: justify;
  505. overflow: hidden;
  506. transition: all 0.25s ease-in-out;
  507. }
  508. &__status {
  509. margin-top: 10rpx;
  510. font-size: 26rpx;
  511. color: #82B2FF;
  512. }
  513. }
  514. &__main-image {
  515. border: 1rpx solid #F8F7F8;
  516. border-radius: 16rpx;
  517. &--1 {
  518. max-width: 80%;
  519. max-height: 300rpx;
  520. }
  521. &--2 {
  522. max-width: 260rpx;
  523. max-height: 260rpx;
  524. }
  525. &--3 {
  526. height: 212rpx;
  527. width: 100%;
  528. }
  529. }
  530. &__count-icon {
  531. font-size: 40rpx;
  532. padding-right: 5rpx;
  533. }
  534. &__ad {
  535. width: 100%;
  536. height: 500rpx;
  537. transform: translate3d(0px, 0px, 0px) !important;
  538. ::v-deep .uni-swiper-slide-frame {
  539. transform: translate3d(0px, 0px, 0px) !important;
  540. }
  541. .uni-swiper-slide-frame {
  542. transform: translate3d(0px, 0px, 0px) !important;
  543. }
  544. &__item {
  545. position: absolute;
  546. width: 100%;
  547. height: 100%;
  548. transform-origin: left center;
  549. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  550. transition: transform 0.25s ease-in-out;
  551. z-index: 1;
  552. &--0 {
  553. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  554. z-index: 4;
  555. }
  556. &--1 {
  557. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  558. z-index: 3;
  559. }
  560. &--2 {
  561. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  562. z-index: 2;
  563. }
  564. }
  565. &__content {
  566. border-radius: 40rpx;
  567. width: 640rpx;
  568. height: 500rpx;
  569. overflow: hidden;
  570. }
  571. &__image {
  572. width: 100%;
  573. height: 100%;
  574. }
  575. }
  576. }
  577. .bg-content{
  578. color: #fff;
  579. background-image: url(./../../../static/bg.png);
  580. background-size: cover;
  581. }
  582. </style>