detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  255. // })
  256. uni.downloadFile({
  257. url: url,
  258. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  259. success: function (res) {
  260. const filePath = res.filePath
  261. uni.openDocument({
  262. filePath: filePath,
  263. showMenu: true,
  264. success: function (res) {
  265. console.log('打开文档成功')
  266. },
  267. fail: function(){
  268. uni.navigateTo({
  269. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  270. })
  271. }
  272. })
  273. }
  274. })
  275. // uni.navigateTo({
  276. // url: '/pages/webview/web-view?url=' + url,
  277. // })
  278. },
  279. hideSheet(){
  280. this.showSheet = false;
  281. },
  282. showActionSheet(item) {
  283. let that = this;
  284. console.warn(item);
  285. this.curItem = item;
  286. this.curItem.isNeed = 1;
  287. this.collStatus = false;
  288. this.showSheet = true;
  289. that.showContact = false;
  290. if (uni.getStorageSync('userNo')) {
  291. let params = {};
  292. params = {
  293. fkBisNo: that.curItem.bisNo,
  294. userNo: uni.getStorageSync('userNo'),
  295. };
  296. request.post('/slbCollect/query', params).then(res => {
  297. if (res.success) {
  298. if (res.list && res.list.length > 0) {
  299. that.collStatus = true;
  300. that.collId = res.list[0].id;
  301. }
  302. }
  303. })
  304. }
  305. },
  306. linkTel() {
  307. if (!uni.getStorageSync('userNo')) {
  308. uni.showToast({
  309. title: '请登录',
  310. icon:'none'
  311. })
  312. uni.navigateTo({
  313. url: '/pages/login/login'
  314. })
  315. return false;
  316. }
  317. let that = this;
  318. let params = {};
  319. params.slbBisContact = JSON.stringify({
  320. fkBisNo: that.curItem.bisNo,
  321. bisType: that.isNeed==1?'1':'2',
  322. type: '1',
  323. company: that.curItem.company,
  324. companyNo: that.curItem.companyNo,
  325. userNo: uni.getStorageSync('userNo'),
  326. });
  327. request.post('/slbBisContact/add', params).then(res => {
  328. if (res.success) {
  329. that.showContact = true;
  330. that.curContact.company = that.curItem.company;
  331. that.curContact.contactMethod = res.resultMap.contactMethod;
  332. that.curContact.contactPerson = res.resultMap.contactPerson;
  333. } else {
  334. that.showContact = false;
  335. uni.showToast({
  336. title: res.msg,
  337. icon: 'none'
  338. })
  339. }
  340. })
  341. },
  342. addColl() {
  343. if (!uni.getStorageSync('userNo')) {
  344. uni.showToast({
  345. title: '请登录',
  346. icon:'none'
  347. })
  348. uni.navigateTo({
  349. url: '/pages/login/login'
  350. })
  351. return false;
  352. }
  353. let that = this;
  354. let params = {};
  355. params.slbCollect = JSON.stringify({
  356. fkBisNo: that.curItem.bisNo,
  357. bisType: that.isNeed==1?'1':'2',
  358. userNo: uni.getStorageSync('userNo'),
  359. });
  360. request.post('/slbCollect/add', params).then(res => {
  361. if (res.success) {
  362. that.showSheet = false;
  363. uni.showToast({
  364. title: '信息已收藏,请在我的收藏里查看阅读',
  365. icon: 'none',
  366. duration: 2000
  367. })
  368. } else {
  369. uni.showToast({
  370. title: res.msg,
  371. icon:'none'
  372. })
  373. }
  374. })
  375. },
  376. delColl() {
  377. let that = this;
  378. request.post('/slbCollect/del', {
  379. id: that.collId
  380. }).then(res => {
  381. if (res.success) {
  382. that.showSheet = false;
  383. uni.showToast({
  384. title: '此'+(that.isNeed==1?'需求':'供应')+'信息将不会保存在我的收藏里',
  385. icon: 'none',
  386. duration: 2000
  387. })
  388. } else {
  389. uni.showToast({
  390. title: res.msg,
  391. icon:'none'
  392. })
  393. }
  394. })
  395. },
  396. loadData(){
  397. let that = this;
  398. request.post(that.isNeed==1?'/slbResourceDemand/query':'/slbResourceShare/query', {
  399. bisNo: that.bisNo
  400. }).then(res => {
  401. if (res.success) {
  402. let newList = res.list || [];
  403. for (let i = 0; i < newList.length; i++) {
  404. newList[i].imgList = [];
  405. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  406. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  407. newList[i].imgList.push(newList[i].fileDetailList[j]);
  408. }
  409. }
  410. }
  411. if (1 == 1) {
  412. that.content = newList || [];
  413. } else {
  414. that.content = that.content.concat(newList || []);
  415. }
  416. // that.showEmpty = true;
  417. }
  418. console.warn(res);
  419. })
  420. },
  421. sleep(time) {
  422. return new Promise((resolve) => setTimeout(resolve, time));
  423. },
  424. onShareAppMessage: function(option) {
  425. this.addLog(this.curItem)
  426. this.showSheet = false;
  427. this.sleep(1500);
  428. return;
  429. },
  430. addLog(shareData){
  431. const that = this;
  432. let params= {
  433. bisNo:shareData.bisNo,
  434. bisType:that.isNeed==1?'1':'2',
  435. company: shareData.company,
  436. companyNo: shareData.companyNo,
  437. userNo:uni.getStorageSync('userNo')
  438. };
  439. request.post('/slbForward/add',{slbForward:JSON.stringify(params)},{
  440. headers: {
  441. 'Content-Type': 'application/json', // 默认值
  442. },
  443. }).then(res=>{
  444. })
  445. },
  446. showTel(tel){
  447. uni.makePhoneCall({
  448. phoneNumber: tel,
  449. });
  450. },
  451. },
  452. onLoad(props) {
  453. this.bisNo = props.id;
  454. this.isNeed = props.isNeed;
  455. this.loadData();
  456. }
  457. }
  458. </script>
  459. <style lang="scss" scoped>
  460. /* 胶囊*/
  461. .tn-custom-nav-bar__back {
  462. width: 60%;
  463. height: 100%;
  464. position: relative;
  465. display: flex;
  466. justify-content: space-evenly;
  467. align-items: center;
  468. box-sizing: border-box;
  469. // background-color: rgba(0, 0, 0, 0.15);
  470. border-radius: 1000rpx;
  471. border: 1rpx solid rgba(255, 255, 255, 0.5);
  472. // color: #FFFFFF;
  473. font-size: 18px;
  474. .icon {
  475. display: block;
  476. flex: 1;
  477. margin: auto;
  478. text-align: center;
  479. }
  480. &:before {
  481. content: " ";
  482. width: 1rpx;
  483. height: 110%;
  484. position: absolute;
  485. top: 22.5%;
  486. left: 0;
  487. right: 0;
  488. margin: auto;
  489. transform: scale(0.5);
  490. transform-origin: 0 0;
  491. pointer-events: none;
  492. box-sizing: border-box;
  493. opacity: 0.7;
  494. background-color: #FFFFFF;
  495. }
  496. }
  497. /* 文章内容 start*/
  498. .blogger {
  499. &__item {
  500. padding: 30rpx;
  501. }
  502. &__author {
  503. &__btn {
  504. margin-right: -12rpx;
  505. opacity: 0.5;
  506. }
  507. }
  508. &__desc {
  509. line-height: 30rpx;
  510. &__label {
  511. color: #1D2541;
  512. background-color: #F3F2F7;
  513. border-radius: 10rpx;
  514. font-size: 22rpx;
  515. padding: 5rpx 15rpx;
  516. margin: 5rpx 18rpx 0 0;
  517. &--prefix {
  518. font-size: 24rpx;
  519. color: #1D2541;
  520. padding-right: 10rpx;
  521. }
  522. }
  523. &__content {
  524. line-height: 50rpx;
  525. }
  526. }
  527. &__content {
  528. margin-top: 18rpx;
  529. padding-right: 18rpx;
  530. &__data {
  531. line-height: 46rpx;
  532. text-align: justify;
  533. overflow: hidden;
  534. transition: all 0.25s ease-in-out;
  535. }
  536. &__status {
  537. margin-top: 10rpx;
  538. font-size: 26rpx;
  539. color: #82B2FF;
  540. }
  541. }
  542. &__main-image {
  543. border: 1rpx solid #F8F7F8;
  544. border-radius: 16rpx;
  545. &--1 {
  546. max-width: 80%;
  547. max-height: 300rpx;
  548. }
  549. &--2 {
  550. max-width: 260rpx;
  551. max-height: 260rpx;
  552. }
  553. &--3 {
  554. height: 212rpx;
  555. width: 100%;
  556. }
  557. }
  558. &__count-icon {
  559. font-size: 40rpx;
  560. padding-right: 5rpx;
  561. }
  562. &__ad {
  563. width: 100%;
  564. height: 500rpx;
  565. transform: translate3d(0px, 0px, 0px) !important;
  566. ::v-deep .uni-swiper-slide-frame {
  567. transform: translate3d(0px, 0px, 0px) !important;
  568. }
  569. .uni-swiper-slide-frame {
  570. transform: translate3d(0px, 0px, 0px) !important;
  571. }
  572. &__item {
  573. position: absolute;
  574. width: 100%;
  575. height: 100%;
  576. transform-origin: left center;
  577. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  578. transition: transform 0.25s ease-in-out;
  579. z-index: 1;
  580. &--0 {
  581. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  582. z-index: 4;
  583. }
  584. &--1 {
  585. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  586. z-index: 3;
  587. }
  588. &--2 {
  589. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  590. z-index: 2;
  591. }
  592. }
  593. &__content {
  594. border-radius: 40rpx;
  595. width: 640rpx;
  596. height: 500rpx;
  597. overflow: hidden;
  598. }
  599. &__image {
  600. width: 100%;
  601. height: 100%;
  602. }
  603. }
  604. }
  605. .bg-content{
  606. color: #fff;
  607. background-image: url(./../../../static/bg.png);
  608. background-size: cover;
  609. }
  610. </style>