policy_deatil.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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. this.getDetailInfo(id);
  204. },
  205. onShow() {
  206. },
  207. methods: {
  208. goAuthPage(){
  209. uni.navigateTo({
  210. url:'../auth/index'
  211. })
  212. },
  213. getDetailInfo(ids) {
  214. let md5Sign = md5(
  215. "method=" +
  216. "common" +
  217. "&timestamp=" +
  218. getApp().globalData.globalTimestamp +
  219. "&secret=" +
  220. getApp().globalData.secret
  221. );
  222. let url =
  223. getApp().globalData.shareUrl +
  224. "api/api.php" +
  225. "?method=common&source=policy&action=info_by_id&timestamp=" +
  226. getApp().globalData.globalTimestamp +
  227. "&sign=" +
  228. md5Sign;
  229. uni.request({
  230. url: url,
  231. method: "POST",
  232. header: {
  233. "content-type": "application/x-www-form-urlencoded",
  234. },
  235. data: {
  236. id: ids,
  237. openId: getApp().globalData.open_id,
  238. },
  239. success: (res) => {
  240. if (res.data.code === 200) {
  241. if (res.data.data.video_url) {
  242. res.data.data.video_url =
  243. getApp().globalData.shareUrl + res.data.data.video_url;
  244. }
  245. res.data.data.level = this.levelList[res.data.data.level];
  246. this.infoObj = res.data.data;
  247. this.getRich1(ids);
  248. this.getRich2(ids);
  249. this.getRich3(ids);
  250. this.getRich4(ids);
  251. }
  252. },
  253. fail: () => {
  254. console.log("连接失败");
  255. },
  256. });
  257. },
  258. getRich1(ids) {
  259. uni.request({
  260. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  261. ids / 1000
  262. )}/${ids}_1.html`,
  263. method: "GET",
  264. header: {
  265. "content-type": "application/x-www-form-urlencoded",
  266. },
  267. success: (res) => {
  268. if (res.statusCode === 200) {
  269. this.$set(this.infoObj, "lidu", res.data);
  270. }
  271. },
  272. fail: () => {
  273. console.log("连接失败");
  274. },
  275. });
  276. },
  277. getRich2(ids) {
  278. uni.request({
  279. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  280. ids / 1000
  281. )}/${ids}_2.html`,
  282. method: "GET",
  283. header: {
  284. "content-type": "application/x-www-form-urlencoded",
  285. },
  286. success: (res) => {
  287. if (res.statusCode === 200) {
  288. this.$set(this.textModel1, "text", res.data);
  289. }
  290. },
  291. fail: () => {
  292. console.log("连接失败");
  293. },
  294. });
  295. },
  296. getRich3(ids) {
  297. uni.request({
  298. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  299. ids / 1000
  300. )}/${ids}_3.html`,
  301. method: "GET",
  302. header: {
  303. "content-type": "application/x-www-form-urlencoded",
  304. },
  305. success: (res) => {
  306. if (res.statusCode === 200) {
  307. this.$set(this.textModel2, "text", res.data);
  308. }
  309. },
  310. fail: () => {
  311. console.log("连接失败");
  312. },
  313. });
  314. },
  315. getRich4(ids) {
  316. uni.request({
  317. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  318. ids / 1000
  319. )}/${ids}_4.html`,
  320. method: "GET",
  321. header: {
  322. "content-type": "application/x-www-form-urlencoded",
  323. },
  324. success: (res) => {
  325. if (res.statusCode === 200) {
  326. this.$set(this.textModel3, "text", res.data);
  327. }
  328. },
  329. fail: () => {
  330. console.log("连接失败");
  331. },
  332. });
  333. },
  334. collectionPage() {
  335. if(!getApp().globalData.user_phone){
  336. this.goAuthPage();
  337. return
  338. }
  339. let md5Sign = md5(
  340. "method=" +
  341. "user" +
  342. "&timestamp=" +
  343. getApp().globalData.globalTimestamp +
  344. "&secret=" +
  345. getApp().globalData.secret
  346. );
  347. let url =
  348. getApp().globalData.shareUrl +
  349. "api/api.php" +
  350. "?method=user&source=policy&action=collect_add&timestamp=" +
  351. getApp().globalData.globalTimestamp +
  352. "&sign=" +
  353. md5Sign;
  354. uni.request({
  355. url: url,
  356. method: "POST",
  357. header: {
  358. "content-type": "application/x-www-form-urlencoded",
  359. },
  360. data: {
  361. openId: getApp().globalData.open_id,
  362. source: "policy",
  363. source_name: "政策",
  364. source_id: this.infoObj.id,
  365. source_title: this.infoObj.title,
  366. },
  367. success: (res) => {
  368. if (res.data.code === 200) {
  369. res.data.data
  370. ? (this.infoObj.if_collect = true)
  371. : (this.infoObj.if_collect = false);
  372. this.$forceUpdate();
  373. uni.showToast({
  374. duration: 3000,
  375. title: res.data.msg,
  376. icon: "none",
  377. });
  378. }
  379. },
  380. fail: () => {
  381. console.log("连接失败");
  382. },
  383. });
  384. },
  385. shareRequest() {
  386. let md5Sign = md5(
  387. "method=" +
  388. "user" +
  389. "&timestamp=" +
  390. getApp().globalData.globalTimestamp +
  391. "&secret=" +
  392. getApp().globalData.secret
  393. );
  394. let url =
  395. getApp().globalData.shareUrl +
  396. "api/api.php" +
  397. "?method=user&source=policy&action=repost&timestamp=" +
  398. getApp().globalData.globalTimestamp +
  399. "&sign=" +
  400. md5Sign;
  401. uni.request({
  402. url: url,
  403. method: "POST",
  404. header: {
  405. "content-type": "application/x-www-form-urlencoded",
  406. },
  407. data: {
  408. openId: getApp().globalData.open_id,
  409. source_id: this.infoObj.id,
  410. source: "policy",
  411. },
  412. success: (res) => {
  413. if (res.data.code === 200) {
  414. console.log(res);
  415. }
  416. },
  417. fail: () => {
  418. console.log("连接失败");
  419. },
  420. });
  421. },
  422. sharePage() {
  423. let that = this;
  424. uni.showShareMenu({
  425. title: that.infoObj.title,
  426. path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  427. success(res) {
  428. that.shareRequest();
  429. },
  430. });
  431. // if(!getApp().globalData.user_phone){
  432. // that.goAuthPage();
  433. // }else {
  434. // // uni.showShareMenu({
  435. // // title: that.infoObj.title,
  436. // // path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  437. // // success(res) {
  438. // // that.shareRequest();
  439. // // },
  440. // // });
  441. // }
  442. },
  443. changeScroll(height) {
  444. //点的时候触发这个函数 height 是之前的高度
  445. uni.pageScrollTo({
  446. scrollTop: this.scrollTop,
  447. duration: 0,
  448. });
  449. },
  450. },
  451. onPageScroll(e) {
  452. this.scrollTop = e.scrollTop;
  453. },
  454. };
  455. </script>
  456. <style lang="scss" scoped>
  457. * {
  458. box-sizing: border-box;
  459. }
  460. .footer-share-box {
  461. margin-left: -20rpx;
  462. }
  463. .content {
  464. margin-top: 20rpx;
  465. display: flex;
  466. flex-direction: column;
  467. align-items: center;
  468. justify-content: center;
  469. padding: 20rpx;
  470. height: auto;
  471. .title-box {
  472. width: 100%;
  473. display: flex;
  474. flex-direction: column;
  475. padding-bottom: 10rpx;
  476. margin-left: 30rpx;
  477. .title {
  478. letter-spacing: 5rpx;
  479. font-size: 35rpx;
  480. font-weight: 500;
  481. }
  482. .title-time {
  483. display: flex;
  484. font-size: 20rpx;
  485. color: $uni-text-color-grey;
  486. margin-top: 20rpx;
  487. .time {
  488. margin-right: 100rpx;
  489. }
  490. }
  491. }
  492. .video-box {
  493. width: 100%;
  494. // image {
  495. // width: 100%;
  496. // height: 400rpx;
  497. // border-radius: 32rpx;
  498. // }
  499. }
  500. #myVideo {
  501. width: 100%;
  502. border-radius: 10rpx;
  503. }
  504. .card-input-content {
  505. width: 100%;
  506. margin-top: 20rpx;
  507. .card-input {
  508. padding: 30rpx 30rpx;
  509. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  510. border-radius: 32rpx;
  511. .card-title {
  512. font-weight: 600;
  513. padding: 20rpx 20rpx 0rpx 20rpx;
  514. }
  515. .table {
  516. border-radius: 32rpx;
  517. background-color: #f2f2f2;
  518. margin-top: 20rpx;
  519. display: flex;
  520. padding: 0 20rpx;
  521. flex-direction: column;
  522. .table-item {
  523. box-sizing: border-box;
  524. width: 100%;
  525. margin: 20rpx 0;
  526. font-size: 27rpx;
  527. font-weight: 300;
  528. display: flex;
  529. justify-content: space-between;
  530. }
  531. }
  532. }
  533. }
  534. .card-situation {
  535. margin-top: 20rpx;
  536. padding: 20rpx;
  537. border-top: 8rpx solid #f2f2f2;
  538. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  539. border-radius: 32rpx;
  540. .card-title {
  541. font-weight: 600;
  542. padding: 20rpx 20rpx 0rpx 20rpx;
  543. }
  544. p {
  545. padding: 20rpx;
  546. margin-top: 20rpx;
  547. font-size: 27rpx;
  548. letter-spacing: 1rpx;
  549. line-height: 50rpx;
  550. }
  551. }
  552. .card-group {
  553. width: 100%;
  554. }
  555. .share-collection {
  556. background-color: #ffffff;
  557. position: fixed;
  558. bottom: 0;
  559. width: 100%;
  560. height: 80rpx;
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. .share,
  565. .collection {
  566. width: 50%;
  567. display: flex;
  568. justify-content: center;
  569. align-items: center;
  570. height: 100%;
  571. }
  572. .share {
  573. border-right: 1px solid $uni-border-color;
  574. }
  575. image {
  576. width: 50rpx;
  577. height: 50rpx;
  578. margin-left: 40rpx;
  579. }
  580. }
  581. .content-basic {
  582. box-sizing: border-box;
  583. margin-top: 20rpx;
  584. padding: 20rpx;
  585. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  586. border-radius: 32rpx;
  587. width: 100%;
  588. display: flex;
  589. flex-direction: column;
  590. // margin-bottom: 80rpx;
  591. .card-title {
  592. padding: 20rpx 20rpx 0rpx 20rpx;
  593. font-weight: 600;
  594. }
  595. .item-list {
  596. margin-left: 20rpx;
  597. display: flex;
  598. flex-direction: column;
  599. .term {
  600. display: flex;
  601. padding: 20rpx;
  602. .term-name {
  603. font-size: 27rpx;
  604. width: 30%;
  605. display: flex;
  606. margin: 20rpx;
  607. color: #7f7f7f;
  608. }
  609. .term-value-group {
  610. flex: 1;
  611. display: flex;
  612. flex-direction: column;
  613. font-size: 27rpx;
  614. .term-value-item {
  615. margin: 20rpx;
  616. }
  617. }
  618. }
  619. }
  620. }
  621. .content-rich {
  622. box-sizing: border-box;
  623. margin-top: 20rpx;
  624. padding: 20rpx;
  625. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  626. border-radius: 32rpx;
  627. width: 100%;
  628. display: flex;
  629. flex-direction: column;
  630. // margin-bottom: 80rpx;
  631. .card-title {
  632. padding: 20rpx 20rpx 0rpx 20rpx;
  633. font-weight: 600;
  634. }
  635. .item-list {
  636. margin-left: 20rpx;
  637. display: flex;
  638. flex-direction: column;
  639. .term {
  640. display: flex;
  641. padding: 20rpx;
  642. .term-name {
  643. font-size: 27rpx;
  644. width: 30%;
  645. display: flex;
  646. margin: 20rpx;
  647. color: #7f7f7f;
  648. }
  649. .term-value-group {
  650. flex: 1;
  651. display: flex;
  652. flex-direction: column;
  653. font-size: 27rpx;
  654. .term-value-item {
  655. margin: 20rpx;
  656. }
  657. }
  658. }
  659. }
  660. }
  661. .margin-bottom-80 {
  662. margin-bottom: 80rpx;
  663. }
  664. }
  665. </style>