policy_deatil.vue 18 KB

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