index.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362
  1. // index.js
  2. import {
  3. login
  4. } from "../api/request";
  5. import {
  6. imgUrl,
  7. request,
  8. request2
  9. } from "../api/request"
  10. import {
  11. yjzjList
  12. } from "../api/index-api"
  13. import {
  14. send
  15. } from "../api/index-api2"
  16. import * as echarts from '../../ec-canvas/echarts';
  17. import {
  18. getNanVideo
  19. } from "../api/newPaper-api"
  20. import {
  21. cacheSet
  22. } from "../../utils/cacheUtil"
  23. // 获取应用实例
  24. const app = getApp()
  25. Page({
  26. data: {
  27. hideAll: true,
  28. imgUrl: imgUrl,
  29. // 屏幕高度
  30. navHeight: '',
  31. searchInput: '',
  32. // 南岸咨询
  33. naTab: 0,
  34. naItem: '',
  35. // 政民tab
  36. communicateTab: 0,
  37. // 政民item
  38. communicateItem: 0,
  39. // 服务列表
  40. serviceItems1: [{
  41. img: imgUrl + 'service-1.png',
  42. name: '生活缴费'
  43. },
  44. {
  45. img: imgUrl + 'service-2.png',
  46. name: '社保服务'
  47. },
  48. {
  49. img: imgUrl + 'service-3.png',
  50. name: '公积金'
  51. },
  52. {
  53. img: imgUrl + 'service-4.png',
  54. name: '电子证照'
  55. },
  56. {
  57. img: imgUrl + 'service-5.png',
  58. name: '民政低保'
  59. }
  60. ],
  61. serviceItems2: [{
  62. img: imgUrl + 'service-6.png',
  63. name: '税务服务'
  64. },
  65. {
  66. img: imgUrl + 'service-7.png',
  67. name: '交通出行'
  68. },
  69. {
  70. img: imgUrl + 'service-8.png',
  71. name: '核酸采样点'
  72. },
  73. {
  74. img: imgUrl + 'service-9.png',
  75. name: '住房置业'
  76. },
  77. // {
  78. // img: imgUrl + 'service-10.png',
  79. // name: '更多功能'
  80. // }
  81. ],
  82. // 百姓聚焦
  83. peopleService: [{
  84. id: 1,
  85. top: true,
  86. name: '12345热线'
  87. },
  88. {
  89. id: 2,
  90. top: false,
  91. name: '个人社保查询'
  92. },
  93. {
  94. id: 3,
  95. top: false,
  96. name: '广阳岛'
  97. },
  98. {
  99. id: 4,
  100. top: false,
  101. name: '长嘉汇弹子石老街'
  102. },
  103. {
  104. id: 5,
  105. top: false,
  106. name: '南岸一颗树'
  107. },
  108. {
  109. id: 6,
  110. top: false,
  111. name: '印象南岸'
  112. }
  113. ],
  114. // 南岸咨询二级title
  115. naItemTabList: [{
  116. id: 1,
  117. name: '政策.咨询'
  118. },
  119. {
  120. id: 2,
  121. name: '党建.服务'
  122. },
  123. {
  124. id: 3,
  125. name: '抗疫.复工'
  126. },
  127. {
  128. id: 4,
  129. name: '功能.服务'
  130. }
  131. ],
  132. // 南岸咨询内容
  133. naContentList: [],
  134. // 南岸加载中参数
  135. isNaLoading: false,
  136. // 南岸是否为空数据
  137. isNaEmpty: true,
  138. // 本年办件数
  139. officeNumber: [],
  140. // 评价总量
  141. evalutionNum: 0,
  142. // 满意度
  143. evalutionRate: '',
  144. // 图表
  145. streetlinechartec: {
  146. lazyLoad: true,
  147. },
  148. // 图表图片
  149. canvasImg: '',
  150. // 视频推荐数据
  151. videoInfo: [],
  152. // 视频推荐数据加载中参数
  153. isVideoLoading: true,
  154. // 视频推荐是否为空数据
  155. isVideoEmpty: false,
  156. // 意见征集list
  157. yjzjDataList: [],
  158. // 在线调查
  159. investigatePage: 1,
  160. investigateList: [],
  161. isOnlineLoading: false,
  162. isOnlineFinish: false,
  163. // 地图服务
  164. mapServiceData: [{
  165. id: 1,
  166. name: '政务公开'
  167. },
  168. {
  169. id: 2,
  170. name: '政务服务'
  171. },
  172. {
  173. id: 3,
  174. name: '党群服务'
  175. },
  176. {
  177. id: 4,
  178. name: '核酸检测'
  179. },
  180. {
  181. id: 5,
  182. name: '教育资源'
  183. },
  184. {
  185. id: 6,
  186. name: '医疗卫生'
  187. },
  188. {
  189. id: 7,
  190. name: '户籍管理'
  191. },
  192. {
  193. id: 8,
  194. name: '交通服务'
  195. },
  196. ],
  197. // 媒体矩阵导航
  198. mediaCurrentTab: 0,
  199. // 公众号弹窗
  200. ewmShowDialog: false,
  201. // 南岸发布flag
  202. isNafaLoading: false,
  203. // 媒体矩阵导航列表
  204. provList: [{
  205. "name": "南岸发布"
  206. },
  207. {
  208. "name": "微信公众号"
  209. }
  210. // {
  211. // "name": "今日头条"
  212. // }
  213. ],
  214. // 媒体矩阵内容选项
  215. mediaSelectList: [{
  216. id: '1',
  217. name: "重庆市南岸区人民政府",
  218. img: imgUrl + 'index-media-icon1.png',
  219. ewm: "index_ewm_logo_1.png"
  220. },
  221. {
  222. id: '2',
  223. name: "南岸文旅",
  224. img: imgUrl + 'index-media-icon2.png',
  225. ewm: "index_ewm_logo_2.png"
  226. },
  227. {
  228. id: '3',
  229. name: "南岸发布",
  230. img: imgUrl + 'index-media-icon3.png',
  231. ewm: "index_ewm_logo_3.jpg",
  232. },
  233. {
  234. id: '4',
  235. name: "南岸国资",
  236. img: imgUrl + 'index-media-icon4.png',
  237. ewm: "index_ewm_logo_4.png"
  238. },
  239. {
  240. id: '5',
  241. name: "重庆南岸消防",
  242. img: imgUrl + 'index-media-icon5.png',
  243. ewm: "index_ewm_logo_5.png"
  244. },
  245. {
  246. id: '6',
  247. name: "南岸生态环境",
  248. img: imgUrl + 'index-media-icon6.png',
  249. ewm: "index_ewm_logo_6.png"
  250. },
  251. {
  252. id: '7',
  253. name: "南岸健康卫士",
  254. img: imgUrl + 'index-media-icon7.png',
  255. ewm: "index_ewm_logo_7.png"
  256. },
  257. {
  258. id: '8',
  259. name: "南岸公安",
  260. img: imgUrl + 'index-media-icon8.png',
  261. ewm: "index_ewm_logo_8.png"
  262. },
  263. {
  264. id: '9',
  265. name: "遇见南坪",
  266. img: imgUrl + 'index-media-icon9.png',
  267. ewm: "index_ewm_logo_9.png"
  268. },
  269. {
  270. id: '10',
  271. name: "书香南岸",
  272. img: imgUrl + 'index-media-icon10.png',
  273. ewm: "index_ewm_logo_10.png"
  274. },
  275. // {
  276. // id: '11',
  277. // name: "南岸卫生健康监督",
  278. // img: imgUrl + 'index-media-icon11.png',
  279. // ewm: "index_ewm_logo_11.jpg"
  280. // },
  281. {
  282. id: '12',
  283. name: "广阳岛绿色发展公司",
  284. img: imgUrl + 'index-media-icon13.png',
  285. ewm: "index_ewm_logo_13.jpg"
  286. },
  287. {
  288. id: '13',
  289. name: "南岸人力社保",
  290. img: imgUrl + 'index-media-icon14.png',
  291. ewm: "index_ewm_logo_14.png"
  292. },
  293. {
  294. id: '14',
  295. name: "广阳湾智创生态城",
  296. img: imgUrl + 'index-media-icon15.png',
  297. ewm: "index_ewm_logo_15.jpg"
  298. },
  299. {
  300. id: '15',
  301. name: "南岸健康",
  302. img: imgUrl + 'index-media-icon18.png',
  303. ewm: "index_ewm_logo_18.jpg"
  304. },
  305. {
  306. id: '16',
  307. name: "重庆市南岸区天文街道",
  308. img: imgUrl + 'index-media-icon17.png',
  309. ewm: "index_ewm_logo_17.png"
  310. },
  311. {
  312. id: '17',
  313. name: "南岸智慧城管",
  314. img: imgUrl + 'index-media-icon16.png',
  315. ewm: "index_ewm_logo_16.png"
  316. },
  317. {
  318. id: '18',
  319. name: "重庆市南岸区南坪街道",
  320. img: imgUrl + 'index-media-icon19.png',
  321. ewm: "index_ewm_logo_19.png"
  322. },
  323. {
  324. id: '19',
  325. name: "南岸司法",
  326. img: imgUrl + 'index-media-icon12.png',
  327. ewm: "index_ewm_logo_12.png"
  328. },
  329. ],
  330. // 媒体矩阵南岸发布
  331. mediaReleaseList: [],
  332. // 媒体矩阵今日头条
  333. mediaHeadlineList: []
  334. },
  335. onReady() {},
  336. onShow() {
  337. if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  338. this.getTabBar().setData({
  339. selected: 0
  340. })
  341. }
  342. this.setData({
  343. // naItem: 0,
  344. // naItemTab: 1,
  345. ewmShowDialog: false,
  346. isOnlineLoading: false,
  347. isOnlineFinish: false
  348. })
  349. if (this.data.loginReturnFlag) {
  350. this.setData({
  351. loginReturnFlag: false
  352. })
  353. this.getVideoRecommend()
  354. }
  355. },
  356. // 点击服务
  357. clickService1(e) {
  358. const index = e.currentTarget.dataset.item
  359. switch (index) {
  360. case 0: {
  361. wx.navigateToMiniProgram({
  362. appId: 'wxd2ade0f25a874ee2',
  363. success(res) {
  364. // 打开成功
  365. }
  366. })
  367. };
  368. break;
  369. case 1: {
  370. wx.navigateToMiniProgram({
  371. appId: 'wxfc86707bae655315',
  372. success(res) {
  373. // 打开成功
  374. }
  375. })
  376. };
  377. break;
  378. case 2: {
  379. wx.navigateToMiniProgram({
  380. appId: 'wx0bff7955e6e8b2bb',
  381. success(res) {
  382. // 打开成功
  383. }
  384. })
  385. };
  386. break;
  387. case 3: {
  388. wx.navigateToMiniProgram({
  389. appId: 'wxfc86707bae655315',
  390. success(res) {
  391. // 打开成功
  392. }
  393. })
  394. };
  395. break;
  396. case 4: {
  397. wx.navigateToMiniProgram({
  398. appId: 'wxfc86707bae655315',
  399. success(res) {
  400. // 打开成功
  401. }
  402. })
  403. };
  404. break;
  405. }
  406. },
  407. // 点击服务
  408. clickService2(e) {
  409. const index = e.currentTarget.dataset.item
  410. switch (index) {
  411. case 0: {
  412. wx.navigateToMiniProgram({
  413. appId: 'wxfc86707bae655315',
  414. success(res) {
  415. // 打开成功
  416. }
  417. })
  418. };
  419. break;
  420. case 1: {
  421. wx.navigateToMiniProgram({
  422. appId: 'wxbb58374cdce267a6',
  423. success(res) {
  424. // 打开成功
  425. }
  426. })
  427. };
  428. break;
  429. case 2: {
  430. wx.navigateTo({
  431. url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/maps/sy_mobile.html&se=采样点",
  432. })
  433. };
  434. break;
  435. case 3: {
  436. wx.navigateToMiniProgram({
  437. appId: 'wx0bff7955e6e8b2bb',
  438. success(res) {
  439. // 打开成功
  440. }
  441. })
  442. };
  443. break;
  444. }
  445. },
  446. toDataCenter() {
  447. wx.navigateTo({
  448. url: '/pages/dataCenter/dataCenter',
  449. })
  450. },
  451. onHide() {
  452. if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  453. this.getTabBar().setData({
  454. selected: -1
  455. })
  456. }
  457. },
  458. onLoad() {
  459. // // 加载字体
  460. // wx.loadFontFace({
  461. // family: 'DOUYU',
  462. // // source: 'url("https://hui.yrslm.com:8089/douyu.ttf")',
  463. // source: 'url("https://www.cqna.gov.cn/mnazw/applet/font/douyu.ttf")',
  464. // success: function (e) {
  465. // console.log(e, '动态加载字体成功')
  466. // },
  467. // fail: function (e) {
  468. // console.log(e, '动态加载字体失败')
  469. // },
  470. // })
  471. // 获取视频推荐数据
  472. this.getVideoRecommend();
  473. // 获取媒体矩阵南岸发布数据
  474. this.getMediaReleaseList();
  475. // 获取媒体矩阵今日头条数据
  476. this.getMediaHeadlineList();
  477. // 获取好差评图表
  478. this.barComponent3 = this.selectComponent('#streetlinechart3');
  479. this.init_bar3();
  480. // 获取本年办件数
  481. this.getOfficeNumberByAreaInfo();
  482. // 意见征集数据
  483. this.yjzjData()
  484. // 初始化在线调查page
  485. this.setData({
  486. investigatePage: 1,
  487. investigateList: [],
  488. navHeight: app.globalData.navHeight + app.globalData.menuHeight / 2
  489. })
  490. this.initNadt()
  491. setTimeout(() => {
  492. this.setData({
  493. hideAll: false
  494. })
  495. }, 1000);
  496. // wx.login({
  497. // success(res) {
  498. // if (res.code) {
  499. // //发起网络请求
  500. // login(res.code).then(res => {
  501. // console.log(res)
  502. // wx.setStorageSync("token", res.data.data)
  503. // })
  504. // } else {
  505. // console.log('登录失败!' + res.errMsg)
  506. // }
  507. // }
  508. // })
  509. },
  510. // canvas转图片
  511. canvasToTempImage() {
  512. wx.canvasToTempFilePath({
  513. canvas: this.barComponent3.canvasNode,
  514. success: (res) => {
  515. this.setData({
  516. canvasImg: res.tempFilePath
  517. });
  518. }
  519. }, this);
  520. },
  521. // 加载评价图表
  522. init_bar3() {
  523. let that = this;
  524. this.barComponent3.init((canvas, width, height, dpr) => {
  525. // 初始化图表
  526. const barChart = echarts.init(canvas, null, {
  527. width: width,
  528. height: height,
  529. devicePixelRatio: dpr
  530. });
  531. wx.request({
  532. url: 'https://www.cqna.gov.cn/data//goodOrbad/getGoodOrBadByYearAndArea?area=1',
  533. method: 'GET',
  534. success: res => {
  535. res = res.data;
  536. if (res.result === 'ok') {
  537. let temp = [];
  538. temp.push(res.data.veryDissatisfied);
  539. temp.push(res.data.notSatisfied);
  540. temp.push(res.data.basicSatisfied);
  541. temp.push(res.data.satisfied);
  542. temp.push(res.data.great);
  543. // 计算最大值,以及分割值
  544. var maxValue = Math.max(...temp)
  545. maxValue = parseInt(maxValue / 10000 + 1) * 10000
  546. var interval = maxValue / 4
  547. barChart.setOption(this.getScaOption2(maxValue, interval));
  548. this.setData({
  549. evalutionNum: res.data.goodOrBad,
  550. evalutionRate: (res.data.good / res.data.goodOrBad * 100).toFixed(2)
  551. })
  552. barChart.setOption({
  553. series: [{
  554. data: temp
  555. }]
  556. })
  557. }
  558. }
  559. })
  560. barChart.on("finished", function () {
  561. that.canvasToTempImage();
  562. });
  563. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  564. return barChart;
  565. });
  566. },
  567. getScaOption2(maxValue, interval) {
  568. //请求数据
  569. let xAxis = {
  570. type: 'value',
  571. splitNumber: 4,
  572. max: maxValue,
  573. interval: interval,
  574. axisLine: {
  575. show: true
  576. },
  577. splitLine: {
  578. interval: 0
  579. }
  580. },
  581. yAxis = {
  582. axisTick: {
  583. show: false
  584. },
  585. type: 'category',
  586. data: [
  587. '非常不满意', '不满意', '基本满意', '满意', '非常满意'
  588. ]
  589. },
  590. grid = {
  591. left: '23%',
  592. top: '5%',
  593. bottom: '20%',
  594. right: '18%'
  595. },
  596. series = [{
  597. data: [],
  598. type: 'bar',
  599. barWidth: 15,
  600. itemStyle: {
  601. normal: {
  602. barBorderRadius: [0, 7, 7, 0],
  603. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  604. offset: 0,
  605. color: '#006BFD'
  606. },
  607. {
  608. offset: 1,
  609. color: '#00E9F1'
  610. }
  611. ]),
  612. }
  613. },
  614. label: {
  615. show: true,
  616. position: 'right',
  617. valueAnimation: true
  618. }
  619. }]
  620. return {
  621. backgroundColor: '#FFFFFF',
  622. xAxis: xAxis,
  623. yAxis: yAxis,
  624. grid: grid,
  625. series: series,
  626. animationDelay: function (idx) {
  627. return idx * 50;
  628. },
  629. animationEasing: 'elasticOut'
  630. };
  631. },
  632. // 获取本年办件数
  633. getOfficeNumberByAreaInfo() {
  634. request2({
  635. url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3',
  636. method: 'GET'
  637. }).then(res => {
  638. let temp = [];
  639. temp.push(res.data.acceptNumber);
  640. temp.push(res.data.serialNumber);
  641. temp.push(res.data.applicationNumberNetwork);
  642. this.setData({
  643. officeNumber: temp
  644. })
  645. })
  646. },
  647. // 搜索框
  648. bindKeyInput: function (e) {
  649. this.setData({
  650. searchInput: e.detail.value
  651. })
  652. },
  653. naChangeTab: function (e) {
  654. this.setData({
  655. naTab: e.detail.current,
  656. naItem: e.detail.current,
  657. naContentList: []
  658. })
  659. this.setData({
  660. })
  661. if (e.detail.current == 1) {
  662. wx.request({
  663. url: 'https://www.cq.gov.cn/ywdt/jrzq/index.json?cqjrcq=cqjrcq&_=1669609973472',
  664. success: res => {
  665. if (res.statusCode == 200) {
  666. var s = res.data
  667. s = s.substring(7, s.length - 1)
  668. s = JSON.parse(s)
  669. var d = [];
  670. var size = s.datas.length <= 5 ? s.datas.length : 5
  671. for (let i = 0; i < size; i++) {
  672. d.push({
  673. "DOCTITLE": s.datas[i].title,
  674. "url": s.datas[i].url
  675. })
  676. }
  677. this.setData({
  678. naContentList: d
  679. })
  680. }
  681. }
  682. })
  683. }
  684. if (e.detail.current == 2) {
  685. wx.request({
  686. url: 'https://www.gov.cn/pushinfo/v150203/pushinfo.jsonp?pushInfoJsonpCallBack=pushInfoJsonpCallBack&_=1669609973471',
  687. success: res => {
  688. console.log(res);
  689. if (res.statusCode == 200) {
  690. var s = res.data
  691. s = s.substring(22, s.length - 1)
  692. s = JSON.parse(s)
  693. console.log(s);
  694. var d = [];
  695. var size = s.length <= 5 ? s.length : 5
  696. for (let i = 0; i < size; i++) {
  697. d.push({
  698. "DOCTITLE": s[i].description,
  699. "url": s[i].link
  700. })
  701. }
  702. this.setData({
  703. naContentList: d
  704. })
  705. }
  706. }
  707. })
  708. }
  709. if (e.detail.current == 0) {
  710. let column = ["20430", "59482", "59481"]
  711. send(1, 5, column[e.detail.current]).then(res => {
  712. if (res.result) {
  713. this.setData({
  714. naContentList: res.data.DATA
  715. })
  716. }
  717. })
  718. }
  719. // 重置咨询title-tab
  720. this.setData({
  721. naItemTab: 1
  722. })
  723. },
  724. initNadt() {
  725. this.setData({
  726. isNaLoading: true
  727. })
  728. send(1, 5, "20430").then(res => {
  729. if (res.result) {
  730. this.setData({
  731. isNaLoading: false
  732. })
  733. if (res.data.DATA.length < 1) {
  734. this.setData({
  735. isNaEmpty: true
  736. })
  737. } else {
  738. this.setData({
  739. isNaEmpty: false
  740. })
  741. }
  742. this.setData({
  743. naContentList: res.data.DATA
  744. })
  745. } else {
  746. this.setData({
  747. isNaLoading: false,
  748. isNaEmpty: true
  749. })
  750. }
  751. })
  752. },
  753. // 南岸咨询子集菜单点击
  754. clickNaTilteTab: function (e) {
  755. this.setData({
  756. naItem: e.currentTarget.dataset.item,
  757. naContentList: []
  758. })
  759. if (e.currentTarget.dataset.item == 1) {
  760. // wx.showToast({title: '加载中',icon: 'loading',duration: 1000})
  761. this.setData({
  762. isNaLoading: true
  763. })
  764. wx.request({
  765. url: 'https://www.cq.gov.cn/ywdt/jrzq/index.json?cqjrcq=cqjrcq&_=1669609973472',
  766. success: res => {
  767. if (res.statusCode == 200) {
  768. var s = res.data
  769. s = s.substring(7, s.length - 1)
  770. s = JSON.parse(s)
  771. var d = [];
  772. var size = s.datas.length <= 5 ? s.datas.length : 5
  773. if (size < 1) {
  774. this.setData({
  775. isNaEmpty: true
  776. })
  777. } else {
  778. this.setData({
  779. isNaEmpty: false
  780. })
  781. }
  782. for (let i = 0; i < size; i++) {
  783. d.push({
  784. "DOCTITLE": s.datas[i].title,
  785. "url": s.datas[i].url
  786. })
  787. }
  788. // wx.showToast({title: '加载完成',icon: 'success',duration: 500})
  789. this.setData({
  790. isNaLoading: false
  791. })
  792. this.setData({
  793. naContentList: d
  794. })
  795. } else {
  796. this.setData({
  797. isNaLoading: false,
  798. isNaEmpty: true
  799. })
  800. }
  801. }
  802. })
  803. }
  804. if (e.currentTarget.dataset.item == 2) {
  805. // wx.showToast({title: '加载中',icon: 'loading',duration: 1000})
  806. this.setData({
  807. isNaLoading: true
  808. })
  809. wx.request({
  810. url: 'https://www.gov.cn/pushinfo/v150203/pushinfo.jsonp?pushInfoJsonpCallBack=pushInfoJsonpCallBack&_=1669609973471',
  811. success: res => {
  812. console.log(res);
  813. if (res.statusCode == 200) {
  814. var s = res.data
  815. s = s.substring(22, s.length - 1)
  816. s = JSON.parse(s)
  817. console.log(s);
  818. var d = [];
  819. var size = s.length <= 5 ? s.length : 5
  820. if (size < 1) {
  821. this.setData({
  822. isNaEmpty: true
  823. })
  824. } else {
  825. this.setData({
  826. isNaEmpty: false
  827. })
  828. }
  829. for (let i = 0; i < size; i++) {
  830. d.push({
  831. "DOCTITLE": s[i].description,
  832. "url": s[i].link
  833. })
  834. }
  835. this.setData({
  836. isNaLoading: false
  837. })
  838. // wx.showToast({title: '加载完成',icon: 'success',duration: 500})
  839. this.setData({
  840. naContentList: d
  841. })
  842. } else {
  843. this.setData({
  844. isNaLoading: false,
  845. isNaEmpty: true
  846. })
  847. }
  848. }
  849. })
  850. }
  851. if (e.currentTarget.dataset.item == 0) {
  852. let column = ["20430", "59482", "59481"]
  853. // wx.showToast({title: '加载中',icon: 'loading',duration: 1000})
  854. this.setData({
  855. isNaLoading: true
  856. })
  857. send(1, 5, column[e.currentTarget.dataset.item]).then(res => {
  858. if (res.result) {
  859. // wx.showToast({title: '加载完成',icon: 'success',duration: 500})
  860. this.setData({
  861. isNaLoading: false
  862. })
  863. if (res.data.DATA.length < 1) {
  864. this.setData({
  865. isNaEmpty: true
  866. })
  867. } else {
  868. this.setData({
  869. isNaEmpty: false
  870. })
  871. }
  872. this.setData({
  873. naContentList: res.data.DATA
  874. })
  875. } else {
  876. this.setData({
  877. isNaLoading: false,
  878. isNaEmpty: true
  879. })
  880. }
  881. })
  882. }
  883. },
  884. // 南岸咨询内容点击
  885. clickNaContent: function (e) {
  886. let item = e.currentTarget.dataset.item
  887. switch (this.data.naTab) {
  888. case 0:
  889. wx.navigateTo({
  890. url: '/pages/articlDetail/articlDetail?CHNLID=' + item.CHNLID + '&DOCID=' + item.DOCID,
  891. })
  892. break
  893. case 1:
  894. case 2:
  895. wx.navigateTo({
  896. url: '/pages/web/web?url=' + item.url,
  897. })
  898. break
  899. }
  900. },
  901. // 南岸咨询更多
  902. naMore: function (e) {
  903. let title = '';
  904. switch (this.data.naTab) {
  905. case 0:
  906. title = '南岸动态'
  907. wx.navigateTo({
  908. url: '/pages/aticleList/aticleList?title=' + title + '&id=1',
  909. })
  910. break
  911. case 1:
  912. title = '今日重庆'
  913. wx.navigateTo({
  914. url: '/pages/aticleList/aticleList?title=' + title + '&id=2',
  915. })
  916. break
  917. case 2:
  918. title = '国务院信息'
  919. wx.navigateTo({
  920. url: '/pages/aticleList/aticleList?title=' + title + '&id=3',
  921. })
  922. break
  923. }
  924. },
  925. // 政民互动
  926. communicateChangeItem: function (e) {
  927. this.setData({
  928. communicateItem: e.currentTarget.dataset.item
  929. })
  930. },
  931. communicateChangeTab: function (e) {
  932. this.setData({
  933. communicateTab: e.detail.current
  934. })
  935. if (this.data.communicateTab == 1) {
  936. this.getInvestigation(false)
  937. }
  938. },
  939. // 意见征集接口
  940. yjzjData() {
  941. yjzjList().then(res => {
  942. var list = []
  943. if (res.statusCode == 200 && res.datas.pageInfo.totalResults > 0) {
  944. list = res.datas.data
  945. for (var i = 0; i < list.length; i++) {
  946. list[i].beginTime = this.formatDateNumber(new Date(list[i].beginTime * 1))
  947. list[i].endTime = this.formatDateNumber(new Date(list[i].endTime * 1))
  948. }
  949. this.setData({
  950. 'yjzjDataList': list
  951. })
  952. }
  953. })
  954. },
  955. // 获取在线调查列表
  956. getInvestigation(flag) {
  957. this.setData({
  958. isOnlineLoading: true
  959. })
  960. var data = []
  961. wx.request({
  962. url: `https://www.cqna.gov.cn/IGI/open/survey/list?siteId=254&pageIndex=${this.data.investigatePage}&pageSize=10&orderBy=startTime_desc`,
  963. method: 'GET',
  964. success: res => {
  965. data = res.data.datas.data
  966. if (data && data.length > 0) {
  967. for (var i = 0; i < data.length; i++) {
  968. data[i].startTime = this.formatDateNumber(new Date(data[i].startTime * 1))
  969. data[i].endTime = this.formatDateNumber(new Date(data[i].endTime * 1))
  970. }
  971. data = this.data.investigateList.concat(data)
  972. this.setData({
  973. 'isOnlineLoading': false,
  974. 'investigateList': data,
  975. 'investigatePage': this.data.investigatePage + 1
  976. })
  977. } else {
  978. this.setData({
  979. 'isOnlineLoading': false
  980. })
  981. // 下拉刷新会提示加载完成
  982. if (flag) {
  983. this.setData({
  984. 'isOnlineFinish': true
  985. })
  986. setTimeout(() => {
  987. this.setData({
  988. isOnlineFinish: false
  989. })
  990. }, 600)
  991. }
  992. }
  993. },
  994. fail: res => {
  995. this.setData({
  996. 'isOnlineLoading': false
  997. })
  998. }
  999. })
  1000. },
  1001. // 在线调查触底
  1002. investigationScrollBottom(e) {
  1003. this.getInvestigation(true)
  1004. },
  1005. goToInvestigationDetail(e) {
  1006. const id = e.target.dataset.id
  1007. const siteId = e.target.dataset.siteid
  1008. wx.navigateTo({
  1009. url: '/pages/web/web?wxUrl=' + encodeURIComponent(`https://www.cqna.gov.cn/personalCenter/answerSheet/answerSheet.html?siteId=${siteId}&metadataId=${id}`),
  1010. })
  1011. },
  1012. goYjzjDetail(e) {
  1013. const html = e.currentTarget.dataset.item
  1014. const title = e.currentTarget.dataset.theme
  1015. wx.navigateTo({
  1016. url: `/pages/yjzjDetail/yjzjDetail?html=${encodeURIComponent(html)}&title=${title}`
  1017. })
  1018. },
  1019. // 日期格式化
  1020. formatDateNumber: function (date) {
  1021. let myYear = date.getFullYear();
  1022. let myMonth = date.getMonth() + 1;
  1023. let myWeekDay = date.getDate();
  1024. return myYear + "-" + myMonth + "-" + myWeekDay
  1025. },
  1026. toList: function () {
  1027. wx.navigateTo({
  1028. url: '/pages/programList/programList',
  1029. })
  1030. },
  1031. toLeaveMessage: function () {
  1032. wx.navigateTo({
  1033. url: '/pages/leaveMessage/leaveMessage',
  1034. })
  1035. },
  1036. // 媒体矩阵
  1037. swichNav: function (e) {
  1038. var that = this;
  1039. if (this.data.mediaCurrentTab === e.target.dataset.current) {
  1040. return false;
  1041. } else {
  1042. that.setData({
  1043. mediaCurrentTab: e.target.dataset.current,
  1044. navScrollLeft: e.target.dataset.current >= 2 ? ((e.target.dataset.current - 1) * 215) : 0
  1045. })
  1046. }
  1047. },
  1048. SPTJImgError(e) {
  1049. let temp = this.data.videoInfo;
  1050. temp[e.currentTarget.dataset.index].images = null;
  1051. this.setData({
  1052. videoInfo: temp
  1053. })
  1054. },
  1055. // 获取视频推荐数据
  1056. getVideoRecommend() {
  1057. this.setData({
  1058. isVideoLoading: true
  1059. })
  1060. getNanVideo().then(res => {
  1061. this.setData({
  1062. isVideoLoading: false
  1063. })
  1064. if (res.data.length <= 0) {
  1065. this.setData({
  1066. isVideoEmpty: true
  1067. })
  1068. } else {
  1069. this.setData({
  1070. isVideoEmpty: false,
  1071. videoInfo: res.data
  1072. })
  1073. }
  1074. })
  1075. },
  1076. gotoVideoDetail(e) {
  1077. wx.navigateTo({
  1078. url: '/pages/web/web?wxUrl=' + encodeURIComponent(e.currentTarget.dataset.url)
  1079. })
  1080. },
  1081. // 获取媒体矩阵南岸发布数据
  1082. getMediaReleaseList() {
  1083. let date = new Date();
  1084. let year = date.getFullYear()
  1085. let month = date.getMonth() + 1
  1086. let day = date.getDate()
  1087. let time = year + "-" + month + "-" + day;
  1088. this.setData({
  1089. isNafaLoading: true
  1090. })
  1091. wx.request({
  1092. url: 'https://www.cqna.gov.cn/data/article/getNAFBArticleByDate?date=' + time,
  1093. method: 'GET',
  1094. success: res => {
  1095. this.setData({
  1096. isNafaLoading: false,
  1097. mediaReleaseList: res.data.data
  1098. })
  1099. },
  1100. fail: res => {
  1101. this.setData({
  1102. isNafaLoading: false
  1103. })
  1104. }
  1105. })
  1106. },
  1107. gotoReleaseDetail(e) {
  1108. wx.navigateTo({
  1109. url: '/pages/web/web?wxUrl=' + encodeURIComponent(e.currentTarget.dataset.url),
  1110. })
  1111. },
  1112. // 获取媒体矩阵今日头条数据
  1113. getMediaHeadlineList() {
  1114. wx.request({
  1115. url: 'https://www.cqna.gov.cn/data/article/getAllOfficialAccount?official=重庆市南岸区人民政府',
  1116. method: 'GET',
  1117. success: res => {
  1118. this.setData({
  1119. mediaHeadlineList: res.data.data.jrtt
  1120. })
  1121. }
  1122. })
  1123. },
  1124. gotoHeadlineDetail(e) {
  1125. wx.navigateTo({
  1126. url: '/pages/web/web?wxUrl=' + encodeURIComponent(e.currentTarget.dataset.url),
  1127. })
  1128. },
  1129. mediaBindChange: function (e) {
  1130. var that = this;
  1131. that.setData({
  1132. mediaCurrentTab: e.detail.current,
  1133. navScrollLeft: e.detail.current >= 2 ? ((e.detail.current - 1) * 215) : 0
  1134. });
  1135. },
  1136. getUserProfile() {
  1137. wx.setStorageSync('nickname', "");
  1138. wx.setStorageSync('avatarUrl', "");
  1139. wx.getUserProfile({
  1140. desc: '获取用户信息',
  1141. success: (res) => {
  1142. wx.setStorageSync('nickname', res.userInfo.nickName);
  1143. wx.setStorageSync('avatarUrl', res.userInfo.avatarUrl);
  1144. wx.login({
  1145. success(res) {
  1146. if (res.code) {
  1147. //发起网络请求
  1148. data = {
  1149. code: res.code
  1150. }
  1151. login(data).then(res => {
  1152. console.log(res)
  1153. cacheSet('token', res.data.token, 3600 * 24)
  1154. // wx.setStorageSync("token", res.data.data)
  1155. })
  1156. } else {
  1157. console.log('登录失败!' + res.errMsg)
  1158. }
  1159. }
  1160. })
  1161. },
  1162. fail(res) {
  1163. console.log("获取用户信息失败", res)
  1164. }
  1165. })
  1166. },
  1167. //印象南岸进入
  1168. toYxna() {
  1169. wx.navigateTo({
  1170. url: "/pagesPublic/pages/yxnaJfq/yxnaJfq",
  1171. })
  1172. },
  1173. toJfq: function () {
  1174. wx.navigateTo({
  1175. url: '/pagesPublic/pages/yxnaJfq/yxnaJfq',
  1176. })
  1177. },
  1178. toJfh: function () {
  1179. wx.navigateTo({
  1180. url: '/pagesPublic/pages/yxnaJfh/yxnaJfh',
  1181. })
  1182. },
  1183. toXsj: function () {
  1184. wx.navigateTo({
  1185. url: '/pagesPublic/pages/yxna/yxna',
  1186. })
  1187. },
  1188. toQxn: function () {
  1189. wx.navigateTo({
  1190. url: '/pagesPublic/pages/yxnaQxn/yxnaQxn',
  1191. })
  1192. },
  1193. gotoSjzx() {
  1194. wx.navigateTo({
  1195. url: '/pages/dataCenter/dataCenter',
  1196. })
  1197. },
  1198. gotoZWTJ() {
  1199. wx.navigateTo({
  1200. url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
  1201. })
  1202. },
  1203. gotoNewsPaper() {
  1204. wx.navigateTo({
  1205. url: '/pages/newsPaper/newsPaper',
  1206. })
  1207. },
  1208. gotoZlwd() {
  1209. wx.navigateTo({
  1210. url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/ghwd/znwd/mobile/index.html",
  1211. })
  1212. },
  1213. gotoDTSS(e) {
  1214. const search = e.currentTarget.dataset.item
  1215. if (search && search != '') {
  1216. wx.navigateTo({
  1217. url: '/pages/map/map?se='+ search,
  1218. })
  1219. } else {
  1220. wx.navigateTo({
  1221. url: '/pages/map/map',
  1222. })
  1223. }
  1224. },
  1225. gotoMTJZ() {
  1226. wx.navigateTo({
  1227. url: '/pages/web/web?url=' + "https://data.cqna.gov.cn/newMedia/officialAccounts.html",
  1228. })
  1229. },
  1230. gotoSPTJ() {
  1231. wx.navigateTo({
  1232. url: '/pages/videoRecommend/videoRecommend',
  1233. })
  1234. },
  1235. gotoNAB() {
  1236. // wx.navigateTo({
  1237. // url: '/pages/phoneNewsPaper/phoneNewsPaper',
  1238. // })
  1239. wx.navigateTo({
  1240. url: '/pages/web/web?url=' + "http://www.cqna.com.cn/na_Class/node_24150.html",
  1241. })
  1242. },
  1243. showLogoDialog(e) {
  1244. this.setData({
  1245. ewmName: e.target.dataset.name,
  1246. ewmUrl: e.target.dataset.ewm
  1247. })
  1248. wx.navigateTo({
  1249. url: '/pages/web/web?url=https://www.cqna.gov.cn/data/newMedia/officialAccounts.html',
  1250. })
  1251. },
  1252. closeDialog() {
  1253. this.setData({
  1254. ewmShowDialog: false
  1255. })
  1256. },
  1257. toZMHD() {
  1258. wx.navigateTo({
  1259. url: '/pages/zmhd/zmhd',
  1260. })
  1261. },
  1262. callTheHotline() {
  1263. wx.makePhoneCall({
  1264. phoneNumber: '12345',
  1265. })
  1266. },
  1267. gotoZxft() {
  1268. wx.navigateTo({
  1269. url: '/pages/zxft/fileList',
  1270. })
  1271. },
  1272. gototsjy() {
  1273. wx.navigateTo({
  1274. url: '/pages/blankpage/blankpage?name=投诉建议',
  1275. })
  1276. },
  1277. // 点击百姓聚焦item
  1278. clickFocus(e) {
  1279. var id = e.currentTarget.dataset.id
  1280. switch(id) {
  1281. case 1: {
  1282. wx.makePhoneCall({
  1283. phoneNumber: "12345",
  1284. success: function () {
  1285. },
  1286. fail: function () {
  1287. }
  1288. })
  1289. };break;
  1290. case 2: {
  1291. wx.navigateToMiniProgram({
  1292. appId: 'wxfc86707bae655315',
  1293. success(res) {
  1294. // 打开成功
  1295. }
  1296. })
  1297. };break;
  1298. case 3: {
  1299. wx.navigateTo({
  1300. url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/zjna/gyw/#tryb",
  1301. })
  1302. };break;
  1303. case 4: {
  1304. wx.navigateTo({
  1305. url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/zjna/nbl/#yhnb",
  1306. })
  1307. };break;
  1308. case 5: {
  1309. wx.navigateTo({
  1310. url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/zjna/ns/hlns/nsjd/202209/t20220921_11130108.html",
  1311. })
  1312. };break;
  1313. case 6: {
  1314. this.toYxna()
  1315. };break;
  1316. }
  1317. },
  1318. /**
  1319. * 用户点击右上角分享
  1320. */
  1321. onShareAppMessage() {
  1322. return {
  1323. title: '首页'
  1324. }
  1325. }
  1326. })