policy_deatil.vue 18 KB

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