policy_deatil.vue 18 KB

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