policyInfo.vue 15 KB

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