index.js 30 KB

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