productInfo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. <template>
  2. <view>
  3. <view class="overlay" v-if="showfx" @click="showwx">
  4. <image style="height: 100%;width: 100%;" src="/static/img/zz.png"></image>
  5. </view>
  6. <view :class="['custom-header', { 'is-back': isBack }, bgColor]">
  7. <view class="back-container" @click="handleBack">
  8. <view class="back-text">返回</view>
  9. </view>
  10. <view class="content-container">
  11. <view class="content-text">{{title}}</view>
  12. </view>
  13. </view>
  14. <!-- <swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="3000" :duration="800">
  15. <swiper-item v-for="(item, index) in swiperList" :key="index">
  16. <image :src="item.url" class="swiper-item"></image>
  17. </swiper-item>
  18. </swiper> -->
  19. <form class="cu-list menu">
  20. <view class="titlebg2">
  21. <view class="titlet1" ></view>
  22. <view class="titlet2" >发布企业</view>
  23. </view>
  24. <view class="show1">
  25. <view class="textbg">
  26. <view class="text1">
  27. 企业名称
  28. </view>
  29. <view class="text2" >
  30. {{inputForm.des5}}
  31. </view>
  32. </view>
  33. <view class="textbg">
  34. <view class="text1">
  35. 供需类型
  36. </view>
  37. <view class="text2" :class="inputForm.des1 === '需' ? 'text33' : 'text44'" >
  38. {{inputForm.des1}}
  39. </view>
  40. </view>
  41. <view class="textbg">
  42. <view class="text1">
  43. 发布时间
  44. </view>
  45. <view class="text2" >
  46. {{inputForm.updateDate}}
  47. </view>
  48. </view>
  49. </view>
  50. <view class="titlebg2">
  51. <view class="titlet1" ></view>
  52. <view class="titlet2" >供需基本信息</view>
  53. </view>
  54. <view class="textbg">
  55. <view class="text12">
  56. {{t1}}
  57. </view>
  58. <view class="text22">
  59. {{inputForm.des2}}
  60. </view>
  61. </view>
  62. <view class="textbg">
  63. <view class="text12">
  64. {{t2}}
  65. </view>
  66. <view class="text22">
  67. {{inputForm.des3}}
  68. </view>
  69. </view>
  70. <view class="textbg">
  71. <view class="text12">
  72. {{t3}}
  73. </view>
  74. <view class="text221">
  75. {{inputForm.des4}}
  76. </view>
  77. </view>
  78. <view style="height: 30rpx;background-color: white;"></view>
  79. <view class="titlebg2" v-if="swiperList.length>0" >
  80. <view class="titlet1" ></view>
  81. <view class="titlet2" >图文详情</view>
  82. </view>
  83. <view v-for="(item, index) in swiperList" :key="index" style="width: 100%;">
  84. <image :src="item.url" mode="widthFix" style="width: 100%;" >
  85. </image>
  86. </view>
  87. <view style="height: 40rpx;"></view>
  88. <view class="padding-xl" v-if="isadmin&&inputForm.des6=='1'">
  89. <button @click="sharezz" class="cu-btn block bg-blue margin-tb-sm lg">分享此企业账号</button>
  90. </view>
  91. </form>
  92. </view>
  93. </template>
  94. <script>
  95. import loginService from '@/api/auth/loginService.js'
  96. import { wxShare } from "@/common/wxutils.js";
  97. export default {
  98. onShow() {
  99. //this.$auth.checkLogin()
  100. },
  101. data() {
  102. return {
  103. title: '产品供需详情',
  104. isBack: true, // 是否显示返回按钮
  105. backText: '返回', // 返回按钮的文本
  106. bgColor: 'bg-blue', // 背景颜色
  107. autoUpload: false,
  108. swiperList: [],
  109. inputForm: {
  110. id: '',
  111. name: '',
  112. industry: '',
  113. des1: '',
  114. des2: '',
  115. des3: '',
  116. des4: '',
  117. des5: '',
  118. des6: '',
  119. des7: '',
  120. des8: '',
  121. des9: '',
  122. updateDate: '',
  123. },
  124. t1: '产品名称',
  125. t2: '产品产能',
  126. t3: '详细描述',
  127. text1:'',
  128. text2:'',
  129. parkList: [],
  130. ischeck: false,
  131. isLogin:"",
  132. username:"",
  133. isadmin:false,
  134. lyIndex: '',
  135. showLYList: [],
  136. showfx:false,
  137. }
  138. },
  139. created() {
  140. },
  141. mounted() {
  142. },
  143. onLoad(query) {
  144. this.isLogin=this.$auth.checkisLogin();
  145. this.username=this.$auth.getUserInfo();
  146. if(this.username!=undefined&&this.username!=''&&this.username!=null&&this.isLogin!=null){
  147. if(this.username.loginName=='admin'){
  148. this.isadmin=true;
  149. }
  150. }
  151. if (query && query.ischeck) {
  152. this.ischeck = true
  153. }
  154. if (query && query.id && !query.ischeck) {
  155. this.title = "修改企业信息";
  156. }
  157. this.getComById(query)
  158. },
  159. methods: {
  160. getParkList(query) {
  161. loginService.list({
  162. current: 1,
  163. size: 1000000,
  164. }).then(({
  165. data
  166. }) => {
  167. this.parkList = data.records.map((item) => {
  168. return {
  169. label: item.buildingName,
  170. value: item.id
  171. }
  172. })
  173. this.showLYList = this.parkList.map(item => item.label)
  174. if (query && query.id) {
  175. loginService.queryByIdPro(query.id).then(({
  176. data
  177. }) => {
  178. this.inputForm = this.recover(this.inputForm, data)
  179. this.lyIndex = this.parkList.findIndex(item => item.value == this.inputForm.des1)
  180. console.log(this.lyIndex, '=====================>lyIndex')
  181. }).catch((e) => {
  182. })
  183. }
  184. }).catch(e => {
  185. console.log(e)
  186. })
  187. },
  188. handleBack() {
  189. // 返回逻辑,比如跳转至上一页
  190. this.$router.go(-1);
  191. console.log('返回按钮被点击');
  192. },
  193. showwx() {
  194. this.showfx=false;
  195. },
  196. getComById(query) {
  197. loginService.queryByIdPro(query.id).then(({
  198. data
  199. }) => {
  200. //未登录
  201. // if(this.isLogin==null){
  202. // console.log('未登录')
  203. // //不做处理后台已做处理
  204. if(data.des1=='1'){
  205. data.des1="供"
  206. }else{
  207. data.des1="需"
  208. }
  209. this.setData(data);
  210. // }else{
  211. // this.setData(data);
  212. // }
  213. }).catch((e) => {
  214. })
  215. },
  216. //账号分享
  217. sharezz(){
  218. var that=this;
  219. setTimeout(function() {
  220. that.showfx=true;
  221. console.log("1"+ this.showfx);
  222. }, 500); // 2000毫秒后执行
  223. loginService.getloginstr(this.inputForm.phone).then(({
  224. data
  225. }) => {
  226. //未登录
  227. if(data.Id=='0'){
  228. uni.showModal({
  229. title: '您无权限分享账号,请联系管!',
  230. showCancel: true,
  231. success: (res) => {
  232. }
  233. });
  234. }else{
  235. this.weixin(data);
  236. // const textArea = document.createElement("textarea");
  237. // textArea.value = 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/#/pages/index/index?loginid='+data.Id;
  238. // document.body.appendChild(textArea);
  239. // textArea.focus();
  240. // textArea.select();
  241. // try {
  242. // document.execCommand('copy');
  243. // uni.showModal({
  244. // title: '已将登录链接复制到剪切板,直接打开微信好友粘贴分享!',
  245. // showCancel: true,
  246. // success: (res) => {
  247. // }
  248. // });
  249. // } catch (err) {
  250. // console.error('Could not copy text', err);
  251. // uni.showModal({
  252. // title: '当前不支持分享功能!',
  253. // showCancel: true,
  254. // success: (res) => {
  255. // }
  256. // });
  257. // } finally {
  258. // document.body.removeChild(textArea);
  259. // }
  260. }
  261. }).catch((e) => {
  262. })
  263. },
  264. async weixin(data) {
  265. try {
  266. if ( data) {
  267. //微信加签
  268. var obj = {
  269. appId: data.appid,
  270. nonceStr: data.nonceStr,
  271. signature: data.signature,
  272. timestamp: data.timestamp,
  273. Id: data.Id,
  274. }
  275. //分享数据,这段主要是为了在hash模式下分享出去的链接不被浏览器截取,保证完全把链接分享出去(link的链接可以自己拼,无须与当前页面的后缀参数之类的内容完全一致)
  276. let shareData = {
  277. title: '‘都企供需’线上平台',
  278. desc: '点击直接登录',
  279. imgUrl: 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/static/img/titlebg.jpg',
  280. link: 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/#/pages/index/index?loginid='+data.Id + "&t=" + data.timestamp + "&Content=1", // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  281. };
  282. //引用
  283. wxShare(obj, shareData);
  284. } else {
  285. uni.showModal({
  286. title: '获取sdk参数失败!',
  287. showCancel: true,
  288. success: (res) => {
  289. }
  290. });
  291. }
  292. } catch (err) {
  293. //
  294. } finally {
  295. //
  296. }
  297. },
  298. setData(data){
  299. this.inputForm = this.recover(this.inputForm, data)
  300. if(this.inputForm.des1=='供'){
  301. this.t1='可供产品';
  302. this.t2= '可供数量';
  303. }else{
  304. this.t1='需求名称';
  305. this.t2= '需求数量';
  306. }
  307. let pics=this.inputForm.des6.split(",");
  308. console.log(pics)
  309. pics.forEach(item => {
  310. if(item!=''){
  311. this.swiperList.push({
  312. 'url': "http://47.97.69.114:8089/yd_qycpfbWeb/"+item,
  313. })
  314. }
  315. })
  316. console.log(this.swiperList)
  317. },
  318. goToCompany(companyName) {
  319. //https://www.qcc.com/web/search?key=
  320. window.open("https://www.qcc.com/web/search?key="+companyName);
  321. //window.location.href = `https://www.qcc.com/company/${encodeURIComponent(companyName)}`;
  322. },
  323. call1(){
  324. // uni.navigateTo({
  325. // url: '/pages/index/AudioToWord'
  326. // })
  327. // uni.navigateTo({
  328. // url: '/pages/comList/comList'
  329. // })
  330. //未登录
  331. if(this.isLogin==null){
  332. uni.showModal({
  333. title: '您还未登录,是否跳转登录页面?',
  334. showCancel: true,
  335. success: (res) => {
  336. if (res.confirm) {
  337. uni.reLaunch({
  338. url: '/pages/login/login'
  339. })
  340. }
  341. }
  342. });
  343. }else{
  344. window.location.href = 'tel:'+this.inputForm.phone;
  345. }
  346. },
  347. call2(){
  348. //未登录
  349. if(this.isLogin==null){
  350. uni.showModal({
  351. title: '您还未登录,是否跳转登录页面?',
  352. showCancel: true,
  353. success: (res) => {
  354. if (res.confirm) {
  355. uni.reLaunch({
  356. url: '/pages/login/login'
  357. })
  358. }
  359. }
  360. });
  361. }else{
  362. window.location.href = 'tel:'+this.inputForm.bz6;
  363. }
  364. },
  365. }
  366. }
  367. </script>
  368. <style>
  369. /* .file-title) {
  370. font-size: 17px !important;
  371. } */
  372. input,textarea{
  373. color: #8799a3;
  374. }
  375. .swiper {
  376. width: 750rpx;
  377. height: 310rpx;
  378. }
  379. .swiper-item {
  380. width: 750rpx;
  381. height: 310rpx;
  382. background-color: aliceblue;
  383. }
  384. .show1{
  385. background-color: #2752eb;
  386. padding-left: 8rpx;
  387. }
  388. .textbg{
  389. display: flex;
  390. background-color: white;
  391. padding-top: 29rpx;
  392. }
  393. .text1{
  394. width: 200rpx;
  395. margin-left: 30rpx;
  396. color: #333333;
  397. font-size: 30rpx;
  398. }
  399. .text12{
  400. width: 200rpx;
  401. margin-left: 30rpx;
  402. color: #000000;
  403. font-size: 29rpx;
  404. }
  405. .text2{
  406. flex: 1;
  407. color: #000000;
  408. font-size: 30rpx;
  409. padding-bottom: 2rpx;
  410. }
  411. .text33{
  412. flex: 1;
  413. color: #FF4500;
  414. font-size: 30rpx;
  415. padding-bottom: 2rpx;
  416. }
  417. .text44{
  418. flex: 1;
  419. color: #2E8B57;
  420. font-size: 30rpx;
  421. padding-bottom: 2rpx;
  422. }
  423. .text22{
  424. flex: 1;
  425. color: #666666;
  426. font-size: 29rpx;
  427. padding-bottom: 2rpx;
  428. }
  429. .text221{
  430. flex: 1;
  431. color: #666666;
  432. font-size: 29rpx;
  433. padding-right:15rpx ;
  434. padding-bottom: 2rpx;
  435. }
  436. .text3{
  437. display: flex;
  438. color: #000000;
  439. }
  440. .phone{
  441. display: flex;
  442. color: #1E8AD7;
  443. padding-left: 5rpx;
  444. padding-right: 5rpx;
  445. font-size: 30rpx;
  446. align-items: center
  447. }
  448. .phoneimg{
  449. margin-left: 10rpx;
  450. width: 35rpx;
  451. height: 35rpx;
  452. }
  453. .titlebg2{
  454. display: flex;
  455. background-color: white;
  456. padding-left: 22rpx;
  457. padding-top: 35rpx;
  458. padding-bottom: 25rpx;
  459. margin-bottom: 2rpx;
  460. }
  461. .titlet1{
  462. width: 7rpx;
  463. margin-top: 7rpx;
  464. margin-bottom: 7rpx;
  465. background-color: #2752eb;
  466. margin-right: 8rpx;
  467. }
  468. .titlet2{
  469. font-weight: 800;
  470. color: #2752eb;
  471. }
  472. .overlay{
  473. position: fixed; /* 固定定位,覆盖整个页面 */
  474. top: 0;
  475. left: 0;
  476. width: 100%;
  477. height: 100%;
  478. background-color: rgba(255, 255, 255, 0.5); /* 半透明白色背景 */
  479. z-index: 1000; /* 确保遮罩在页面内容之上 */
  480. }
  481. .custom-header {
  482. display: flex;
  483. align-items: center;
  484. justify-content: center;
  485. padding: 10px;
  486. width: 100%;
  487. }
  488. .is-back {
  489. position: relative;
  490. }
  491. .back-container {
  492. position: absolute;
  493. left: 10px;
  494. cursor: pointer;
  495. }
  496. .back-text {
  497. color: white; /* 返回按钮文本颜色 */
  498. }
  499. .content-container {
  500. flex: 1;
  501. text-align: center;
  502. }
  503. .content-text {
  504. color: white; /* 标题文本颜色 */
  505. font-weight: bold;
  506. }
  507. /* 背景颜色 */
  508. .bg-blue {
  509. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  510. }
  511. </style>