policyInfo.vue 15 KB

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