comm.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964
  1. <template>
  2. <view class="circle tn-safe-area-inset-bottom" style="background: #f7f7f7;">
  3. <tn-nav-bar customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back'>
  5. <image style="width: 28px;height: 28px;margin-left:4px" @click="reFetchData()" src="../../static/tu/reload.png"></image>
  6. <image style="width: 28px;height: 28px;margin-left:12px" @click="addButton()" src="../../static/tu/add.png"></image>
  7. </view>
  8. <view slot="default" style="display: flex;">
  9. <view style="flex:1;">
  10. <text :style="{fontSize:(wxFontSize)+'px'}">我有什么</text>
  11. </view>
  12. </view>
  13. </tn-nav-bar>
  14. <scroll-view class="custom-tabbar-page" style="height: 100vh;" :style="{marginTop: vuex_custom_bar_height + 'px'}" scroll-y :refresher-enabled="true" :refresher-triggered="triggered" lower-threshold="60" @refresherrestore="onRestore" @refresherrefresh="onRefresh" @refresherpulling="onPulling" enable-back-to-top @scrolltolower="tabbarPageScrollLower">
  15. <!-- 发现 -->
  16. <view class="" v-if="current==0" >
  17. <uv-sticky bgColor="#f7f7f7">
  18. <view style="width: 100%;" v-if="currentTab==0">
  19. <view style="display: flex; padding: 16px;">
  20. <view
  21. style="flex:1;background-color: #fff;border-radius: 18px;color: #999;line-height: 36px;"
  22. @click="showSearch">
  23. <view>
  24. <image src="../../static/tu/search.png" style="width: 26px;height: 26px;vertical-align: middle; margin-left:8px; margin-right: 12px;margin-top: -2px;"></image>
  25. <text :style="{fontSize:(wxFontSize-2)+'px'}" v-if="!searchProdValue">产品名称/品牌/产品型号</text>
  26. <text :style="{fontSize:(wxFontSize-2)+'px'}" v-if="searchProdValue">{{searchProdValue}}</text>
  27. </view>
  28. </view>
  29. <view v-if="searchProdValue" @click="clearProd" style="line-height: 36px;margin-left: 10px;color: #333;" :style="{fontSize:(wxFontSize-2)+'px'}">取消
  30. </view>
  31. </view>
  32. </view>
  33. <view style="width: 100%;" v-if="currentTab==1">
  34. <view style="display: flex; padding: 16px;">
  35. <view
  36. style="flex:1;background-color: #fff;border-radius: 18px;color: #999;line-height: 36px;"
  37. @click="showSearch2">
  38. <view>
  39. <image src="../../static/tu/search.png" style="width: 26px;height: 26px;vertical-align: middle; margin-left:8px;margin-right: 12px;margin-top: -2px;"></image>
  40. <text v-if="!searchProdValue2" :style="{fontSize:(wxFontSize-2)+'px'}">品牌/服务内容</text>
  41. <text v-if="searchProdValue2" :style="{fontSize:(wxFontSize-2)+'px'}">{{searchProdValue2}}</text>
  42. </view>
  43. </view>
  44. <view v-if="searchProdValue2" @click="clearProd2" style="line-height: 36px;margin-left: 10px;color: #333;" :style="{fontSize:(wxFontSize-2)+'px'}">取消
  45. </view>
  46. </view>
  47. </view>
  48. <tn-tabs-swiper :list="tabList" :isScroll="false" :fontSize="(wxFontSize+12)" :barWidth="wxFontSize+50" :current="currentTab" name="tab-name" activeColor="#005DA6" inactiveColor="#333"
  49. @change="changeTab">
  50. </tn-tabs-swiper>
  51. </uv-sticky>
  52. <view class="tn-flex tn-flex-direction-column tn-margin-top-sm ">
  53. <!-- 图文信息 -->
  54. <block v-for="(item,index) in content" :key="item.id">
  55. <view class="blogger__item" style="border-radius: 12px;margin: 0px 16px 12px 16px; background-color: #fff;" :key="index">
  56. <view class="blogger__author tn-flex tn-flex-row-between tn-flex-col-center">
  57. <view class="justify__author__info">
  58. <view class="tn-flex tn-flex-row-center">
  59. <view class="tn-flex tn-flex-row-center tn-flex-col-center">
  60. <view class="" style="width: 5px;height: 5px;background: #E18730;border-radius: 50%;margin-right: 4px;">
  61. </view>
  62. <view class="tn-padding-right">
  63. <view class="tn-text-lg" style="color:#333;font-weight: 600;" :style="{fontSize:(wxFontSize)+'px'}">
  64. {{ item.company||(item.contactNickName||item.contactPerson) }}
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view
  72. class="blogger__desc tn-margin-top-sm tn-margin-bottom-sm tn-text-justify tn-flex-col-center tn-flex-row-left"
  73. >
  74. <tn-tag margin="-4px 4px 0 0" backgroundColor="#005da61a" v-if="item.brand"
  75. fontColor="#005DA6" shape="circle" :fontSize="wxFontSize+8" @click="showBrand('品牌:'+item.brand)">{{ item.brand }}</tn-tag>
  76. <tn-tag margin="-4px 4px 0 0" backgroundColor="#005da61a" v-if="!item.company"
  77. fontColor="#005DA6" shape="circle" :fontSize="wxFontSize+8" @click="showBrand('个人发布')">个人</tn-tag>
  78. </view>
  79. <view style="border-radius: 0px 0px 0px 0px;width:calc(100% + 32px);margin-left:-16px;border-bottom: 1px solid #E6E6E6;"></view>
  80. <view v-if="item.content" style="padding: 12px 12px 5px 5px;">
  81. <text
  82. class="blogger__desc__content tn-flex-1 tn-text-justify tn-text-df" style="color:#747E87" :style="{fontSize:(wxFontSize-2)+'px'}">{{ item.content }}</text>
  83. </view>
  84. <!-- 内容太多疲劳了-->
  85. <view v-if="item.shareExt&&item.shareExt.length>0" :id="`blogger__content--${index}`">
  86. <view v-for="(sitem,index) in item.shareExt" :key="sitem.id">
  87. <view style="padding: 12px 0 8px 5px;color:#005DA6;" :style="{fontSize:(wxFontSize-3)+'px'}">
  88. {{sitem.prodName}}
  89. </view>
  90. <view style="padding: 8px 8px 0 5px;color:#333;display: flex;" :style="{fontSize:(wxFontSize-3)+'px'}">
  91. <text style="color: #777;white-space: nowrap;">产品型号:</text>{{sitem.prodSpec}}
  92. </view>
  93. <view v-if="sitem.prodDesc" style="padding: 8px 8px 0 5px;color:#333;display: flex;" :style="{fontSize:(wxFontSize-3)+'px'}">
  94. <text style="color: #777;white-space: nowrap;">产品介绍:</text><text>{{sitem.prodDesc}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <block v-if="item.imgList&&item.imgList.length>0">
  99. <view v-if="[1,2,4].indexOf(item.imgList.length) != -1" class="tn-padding-top-xs">
  100. <image v-for="(image_item,image_index) in item.imgList" :key="image_index"
  101. class="blogger__main-image" :class="{
  102. 'blogger__main-image--1 tn-margin-bottom-sm': item.imgList.length === 1,
  103. 'blogger__main-image--2 tn-margin-right-sm tn-margin-bottom-sm': item.imgList.length === 2 || item.imgList.length === 4
  104. }" :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  105. </view>
  106. <view v-else class="tn-padding-top-xs" @click="tn('')">
  107. <tn-grid hoverClass="none" :col="3">
  108. <block v-for="(image_item,image_index) in item.imgList" :key="image_index">
  109. <!-- #ifndef MP-WEIXIN -->
  110. <tn-grid-item style="width: 30%;margin: 10rpx;">
  111. <image class="blogger__main-image blogger__main-image--3"
  112. :src="image_item.ftpUrl" mode="aspectFill" @click="showImg(item.imgList,image_index)"></image>
  113. </tn-grid-item>
  114. <!-- #endif-->
  115. <!-- #ifdef 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. </block>
  122. </tn-grid>
  123. </view>
  124. </block>
  125. <view v-for="(file,fIndex) in item.fileDetailList" :style="{marginTop:item.imgList&&item.imgList.length==0&&fIndex==0?'8px':'0'}" style="background-color:#005da60d ;margin-bottom: 4px;padding: 4px 8px;border-radius: 4px;" :key="file.id" v-if="!isImage(file.fileName)" @click="clickLink(file.ftpUrl,file.fileName)">
  126. <view>
  127. <image src="../../static/tu/link.png" style="width: 18px;height: 18px;vertical-align: bottom;"></image>
  128. <view style="display: inline;margin-left:8px;color:#005DA6;" :style="{fontSize:(wxFontSize-3)+'px'}">
  129. {{file.fileName}}</view>
  130. </view>
  131. </view>
  132. <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin-top-xs">
  133. <view class="justify-content-item tn-color-gray tn-text-center">
  134. <view class="tn-padding-right tn-padding-top-xs" :style="{fontSize:(wxFontSize-3)+'px',color:'#777'}">
  135. {{ item.createTime|formatDate }}
  136. </view>
  137. </view>
  138. <view class="justify-content-item tn-flex tn-flex-col-center" style="position: relative">
  139. <image style="width: 30px;height:30px;" @click="showActionSheet(item)" src="../../static/tu/more.png"></image>
  140. <view v-if="curItem.id==item.id&&showSheet" class="pop-dia" style="position: absolute;background: #E4F1FB;display: block;right: 10px;top: 24px;border-radius: 6px;z-index: 900;">
  141. <view class="content" style="padding: 8px;font-size: 16px;line-height: 24px; width: 180px;border-radius: 6px;"
  142. v-if="!showContact">
  143. <button @click="linkTel()" style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);">
  144. <image src="../../static/tu/call.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: middle;"> 联系供方</button>
  145. <!-- <view>联系我们帮助对接</view> -->
  146. <button v-if="!collStatus" @click="addColl"
  147. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);" type="default" plain="true">
  148. <image src="../../static/tu/coll.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;">
  149. 收&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;藏</button>
  150. <button v-if="collStatus" @click="delColl"
  151. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;border-bottom: 1px solid rgb(0 93 166 / 0.2);" type="default" plain="true">
  152. <image src="../../static/tu/coll.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;"> 取消收藏</button>
  153. <button open-type="share"
  154. style="border: none;border-radius: 0;color: #333333;background-color: #E4F1FB;" type="default" plain="true" :data-coupon="curItem">
  155. <image src="../../static/tu/share.png" style="width: 26px;height: 26px;margin-right:10px;vertical-align: sub;">
  156. 转&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发</button>
  157. </view>
  158. <view class="content " style="position: relative;background: linear-gradient( 180deg, #DAECFA 0%, #FFFFFF 27%, #FFFFFF 100%);padding: 24px 40px;padding-bottom: 32px;font-size: 16px;width: calc(100vw - 80px);line-height: 24px;border-radius: 12px;"
  159. v-if="showContact">
  160. <view><text style="font-size: 19px;font-weight: bold;color: #333;" v-if="curContact.company">{{curContact.company}}</text></view>
  161. <view style="margin-top:10px;font-size: 17px;text-align: center;color:#333">
  162. <image src="../../static/tu/person.png" style="width: 24px;height: 24px;vertical-align: sub;">
  163. <text style="margin-left: 6px;">{{curContact.contactPerson}}</text> </view>
  164. <view style="margin-top:10px;font-size: 17px;text-align: center;color:#333" @click="showTel(curContact.contactMethod)">
  165. <image src="../../static/tu/tel.png" style="width: 24px;height: 24px;vertical-align: middle;">
  166. <text style="margin-left: 4px;">{{curContact.contactMethod}}</text>
  167. </view>
  168. <image src="../../static/tu/close.png" style="width: 40px;height: 40px;position: absolute; left: calc(50vw - 60px);bottom: -64px;" @click="hideSheet()"></image>
  169. </view>
  170. <view style="position: fixed;top: 0;left: 0;height: 100000vh;width: 100%;background: rgb(0 0 0 / 0.5);z-index: -1;" @click="hideSheet()" v-if="showContact"></view>
  171. </view>
  172. </view>
  173. </view>
  174. </view>
  175. </block>
  176. <view v-if="showEmpty&&content.length==0" style="margin-top: 32vh;">
  177. <tn-empty mode="list"></tn-empty>
  178. </view>
  179. <!-- 结尾 -->
  180. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==0" style="background-color: #f7f7f7;padding: 16px 0;" :style="{paddingTop:showSheet?'166px':'16px'}">
  181. <tn-load-more status="nomore" :loadText="loadText" :fontSize="(wxFontSize+11)"></tn-load-more>
  182. </view>
  183. <view v-if="content.length==totalSize&&totalSize!=0&&currentTab==1" style="background-color: #f7f7f7;padding: 16px 0;" :style="{paddingTop:showSheet?'166px':'16px'}">
  184. <tn-load-more status="nomore" :loadText="loadText2" :fontSize="(wxFontSize+11)"></tn-load-more>
  185. </view>
  186. </view>
  187. <view class='tn-tabbar-height'></view>
  188. </view>
  189. </scroll-view>
  190. </view>
  191. </template>
  192. <script>
  193. import request from '../../utils/request'
  194. export default {
  195. name: 'Circle',
  196. data() {
  197. return {
  198. loading: false,
  199. searchProdValue: '',
  200. searchProdValue2:'',
  201. tabList: [{
  202. 'tab-name': '产品'
  203. }, {
  204. 'tab-name': '服务'
  205. }],
  206. loadText: {
  207. loadmore: '下拉加载',
  208. loading: '快速加载中...',
  209. nomore: '恭喜你,已阅读完所有供应信息哦!'
  210. },
  211. loadText2: {
  212. loadmore: '下拉加载',
  213. loading: '快速加载中...',
  214. nomore: '恭喜你,已阅读完所有供应信息哦!'
  215. },
  216. currentTab: 0,
  217. showEmpty: false,
  218. columns: [{
  219. fieldName: 'prodName',
  220. fieldDesc: '产品名称',
  221. }, {
  222. fieldName: 'prodSpec',
  223. fieldDesc: '产品型号',
  224. }, {
  225. fieldName: 'prodDesc',
  226. fieldDesc: '产品介绍',
  227. fieldType:'slot'
  228. }],
  229. showSheet: false,
  230. curItem: {},
  231. collId: '',
  232. showContact: false,
  233. curContact: {},
  234. current: 0,
  235. collStatus: '',
  236. searchValue: '',
  237. content: [],
  238. totalSize: 0,
  239. curIndex: 1,
  240. wxFontSize:17,
  241. triggered: false,
  242. _freshing: false,
  243. shareData:{}
  244. }
  245. },
  246. onReady() {
  247. const appBaseInfo = wx.getAppBaseInfo();
  248. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  249. this.$nextTick(() => {
  250. this.fetchData()
  251. })
  252. },
  253. onShow() {
  254. this.fetchData()
  255. },
  256. onHide() {
  257. this.adAutoplay = false
  258. },
  259. filters: {
  260. formatDate(value) {
  261. if (!value) return '';
  262. const date = new Date(value);
  263. const today = new Date();
  264. const yesterday = new Date(today); // 昨天的日期
  265. yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
  266. if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
  267. today.getDate()) {
  268. return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  269. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  270. }
  271. if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
  272. .getDate() == yesterday.getDate()) {
  273. return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  274. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  275. }
  276. return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
  277. .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
  278. },
  279. },
  280. methods: {
  281. // 瀑布流导航页面滚动到底部
  282. tabbarPageScrollLower(e) {
  283. this.loadMore();
  284. },
  285. onPulling(e) {
  286. console.log("onpulling", e);
  287. if(e.detail.deltaY<0){
  288. return
  289. }
  290. this.triggered = true
  291. },
  292. onRefresh(){
  293. if (this._freshing) return;
  294. this._freshing = true;
  295. this.reFetchData();
  296. setTimeout(() => {
  297. this.triggered = false;
  298. this._freshing = false;
  299. }, 2000)
  300. },
  301. onRestore() {
  302. this.triggered = false; // 需要重置
  303. },
  304. addLog(shareData){
  305. const that = this;
  306. let params= {
  307. bisNo:shareData.bisNo,
  308. bisType:'2',
  309. userNo:uni.getStorageSync('userNo')
  310. };
  311. request.post('/slbForward/add',{slbForward:JSON.stringify(params)},{
  312. headers: {
  313. 'Content-Type': 'application/json', // 默认值
  314. },
  315. }).then(res=>{
  316. })
  317. },
  318. sleep(time) {
  319. return new Promise((resolve) => setTimeout(resolve, time));
  320. },
  321. onShareAppMessage: function(option) {
  322. if(option.from=="button"){
  323. this.hideSheet();
  324. this.shareData=option.target.dataset.coupon;
  325. this.addLog(this.shareData);
  326. const promise = new Promise(async (resolve) => {
  327. await this.sleep(500);
  328. resolve({
  329. // title: `速立保`,
  330. path: `/pages/index/detail/detail?id=`+this.shareData.bisNo+'&isNeed=0',
  331. // imageUrl: url,
  332. });
  333. });
  334. // 默认参数
  335. return {
  336. // title: `速立保`,
  337. path: `/pages/index/detail/detail?id=`+this.shareData.bisNo+'&isNeed=0',
  338. promise,
  339. };
  340. }else{
  341. return {
  342. // title: '速立保',
  343. path: '/pages/index/index',
  344. };
  345. }
  346. },
  347. showSearch(item) {
  348. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  349. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  350. uni.navigateTo({
  351. url: '/pages/comm/search'
  352. })
  353. },
  354. showDetail(item){
  355. uni.navigateTo({
  356. url: '/pages/index/detail/detail?id='+item.bisNo+'&isNeed=0'
  357. })
  358. },
  359. showSearch2(item) {
  360. // 或者可以直接设置body的tabindex属性为-1,然后移除焦点
  361. // 注意:这种方式可能会导致一些浏览器的兼容性问题
  362. uni.navigateTo({
  363. url: '/pages/comm/search2'
  364. })
  365. },
  366. isImage(fileName) {
  367. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  368. const extension = fileName.split('.').pop().toLowerCase();
  369. return imageExtensions.includes(extension);
  370. },
  371. addButton() {
  372. if (!uni.getStorageSync('userNo')) {
  373. uni.showToast({
  374. title: '请登录',
  375. icon:'none'
  376. })
  377. uni.navigateTo({
  378. url: '/pages/login/login'
  379. })
  380. return false;
  381. } else {
  382. uni.navigateTo({
  383. url: '/circlePages/addShare'
  384. })
  385. }
  386. },
  387. showImg(items, index) {
  388. let urls = [];
  389. for (let i = 0; i < items.length; i++) {
  390. urls.push(items[i].ftpUrl);
  391. }
  392. // wx.chooseMessageFile({
  393. // count: 3, //默认100
  394. // type:'file',
  395. // extension:['.pdf','.doc'],
  396. // success: function (res) {
  397. // console.error(JSON.stringify(res));
  398. // }
  399. // });
  400. // 预览图片
  401. uni.previewImage({
  402. urls: urls,
  403. current: index,
  404. });
  405. },
  406. clickLink(url,fileName) {
  407. // uni.navigateTo({
  408. // url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  409. // })
  410. uni.downloadFile({
  411. url: url,
  412. filePath: wx.env.USER_DATA_PATH + "/" + fileName,
  413. success: function (res) {
  414. const filePath = res.filePath
  415. uni.openDocument({
  416. filePath: filePath,
  417. showMenu: true,
  418. success: function (res) {
  419. console.log('打开文档成功')
  420. },
  421. fail: function(){
  422. uni.navigateTo({
  423. url:'/pages/webview/web-view?url='+encodeURIComponent('https://slb-m.lx-device.com/webview?title='+fileName+'&url='+ url),
  424. })
  425. }
  426. })
  427. }
  428. })
  429. // uni.navigateTo({
  430. // url: '/pages/webview/web-view?url=' + url,
  431. // })
  432. },
  433. // tab选项卡切换
  434. tabChange(index) {
  435. this.current = index
  436. },
  437. // 跳转
  438. tn(e) {
  439. uni.navigateTo({
  440. url: e,
  441. });
  442. },
  443. // 震动跳转
  444. navEdit(e) {
  445. wx.vibrateLong();
  446. uni.navigateTo({
  447. url: '/circlePages/edit'
  448. })
  449. },
  450. // 震动跳转
  451. navCreate(e) {
  452. wx.vibrateLong();
  453. uni.navigateTo({
  454. url: '/circlePages/create'
  455. })
  456. },
  457. // 震动跳转
  458. navBuild(e) {
  459. wx.vibrateLong();
  460. uni.navigateTo({
  461. url: '/circlePages/build'
  462. })
  463. },
  464. reFetchData() {
  465. this.loading = true;
  466. uni.showToast({
  467. title: '正在刷新...',
  468. icon: 'none'
  469. });
  470. this.fetchData();
  471. },
  472. hideSheet(){
  473. this.curItem = {};
  474. this.showSheet = false;
  475. },
  476. loadMore() {
  477. if (this.totalSize > this.content.length) {
  478. this.fetchData(this.curIndex + 1);
  479. }
  480. console.error('正在加载更多');
  481. },
  482. changeTab(index) {
  483. this.currentTab = index;
  484. this.content = [];
  485. this.fetchData();
  486. },
  487. // 获取内容容器的信息
  488. fetchData(curIndex = 1) {
  489. let that = this;
  490. that.showEmpty = false;
  491. this.curIndex = curIndex;
  492. if (uni.getStorageSync('searchProdValue')) {
  493. that.searchProdValue = uni.getStorageSync('searchProdValue');
  494. }else{
  495. that.searchProdValue = ''
  496. }
  497. if (uni.getStorageSync('searchProdValue2')) {
  498. that.searchProdValue2 = uni.getStorageSync('searchProdValue2');
  499. }else{
  500. that.searchProdValue2 = ''
  501. }
  502. request.post('/slbResourceShare/query', {
  503. type: that.currentTab == 1 ? '2' : '1',
  504. index: curIndex,
  505. content: that.currentTab == 1 ? (that.searchProdValue2 ? that.searchProdValue2.split('/')[1]:'') : undefined,
  506. prodSpec: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[2] :
  507. '') : undefined,
  508. prodName: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[0] :
  509. '') : undefined,
  510. brand: that.currentTab == 0 ? (that.searchProdValue ? that.searchProdValue.split('/')[1] :
  511. '') : that.currentTab == 1 ?(that.searchProdValue2 ? that.searchProdValue2.split('/')[0]:''): undefined,
  512. }).then(res => {
  513. that.loading = false;
  514. if (res && res.success) {
  515. that.totalSize = res.total || 0;
  516. let newList = res.list || [];
  517. for (let i = 0; i < newList.length; i++) {
  518. newList[i].imgList = [];
  519. for (let j = 0; j < newList[i].fileDetailList.length; j++) {
  520. if (that.isImage(newList[i].fileDetailList[j].fileName)) {
  521. newList[i].imgList.push(newList[i].fileDetailList[j]);
  522. }
  523. }
  524. for(let k = 0;newList[i].shareExt&&k<newList[i].shareExt.length;k++){
  525. newList[i].shareExt[k].fontSize= this.wxFontSize;
  526. }
  527. }
  528. if (curIndex == 1) {
  529. that.content = newList || [];
  530. } else {
  531. that.content = that.content.concat(newList || []);
  532. }
  533. }
  534. that.showEmpty = true;
  535. console.warn(res);
  536. })
  537. },
  538. showActionSheet(item) {
  539. let that = this;
  540. if(!this.curItem.id){
  541. this.curItem = item;
  542. }else{
  543. this.curItem = {}
  544. this.showSheet = false;
  545. return false;
  546. }
  547. this.collStatus = false;
  548. this.showSheet = true;
  549. that.showContact = false;
  550. if (uni.getStorageSync('userNo')) {
  551. let params = {};
  552. params = {
  553. fkBisNo: that.curItem.bisNo,
  554. userNo: uni.getStorageSync('userNo'),
  555. };
  556. request.post('/slbCollect/query', params).then(res => {
  557. if (res.success) {
  558. if (res.list && res.list.length > 0) {
  559. that.collStatus = true;
  560. that.collId = res.list[0].id;
  561. }
  562. }
  563. })
  564. }
  565. },
  566. linkTel() {
  567. if (!uni.getStorageSync('userNo')) {
  568. uni.showToast({
  569. title: '请登录',
  570. icon:'none'
  571. })
  572. uni.navigateTo({
  573. url: '/pages/login/login'
  574. })
  575. return false;
  576. }
  577. let that = this;
  578. let params = {};
  579. params.slbBisContact = JSON.stringify({
  580. fkBisNo: that.curItem.bisNo,
  581. bisType: '2',
  582. type: '1',
  583. company: that.curItem.company,
  584. companyNo: that.curItem.companyNo,
  585. userNo: uni.getStorageSync('userNo'),
  586. });
  587. request.post('/slbBisContact/add', params).then(res => {
  588. if (res.success) {
  589. that.showContact = true;
  590. that.curContact.company = that.curItem.company;
  591. that.curContact.contactMethod = res.resultMap.contactMethod;
  592. that.curContact.contactPerson = res.resultMap.contactPerson;
  593. } else {
  594. that.showContact = false;
  595. uni.showToast({
  596. title: res.msg,
  597. icon: 'none'
  598. })
  599. }
  600. })
  601. },
  602. showBrand(text){
  603. uni.showToast({
  604. title: text,
  605. icon: 'none'
  606. })
  607. },
  608. addColl() {
  609. if (!uni.getStorageSync('userNo')) {
  610. uni.showToast({
  611. title: '请登录',
  612. icon:'none'
  613. })
  614. uni.navigateTo({
  615. url: '/pages/login/login'
  616. })
  617. return false;
  618. }
  619. let that = this;
  620. let params = {};
  621. params.slbCollect = JSON.stringify({
  622. fkBisNo: that.curItem.bisNo,
  623. bisType: '2',
  624. userNo: uni.getStorageSync('userNo'),
  625. });
  626. request.post('/slbCollect/add', params).then(res => {
  627. if (res.success) {
  628. that.showSheet = false;
  629. that.curItem = {};
  630. uni.showToast({
  631. title: '信息已收藏,请在我的收藏里查看阅读',
  632. icon: 'none',
  633. duration: 2000
  634. })
  635. } else {
  636. uni.showToast({
  637. title: res.msg,
  638. icon:'none'
  639. })
  640. }
  641. })
  642. },
  643. delColl() {
  644. let that = this;
  645. request.post('/slbCollect/del', {
  646. id: that.collId
  647. }).then(res => {
  648. if (res.success) {
  649. that.showSheet = false;
  650. that.curItem = {};
  651. uni.showToast({
  652. title: '此供应信息将不会保存在我的收藏里',
  653. icon: 'none',
  654. duration: 2000
  655. })
  656. } else {
  657. uni.showToast({
  658. title: res.msg,
  659. icon:'none'
  660. })
  661. }
  662. })
  663. },
  664. search() {
  665. this.fetchData();
  666. },
  667. searchProd() {
  668. this.searchProdValue = '';
  669. this.fetchData();
  670. },
  671. cancel() {
  672. this.searchValue = '';
  673. this.fetchData();
  674. },
  675. clear() {
  676. this.searchValue = '';
  677. this.fetchData();
  678. },
  679. clearProd() {
  680. this.searchProdValue = '';
  681. uni.removeStorageSync('searchProdValue');
  682. this.fetchData();
  683. },
  684. clearProd2() {
  685. this.searchProdValue2 = '';
  686. uni.removeStorageSync('searchProdValue2');
  687. this.fetchData();
  688. },
  689. showTel(tel){
  690. uni.makePhoneCall({
  691. phoneNumber: tel,
  692. });
  693. },
  694. }
  695. }
  696. </script>
  697. <style lang="scss" scoped>
  698. .circle {
  699. max-height: 100vh;
  700. }
  701. /* 底部安全边距 start*/
  702. .tn-tabbar-height {
  703. min-height: 120rpx;
  704. height: calc(140rpx + env(safe-area-inset-bottom) / 2);
  705. height: calc(140rpx + constant(safe-area-inset-bottom));
  706. }
  707. /* 自定义导航栏内容 start */
  708. .custom-nav {
  709. height: 100%;
  710. &__back {
  711. margin: auto 5rpx;
  712. font-size: 40rpx;
  713. margin-right: 10rpx;
  714. margin-left: 30rpx;
  715. flex-basis: 5%;
  716. }
  717. &__search {
  718. flex-basis: 60%;
  719. width: 100%;
  720. height: 100%;
  721. &__box {
  722. width: 100%;
  723. height: 70%;
  724. padding: 10rpx 0;
  725. margin: 0 30rpx;
  726. border-radius: 60rpx 60rpx 0 60rpx;
  727. font-size: 24rpx;
  728. }
  729. &__icon {
  730. padding-right: 10rpx;
  731. margin-left: 20rpx;
  732. font-size: 30rpx;
  733. }
  734. &__text {
  735. color: #AAAAAA;
  736. }
  737. }
  738. }
  739. /* 自定义导航栏内容 end */
  740. /* 文章内容 start*/
  741. .blogger {
  742. &__item {
  743. padding: 30rpx;
  744. }
  745. &__author {
  746. &__btn {
  747. margin-right: -12rpx;
  748. opacity: 0.5;
  749. }
  750. }
  751. &__desc {
  752. line-height: 30rpx;
  753. &__label {
  754. color: #1D2541;
  755. background-color: #F3F2F7;
  756. border-radius: 10rpx;
  757. font-size: 22rpx;
  758. padding: 5rpx 15rpx;
  759. margin: 5rpx 18rpx 0 0;
  760. &--prefix {
  761. font-size: 24rpx;
  762. color: #1D2541;
  763. padding-right: 10rpx;
  764. }
  765. }
  766. &__content {
  767. line-height: 50rpx;
  768. }
  769. }
  770. &__content {
  771. margin-top: 18rpx;
  772. padding-right: 18rpx;
  773. &__data {
  774. line-height: 46rpx;
  775. text-align: justify;
  776. overflow: hidden;
  777. transition: all 0.25s ease-in-out;
  778. }
  779. &__status {
  780. margin-top: 10rpx;
  781. font-size: 26rpx;
  782. color: #82B2FF;
  783. }
  784. }
  785. &__main-image {
  786. border: 1rpx solid #F8F7F8;
  787. border-radius: 16rpx;
  788. &--1 {
  789. max-width: 80%;
  790. max-height: 300rpx;
  791. }
  792. &--2 {
  793. max-width: 260rpx;
  794. max-height: 260rpx;
  795. }
  796. &--3 {
  797. height: 212rpx;
  798. width: 100%;
  799. }
  800. }
  801. &__count-icon {
  802. font-size: 40rpx;
  803. padding-right: 5rpx;
  804. }
  805. &__ad {
  806. width: 100%;
  807. height: 500rpx;
  808. transform: translate3d(0px, 0px, 0px) !important;
  809. ::v-deep .uni-swiper-slide-frame {
  810. transform: translate3d(0px, 0px, 0px) !important;
  811. }
  812. .uni-swiper-slide-frame {
  813. transform: translate3d(0px, 0px, 0px) !important;
  814. }
  815. &__item {
  816. position: absolute;
  817. width: 100%;
  818. height: 100%;
  819. transform-origin: left center;
  820. transform: translate3d(100%, 0px, 0px) scale(1) !important;
  821. transition: transform 0.25s ease-in-out;
  822. z-index: 1;
  823. &--0 {
  824. transform: translate3d(0%, 0px, 0px) scale(1) !important;
  825. z-index: 4;
  826. }
  827. &--1 {
  828. transform: translate3d(13%, 0px, 0px) scale(0.9) !important;
  829. z-index: 3;
  830. }
  831. &--2 {
  832. transform: translate3d(26%, 0px, 0px) scale(0.8) !important;
  833. z-index: 2;
  834. }
  835. }
  836. &__content {
  837. border-radius: 40rpx;
  838. width: 640rpx;
  839. height: 500rpx;
  840. overflow: hidden;
  841. }
  842. &__image {
  843. width: 100%;
  844. height: 100%;
  845. }
  846. }
  847. }
  848. /* 文章内容 end*/
  849. /* 自定义导航栏内容 end */
  850. /* 标签内容 start*/
  851. .tn-tag-content {
  852. &__item {
  853. display: inline-block;
  854. line-height: 35rpx;
  855. color: #1D2541;
  856. background-color: #F3F2F7;
  857. border-radius: 10rpx;
  858. font-size: 22rpx;
  859. padding: 5rpx 15rpx;
  860. &--prefix {
  861. padding-right: 10rpx;
  862. }
  863. }
  864. }
  865. </style>