productInfo.vue 12 KB

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