policy_deatil.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <template>
  2. <div class="content">
  3. <div class="title-box">
  4. <div class="title">{{ infoObj.title }}</div>
  5. <div class="title-time">
  6. <p class="time">{{ infoObj.publish_time | globalTime }}</p>
  7. <p class="read-count">
  8. 阅读量
  9. {{
  10. Number(infoObj.base_read_count) + Number(infoObj.real_read_count)
  11. }}
  12. </p>
  13. </div>
  14. </div>
  15. <div class="video-box" v-if="infoObj.video_url">
  16. <video :src="infoObj.video_url" id="myVideo" controls="true"></video>
  17. </div>
  18. <!-- 企业研发投入补贴 -->
  19. <div class="card-input-content">
  20. <div class="card-input">
  21. <div class="card-title">{{ infoObj.project_name || '-'}}</div>
  22. <div class="table">
  23. <p class="table-item">
  24. <span>项目金额:</span>
  25. <span>{{ infoObj.project_money || '-' }}</span>
  26. </p>
  27. <p class="table-item">
  28. <span>申报时间:</span>
  29. <span
  30. >{{ infoObj.project_start_date || '-'}} 至
  31. {{ infoObj.project_end_date || '-' }}</span
  32. >
  33. </p>
  34. <p class="table-item">
  35. <span>申报状态:</span>
  36. <span v-if="infoObj.project_end_date">剩
  37. {{
  38. Math.floor(new Date(new Date(infoObj.project_end_date).getTime() -new Date().getTime()).getTime() / (1 * 24 * 60 * 60 * 1000)) + 1 >= 1 ?
  39. Math.floor(new Date(new Date(infoObj.project_end_date).getTime() -new Date().getTime()).getTime() / (1 * 24 * 60 * 60 * 1000)) + 1 : 0
  40. }}
  41. 天</span>
  42. <span v-else>长期可申报</span>
  43. </p>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- 项目概况 -->
  48. <div class="card-situation" v-if="infoObj.project_desc">
  49. <div class="card-title">项目概况</div>
  50. <p>
  51. {{ infoObj.project_desc || '-'}}
  52. </p>
  53. </div>
  54. <!-- <div class="card-group" v-for="(item, idx) in model" :key="idx">
  55. <policy-deatil-card :model="item" :isMar="idx == model.length - 1"></policy-deatil-card>
  56. </div> -->
  57. <div class="card-group">
  58. <div class="content-basic">
  59. <div class="card-title">基本信息</div>
  60. <div class="item-list">
  61. <div class="term">
  62. <div class="term-name">项目名称:</div>
  63. <div class="term-value-group">
  64. <p class="term-value-item">{{ infoObj.project_name || '-'}}</p>
  65. </div>
  66. </div>
  67. <div class="term">
  68. <div class="term-name">受理部门:</div>
  69. <div class="term-value-group">
  70. <p class="term-value-item">{{ infoObj.sponsor_name || '-'}}</p>
  71. </div>
  72. </div>
  73. <div class="term">
  74. <div class="term-name">政策层级:</div>
  75. <div class="term-value-group">
  76. <p class="term-value-item">{{ infoObj.level }}</p>
  77. </div>
  78. </div>
  79. <div class="term">
  80. <div class="term-name">信息提供日期:</div>
  81. <div class="term-value-group">
  82. <p class="term-value-item">
  83. {{ infoObj.publish_time | globalTime }}
  84. </p>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="card-group">
  91. <div class="content-basic">
  92. <div class="card-title">支持力度</div>
  93. <div class="item-list">
  94. <div class="term">
  95. <div class="term-name">支持金额:</div>
  96. <div class="term-value-group">
  97. <p class="term-value-item">{{ infoObj.project_money || '-'}}</p>
  98. </div>
  99. </div>
  100. <div class="term">
  101. <div class="term-name">资助标准:</div>
  102. <div class="term-value-group">
  103. <!-- <p class="term-value-item" v-html="infoObj.lidu"></p> -->
  104. <u-parse :content="infoObj.lidu" @navigate="navigateUrl" />
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  111. <div class="card-title">{{ textModel1.title }}</div>
  112. <div class="item-list">
  113. <div class="term">
  114. <div class="term-value-group">
  115. <!-- <p class="term-value-item" v-html="textModel1.text"></p> -->
  116. <u-parse :content="textModel1.text" @navigate="navigateUrl" />
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  122. <div class="card-title">{{ textModel2.title }}</div>
  123. <div class="item-list">
  124. <div class="term">
  125. <div class="term-value-group">
  126. <!-- <p class="term-value-item" v-html="textModel2.text"></p> -->
  127. <u-parse :content="textModel2.text" @navigate="navigateUrl" />
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  133. <div class="card-title">{{ textModel3.title }}</div>
  134. <div class="item-list">
  135. <div class="term">
  136. <div class="term-value-group">
  137. <!-- <p class="term-value-item" v-html="textModel3.text"></p> -->
  138. <u-parse :content="textModel3.text" @navigate="navigateUrl" />
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="content-rich" :class="{ 'margin-bottom-80': false }" style="margin-bottom: 90rpx;">
  144. <div class="card-title">联系方式</div>
  145. <div class="item-list">
  146. <div class="term">
  147. <div class="term-value-group">
  148. <p class="term-value-item">{{ infoObj.contact || '-'}}</p>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <div style="width: 100%">
  154. <footer-share
  155. style="width: 100%"
  156. :isCollection="true"
  157. :isCollectedIcon="infoObj.if_collect"
  158. @collectionPages="collectionPage"
  159. @sharePages="sharePage"
  160. ></footer-share>
  161. </div>
  162. </div>
  163. </template>
  164. <script>
  165. import policy_deatil_card from "./policy_deatil_card";
  166. import policy_rich_card from "./policy_rich_card";
  167. import md5 from "@/common/md5.js";
  168. import uParse from '@/components/gaoyia-parse/parse.vue'
  169. export default {
  170. components: {
  171. policyDeatilCard: policy_deatil_card,
  172. policyRichCard: policy_rich_card,
  173. uParse
  174. },
  175. data() {
  176. return {
  177. model: [],
  178. levelList: {
  179. 1: "省级政策",
  180. 2: "市级政策",
  181. 3: "新区政策",
  182. 4: "新城政策",
  183. },
  184. id: "",
  185. pageId:'',
  186. textModel1: {
  187. title: "申报条件",
  188. text: "",
  189. },
  190. textModel2: {
  191. title: "申报材料",
  192. text: "",
  193. },
  194. textModel3: {
  195. title: "申报途径",
  196. text: "",
  197. },
  198. // textModel4: {
  199. // title: "联系方式",
  200. // text: "",
  201. // },
  202. scrollTop: 0,
  203. infoObj: {},
  204. };
  205. },
  206. onLoad(option) {
  207. this.pageId = option.id;
  208. // this.getDetailInfo(id);
  209. this.getUserAuth();
  210. },
  211. onShow() {
  212. this.getDetailInfo(this.pageId);
  213. },
  214. methods: {
  215. goAuthPage(){
  216. uni.navigateTo({
  217. url:'../auth/index'
  218. })
  219. },
  220. getUserAuth(){
  221. let md5Sign = md5("method="+'user'+"&timestamp="+getApp().globalData.globalTimestamp+"&secret="+getApp().globalData.secret)
  222. let url = getApp().globalData.shareUrl+'api/api.php'+'?method=user&action=info_by_openid&timestamp='+getApp().globalData.globalTimestamp +'&sign='+md5Sign
  223. uni.request({
  224. url:url,
  225. method: 'POST',
  226. header: {
  227. 'content-type': 'application/x-www-form-urlencoded'
  228. },
  229. data: {
  230. openId:getApp().globalData.open_id
  231. },
  232. success: (res) => {
  233. if(res.data.code === 200){
  234. res.data.data.nickname ? getApp().globalData.user_name = res.data.data.nickname :getApp().globalData.user_name = ''
  235. }
  236. },
  237. fail: () => {
  238. console.log("连接失败");
  239. }
  240. });
  241. },
  242. getDetailInfo(ids) {
  243. let md5Sign = md5(
  244. "method=" +
  245. "common" +
  246. "&timestamp=" +
  247. getApp().globalData.globalTimestamp +
  248. "&secret=" +
  249. getApp().globalData.secret
  250. );
  251. let url =
  252. getApp().globalData.shareUrl +
  253. "api/api.php" +
  254. "?method=common&source=policy&action=info_by_id&timestamp=" +
  255. getApp().globalData.globalTimestamp +
  256. "&sign=" +
  257. md5Sign;
  258. uni.request({
  259. url: url,
  260. method: "POST",
  261. header: {
  262. "content-type": "application/x-www-form-urlencoded",
  263. },
  264. data: {
  265. id: ids,
  266. openId: getApp().globalData.open_id,
  267. },
  268. success: (res) => {
  269. if (res.data.code === 200) {
  270. if (res.data.data.video_url) {
  271. res.data.data.video_url =
  272. getApp().globalData.shareUrl + res.data.data.video_url;
  273. }
  274. res.data.data.level = this.levelList[res.data.data.level];
  275. this.infoObj = res.data.data;
  276. this.getRich1(ids);
  277. this.getRich2(ids);
  278. this.getRich3(ids);
  279. this.getRich4(ids);
  280. }
  281. },
  282. fail: () => {
  283. console.log("连接失败");
  284. },
  285. });
  286. },
  287. getRich1(ids) {
  288. uni.request({
  289. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  290. ids / 1000
  291. )}/${ids}_1.html`,
  292. method: "GET",
  293. header: {
  294. "content-type": "application/x-www-form-urlencoded",
  295. },
  296. success: (res) => {
  297. if (res.statusCode === 200) {
  298. this.$set(this.infoObj, "lidu", res.data);
  299. }
  300. },
  301. fail: () => {
  302. console.log("连接失败");
  303. },
  304. });
  305. },
  306. getRich2(ids) {
  307. uni.request({
  308. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  309. ids / 1000
  310. )}/${ids}_2.html`,
  311. method: "GET",
  312. header: {
  313. "content-type": "application/x-www-form-urlencoded",
  314. },
  315. success: (res) => {
  316. if (res.statusCode === 200) {
  317. this.$set(this.textModel1, "text", res.data);
  318. }
  319. },
  320. fail: () => {
  321. console.log("连接失败");
  322. },
  323. });
  324. },
  325. // previewUrl(src, e) {
  326. // console.log(src)
  327. // // do something
  328. // },
  329. navigateUrl(href, e) {
  330. uni.setClipboardData({
  331. data:href,//要被复制的内容
  332. success:()=>{//复制成功的回调函数
  333. uni.showToast({//提示
  334. title:'复制成功'
  335. })
  336. }
  337. });
  338. },
  339. getRich3(ids) {
  340. uni.request({
  341. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  342. ids / 1000
  343. )}/${ids}_3.html`,
  344. method: "GET",
  345. header: {
  346. "content-type": "application/x-www-form-urlencoded",
  347. },
  348. success: (res) => {
  349. if (res.statusCode === 200) {
  350. this.$set(this.textModel2, "text", res.data);
  351. }
  352. },
  353. fail: () => {
  354. console.log("连接失败");
  355. },
  356. });
  357. },
  358. getRich4(ids) {
  359. uni.request({
  360. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  361. ids / 1000
  362. )}/${ids}_4.html`,
  363. method: "GET",
  364. header: {
  365. "content-type": "application/x-www-form-urlencoded",
  366. },
  367. success: (res) => {
  368. if (res.statusCode === 200) {
  369. this.$set(this.textModel3, "text", res.data);
  370. }
  371. },
  372. fail: () => {
  373. console.log("连接失败");
  374. },
  375. });
  376. },
  377. collectionPage() {
  378. if(!getApp().globalData.user_name){
  379. this.goAuthPage();
  380. return
  381. }
  382. let md5Sign = md5(
  383. "method=" +
  384. "user" +
  385. "&timestamp=" +
  386. getApp().globalData.globalTimestamp +
  387. "&secret=" +
  388. getApp().globalData.secret
  389. );
  390. let url =
  391. getApp().globalData.shareUrl +
  392. "api/api.php" +
  393. "?method=user&source=policy&action=collect_add&timestamp=" +
  394. getApp().globalData.globalTimestamp +
  395. "&sign=" +
  396. md5Sign;
  397. uni.request({
  398. url: url,
  399. method: "POST",
  400. header: {
  401. "content-type": "application/x-www-form-urlencoded",
  402. },
  403. data: {
  404. openId: getApp().globalData.open_id,
  405. source: "policy",
  406. source_name: "政策",
  407. source_id: this.infoObj.id,
  408. source_title: this.infoObj.title,
  409. },
  410. success: (res) => {
  411. if (res.data.code === 200) {
  412. res.data.data
  413. ? (this.infoObj.if_collect = true)
  414. : (this.infoObj.if_collect = false);
  415. this.$forceUpdate();
  416. uni.showToast({
  417. duration: 3000,
  418. title: res.data.msg,
  419. icon: "none",
  420. });
  421. }
  422. },
  423. fail: () => {
  424. console.log("连接失败");
  425. },
  426. });
  427. },
  428. shareRequest() {
  429. let md5Sign = md5(
  430. "method=" +
  431. "user" +
  432. "&timestamp=" +
  433. getApp().globalData.globalTimestamp +
  434. "&secret=" +
  435. getApp().globalData.secret
  436. );
  437. let url =
  438. getApp().globalData.shareUrl +
  439. "api/api.php" +
  440. "?method=user&source=policy&action=repost&timestamp=" +
  441. getApp().globalData.globalTimestamp +
  442. "&sign=" +
  443. md5Sign;
  444. uni.request({
  445. url: url,
  446. method: "POST",
  447. header: {
  448. "content-type": "application/x-www-form-urlencoded",
  449. },
  450. data: {
  451. openId: getApp().globalData.open_id,
  452. source_id: this.infoObj.id,
  453. source: "policy",
  454. },
  455. success: (res) => {
  456. if (res.data.code === 200) {
  457. console.log(res);
  458. }
  459. },
  460. fail: () => {
  461. console.log("连接失败");
  462. },
  463. });
  464. },
  465. sharePage() {
  466. let that = this;
  467. uni.showShareMenu({
  468. title: that.infoObj.title,
  469. path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  470. success(res) {
  471. that.shareRequest();
  472. },
  473. });
  474. // if(!getApp().globalData.user_phone){
  475. // that.goAuthPage();
  476. // }else {
  477. // // uni.showShareMenu({
  478. // // title: that.infoObj.title,
  479. // // path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  480. // // success(res) {
  481. // // that.shareRequest();
  482. // // },
  483. // // });
  484. // }
  485. },
  486. changeScroll(height) {
  487. //点的时候触发这个函数 height 是之前的高度
  488. uni.pageScrollTo({
  489. scrollTop: this.scrollTop,
  490. duration: 0,
  491. });
  492. },
  493. },
  494. onPageScroll(e) {
  495. this.scrollTop = e.scrollTop;
  496. },
  497. };
  498. </script>
  499. <style lang="scss" scoped>
  500. * {
  501. box-sizing: border-box;
  502. }
  503. .footer-share-box {
  504. margin-left: -20rpx;
  505. }
  506. .content {
  507. margin-top: 20rpx;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. justify-content: center;
  512. padding: 20rpx;
  513. height: auto;
  514. .title-box {
  515. width: 100%;
  516. display: flex;
  517. flex-direction: column;
  518. padding-bottom: 10rpx;
  519. margin-left: 30rpx;
  520. .title {
  521. letter-spacing: 5rpx;
  522. font-size: 35rpx;
  523. font-weight: 500;
  524. }
  525. .title-time {
  526. display: flex;
  527. font-size: 24rpx;
  528. color: $uni-text-color-grey;
  529. margin-top: 20rpx;
  530. .time {
  531. margin-right: 100rpx;
  532. }
  533. }
  534. }
  535. .video-box {
  536. width: 100%;
  537. // image {
  538. // width: 100%;
  539. // height: 400rpx;
  540. // border-radius: 32rpx;
  541. // }
  542. }
  543. #myVideo {
  544. width: 100%;
  545. border-radius: 10rpx;
  546. }
  547. .card-input-content {
  548. width: 100%;
  549. margin-top: 20rpx;
  550. .card-input {
  551. padding: 30rpx 30rpx;
  552. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  553. border-radius: 32rpx;
  554. .card-title {
  555. font-weight: 600;
  556. padding: 20rpx 20rpx 0rpx 20rpx;
  557. }
  558. .table {
  559. border-radius: 32rpx;
  560. background-color: #f2f2f2;
  561. margin-top: 20rpx;
  562. display: flex;
  563. padding: 0 20rpx;
  564. flex-direction: column;
  565. .table-item {
  566. box-sizing: border-box;
  567. width: 100%;
  568. margin: 20rpx 0;
  569. font-size: 28rpx;
  570. font-weight: 300;
  571. display: flex;
  572. justify-content: space-between;
  573. }
  574. }
  575. }
  576. }
  577. .card-situation {
  578. margin-top: 20rpx;
  579. padding: 20rpx;
  580. border-top: 8rpx solid #f2f2f2;
  581. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  582. border-radius: 32rpx;
  583. .card-title {
  584. font-weight: 600;
  585. padding: 20rpx 20rpx 0rpx 20rpx;
  586. }
  587. p {
  588. padding: 20rpx;
  589. margin-top: 20rpx;
  590. font-size: 28rpx;
  591. letter-spacing: 1rpx;
  592. line-height: 50rpx;
  593. }
  594. }
  595. .card-group {
  596. width: 100%;
  597. }
  598. .share-collection {
  599. background-color: #ffffff;
  600. position: fixed;
  601. bottom: 0;
  602. width: 100%;
  603. height: 80rpx;
  604. display: flex;
  605. align-items: center;
  606. justify-content: space-between;
  607. .share,
  608. .collection {
  609. width: 50%;
  610. display: flex;
  611. justify-content: center;
  612. align-items: center;
  613. height: 100%;
  614. }
  615. .share {
  616. border-right: 1px solid $uni-border-color;
  617. }
  618. image {
  619. width: 50rpx;
  620. height: 50rpx;
  621. margin-left: 40rpx;
  622. }
  623. }
  624. .content-basic {
  625. box-sizing: border-box;
  626. margin-top: 20rpx;
  627. padding: 20rpx;
  628. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  629. border-radius: 32rpx;
  630. width: 100%;
  631. display: flex;
  632. flex-direction: column;
  633. // margin-bottom: 80rpx;
  634. .card-title {
  635. padding: 20rpx 20rpx 0rpx 20rpx;
  636. font-weight: 600;
  637. }
  638. .item-list {
  639. margin-left: 20rpx;
  640. display: flex;
  641. flex-direction: column;
  642. .term {
  643. display: flex;
  644. padding: 20rpx;
  645. .term-name {
  646. font-size: 28rpx;
  647. width: 30%;
  648. display: flex;
  649. margin: 20rpx;
  650. color: #7f7f7f;
  651. }
  652. .term-value-group {
  653. flex: 1;
  654. display: flex;
  655. flex-direction: column;
  656. font-size: 28rpx;
  657. .term-value-item {
  658. margin: 20rpx;
  659. }
  660. }
  661. }
  662. }
  663. }
  664. .content-rich {
  665. box-sizing: border-box;
  666. margin-top: 20rpx;
  667. padding: 20rpx;
  668. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  669. border-radius: 32rpx;
  670. width: 100%;
  671. display: flex;
  672. flex-direction: column;
  673. // margin-bottom: 80rpx;
  674. .card-title {
  675. padding: 20rpx 20rpx 0rpx 20rpx;
  676. font-weight: 600;
  677. }
  678. .item-list {
  679. margin-left: 20rpx;
  680. display: flex;
  681. flex-direction: column;
  682. .term {
  683. display: flex;
  684. padding: 20rpx;
  685. .term-name {
  686. font-size: 28rpx;
  687. width: 30%;
  688. display: flex;
  689. margin: 20rpx;
  690. color: #7f7f7f;
  691. }
  692. .term-value-group {
  693. flex: 1;
  694. display: flex;
  695. flex-direction: column;
  696. font-size: 28rpx;
  697. .term-value-item {
  698. margin: 20rpx;
  699. }
  700. }
  701. }
  702. }
  703. }
  704. .margin-bottom-80 {
  705. margin-bottom: 80rpx;
  706. }
  707. }
  708. </style>