policy_deatil.vue 17 KB

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