policyInfo.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  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">涉企政策详情</view>
  12. </view>
  13. </view>
  14. <form class="cu-list menu">
  15. <view class="show1">
  16. <view class="textbg">
  17. <view class="text1">
  18. {{inputForm.des1}}
  19. </view>
  20. </view>
  21. <view class="textbg">
  22. <view class="text2">
  23. 政策发文日期:{{inputForm.stime}}
  24. </view>
  25. </view>
  26. <view class="textbg">
  27. <view class="text2">
  28. 政策类型:{{inputForm.des2}}
  29. </view>
  30. </view>
  31. <view class="textbg">
  32. <view class="text2">
  33. 政策级别:{{inputForm.des3}}
  34. </view>
  35. </view>
  36. <view class="textbg">
  37. <view class="text2">
  38. 类别:{{inputForm.des8}}
  39. </view>
  40. </view>
  41. </view>
  42. <view class="titlebg2">
  43. <view class="titlet1" ></view>
  44. <view class="titlet2" >政策内容</view>
  45. </view>
  46. <view class="textbg">
  47. <view class="text12">
  48. <rich-text :nodes="inputForm.des4"></rich-text>
  49. </view>
  50. </view>
  51. <view class="titlebg2">
  52. <view class="titlet1" ></view>
  53. <view class="titlet2" >政策要点</view>
  54. </view>
  55. <view class="textbg">
  56. <view class="text12">
  57. <rich-text :nodes="inputForm.des6"></rich-text>
  58. </view>
  59. </view>
  60. <view class="titlebg2">
  61. <view class="titlet1" ></view>
  62. <view class="titlet2" >附件</view>
  63. </view>
  64. <view class="textbg">
  65. <view class="text12">
  66. <view v-for="(attachment, indexfj) in swiperList" :key="indexfj" style="margin-left: 20rpx;padding-bottom: 20rpx;">
  67. <view @click="viewAttachment(attachment)" style="width: 100%;color: blue;">{{ attachment.name }}</view>
  68. </view>
  69. </view>
  70. </view>
  71. <view style="height: 50rpx;background-color: white;"></view>
  72. <view style="height: 40rpx;"></view>
  73. </form>
  74. </view>
  75. </template>
  76. <script>
  77. import loginService from '@/api/auth/loginService.js'
  78. import { wxShare } from "@/common/wxutils.js";
  79. export default {
  80. onShow() {
  81. //this.$auth.checkLogin()
  82. },
  83. data() {
  84. return {
  85. title: '新建企业信息',
  86. imgurl: "",
  87. isBack: true, // 是否显示返回按钮
  88. backText: '返回', // 返回按钮的文本
  89. bgColor: 'bg-blue', // 背景颜色
  90. autoUpload: false,
  91. inputForm: {
  92. id: '',
  93. stime: '',
  94. des1: '',
  95. des2: '',
  96. des3: '',
  97. des4: '',
  98. des6: '',
  99. des7: '',
  100. des8: '',
  101. },
  102. text1:'',
  103. text2:'',
  104. parkList: [],
  105. ischeck: false,
  106. isLogin:"",
  107. username:"",
  108. isadmin:false,
  109. lyIndex: '',
  110. showLYList: [],
  111. showfx:false,
  112. swiperList: [],
  113. }
  114. },
  115. created() {
  116. },
  117. mounted() {
  118. },
  119. onLoad(query) {
  120. this.isLogin=this.$auth.checkisLogin();
  121. this.username=this.$auth.getUserInfo();
  122. if(this.username!=undefined&&this.username!=''&&this.username!=null&&this.isLogin!=null){
  123. if(this.username.loginName=='admin'){
  124. this.isadmin=true;
  125. }
  126. }
  127. if (query && query.ischeck) {
  128. this.ischeck = true
  129. this.title = "查看企业信息";
  130. }
  131. if (query && query.id && !query.ischeck) {
  132. this.title = "修改企业信息";
  133. }
  134. this.getComById(query)
  135. },
  136. methods: {
  137. getParkList(query) {
  138. loginService.list({
  139. current: 1,
  140. size: 1000000,
  141. }).then(({
  142. data
  143. }) => {
  144. this.parkList = data.records.map((item) => {
  145. return {
  146. label: item.buildingName,
  147. value: item.id
  148. }
  149. })
  150. this.showLYList = this.parkList.map(item => item.label)
  151. if (query && query.id) {
  152. loginService.queryByIdCom(query.id).then(({
  153. data
  154. }) => {
  155. this.inputForm = this.recover(this.inputForm, data)
  156. this.lyIndex = this.parkList.findIndex(item => item.value == this.inputForm.des1)
  157. console.log(this.lyIndex, '=====================>lyIndex')
  158. }).catch((e) => {
  159. })
  160. }
  161. }).catch(e => {
  162. console.log(e)
  163. })
  164. },
  165. handleBack() {
  166. // 返回逻辑,比如跳转至上一页
  167. this.$router.go(-1);
  168. console.log('返回按钮被点击');
  169. },
  170. showwx() {
  171. this.showfx=false;
  172. },
  173. getComById(query) {
  174. loginService.policyInfo({
  175. id: query.id,
  176. }).then(({
  177. data
  178. }) => {
  179. this.setData(data);
  180. let pics=this.inputForm.des7.split(",");
  181. for (let j = 0; j < pics.length; j++) {
  182. let aa=pics[j].split("&name=")
  183. this.swiperList.push({
  184. 'url': "http://47.97.69.114:8089/yd_qycpfbWeb"+pics[j],
  185. 'uuid': pics[j],
  186. 'name': aa[1]
  187. })
  188. }
  189. }).catch((e) => {
  190. })
  191. },
  192. viewAttachment(attachment) {
  193. let aa=this.checkFileTypeByExtension(attachment.url);
  194. if(aa=='Image'){
  195. uni.previewImage({
  196. urls: [attachment.url], // 图片链接列表
  197. indicator: 'number', // 显示页码
  198. loop: true // 是否循环播放
  199. });
  200. }else{
  201. this.downloadFile(attachment.url);
  202. }
  203. },
  204. checkFileTypeByExtension(url) {
  205. const extension = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
  206. if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) {
  207. return 'Image';
  208. } else if (['doc', 'docx', 'xls', 'xlsx', 'pdf'].includes(extension)) {
  209. return 'Document';
  210. } else {
  211. return 'Unknown';
  212. }
  213. },
  214. downloadFile(url) {
  215. const a = document.createElement('a');
  216. a.href = url; //filePath 这里的地址是 uni.downloadFile 中的返回值里的地址
  217. let aa=url.split("&name=")
  218. a.download = aa[1]; // 可以设置下载文件名,如果是空字符串,则使用服务器端设置的文件名
  219. a.click();
  220. },
  221. //账号分享
  222. sharezz(){
  223. var that=this;
  224. setTimeout(function() {
  225. that.showfx=true;
  226. console.log("1"+ this.showfx);
  227. }, 500); // 2000毫秒后执行
  228. loginService.getloginstr(this.inputForm.phone).then(({
  229. data
  230. }) => {
  231. //未登录
  232. if(data.Id=='0'){
  233. uni.showModal({
  234. title: '您无权限分享账号,请联系管!',
  235. showCancel: true,
  236. success: (res) => {
  237. }
  238. });
  239. }else{
  240. this.weixin(data);
  241. // const textArea = document.createElement("textarea");
  242. // textArea.value = 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/#/pages/index/index?loginid='+data.Id;
  243. // document.body.appendChild(textArea);
  244. // textArea.focus();
  245. // textArea.select();
  246. // try {
  247. // document.execCommand('copy');
  248. // uni.showModal({
  249. // title: '已将登录链接复制到剪切板,直接打开微信好友粘贴分享!',
  250. // showCancel: true,
  251. // success: (res) => {
  252. // }
  253. // });
  254. // } catch (err) {
  255. // console.error('Could not copy text', err);
  256. // uni.showModal({
  257. // title: '当前不支持分享功能!',
  258. // showCancel: true,
  259. // success: (res) => {
  260. // }
  261. // });
  262. // } finally {
  263. // document.body.removeChild(textArea);
  264. // }
  265. }
  266. }).catch((e) => {
  267. })
  268. },
  269. // async initUser() {
  270. // const { data = {} } = await api.fetchUserInfo();
  271. // if (Object.keys(data).length > 0) {
  272. // // 设置用户基本信息
  273. // this.setUser(data);
  274. // const browser = window.navigator.userAgent.toLowerCase();
  275. // //匹配browser中是否含有MicroMessenger字符串
  276. // if (browser.match(/MicroMessenger/i) == "micromessenger") {
  277. // this.weixin(data);
  278. // } else {
  279. // const params = new URLSearchParams(window.location.search);
  280. // const id = params.get("id");
  281. // if (!id || (id && id !== data.uid)) {
  282. // // 如果不是微信浏览器,则跳转页面带id后缀
  283. // const url_a = window.location.origin;
  284. // window.location.href = url_a + "?id=" + data.uid;
  285. // }
  286. // }
  287. // }
  288. // },
  289. async weixin(data) {
  290. try {
  291. if ( data) {
  292. //微信加签
  293. var obj = {
  294. appId: data.appid,
  295. nonceStr: data.nonceStr,
  296. signature: data.signature,
  297. timestamp: data.timestamp,
  298. Id: data.Id,
  299. }
  300. //分享数据,这段主要是为了在hash模式下分享出去的链接不被浏览器截取,保证完全把链接分享出去(link的链接可以自己拼,无须与当前页面的后缀参数之类的内容完全一致)
  301. let shareData = {
  302. title: '大走访+都企供需线上平台',
  303. desc: '点击直接登录',
  304. imgUrl: 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/static/img/titlebg.jpg',
  305. link: 'https://miniapp.huidutech.com.cn/yd_qycpfbH5/#/pages/index/index?loginid='+data.Id + "&t=" + data.timestamp + "&Content=1", // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  306. };
  307. //引用
  308. wxShare(obj, shareData);
  309. } else {
  310. uni.showModal({
  311. title: '获取sdk参数失败!',
  312. showCancel: true,
  313. success: (res) => {
  314. }
  315. });
  316. }
  317. } catch (err) {
  318. //
  319. } finally {
  320. //
  321. }
  322. },
  323. setData(data){
  324. if(data.des2=="1"){
  325. data.des2="工业";
  326. }else if(data.des2=="2"){
  327. data.des2="科技";
  328. }else if(data.des2=="3"){
  329. data.des2="发改";
  330. }else if(data.des2=="4"){
  331. data.des2="商务";
  332. }else if(data.des2=="5"){
  333. data.des2="人才政策";
  334. }else if(data.des2=="6"){
  335. data.des2="其他";
  336. }
  337. if(data.des3=="1"){
  338. data.des3="国家";
  339. }else if(data.des3=="2"){
  340. data.des3="省级";
  341. }else if(data.des3=="3"){
  342. data.des3="市级";
  343. }else if(data.des3=="4"){
  344. data.des3="区级";
  345. }
  346. if(data.des8=="1"){
  347. data.des8="政策法规";
  348. }else if(data.des8=="2"){
  349. data.des8="品牌申报";
  350. }else if(data.des8=="3"){
  351. data.des8="展会活动";
  352. }
  353. //替换图片样式
  354. if(data.des6!=undefined){
  355. data.des6=data.des6.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
  356. }else{
  357. data.des6="";
  358. }
  359. if(data.des4!=undefined){
  360. data.des4=data.des4.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
  361. }
  362. console.log(data.des4)
  363. this.inputForm = this.recover(this.inputForm, data)
  364. // console.log(this.inputForm.buildingName);
  365. // if(this.inputForm.buildingName=='盐都经开区'){
  366. // this.imgurl="https://miniapp.huidutech.com.cn/yd_qycpfbH5/jin.jpg";
  367. // }else if(this.inputForm.buildingName=='盐城高新区'){
  368. // this.imgurl="https://miniapp.huidutech.com.cn/yd_qycpfbH5/gao.jpg";
  369. // }else if(this.inputForm.buildingName=='龙冈产业园'){
  370. // this.imgurl="https://miniapp.huidutech.com.cn/yd_qycpfbH5/long.jpg";
  371. // }
  372. // if(this.inputForm.picture!=""){
  373. // this.inputForm.picture="http://47.97.69.114:8089"+this.inputForm.picture;
  374. // }
  375. },
  376. goToCompany(companyName) {
  377. //https://www.qcc.com/web/search?key=
  378. window.open("https://www.qcc.com/web/search?key="+companyName);
  379. //window.location.href = `https://www.qcc.com/company/${encodeURIComponent(companyName)}`;
  380. },
  381. call1(){
  382. // uni.navigateTo({
  383. // url: '/pages/index/AudioToWord'
  384. // })
  385. // uni.navigateTo({
  386. // url: '/pages/comList/comList'
  387. // })
  388. //未登录
  389. if(this.isLogin==null){
  390. uni.showModal({
  391. title: '您还未登录,是否跳转登录页面?',
  392. showCancel: true,
  393. success: (res) => {
  394. if (res.confirm) {
  395. uni.reLaunch({
  396. url: '/pages/login/login'
  397. })
  398. }
  399. }
  400. });
  401. }else{
  402. window.location.href = 'tel:'+this.inputForm.phone;
  403. }
  404. },
  405. call2(){
  406. //未登录
  407. if(this.isLogin==null){
  408. uni.showModal({
  409. title: '您还未登录,是否跳转登录页面?',
  410. showCancel: true,
  411. success: (res) => {
  412. if (res.confirm) {
  413. uni.reLaunch({
  414. url: '/pages/login/login'
  415. })
  416. }
  417. }
  418. });
  419. }else{
  420. window.location.href = 'tel:'+this.inputForm.bz6;
  421. }
  422. },
  423. }
  424. }
  425. </script>
  426. <style>
  427. /* .file-title) {
  428. font-size: 17px !important;
  429. } */
  430. input,textarea{
  431. color: #8799a3;
  432. }
  433. .swiper {
  434. width: 750rpx;
  435. height: 310rpx;
  436. }
  437. .swiper-item {
  438. width: 750rpx;
  439. height: 310rpx;
  440. background-color: aliceblue;
  441. }
  442. .show1{
  443. background-color: #2752eb;
  444. padding-left: 8rpx;
  445. }
  446. .textbg{
  447. display: flex;
  448. background-color: white;
  449. padding-top: 29rpx;
  450. }
  451. .text2{
  452. flex: 1;
  453. color: #000000;
  454. font-size: 30rpx;
  455. padding-bottom: 2rpx;
  456. }
  457. .text22{
  458. flex: 1;
  459. color: #666666;
  460. font-size: 29rpx;
  461. padding-bottom: 2rpx;
  462. }
  463. .text3{
  464. display: flex;
  465. color: #000000;
  466. }
  467. .phone{
  468. display: flex;
  469. color: #1E8AD7;
  470. padding-left: 5rpx;
  471. padding-right: 5rpx;
  472. font-size: 30rpx;
  473. align-items: center
  474. }
  475. .phoneimg{
  476. margin-left: 10rpx;
  477. width: 35rpx;
  478. height: 35rpx;
  479. }
  480. .titlebg2{
  481. display: flex;
  482. background-color: white;
  483. padding-left: 22rpx;
  484. padding-top: 35rpx;
  485. padding-bottom: 25rpx;
  486. margin-bottom: 2rpx;
  487. }
  488. .titlet1{
  489. width: 7rpx;
  490. margin-top: 7rpx;
  491. margin-bottom: 7rpx;
  492. background-color: #2752eb;
  493. margin-right: 8rpx;
  494. }
  495. .titlet2{
  496. font-weight: 800;
  497. color: #2752eb;
  498. }
  499. .overlay{
  500. position: fixed; /* 固定定位,覆盖整个页面 */
  501. top: 0;
  502. left: 0;
  503. width: 100%;
  504. height: 100%;
  505. background-color: rgba(255, 255, 255, 0.5); /* 半透明白色背景 */
  506. z-index: 1000; /* 确保遮罩在页面内容之上 */
  507. }
  508. .custom-header {
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. padding: 10px;
  513. width: 100%;
  514. }
  515. .is-back {
  516. position: relative;
  517. }
  518. .back-container {
  519. position: absolute;
  520. left: 10px;
  521. cursor: pointer;
  522. }
  523. .back-text {
  524. color: white; /* 返回按钮文本颜色 */
  525. }
  526. .content-container {
  527. flex: 1;
  528. text-align: center;
  529. }
  530. .content-text {
  531. color: white; /* 标题文本颜色 */
  532. font-weight: bold;
  533. }
  534. /* 背景颜色 */
  535. .bg-blue {
  536. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  537. }
  538. .text1{
  539. width: 100%;
  540. margin-left: 30rpx;
  541. font-size: 28rpx;
  542. color: #333;
  543. font-weight: bold;
  544. }
  545. .text2{
  546. width: 100%;
  547. margin-left: 30rpx;
  548. font-size: 28rpx;
  549. color: #333;
  550. }
  551. .text12{
  552. width: 100%;
  553. margin-left: 30rpx;
  554. color: #000000;
  555. margin-bottom: 20rpx;
  556. font-size: 29rpx;
  557. }
  558. .img-item {
  559. width: 100%;
  560. }
  561. </style>