policy_deatil.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  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(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. </p>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 项目概况 -->
  47. <div class="card-situation" v-if="infoObj.project_desc">
  48. <div class="card-title">项目概况</div>
  49. <p>
  50. {{ infoObj.project_desc }}
  51. </p>
  52. </div>
  53. <!-- <div class="card-group" v-for="(item, idx) in model" :key="idx">
  54. <policy-deatil-card :model="item" :isMar="idx == model.length - 1"></policy-deatil-card>
  55. </div> -->
  56. <div class="card-group">
  57. <div class="content-basic">
  58. <div class="card-title">基本信息</div>
  59. <div class="item-list">
  60. <div class="term">
  61. <div class="term-name">项目名称:</div>
  62. <div class="term-value-group">
  63. <p class="term-value-item">{{ infoObj.project_name }}</p>
  64. </div>
  65. </div>
  66. <div class="term">
  67. <div class="term-name">受理部门:</div>
  68. <div class="term-value-group">
  69. <p class="term-value-item">{{ infoObj.sponsor_name }}</p>
  70. </div>
  71. </div>
  72. <div class="term">
  73. <div class="term-name">政策层级:</div>
  74. <div class="term-value-group">
  75. <p class="term-value-item">{{ infoObj.level }}</p>
  76. </div>
  77. </div>
  78. <div class="term">
  79. <div class="term-name">信息提供日期:</div>
  80. <div class="term-value-group">
  81. <p class="term-value-item">
  82. {{ infoObj.publish_time | globalTime }}
  83. </p>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="card-group">
  90. <div class="content-basic">
  91. <div class="card-title">支持力度</div>
  92. <div class="item-list">
  93. <div class="term">
  94. <div class="term-name">支持金额:</div>
  95. <div class="term-value-group">
  96. <p class="term-value-item">{{ infoObj.project_money }}</p>
  97. </div>
  98. </div>
  99. <div class="term">
  100. <div class="term-name">资助标准:</div>
  101. <div class="term-value-group">
  102. <p class="term-value-item" v-html="infoObj.lidu"></p>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  109. <div class="card-title">{{ textModel1.title }}</div>
  110. <div class="item-list">
  111. <div class="term">
  112. <div class="term-value-group">
  113. <p class="term-value-item" v-html="textModel1.text"></p>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  119. <div class="card-title">{{ textModel2.title }}</div>
  120. <div class="item-list">
  121. <div class="term">
  122. <div class="term-value-group">
  123. <!-- <p class="term-value-item" v-html="textModel2.text"></p> -->
  124. <u-parse :content="textModel2.text" @navigate="navigateUrl" />
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="content-rich" :class="{ 'margin-bottom-80': false }">
  130. <div class="card-title">{{ textModel3.title }}</div>
  131. <div class="item-list">
  132. <div class="term">
  133. <div class="term-value-group">
  134. <p class="term-value-item" v-html="textModel3.text"></p>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="content-rich" :class="{ 'margin-bottom-80': false }" style="margin-bottom: 90rpx;">
  140. <div class="card-title">联系方式</div>
  141. <div class="item-list">
  142. <div class="term">
  143. <div class="term-value-group">
  144. <p class="term-value-item">{{ infoObj.contact }}</p>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div style="width: 100%">
  150. <footer-share
  151. style="width: 100%"
  152. :isCollection="true"
  153. :isCollectedIcon="infoObj.if_collect"
  154. @collectionPages="collectionPage"
  155. @sharePages="sharePage"
  156. ></footer-share>
  157. </div>
  158. </div>
  159. </template>
  160. <script>
  161. import policy_deatil_card from "./policy_deatil_card";
  162. import policy_rich_card from "./policy_rich_card";
  163. import md5 from "@/common/md5.js";
  164. import uParse from '@/components/gaoyia-parse/parse.vue'
  165. export default {
  166. components: {
  167. policyDeatilCard: policy_deatil_card,
  168. policyRichCard: policy_rich_card,
  169. uParse
  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. // previewUrl(src, e) {
  322. // console.log(src)
  323. // // do something
  324. // },
  325. navigateUrl(href, e) {
  326. uni.setClipboardData({
  327. data:href,//要被复制的内容
  328. success:()=>{//复制成功的回调函数
  329. uni.showToast({//提示
  330. title:'复制成功'
  331. })
  332. }
  333. });
  334. },
  335. getRich3(ids) {
  336. uni.request({
  337. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  338. ids / 1000
  339. )}/${ids}_3.html`,
  340. method: "GET",
  341. header: {
  342. "content-type": "application/x-www-form-urlencoded",
  343. },
  344. success: (res) => {
  345. if (res.statusCode === 200) {
  346. this.$set(this.textModel2, "text", res.data);
  347. }
  348. },
  349. fail: () => {
  350. console.log("连接失败");
  351. },
  352. });
  353. },
  354. getRich4(ids) {
  355. uni.request({
  356. url: `https://kiq.xazhima.com/content/policy/${Math.floor(
  357. ids / 1000
  358. )}/${ids}_4.html`,
  359. method: "GET",
  360. header: {
  361. "content-type": "application/x-www-form-urlencoded",
  362. },
  363. success: (res) => {
  364. if (res.statusCode === 200) {
  365. this.$set(this.textModel3, "text", res.data);
  366. }
  367. },
  368. fail: () => {
  369. console.log("连接失败");
  370. },
  371. });
  372. },
  373. collectionPage() {
  374. if(!getApp().globalData.user_name){
  375. this.goAuthPage();
  376. return
  377. }
  378. let md5Sign = md5(
  379. "method=" +
  380. "user" +
  381. "&timestamp=" +
  382. getApp().globalData.globalTimestamp +
  383. "&secret=" +
  384. getApp().globalData.secret
  385. );
  386. let url =
  387. getApp().globalData.shareUrl +
  388. "api/api.php" +
  389. "?method=user&source=policy&action=collect_add&timestamp=" +
  390. getApp().globalData.globalTimestamp +
  391. "&sign=" +
  392. md5Sign;
  393. uni.request({
  394. url: url,
  395. method: "POST",
  396. header: {
  397. "content-type": "application/x-www-form-urlencoded",
  398. },
  399. data: {
  400. openId: getApp().globalData.open_id,
  401. source: "policy",
  402. source_name: "政策",
  403. source_id: this.infoObj.id,
  404. source_title: this.infoObj.title,
  405. },
  406. success: (res) => {
  407. if (res.data.code === 200) {
  408. res.data.data
  409. ? (this.infoObj.if_collect = true)
  410. : (this.infoObj.if_collect = false);
  411. this.$forceUpdate();
  412. uni.showToast({
  413. duration: 3000,
  414. title: res.data.msg,
  415. icon: "none",
  416. });
  417. }
  418. },
  419. fail: () => {
  420. console.log("连接失败");
  421. },
  422. });
  423. },
  424. shareRequest() {
  425. let md5Sign = md5(
  426. "method=" +
  427. "user" +
  428. "&timestamp=" +
  429. getApp().globalData.globalTimestamp +
  430. "&secret=" +
  431. getApp().globalData.secret
  432. );
  433. let url =
  434. getApp().globalData.shareUrl +
  435. "api/api.php" +
  436. "?method=user&source=policy&action=repost&timestamp=" +
  437. getApp().globalData.globalTimestamp +
  438. "&sign=" +
  439. md5Sign;
  440. uni.request({
  441. url: url,
  442. method: "POST",
  443. header: {
  444. "content-type": "application/x-www-form-urlencoded",
  445. },
  446. data: {
  447. openId: getApp().globalData.open_id,
  448. source_id: this.infoObj.id,
  449. source: "policy",
  450. },
  451. success: (res) => {
  452. if (res.data.code === 200) {
  453. console.log(res);
  454. }
  455. },
  456. fail: () => {
  457. console.log("连接失败");
  458. },
  459. });
  460. },
  461. sharePage() {
  462. let that = this;
  463. uni.showShareMenu({
  464. title: that.infoObj.title,
  465. path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  466. success(res) {
  467. that.shareRequest();
  468. },
  469. });
  470. // if(!getApp().globalData.user_phone){
  471. // that.goAuthPage();
  472. // }else {
  473. // // uni.showShareMenu({
  474. // // title: that.infoObj.title,
  475. // // path: "pages/policy/policy_detail?id=" + that.infoObj.id,
  476. // // success(res) {
  477. // // that.shareRequest();
  478. // // },
  479. // // });
  480. // }
  481. },
  482. changeScroll(height) {
  483. //点的时候触发这个函数 height 是之前的高度
  484. uni.pageScrollTo({
  485. scrollTop: this.scrollTop,
  486. duration: 0,
  487. });
  488. },
  489. },
  490. onPageScroll(e) {
  491. this.scrollTop = e.scrollTop;
  492. },
  493. };
  494. </script>
  495. <style lang="scss" scoped>
  496. * {
  497. box-sizing: border-box;
  498. }
  499. .footer-share-box {
  500. margin-left: -20rpx;
  501. }
  502. .content {
  503. margin-top: 20rpx;
  504. display: flex;
  505. flex-direction: column;
  506. align-items: center;
  507. justify-content: center;
  508. padding: 20rpx;
  509. height: auto;
  510. .title-box {
  511. width: 100%;
  512. display: flex;
  513. flex-direction: column;
  514. padding-bottom: 10rpx;
  515. margin-left: 30rpx;
  516. .title {
  517. letter-spacing: 5rpx;
  518. font-size: 35rpx;
  519. font-weight: 500;
  520. }
  521. .title-time {
  522. display: flex;
  523. font-size: 20rpx;
  524. color: $uni-text-color-grey;
  525. margin-top: 20rpx;
  526. .time {
  527. margin-right: 100rpx;
  528. }
  529. }
  530. }
  531. .video-box {
  532. width: 100%;
  533. // image {
  534. // width: 100%;
  535. // height: 400rpx;
  536. // border-radius: 32rpx;
  537. // }
  538. }
  539. #myVideo {
  540. width: 100%;
  541. border-radius: 10rpx;
  542. }
  543. .card-input-content {
  544. width: 100%;
  545. margin-top: 20rpx;
  546. .card-input {
  547. padding: 30rpx 30rpx;
  548. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  549. border-radius: 32rpx;
  550. .card-title {
  551. font-weight: 600;
  552. padding: 20rpx 20rpx 0rpx 20rpx;
  553. }
  554. .table {
  555. border-radius: 32rpx;
  556. background-color: #f2f2f2;
  557. margin-top: 20rpx;
  558. display: flex;
  559. padding: 0 20rpx;
  560. flex-direction: column;
  561. .table-item {
  562. box-sizing: border-box;
  563. width: 100%;
  564. margin: 20rpx 0;
  565. font-size: 27rpx;
  566. font-weight: 300;
  567. display: flex;
  568. justify-content: space-between;
  569. }
  570. }
  571. }
  572. }
  573. .card-situation {
  574. margin-top: 20rpx;
  575. padding: 20rpx;
  576. border-top: 8rpx solid #f2f2f2;
  577. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  578. border-radius: 32rpx;
  579. .card-title {
  580. font-weight: 600;
  581. padding: 20rpx 20rpx 0rpx 20rpx;
  582. }
  583. p {
  584. padding: 20rpx;
  585. margin-top: 20rpx;
  586. font-size: 27rpx;
  587. letter-spacing: 1rpx;
  588. line-height: 50rpx;
  589. }
  590. }
  591. .card-group {
  592. width: 100%;
  593. }
  594. .share-collection {
  595. background-color: #ffffff;
  596. position: fixed;
  597. bottom: 0;
  598. width: 100%;
  599. height: 80rpx;
  600. display: flex;
  601. align-items: center;
  602. justify-content: space-between;
  603. .share,
  604. .collection {
  605. width: 50%;
  606. display: flex;
  607. justify-content: center;
  608. align-items: center;
  609. height: 100%;
  610. }
  611. .share {
  612. border-right: 1px solid $uni-border-color;
  613. }
  614. image {
  615. width: 50rpx;
  616. height: 50rpx;
  617. margin-left: 40rpx;
  618. }
  619. }
  620. .content-basic {
  621. box-sizing: border-box;
  622. margin-top: 20rpx;
  623. padding: 20rpx;
  624. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  625. border-radius: 32rpx;
  626. width: 100%;
  627. display: flex;
  628. flex-direction: column;
  629. // margin-bottom: 80rpx;
  630. .card-title {
  631. padding: 20rpx 20rpx 0rpx 20rpx;
  632. font-weight: 600;
  633. }
  634. .item-list {
  635. margin-left: 20rpx;
  636. display: flex;
  637. flex-direction: column;
  638. .term {
  639. display: flex;
  640. padding: 20rpx;
  641. .term-name {
  642. font-size: 27rpx;
  643. width: 30%;
  644. display: flex;
  645. margin: 20rpx;
  646. color: #7f7f7f;
  647. }
  648. .term-value-group {
  649. flex: 1;
  650. display: flex;
  651. flex-direction: column;
  652. font-size: 27rpx;
  653. .term-value-item {
  654. margin: 20rpx;
  655. }
  656. }
  657. }
  658. }
  659. }
  660. .content-rich {
  661. box-sizing: border-box;
  662. margin-top: 20rpx;
  663. padding: 20rpx;
  664. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  665. border-radius: 32rpx;
  666. width: 100%;
  667. display: flex;
  668. flex-direction: column;
  669. // margin-bottom: 80rpx;
  670. .card-title {
  671. padding: 20rpx 20rpx 0rpx 20rpx;
  672. font-weight: 600;
  673. }
  674. .item-list {
  675. margin-left: 20rpx;
  676. display: flex;
  677. flex-direction: column;
  678. .term {
  679. display: flex;
  680. padding: 20rpx;
  681. .term-name {
  682. font-size: 27rpx;
  683. width: 30%;
  684. display: flex;
  685. margin: 20rpx;
  686. color: #7f7f7f;
  687. }
  688. .term-value-group {
  689. flex: 1;
  690. display: flex;
  691. flex-direction: column;
  692. font-size: 27rpx;
  693. .term-value-item {
  694. margin: 20rpx;
  695. }
  696. }
  697. }
  698. }
  699. }
  700. .margin-bottom-80 {
  701. margin-bottom: 80rpx;
  702. }
  703. }
  704. </style>