comm.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. <template>
  2. <view class="circle tn-safe-area-inset-bottom">
  3. <!-- 发现 -->
  4. <view class="" v-if="current==0" >
  5. <uv-sticky bgColor="#ffffff">
  6. <view style="width: 100%;" v-if="currentTab==0">
  7. <view style="display: flex; padding: 10px 12px;">
  8. <view
  9. style="flex:1;background-color: #f8f8f8;border-radius: 18px;color: #bbb;line-height: 35px;"
  10. @click="showSearch">
  11. <view>
  12. <uni-icons type="search" color="#bbbbbb" size="18" style="margin: 8px;"></uni-icons>
  13. <text v-if="!searchProdValue">产品名称/品牌/产品型号</text>
  14. <text v-if="searchProdValue">{{searchProdValue}}</text>
  15. </view>
  16. </view>
  17. <view v-if="searchProdValue" @click="clearProd" style="line-height: 36px;margin-left: 10px;">取消
  18. </view>
  19. </view>
  20. </view>
  21. <view style="width: 100%;" v-if="currentTab==1">
  22. <view style="display: flex; padding: 10px 12px;">
  23. <view
  24. style="flex:1;background-color: #f8f8f8;border-radius: 18px;color: #bbb;line-height: 35px;"
  25. @click="showSearch2">
  26. <view>
  27. <uni-icons type="search" color="#bbbbbb" size="18" style="margin: 8px;"></uni-icons>
  28. <text v-if="!searchProdValue2">品牌/服务内容</text>
  29. <text v-if="searchProdValue2">{{searchProdValue2}}</text>
  30. </view>
  31. </view>
  32. <view v-if="searchProdValue2" @click="clearProd2" style="line-height: 36px;margin-left: 10px;">取消
  33. </view>
  34. </view>
  35. </view>
  36. <!-- <uni-search-bar radius="15" placeholder="搜索" v-if="currentTab==1" @confirm="search"
  37. v-model="searchValue" @blur="search" @cancel="cancel" @clear="clear" cancelButton="auto"
  38. clearButton="auto">
  39. </uni-search-bar> -->
  40. <tn-tabs-swiper :list="tabList" :isScroll="false" :current="currentTab" name="tab-name"
  41. @change="changeTab" style="border-bottom: 1rpx solid #f1f1f1cc;">
  42. </tn-tabs-swiper>
  43. </uv-sticky>
  44. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm ">
  45. <!-- 图文信息 -->
  46. <block v-for="(item,index) in content" :key="item.id">
  47. <view class="blogger__item" :key="index">
  48. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  49. <view class="justify__author__info" @click="tn('')">
  50. <view class="tn-flex tn-flex-row-center">
  51. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  52. <!-- <view class="">
  53. <tn-avatar
  54. class=""
  55. shape="circle"
  56. :src="item.userAvatar"
  57. size="lg">
  58. </tn-avatar>
  59. </view> -->
  60. <view class="tn-padding-right tn-text-ellipsis">
  61. <view class="tn-padding-right tn-color-grey tn-text-lg">
  62. {{ item.company||(item.contactNickName||item.contactPerson) }}
  63. </view>
  64. <!-- <view class="tn-padding-right tn-padding-left-sm tn-padding-top-xs tn-color-gray">{{ item.date }}</view> -->
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view v-if="1==0"
  70. class="blogger__author__btn justify-content-item tn-flex-col-center tn-flex-row-center">
  71. <text class="" style="background: #3F51B542;font-size: 12px;
  72. padding: 8px;
  73. color: #0000FF;
  74. border-radius: 24px;
  75. border-top-right-radius: 0;">{{item.validDate}}</text>
  76. </view>
  77. </view>
  78. <view
  79. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  80. >
  81. <!-- 不用限制长度了,因为发布的时候限制长度了-->
  82. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="item.brand"
  83. fontColor="#3a96d7" shape="circle">{{ item.brand }}</tn-tag>
  84. <tn-tag margin="-4px 4px 0 0" backgroundColor="#3a96d733" v-if="!item.company"
  85. fontColor="#3a96d7" shape="circle">个人</tn-tag>
  86. <text v-if="item.content"
  87. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df">{{ item.content }}</text>
  88. </view>
  89. <!-- 内容太多疲劳了-->
  90. <view v-if="item.shareExt&&item.shareExt.length>0" class="blogger__content"
  91. :id="`blogger__content--${index}`">
  92. <basic-table header-row-class-name="basic-table-header" :columns="columns" :border="true"
  93. :stripe="true" :data="item.shareExt">
  94. <template #item="{column,scope,index}">
  95. <view v-if="column.fieldName==='prodDesc'">
  96. <tn-read-more openText="查看全部" :closeBtn="true" closeText="收起" :showHeight="125">
  97. <text>{{scope.prodDesc}}</text>
  98. </tn-read-more>
  99. </view>
  100. </template>
  101. </basic-table>
  102. </view>
  103. <block v-if="item.imgList">
  104. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs"
  105. >
  106. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  107. class="blogger__main-image" :class="{
  108. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  109. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  110. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  111. </view>
  112. <view v-else class="tn-padding-top-xs" @click="tn('')">
  113. <tn-grid hoverClass="none" :col="3">
  114. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  115. <!-- #ifndef MP-WEIXIN -->
  116. <tn-grid-item style="width: 30%;margin: 10rpx;">
  117. <image class="blogger__main-image blogger__main-image--3"
  118. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  119. </tn-grid-item>
  120. <!-- #endif-->
  121. <!-- #ifdef MP-WEIXIN -->
  122. <tn-grid-item style="width: 30%;margin: 10rpx;">
  123. <image class="blogger__main-image blogger__main-image--3"
  124. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  125. </tn-grid-item>
  126. <!-- #endif-->
  127. </block>
  128. </tn-grid>
  129. </view>
  130. </block>
  131. <view v-for="file in item.fileDetailList" :key="file.id" v-if="!isImage(file.fileName)">
  132. <view style="margin-top:10px">
  133. <text class="tn-icon-link"></text>
  134. <view style="display: inline-block;margin-left:8px; white-space: nowrap;
  135. text-overflow: ellipsis;
  136. width: 80%;" @click="clickLink(file.ftpUrl,file.fileName)">
  137. {{file.fileName}}</view>
  138. </view>
  139. </view>
  140. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  141. <view class="justify-content-item tn-color-gray tn-text-center">
  142. <view class="tn-padding-right tn-padding-top-xs tn-color-gray">
  143. {{ item.createTime|formatDate }}
  144. </view>
  145. </view>
  146. <view class="justify-content-item tn-flex tn-flex-col-center" style="position: relative">
  147. <text class="tn-icon-more-vertical tn-color-gray tn-text-bold tn-text-xxl"
  148. @click="showActionSheet(item)"></text>
  149. <view v-if="curItem.id==item.id&&showSheet" style="position: absolute;
  150. background: #ddd;
  151. display: block;
  152. right: 10px;
  153. top: 24px;border-radius: 16px;z-index: 900;border-top-right-radius: 0">
  154. <text class="tn-icon-close" style="float: right;padding:8px;color:#333" @click="hideSheet()"></text>
  155. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: calc(100vw - 52px); border-radius: 16px;
  156. border-top-right-radius: 0;"
  157. v-if="!showContact">
  158. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  159. class="tn-icon-service" style="margin-right: 12px;"></text> 联系需方</button>
  160. <!-- <view>联系我们帮助对接</view> -->
  161. <button v-if="!collStatus" @click="addColl"
  162. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  163. class="tn-icon-star" style="margin-right: 12px;"></text>
  164. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  165. <button v-if="collStatus" @click="delColl"
  166. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  167. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button>
  168. <button open-type="share"
  169. style="margin-top:10px;border-radius:30px;" type="default" plain="true" :data-coupon="curItem"><text
  170. class="tn-icon-send" style="margin-right: 12px;"></text>
  171. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  172. </view>
  173. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width: calc(100vw - 52px);line-height: 24px;"
  174. v-if="showContact">
  175. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  176. <view style="margin-top:20px;
  177. font-weight: bold;
  178. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  179. <view style="margin-top:20px;font-size: 20px;font-weight: bold;" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  180. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <!-- 边距间隔 -->
  187. <view class="tn-strip-bottom" v-if="index != content.length - 1"></view>
  188. </block>
  189. <!-- 边距间隔 -->
  190. <!-- <view class="tn-strip-bottom"></view> -->
  191. <view v-if="showEmpty&&content.length==0" style="margin-top: 32vh;">
  192. <tn-empty mode="list"></tn-empty>
  193. </view>
  194. <!-- 广告 -->
  195. <!-- 结尾 -->
  196. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==0" style="background-color: #f1f1f1cc;padding: 16px 0;" :style="{paddingTop:showSheet?'216px':'16px'}">
  197. <tn-load-more status="nomore" :loadText="loadText"></tn-load-more>
  198. </view>
  199. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==1" style="background-color: #f1f1f1cc;padding: 16px 0;" :style="{paddingTop:showSheet?'216px':'16px'}">
  200. <tn-load-more status="nomore" :loadText="loadText2"></tn-load-more>
  201. </view>
  202. </view>
  203. <view class='tn-tabbar-height' :style="{marginTop: vuex_custom_bar_height + 'px'}"></view>
  204. </view>
  205. <tn-popup v-model="showSheet2" mode="center" closeBtn="true" borderRadius="16">
  206. <view class="content" style="padding: 24px 36px;font-size: 16px;line-height: 24px; width: 320px;"
  207. v-if="!showContact">
  208. <button @click="linkTel()" style="border-radius:30px;color:#fff;background-color: #1d60b1;"><text
  209. class="tn-icon-service" style="margin-right: 12px;"></text> 联系供方</button>
  210. <!-- <view>联系我们帮助对接</view> -->
  211. <button v-if="!collStatus" @click="addColl"
  212. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  213. class="tn-icon-star" style="margin-right: 12px;"></text>
  214. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  215. <button v-if="collStatus" @click="delColl"
  216. style="margin-top:10px;border-radius:30px;" type="default" plain="true"><text
  217. class="tn-icon-star-fill" style="margin-right: 12px;"></text> 取消收藏</button>
  218. <button open-type="share"
  219. style="margin-top:10px;border-radius:30px;" type="default" plain="true" :data-coupon="curItem"><text
  220. class="tn-icon-send" style="margin-right: 12px;"></text>
  221. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  222. </view>
  223. <view class="content bg-content" style="padding: 50px 36px;padding-bottom: 32px;font-size: 16px;width:320px;line-height: 24px;"
  224. v-if="showContact">
  225. <view><text style="font-size: 20px;font-weight: bold;" v-if="curContact.company">{{curContact.company}}</text></view>
  226. <view style="margin-top:20px;
  227. font-weight: bold;
  228. font-size: 20px;"><text class="tn-icon-my-formal"></text><text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  229. <view style="margin-top:20px;font-size: 20px;font-weight: bold;" @click="showTel(curContact.contactMethod)"><text class="tn-icon-tel"></text>
  230. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text> </view>
  231. </view>
  232. </tn-popup>
  233. <tn-toast ref="toast"></tn-toast>
  234. </view>
  235. </template>
  236. <script>
  237. import request from '../../utils/request'
  238. export default {
  239. name: 'Circle',
  240. data() {
  241. return {
  242. loading: false,
  243. searchProdValue: '',
  244. searchProdValue2:'',
  245. tabList: [{
  246. 'tab-name': '产品'
  247. }, {
  248. 'tab-name': '服务'
  249. }],
  250. loadText: {
  251. loadmore: '下拉加载',
  252. loading: '快速加载中...',
  253. nomore: '恭喜你,已阅读完所有供应信息哦!'
  254. },
  255. loadText2: {
  256. loadmore: '下拉加载',
  257. loading: '快速加载中...',
  258. nomore: '恭喜你,已阅读完所有供应信息哦!'
  259. },
  260. currentTab: 0,
  261. showEmpty: false,
  262. columns: [{
  263. fieldName: 'prodName',
  264. fieldDesc: '产品名称',
  265. }, {
  266. fieldName: 'prodSpec',
  267. fieldDesc: '规格型号',
  268. }, {
  269. fieldName: 'prodDesc',
  270. fieldDesc: '产品介绍',
  271. fieldType:'slot'
  272. }],
  273. showSheet: false,
  274. curItem: {},
  275. collId: '',
  276. showContact: false,
  277. curContact: {},
  278. current: 0,
  279. collStatus: '',
  280. searchValue: '',
  281. // 内容默认隐藏显示的高度
  282. contentHideShowHeight: 0,
  283. content: [],
  284. totalSize: 0,
  285. curIndex: 1,
  286. }
  287. },
  288. onLoad() {
  289. this.initContentData()
  290. this.contentHideShowHeight = uni.upx2px(56) * 3
  291. },
  292. onReady() {
  293. this.$nextTick(() => {
  294. this.fetchData()
  295. })
  296. },
  297. onShow() {
  298. this.fetchData()
  299. },
  300. onHide() {
  301. this.adAutoplay = false
  302. },
  303. filters: {
  304. formatDate(value) {
  305. if (!value) return '';
  306. const date = new Date(value);
  307. const today = new Date();
  308. const yesterday = new Date(today); // 昨天的日期
  309. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  310. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  311. today.getDate()) {
  312. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  313. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  314. }
  315. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  316. .getDate() == yesterday.getDate()) {
  317. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  318. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  319. }
  320. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  321. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  322. },
  323. },
  324. methods: {
  325. showSearch(item) {
  326. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  327. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  328. uni.navigateTo({
  329. url: '/pages/comm/search'
  330. })
  331. },
  332. showDetail(item){
  333. uni.navigateTo({
  334. url: '/pages/index/detail/detail?id='+item.bisNo+'&isNeed=0'
  335. })
  336. },
  337. showSearch2(item) {
  338. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  339. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  340. uni.navigateTo({
  341. url: '/pages/comm/search2'
  342. })
  343. },
  344. isImage(fileName) {
  345. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  346. const extension = fileName.split('.').pop().toLowerCase();
  347. return imageExtensions.includes(extension);
  348. },
  349. addButton() {
  350. if (!uni.getStorageSync('userNo')) {
  351. uni.showToast({
  352. title: '请登录'
  353. })
  354. uni.navigateTo({
  355. url: '/pages/login/login'
  356. })
  357. return false;
  358. } else {
  359. uni.navigateTo({
  360. url: '/circlePages/addShare'
  361. })
  362. }
  363. },
  364. showImg(items, index) {
  365. let urls = [];
  366. for (let i = 0; i < items.length; i++) {
  367. urls.push(items[i].ftpUrl);
  368. }
  369. // wx.chooseMessageFile({
  370. // count: 3, //默认100
  371. // type:'file',
  372. // extension:['.pdf','.doc'],
  373. // success: function (res) {
  374. // console.error(JSON.stringify(res));
  375. // }
  376. // });
  377. // 预览图片
  378. uni.previewImage({
  379. urls: urls,
  380. current: index,
  381. });
  382. },
  383. clickLink(url,fileName) {
  384. // uni.navigateTo({
  385. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  386. // })
  387. uni.downloadFile({
  388. url: url,
  389. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  390. success: function (res) {
  391. const filePath = res.filePath
  392. uni.openDocument({
  393. filePath: filePath,
  394. showMenu: true,
  395. success: function (res) {
  396. console.log('打开文档成功')
  397. },
  398. fail: function(){
  399. uni.navigateTo({
  400. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  401. })
  402. }
  403. })
  404. }
  405. })
  406. // uni.navigateTo({
  407. // url: '/pages/webview/web-view?url=' + url,
  408. // })
  409. },
  410. // tab选项卡切换
  411. tabChange(index) {
  412. this.current = index
  413. },
  414. // 跳转
  415. tn(e) {
  416. uni.navigateTo({
  417. url: e,
  418. });
  419. },
  420. // 震动跳转
  421. navEdit(e) {
  422. wx.vibrateLong();
  423. uni.navigateTo({
  424. url: '/circlePages/edit'
  425. })
  426. },
  427. // 震动跳转
  428. navCreate(e) {
  429. wx.vibrateLong();
  430. uni.navigateTo({
  431. url: '/circlePages/create'
  432. })
  433. },
  434. // 震动跳转
  435. navBuild(e) {
  436. wx.vibrateLong();
  437. uni.navigateTo({
  438. url: '/circlePages/build'
  439. })
  440. },
  441. // 处理内容,给内容添加对应的标识信息
  442. initContentData() {
  443. this.content.forEach((item, index) => {
  444. // 是否需要隐藏内容
  445. item.hideContent = false
  446. // 显示所有内容
  447. item.showAllContent = false
  448. // 内容容器的实际高度
  449. item.contentContainerHeight = 0
  450. // 内容容器是否初始化完成
  451. item.contentContainerInit = false
  452. this.$set(this.content, index, item)
  453. })
  454. },
  455. reFetchData() {
  456. this.loading = true;
  457. uni.showToast({
  458. title: '正在刷新...',
  459. icon: 'none'
  460. });
  461. this.fetchData();
  462. },
  463. hideSheet(){
  464. this.curItem = {};
  465. this.showSheet = false;
  466. },
  467. loadMore() {
  468. if (this.totalSize > this.content.length) {
  469. this.fetchData(this.curIndex + 1);
  470. }
  471. console.error('正在加载更多');
  472. },
  473. changeTab(index) {
  474. this.currentTab = index;
  475. this.content = [];
  476. this.fetchData();
  477. },
  478. // 获取内容容器的信息
  479. fetchData(curIndex = 1) {
  480. let that = this;
  481. that.showEmpty = false;
  482. this.curIndex = curIndex;
  483. if (uni.getStorageSync('searchProdValue')) {
  484. that.searchProdValue = uni.getStorageSync('searchProdValue');
  485. }
  486. if (uni.getStorageSync('searchProdValue2')) {
  487. that.searchProdValue2 = uni.getStorageSync('searchProdValue2');
  488. }
  489. request.post('/slbResourceShare/query', {
  490. type: that.currentTab == 1 ? '2' : '1',
  491. index: curIndex,
  492. content: that.currentTab == 1 ? (that.searchProdValue2 ? that.searchProdValue2.split('/')[1]:'') : undefined,
  493. prodSpec: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[2] :
  494. '') : undefined,
  495. prodName: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[0] :
  496. '') : undefined,
  497. brand: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[1] :
  498. '') : that.currentTab == 1 ?(that.searchProdValue2 ? that.searchProdValue2.split('/')[0]:''): undefined,
  499. }).then(res => {
  500. that.loading = false;
  501. if (res && res.success) {
  502. that.totalSize = res.total || 0;
  503. let newList = res.list || [];
  504. for (let i = 0; i < newList.length; i++) {
  505. newList[i].imgList = [];
  506. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  507. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  508. newList[i].imgList.push(newList[i].fileDetailList[j]);
  509. }
  510. }
  511. }
  512. if (curIndex == 1) {
  513. that.content = newList || [];
  514. } else {
  515. that.content = that.content.concat(newList || []);
  516. }
  517. }
  518. that.showEmpty = true;
  519. console.warn(res);
  520. })
  521. // let contentRect = {}
  522. // const query = uni.createSelectorQuery().in(this)
  523. // // 筛选出存在内容的数据
  524. // this.content.forEach((item, index) => {
  525. // if (item?.content) {
  526. // query.select(`#blogger__content--${index}`).boundingClientRect()
  527. // contentRect[index] = item
  528. // }
  529. // })
  530. // // 获取所有内容的宽高信息
  531. // query.exec(res => {
  532. // if (!res) {
  533. // setTimeout(() => {
  534. // this.fetchData()
  535. // }, 10)
  536. // return
  537. // }
  538. // // console.log(res);
  539. // res.map((item) => {
  540. // // console.log(item.height, this.contentHideShowHeight);
  541. // // 获取对应的标号
  542. // const id = item.id
  543. // const idIndex = /blogger__content--(\d)/.exec(id)[1]
  544. // let contentItem = this.content[idIndex]
  545. // contentItem.hideContent = item.height > this.contentHideShowHeight
  546. // contentItem.showAllContent = false
  547. // contentItem.contentContainerHeight = item.height
  548. // contentItem.contentContainerInit = true
  549. // this.$set(this.content, idIndex, contentItem)
  550. // // console.log(/blogger__content--(\d)/.exec(id)[1]);
  551. // })
  552. // })
  553. },
  554. showActionSheet(item) {
  555. let that = this;
  556. if(!this.curItem.id){
  557. this.curItem = item;
  558. }else{
  559. this.curItem = {}
  560. return false;
  561. }
  562. this.collStatus = false;
  563. this.showSheet = true;
  564. that.showContact = false;
  565. if (uni.getStorageSync('userNo')) {
  566. let params = {};
  567. params = {
  568. fkBisNo: that.curItem.bisNo,
  569. userNo: uni.getStorageSync('userNo'),
  570. };
  571. request.post('/slbCollect/query', params).then(res => {
  572. if (res.success) {
  573. if (res.list && res.list.length > 0) {
  574. that.collStatus = true;
  575. that.collId = res.list[0].id;
  576. }
  577. }
  578. })
  579. }
  580. },
  581. linkTel() {
  582. if (!uni.getStorageSync('userNo')) {
  583. uni.showToast({
  584. title: '请登录'
  585. })
  586. uni.navigateTo({
  587. url: '/pages/login/login'
  588. })
  589. return false;
  590. }
  591. let that = this;
  592. let params = {};
  593. params.slbBisContact = JSON.stringify({
  594. fkBisNo: that.curItem.bisNo,
  595. bisType: '2',
  596. type: '1',
  597. company: that.curItem.company,
  598. companyNo: that.curItem.companyNo,
  599. userNo: uni.getStorageSync('userNo'),
  600. });
  601. request.post('/slbBisContact/add', params).then(res => {
  602. if (res.success) {
  603. that.showContact = true;
  604. that.curContact.company = that.curItem.company;
  605. that.curContact.contactMethod = res.resultMap.contactMethod;
  606. that.curContact.contactPerson = res.resultMap.contactPerson;
  607. } else {
  608. that.showContact = false;
  609. uni.showToast({
  610. title: res.msg,
  611. icon: 'none'
  612. })
  613. }
  614. })
  615. },
  616. addColl() {
  617. if (!uni.getStorageSync('userNo')) {
  618. uni.showToast({
  619. title: '请登录'
  620. })
  621. uni.navigateTo({
  622. url: '/pages/login/login'
  623. })
  624. return false;
  625. }
  626. let that = this;
  627. let params = {};
  628. params.slbCollect = JSON.stringify({
  629. fkBisNo: that.curItem.bisNo,
  630. bisType: '2',
  631. userNo: uni.getStorageSync('userNo'),
  632. });
  633. request.post('/slbCollect/add', params).then(res => {
  634. if (res.success) {
  635. that.$refs.toast.show({
  636. title: '信息已收藏,请在我的收藏里查看阅读',
  637. image: '',
  638. duration: 2000
  639. })
  640. that.showSheet = false;
  641. } else {
  642. uni.showToast({
  643. title: res.msg
  644. })
  645. }
  646. })
  647. },
  648. delColl() {
  649. let that = this;
  650. request.post('/slbCollect/del', {
  651. id: that.collId
  652. }).then(res => {
  653. if (res.success) {
  654. that.$refs.toast.show({
  655. title: '此供应信息将不会保存在我的收藏里',
  656. image: '',
  657. duration: 2000
  658. })
  659. that.showSheet = false;
  660. } else {
  661. uni.showToast({
  662. title: res.msg
  663. })
  664. }
  665. })
  666. },
  667. search() {
  668. this.fetchData();
  669. },
  670. searchProd() {
  671. this.searchProdValue = '';
  672. this.fetchData();
  673. },
  674. cancel() {
  675. this.searchValue = '';
  676. this.fetchData();
  677. },
  678. clear() {
  679. this.searchValue = '';
  680. this.fetchData();
  681. },
  682. clearProd() {
  683. this.searchProdValue = '';
  684. uni.removeStorageSync('searchProdValue');
  685. this.fetchData();
  686. },
  687. clearProd2() {
  688. this.searchProdValue2 = '';
  689. uni.removeStorageSync('searchProdValue2');
  690. this.fetchData();
  691. }
  692. }
  693. }
  694. </script>
  695. <style lang="scss" scoped>
  696. .circle {
  697. max-height: 100vh;
  698. }
  699. /* 底部安全边距 start*/
  700. .tn-tabbar-height {
  701. min-height: 120rpx;
  702. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  703. height: calc(140rpx + constant(safe-area-inset-bottom));
  704. }
  705. /* 自定义导航栏内容 start */
  706. .custom-nav {
  707. height: 100%;
  708. &__back {
  709. margin: auto 5rpx;
  710. font-size: 40rpx;
  711. margin-right: 10rpx;
  712. margin-left: 30rpx;
  713. flex-basis: 5%;
  714. }
  715. &__search {
  716. flex-basis: 60%;
  717. width: 100%;
  718. height: 100%;
  719. &__box {
  720. width: 100%;
  721. height: 70%;
  722. padding: 10rpx 0;
  723. margin: 0 30rpx;
  724. border-radius: 60rpx 60rpx 0 60rpx;
  725. font-size: 24rpx;
  726. }
  727. &__icon {
  728. padding-right: 10rpx;
  729. margin-left: 20rpx;
  730. font-size: 30rpx;
  731. }
  732. &__text {
  733. color: #AAAAAA;
  734. }
  735. }
  736. }
  737. .logo-image {
  738. width: 60rpx;
  739. height: 60rpx;
  740. position: relative;
  741. margin-top: -15rpx;
  742. }
  743. .logo-pic {
  744. background-size: cover;
  745. background-repeat: no-repeat;
  746. // background-attachment:fixed;
  747. background-position: top;
  748. border-radius: 50%;
  749. }
  750. /* 自定义导航栏内容 end */
  751. /* 博主头像 start*/
  752. .image-circle {
  753. // padding: 95rpx;
  754. width: 190rpx;
  755. height: 190rpx;
  756. font-size: 40rpx;
  757. font-weight: 300;
  758. position: relative;
  759. }
  760. .image-pic {
  761. border: 1rpx solid #F8F7F8;
  762. background-size: cover;
  763. background-repeat: no-repeat;
  764. // background-attachment:fixed;
  765. background-position: top;
  766. border-radius: 10rpx;
  767. }
  768. .tn-color-cat {
  769. color: #1D2541;
  770. }
  771. .tn-bg-cat {
  772. background-color: #1D2541;
  773. }
  774. /* 文章内容 start*/
  775. .blogger {
  776. &__item {
  777. padding: 30rpx;
  778. }
  779. &__author {
  780. &__btn {
  781. margin-right: -12rpx;
  782. opacity: 0.5;
  783. }
  784. }
  785. &__desc {
  786. line-height: 30rpx;
  787. &__label {
  788. color: #1D2541;
  789. background-color: #F3F2F7;
  790. border-radius: 10rpx;
  791. font-size: 22rpx;
  792. padding: 5rpx 15rpx;
  793. margin: 5rpx 18rpx 0 0;
  794. &--prefix {
  795. font-size: 24rpx;
  796. color: #1D2541;
  797. padding-right: 10rpx;
  798. }
  799. }
  800. &__content {
  801. line-height: 50rpx;
  802. }
  803. }
  804. &__content {
  805. margin-top: 18rpx;
  806. padding-right: 18rpx;
  807. &__data {
  808. line-height: 46rpx;
  809. text-align: justify;
  810. overflow: hidden;
  811. transition: all 0.25s ease-in-out;
  812. }
  813. &__status {
  814. margin-top: 10rpx;
  815. font-size: 26rpx;
  816. color: #82B2FF;
  817. }
  818. }
  819. &__main-image {
  820. border: 1rpx solid #F8F7F8;
  821. border-radius: 16rpx;
  822. &--1 {
  823. max-width: 80%;
  824. max-height: 300rpx;
  825. }
  826. &--2 {
  827. max-width: 260rpx;
  828. max-height: 260rpx;
  829. }
  830. &--3 {
  831. height: 212rpx;
  832. width: 100%;
  833. }
  834. }
  835. &__count-icon {
  836. font-size: 40rpx;
  837. padding-right: 5rpx;
  838. }
  839. &__ad {
  840. width: 100%;
  841. height: 500rpx;
  842. transform: translate3d(0px, 0px, 0px) !important;
  843. ::v-deep .uni-swiper-slide-frame {
  844. transform: translate3d(0px, 0px, 0px) !important;
  845. }
  846. .uni-swiper-slide-frame {
  847. transform: translate3d(0px, 0px, 0px) !important;
  848. }
  849. &__item {
  850. position: absolute;
  851. width: 100%;
  852. height: 100%;
  853. transform-origin: left center;
  854. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  855. transition: transform 0.25s ease-in-out;
  856. z-index: 1;
  857. &--0 {
  858. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  859. z-index: 4;
  860. }
  861. &--1 {
  862. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  863. z-index: 3;
  864. }
  865. &--2 {
  866. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  867. z-index: 2;
  868. }
  869. }
  870. &__content {
  871. border-radius: 40rpx;
  872. width: 640rpx;
  873. height: 500rpx;
  874. overflow: hidden;
  875. }
  876. &__image {
  877. width: 100%;
  878. height: 100%;
  879. }
  880. }
  881. }
  882. /* 文章内容 end*/
  883. /* 间隔线 start*/
  884. .tn-strip-bottom {
  885. width: 100%;
  886. border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
  887. }
  888. /* 间隔线 end*/
  889. /* 广告内容 start */
  890. .ad-image {
  891. width: 80rpx;
  892. height: 80rpx;
  893. position: relative;
  894. }
  895. .ad-pic {
  896. background-size: cover;
  897. background-repeat: no-repeat;
  898. // background-attachment:fixed;
  899. background-position: top;
  900. border-radius: 20%;
  901. }
  902. /* 自定义导航栏内容 end */
  903. /* 全屏轮播 start*/
  904. .card-swiper {
  905. height: 100vh !important;
  906. }
  907. .card-swiper swiper-item {
  908. width: 750rpx !important;
  909. left: 0rpx;
  910. box-sizing: border-box;
  911. overflow: initial;
  912. }
  913. .card-swiper swiper-item .swiper-item {
  914. width: 100%;
  915. display: block;
  916. height: 100vh;
  917. border-radius: 0rpx;
  918. transform: scale(1);
  919. transition: all 0.2s ease-in 0s;
  920. overflow: hidden;
  921. }
  922. .card-swiper swiper-item.cur .swiper-item {
  923. transform: none;
  924. transition: all 0.2s ease-in 0s;
  925. }
  926. .card-swiper swiper-item .swiper-item-png {
  927. margin-top: -50vh;
  928. width: 100%;
  929. display: block;
  930. border-radius: 0rpx;
  931. transform: translate(1040rpx, 20rpx) scale(0.5, 0.5);
  932. transition: all 0.6s ease 0s;
  933. // overflow: hidden;
  934. }
  935. .card-swiper swiper-item.cur .swiper-item-png {
  936. margin-top: -100vh;
  937. width: 900rpx;
  938. transform: translate(-80rpx, 0rpx) scale(1, 1);
  939. transition: all 0.6s ease 0s;
  940. }
  941. .image-banner {
  942. display: flex;
  943. align-items: center;
  944. justify-content: center;
  945. }
  946. .image-banner image {
  947. width: 100%;
  948. }
  949. /* 轮播指示点 start*/
  950. .indication {
  951. z-index: 9999;
  952. width: 100%;
  953. height: 36rpx;
  954. position: fixed;
  955. // display:flex;
  956. display: block;
  957. flex-direction: row;
  958. align-items: center;
  959. justify-content: center;
  960. }
  961. .spot {
  962. background-color: #000;
  963. opacity: 0.3;
  964. width: 10rpx;
  965. height: 10rpx;
  966. border-radius: 20rpx;
  967. margin: 20rpx 0 !important;
  968. left: 95vw;
  969. top: -60vh;
  970. position: relative;
  971. }
  972. .spot.active {
  973. opacity: 0.6;
  974. height: 30rpx;
  975. background-color: #000;
  976. }
  977. /* 资讯主图 start*/
  978. .image-article {
  979. border-radius: 8rpx;
  980. border: 1rpx solid #F8F7F8;
  981. width: 200rpx;
  982. height: 200rpx;
  983. position: relative;
  984. }
  985. .image-pic {
  986. background-size: cover;
  987. background-repeat: no-repeat;
  988. // background-attachment:fixed;
  989. background-position: top;
  990. border-radius: 10rpx;
  991. }
  992. .article-shadow {
  993. border-radius: 15rpx;
  994. box-shadow: 0rpx 0rpx 50rpx 0rpx rgba(0, 0, 0, 0.07);
  995. }
  996. /* 文字截取*/
  997. .clamp-text-1 {
  998. -webkit-line-clamp: 1;
  999. display: -webkit-box;
  1000. -webkit-box-orient: vertical;
  1001. text-overflow: ellipsis;
  1002. overflow: hidden;
  1003. }
  1004. .clamp-text-2 {
  1005. -webkit-line-clamp: 2;
  1006. display: -webkit-box;
  1007. -webkit-box-orient: vertical;
  1008. text-overflow: ellipsis;
  1009. overflow: hidden;
  1010. }
  1011. /* 标签内容 start*/
  1012. .tn-tag-content {
  1013. &__item {
  1014. display: inline-block;
  1015. line-height: 35rpx;
  1016. color: #1D2541;
  1017. background-color: #F3F2F7;
  1018. border-radius: 10rpx;
  1019. font-size: 22rpx;
  1020. padding: 5rpx 15rpx;
  1021. &--prefix {
  1022. padding-right: 10rpx;
  1023. }
  1024. }
  1025. }
  1026. /* 图标容器9 start */
  1027. .icon9 {
  1028. &__item {
  1029. width: 30%;
  1030. background-color: #FFFFFF;
  1031. border-radius: 10rpx;
  1032. padding: 30rpx;
  1033. margin: 20rpx 10rpx;
  1034. transform: scale(1);
  1035. transition: transform 0.3s linear;
  1036. transform-origin: center center;
  1037. &--icon {
  1038. width: 110rpx;
  1039. height: 110rpx;
  1040. font-size: 65rpx;
  1041. border-radius: 50%;
  1042. margin: 20rpx 40rpx;
  1043. position: relative;
  1044. z-index: 1;
  1045. &::after {
  1046. content: " ";
  1047. position: absolute;
  1048. z-index: -1;
  1049. width: 100%;
  1050. height: 100%;
  1051. left: 0;
  1052. bottom: 0;
  1053. border-radius: inherit;
  1054. opacity: 1;
  1055. transform: scale(1, 1);
  1056. background-size: 100% 100%;
  1057. background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg5.png);
  1058. }
  1059. }
  1060. }
  1061. }
  1062. /* 悬浮 */
  1063. .tnxuanfu {
  1064. animation: suspension 3s ease-in-out infinite;
  1065. }
  1066. @keyframes suspension {
  1067. 0%,
  1068. 100% {
  1069. transform: translateY(0);
  1070. }
  1071. 50% {
  1072. transform: translateY(-0.8rem);
  1073. }
  1074. }
  1075. /* 悬浮按钮 */
  1076. .button-shop {
  1077. width: 90rpx;
  1078. height: 90rpx;
  1079. display: flex;
  1080. flex-direction: row;
  1081. position: fixed;
  1082. /* bottom:200rpx;
  1083. right: 20rpx; */
  1084. left: 5rpx;
  1085. top: 5rpx;
  1086. z-index: 1001;
  1087. border-radius: 100px;
  1088. opacity: 0.9;
  1089. }
  1090. /* 按钮 */
  1091. .edit {
  1092. bottom: 300rpx;
  1093. right: 75rpx;
  1094. position: fixed;
  1095. z-index: 9999;
  1096. }
  1097. .pa,
  1098. .pa0 {
  1099. position: absolute
  1100. }
  1101. .pa0 {
  1102. left: 0;
  1103. top: 0
  1104. }
  1105. .bg0 {
  1106. width: 100rpx;
  1107. height: 100rpx;
  1108. top: 50%;
  1109. left: 50%;
  1110. transform: translate(-50%, -50%);
  1111. }
  1112. .bg1 {
  1113. width: 100%;
  1114. height: 100%;
  1115. }
  1116. .hx-box {
  1117. top: 50%;
  1118. left: 50%;
  1119. width: 100rpx;
  1120. height: 100rpx;
  1121. transform-style: preserve-3d;
  1122. transform: translate(-50%, -50%) rotateY(75deg) rotateZ(10deg);
  1123. }
  1124. .hx-box .pr {
  1125. width: 100rpx;
  1126. height: 100rpx;
  1127. transform-style: preserve-3d;
  1128. animation: hxz 20s linear infinite;
  1129. }
  1130. @keyframes hxz {
  1131. 0% {
  1132. transform: rotateX(0deg);
  1133. }
  1134. 100% {
  1135. transform: rotateX(-360deg);
  1136. }
  1137. }
  1138. .hx-box .pr .pa0 {
  1139. width: 100rpx;
  1140. height: 100rpx;
  1141. /* border: 4px solid #5ec0ff; */
  1142. border-radius: 1000px;
  1143. }
  1144. .hx-box .pr .pa0 .span {
  1145. display: block;
  1146. width: 100%;
  1147. height: 100%;
  1148. background: url(https://resource.tuniaokj.com/images/cool_bg_image/arc4.png) no-repeat center center;
  1149. background-size: 100% 100%;
  1150. animation: hx 4s linear infinite;
  1151. }
  1152. @keyframes hx {
  1153. to {
  1154. transform: rotate(360deg);
  1155. }
  1156. }
  1157. .hx-k1 {
  1158. transform: rotateX(-60deg) rotateZ(-60deg)
  1159. }
  1160. .hx-k2 {
  1161. transform: rotateX(-30deg) rotateZ(-30deg)
  1162. }
  1163. .hx-k3 {
  1164. transform: rotateX(0deg) rotateZ(0deg)
  1165. }
  1166. .hx-k4 {
  1167. transform: rotateX(30deg) rotateZ(30deg)
  1168. }
  1169. .hx-k5 {
  1170. transform: rotateX(60deg) rotateZ(60deg)
  1171. }
  1172. .hx-k6 {
  1173. transform: rotateX(90deg) rotateZ(90deg)
  1174. }
  1175. /deep/ .basic-table-header {
  1176. background-color: #edeeee;
  1177. }
  1178. .bg-content{
  1179. color: #fff;
  1180. background-image: url(./../../static/bg.png);
  1181. background-size: cover;
  1182. }
  1183. </style>