policy_deatil.vue 17 KB

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