index.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. // index.js
  2. import {
  3. login
  4. } from "../api/user-api";
  5. import {
  6. imgUrl,
  7. request
  8. } from "../api/request"
  9. import * as echarts from '../../ec-canvas/echarts';
  10. // 获取应用实例
  11. const app = getApp()
  12. Page({
  13. data: {
  14. imgUrl: imgUrl,
  15. // 屏幕高度
  16. navHeight: '',
  17. searchInput: '',
  18. // 南岸咨询
  19. naTab: 0,
  20. naItem: '',
  21. // 政民tab
  22. communicateTab: 0,
  23. // 政民item
  24. communicateItem: 0,
  25. // 服务列表
  26. serviceItems1: [{
  27. img: imgUrl + 'service-1.png',
  28. name: '生活缴费'
  29. },
  30. {
  31. img: imgUrl + 'service-2.png',
  32. name: '社保服务'
  33. },
  34. {
  35. img: imgUrl + 'service-3.png',
  36. name: '公积金'
  37. },
  38. {
  39. img: imgUrl + 'service-4.png',
  40. name: '电子证照'
  41. },
  42. {
  43. img: imgUrl + 'service-5.png',
  44. name: '民政低保'
  45. }
  46. ],
  47. serviceItems2: [{
  48. img: imgUrl + 'service-6.png',
  49. name: '税务服务'
  50. },
  51. {
  52. img: imgUrl + 'service-7.png',
  53. name: '交通出行'
  54. },
  55. {
  56. img: imgUrl + 'service-8.png',
  57. name: '核酸采样点'
  58. },
  59. {
  60. img: imgUrl + 'service-9.png',
  61. name: '住房置业'
  62. },
  63. {
  64. img: imgUrl + 'service-10.png',
  65. name: '更多功能'
  66. }
  67. ],
  68. // 百姓聚焦
  69. peopleService: [{
  70. top: true,
  71. name: '12345热线'
  72. },
  73. {
  74. top: false,
  75. name: '个人社保查询'
  76. },
  77. {
  78. top: false,
  79. name: '南岸文旅消费劵'
  80. },
  81. {
  82. top: false,
  83. name: '长喜汇弹子石老街'
  84. },
  85. {
  86. top: false,
  87. name: '南山一棵松'
  88. },
  89. {
  90. top: false,
  91. name: '一次性创业补助'
  92. }
  93. ],
  94. // 南岸咨询二级title
  95. naItemTabList: [{
  96. id: 1,
  97. name: '政策.咨询'
  98. },
  99. {
  100. id: 2,
  101. name: '党建.服务'
  102. },
  103. {
  104. id: 3,
  105. name: '抗疫.复工'
  106. },
  107. {
  108. id: 4,
  109. name: '功能.服务'
  110. }
  111. ],
  112. // 南岸咨询内容
  113. naContentList: [{
  114. id: 1,
  115. name: '洪斌在全区疫情防控工作会议上强调,坚持不松懈的精神,努力工作,开展创先争优活动,激励人民发扬美好传统美德!'
  116. },
  117. {
  118. id: 2,
  119. name: '​坚持不松劲渝事好商量'
  120. },
  121. {
  122. id: 3,
  123. name: '南岸实践工作全面启动'
  124. },
  125. {
  126. id: 4,
  127. name: '首条直达南滨路人防隧道开建'
  128. },
  129. {
  130. id: 5,
  131. name: '全市首个!南岸区便民数字地图上线啦~'
  132. }
  133. ],
  134. // 本年办件数
  135. officeNumber: [],
  136. // 评价总量
  137. evalutionNum: 0,
  138. // 满意度
  139. evalutionRate: '',
  140. // 图表
  141. streetlinechartec: {
  142. lazyLoad: true,
  143. },
  144. // 图表图片
  145. canvasImg: '',
  146. videoInfo: [{
  147. url: 'video1.png',
  148. title: '南岸百企风采'
  149. }, {
  150. url: 'video2.png',
  151. title: '“不夜南滨”集乐无'
  152. }, {
  153. url: 'video3.png',
  154. title: '2022爱尚重庆'
  155. },
  156. {
  157. url: 'video1.png',
  158. title: '南岸百企风采'
  159. }
  160. ],
  161. // 政民list
  162. communicateData: [{}, {}, {}, {}, {}],
  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. provList: [{
  201. "name": "南岸发布"
  202. },
  203. {
  204. "name": "微信公众号"
  205. },
  206. {
  207. "name": "新浪微博矩阵"
  208. },
  209. {
  210. "name": "今日头条"
  211. },
  212. {
  213. "name": "民政服务"
  214. },
  215. {
  216. "name": "消息服务"
  217. },
  218. {
  219. "name": "今日说法"
  220. },
  221. {
  222. "name": "新媒体"
  223. },
  224. ],
  225. // 媒体矩阵内容选项
  226. mediaSelectList: [{
  227. id: '1',
  228. name: "重庆市南岸区人民政府",
  229. img: imgUrl + 'index-media-icon1.png'
  230. },
  231. {
  232. id: '2',
  233. name: "南岸文旅",
  234. img: imgUrl + 'index-media-icon2.png'
  235. },
  236. {
  237. id: '3',
  238. name: "南岸发布",
  239. img: imgUrl + 'index-media-icon3.png'
  240. },
  241. {
  242. id: '4',
  243. name: "南岸国资",
  244. img: imgUrl + 'index-media-icon4.png'
  245. },
  246. {
  247. id: '5',
  248. name: "重庆南岸消防",
  249. img: imgUrl + 'index-media-icon5.png'
  250. },
  251. {
  252. id: '6',
  253. name: "南岸生态环境",
  254. img: imgUrl + 'index-media-icon6.png'
  255. },
  256. {
  257. id: '7',
  258. name: "南岸健康卫士",
  259. img: imgUrl + 'index-media-icon7.png'
  260. },
  261. {
  262. id: '8',
  263. name: "南岸公安",
  264. img: imgUrl + 'index-media-icon8.png'
  265. },
  266. {
  267. id: '9',
  268. name: "遇见南坪",
  269. img: imgUrl + 'index-media-icon9.png'
  270. },
  271. {
  272. id: '10',
  273. name: "书香南岸",
  274. img: imgUrl + 'index-media-icon10.png'
  275. },
  276. {
  277. id: '11',
  278. name: "南岸卫生健康监督",
  279. img: imgUrl + 'index-media-icon11.png'
  280. },
  281. {
  282. id: '12',
  283. name: "南岸司法",
  284. img: imgUrl + 'index-media-icon12.png'
  285. },
  286. {
  287. id: '13',
  288. name: "广阳岛绿色发展公司",
  289. img: imgUrl + 'index-media-icon13.png'
  290. },
  291. {
  292. id: '14',
  293. name: "南岸人力社保",
  294. img: imgUrl + 'index-media-icon14.png'
  295. },
  296. {
  297. id: '15',
  298. name: "广阳湾智创生态城",
  299. img: imgUrl + 'index-media-icon15.png'
  300. },
  301. {
  302. id: '16',
  303. name: "南岸智慧城管",
  304. img: imgUrl + 'index-media-icon16.png'
  305. }
  306. ]
  307. },
  308. onReady() {},
  309. onShow() {
  310. if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  311. this.getTabBar().setData({
  312. selected: 0
  313. })
  314. }
  315. this.setData({
  316. naItem: 0
  317. }),
  318. this.setData({
  319. naItemTab: 1
  320. })
  321. },
  322. toDataCenter() {
  323. wx.navigateTo({
  324. url: '/pages/dataCenter/dataCenter',
  325. })
  326. },
  327. onHide() {
  328. if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  329. this.getTabBar().setData({
  330. selected: -1
  331. })
  332. }
  333. },
  334. onLoad() {
  335. // 加载字体
  336. wx.loadFontFace({
  337. family: 'DOUYU',
  338. source: 'url("https://hui.yrslm.com:8089/douyu.ttf")',
  339. success: function (e) {
  340. console.log(e, '动态加载字体成功')
  341. },
  342. fail: function (e) {
  343. console.log(e, '动态加载字体失败')
  344. },
  345. })
  346. // 获取好差评图表
  347. this.barComponent3 = this.selectComponent('#streetlinechart3');
  348. this.init_bar3();
  349. // 获取本年办件数
  350. this.getOfficeNumberByAreaInfo();
  351. this.setData({
  352. navHeight: app.globalData.navHeight + app.globalData.menuHeight / 2
  353. })
  354. // wx.login({
  355. // success(res) {
  356. // if (res.code) {
  357. // //发起网络请求
  358. // login(res.code).then(res => {
  359. // console.log(res)
  360. // wx.setStorageSync("token", res.data.data)
  361. // })
  362. // } else {
  363. // console.log('登录失败!' + res.errMsg)
  364. // }
  365. // }
  366. // })
  367. },
  368. // canvas转图片
  369. canvasToTempImage() {
  370. wx.canvasToTempFilePath({
  371. canvas: this.barComponent3.canvasNode,
  372. success: (res) => {
  373. this.setData({
  374. canvasImg: res.tempFilePath
  375. });
  376. }
  377. }, this);
  378. },
  379. // 加载评价图表
  380. init_bar3() {
  381. let that = this;
  382. this.barComponent3.init((canvas, width, height, dpr) => {
  383. // 初始化图表
  384. const barChart = echarts.init(canvas, null, {
  385. width: width,
  386. height: height,
  387. devicePixelRatio: dpr
  388. });
  389. barChart.setOption(this.getScaOption2());
  390. request({
  391. url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1',
  392. method: 'GET'
  393. }).then(res => {
  394. if (res.result === 'ok') {
  395. let temp = [];
  396. temp.push(res.data.veryDissatisfied);
  397. temp.push(res.data.notSatisfied);
  398. temp.push(res.data.basicSatisfied);
  399. temp.push(res.data.satisfied);
  400. temp.push(res.data.great);
  401. this.setData({
  402. evalutionNum: res.data.goodOrBad,
  403. evalutionRate: Math.round(res.data.good / res.data.goodOrBad * 100)
  404. })
  405. barChart.setOption({
  406. series: [{
  407. data: temp
  408. }]
  409. })
  410. }
  411. })
  412. barChart.on("finished", function () {
  413. that.canvasToTempImage();
  414. });
  415. // 注意这里一定要返回 chart 实例,否则会影响事件处理等
  416. return barChart;
  417. });
  418. },
  419. getScaOption2() {
  420. //请求数据
  421. let xAxis = {
  422. type: 'value',
  423. interval: 500000
  424. },
  425. yAxis = {
  426. type: 'category',
  427. data: [
  428. '非常不满意', '不满意', '基本满意', '满意', '非常满意'
  429. ]
  430. },
  431. grid = {
  432. left: '20%',
  433. top: '10%',
  434. bottom: '10%',
  435. right: '20%'
  436. },
  437. series = [{
  438. data: [],
  439. type: 'bar',
  440. barWidth: 14,
  441. itemStyle: {
  442. color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
  443. offset: 0,
  444. color: '#3977E6'
  445. },
  446. {
  447. offset: 1,
  448. color: '#37BBF8'
  449. }
  450. ]),
  451. // emphasis: {
  452. // barBorderRadius: 7
  453. // },
  454. // normal: {
  455. // barBorderRadius: 7
  456. // }
  457. },
  458. label: {
  459. show: true,
  460. position: 'right',
  461. valueAnimation: true
  462. }
  463. }]
  464. return {
  465. backgroundColor: '#FFFFFF',
  466. xAxis: xAxis,
  467. yAxis: yAxis,
  468. grid: grid,
  469. series: series,
  470. animationDelay: function (idx) {
  471. return idx * 50;
  472. },
  473. animationEasing: 'elasticOut'
  474. };
  475. },
  476. // 获取本年办件数
  477. getOfficeNumberByAreaInfo() {
  478. request({
  479. url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3',
  480. method: 'GET'
  481. }).then(res => {
  482. let temp = [];
  483. temp.push(res.data.acceptNumber);
  484. temp.push(res.data.serialNumber);
  485. temp.push(res.data.applicationNumberNetwork);
  486. this.setData({
  487. officeNumber: temp
  488. })
  489. })
  490. },
  491. // 搜索框
  492. bindKeyInput: function (e) {
  493. this.setData({
  494. searchInput: e.detail.value
  495. })
  496. },
  497. // 南岸咨询tab
  498. naChangeItem: function (e) {
  499. this.setData({
  500. naItem: e.currentTarget.dataset.item
  501. })
  502. if (this.data.naItem == 0) {
  503. this.setData({
  504. naItemTabList: [{
  505. id: 1,
  506. name: '政策.咨询'
  507. },
  508. {
  509. id: 2,
  510. name: '党建.服务'
  511. },
  512. {
  513. id: 3,
  514. name: '抗疫.复工'
  515. },
  516. {
  517. id: 4,
  518. name: '功能.服务'
  519. }
  520. ]
  521. })
  522. } else {
  523. this.setData({
  524. naItemTabList: [{
  525. id: 1,
  526. name: '天气.咨询'
  527. },
  528. {
  529. id: 2,
  530. name: '外出.服务'
  531. },
  532. {
  533. id: 3,
  534. name: '打工.复工'
  535. },
  536. {
  537. id: 4,
  538. name: '娱乐.服务'
  539. }
  540. ]
  541. })
  542. }
  543. },
  544. naChangeTab: function (e) {
  545. this.setData({
  546. naTab: e.detail.current
  547. })
  548. if (this.data.naTab == 0) {
  549. this.setData({
  550. naItemTabList: [{
  551. id: 1,
  552. name: '政策.咨询'
  553. },
  554. {
  555. id: 2,
  556. name: '党建.服务'
  557. },
  558. {
  559. id: 3,
  560. name: '抗疫.复工'
  561. },
  562. {
  563. id: 4,
  564. name: '功能.服务'
  565. }
  566. ]
  567. })
  568. } else {
  569. this.setData({
  570. naItemTabList: [{
  571. id: 1,
  572. name: '天气.咨询'
  573. },
  574. {
  575. id: 2,
  576. name: '外出.服务'
  577. },
  578. {
  579. id: 3,
  580. name: '打工.复工'
  581. },
  582. {
  583. id: 4,
  584. name: '娱乐.服务'
  585. }
  586. ]
  587. })
  588. }
  589. // 重置咨询title-tab
  590. this.setData({
  591. naItemTab: 1
  592. })
  593. },
  594. // 南岸咨询子集菜单点击
  595. clickNaTilteTab: function (e) {
  596. this.setData({
  597. naItemTab: e.currentTarget.dataset.item.id
  598. })
  599. const ran = Math.random() * 100 + 41
  600. this.setData({
  601. naContentList: [{
  602. id: 1,
  603. name: `${ran}2洪斌在全区疫情防控工作会议上强调,坚持不松懈的精神,努力工作,开展创先争优活动,激励人民发扬美好传统美德!`
  604. },
  605. {
  606. id: 2,
  607. name: `​${ran}坚持不松劲渝事好商量`
  608. },
  609. {
  610. id: 3,
  611. name: '2南岸实践工作全面启动'
  612. },
  613. {
  614. id: 4,
  615. name: '2首条直达南滨路人防隧道开建'
  616. },
  617. {
  618. id: 5,
  619. name: '2全市首个!南岸区便民数字地图上线啦~'
  620. }
  621. ]
  622. })
  623. },
  624. // 南岸咨询内容点击
  625. clickNaContent: function (e) {
  626. console.log(e)
  627. },
  628. // 南岸咨询更多
  629. naMore: function (e) {
  630. wx.navigateTo({
  631. url: '/pages/aticleList/aticleList',
  632. })
  633. },
  634. // 政民互动
  635. communicateChangeItem: function (e) {
  636. this.setData({
  637. communicateItem: e.currentTarget.dataset.item
  638. })
  639. },
  640. communicateChangeTab: function (e) {
  641. this.setData({
  642. communicateTab: e.detail.current
  643. })
  644. },
  645. toList: function () {
  646. wx.navigateTo({
  647. url: '/pages/programList/programList',
  648. })
  649. },
  650. toLeaveMessage: function () {
  651. wx.navigateTo({
  652. url: '/pages/leaveMessage/leaveMessage',
  653. })
  654. },
  655. // 媒体矩阵
  656. swichNav: function (e) {
  657. var that = this;
  658. if (this.data.mediaCurrentTab === e.target.dataset.current) {
  659. return false;
  660. } else {
  661. that.setData({
  662. mediaCurrentTab: e.target.dataset.current,
  663. navScrollLeft: e.target.dataset.current >= 2 ? ((e.target.dataset.current - 1) * 215) : 0
  664. })
  665. }
  666. },
  667. mediaBindChange: function (e) {
  668. var that = this;
  669. that.setData({
  670. mediaCurrentTab: e.detail.current,
  671. navScrollLeft: e.detail.current >= 2 ? ((e.detail.current - 1) * 215) : 0
  672. });
  673. },
  674. getUserProfile() {
  675. wx.setStorageSync('nickname', "");
  676. wx.setStorageSync('avatarUrl', "");
  677. wx.getUserProfile({
  678. desc: '获取用户信息',
  679. success: (res) => {
  680. wx.setStorageSync('nickname', res.userInfo.nickName);
  681. wx.setStorageSync('avatarUrl', res.userInfo.avatarUrl);
  682. wx.login({
  683. success(res) {
  684. if (res.code) {
  685. //发起网络请求
  686. data = {
  687. code: res.code
  688. }
  689. login(data).then(res => {
  690. console.log(res)
  691. wx.setStorageSync("token", res.data.data)
  692. })
  693. } else {
  694. console.log('登录失败!' + res.errMsg)
  695. }
  696. }
  697. })
  698. },
  699. fail(res) {
  700. console.log("获取用户信息失败", res)
  701. }
  702. })
  703. },
  704. //印象南岸进入
  705. toYxna() {
  706. wx.navigateTo({
  707. url: "/pages/yxnaJfq/yxnaJfq",
  708. })
  709. },
  710. toJfq: function () {
  711. wx.navigateTo({
  712. url: '/pages/yxnaJfq/yxnaJfq',
  713. })
  714. },
  715. toJfh: function () {
  716. wx.navigateTo({
  717. url: '/pages/yxnaJfh/yxnaJfh',
  718. })
  719. },
  720. toXsj: function () {
  721. wx.navigateTo({
  722. url: '/pages/yxna/yxna',
  723. })
  724. },
  725. toQxn: function () {
  726. wx.navigateTo({
  727. url: '/pages/yxnaQxn/yxnaQxn',
  728. })
  729. },
  730. gotoSjzx() {
  731. wx.navigateTo({
  732. url: '/pages/dataCenter/dataCenter',
  733. })
  734. },
  735. gotoZWTJ() {
  736. wx.navigateTo({
  737. url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
  738. })
  739. },
  740. gotoNewsPaper(){
  741. wx.navigateTo({
  742. url: '/pages/newsPaper/newsPaper',
  743. })
  744. },
  745. gotoZlwd(){
  746. wx.navigateTo({
  747. url: '/pages/web/web?url='+"https://www.cqna.gov.cn/ghwd/znwd/mobile/index.html",
  748. })
  749. }
  750. })