policy_deatil.vue 18 KB

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