123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904 |
- // index.js
- import {
- login
- } from "../api/user-api";
- import {
- imgUrl,
- request
- } from "../api/request"
- import {
- yjzjList
- } from "../api/index-api"
- import * as echarts from '../../ec-canvas/echarts';
- // 获取应用实例
- const app = getApp()
- Page({
- data: {
- imgUrl: imgUrl,
- // 屏幕高度
- navHeight: '',
- searchInput: '',
- // 南岸咨询
- naTab: 0,
- naItem: '',
- // 政民tab
- communicateTab: 0,
- // 政民item
- communicateItem: 0,
- // 服务列表
- serviceItems1: [{
- img: imgUrl + 'service-1.png',
- name: '生活缴费'
- },
- {
- img: imgUrl + 'service-2.png',
- name: '社保服务'
- },
- {
- img: imgUrl + 'service-3.png',
- name: '公积金'
- },
- {
- img: imgUrl + 'service-4.png',
- name: '电子证照'
- },
- {
- img: imgUrl + 'service-5.png',
- name: '民政低保'
- }
- ],
- serviceItems2: [{
- img: imgUrl + 'service-6.png',
- name: '税务服务'
- },
- {
- img: imgUrl + 'service-7.png',
- name: '交通出行'
- },
- {
- img: imgUrl + 'service-8.png',
- name: '核酸采样点'
- },
- {
- img: imgUrl + 'service-9.png',
- name: '住房置业'
- },
- // {
- // img: imgUrl + 'service-10.png',
- // name: '更多功能'
- // }
- ],
- // 百姓聚焦
- peopleService: [{
- top: true,
- name: '12345热线'
- },
- {
- top: false,
- name: '个人社保查询'
- },
- {
- top: false,
- name: '南岸文旅消费劵'
- },
- {
- top: false,
- name: '长喜汇弹子石老街'
- },
- {
- top: false,
- name: '南山一棵松'
- },
- {
- top: false,
- name: '一次性创业补助'
- }
- ],
- // 南岸咨询二级title
- naItemTabList: [{
- id: 1,
- name: '政策.咨询'
- },
- {
- id: 2,
- name: '党建.服务'
- },
- {
- id: 3,
- name: '抗疫.复工'
- },
- {
- id: 4,
- name: '功能.服务'
- }
- ],
- // 南岸咨询内容
- naContentList: [{
- id: 1,
- name: '洪斌在全区疫情防控工作会议上强调,坚持不松懈的精神,努力工作,开展创先争优活动,激励人民发扬美好传统美德!'
- },
- {
- id: 2,
- name: '坚持不松劲渝事好商量'
- },
- {
- id: 3,
- name: '南岸实践工作全面启动'
- },
- {
- id: 4,
- name: '首条直达南滨路人防隧道开建'
- },
- {
- id: 5,
- name: '全市首个!南岸区便民数字地图上线啦~'
- }
- ],
- // 本年办件数
- officeNumber: [],
- // 评价总量
- evalutionNum: 0,
- // 满意度
- evalutionRate: '',
- // 图表
- streetlinechartec: {
- lazyLoad: true,
- },
- // 图表图片
- canvasImg: '',
- videoInfo: [{
- url: 'video1.png',
- title: '南岸百企风采'
- }, {
- url: 'video2.png',
- title: '“不夜南滨”集乐无'
- }, {
- url: 'video3.png',
- title: '2022爱尚重庆'
- },
- {
- url: 'video1.png',
- title: '南岸百企风采'
- }
- ],
- // 意见征集list
- yjzjDataList: [],
- // 地图服务
- mapServiceData: [{
- id: 1,
- name: '政务公开'
- },
- {
- id: 2,
- name: '政务服务'
- },
- {
- id: 3,
- name: '党群服务'
- },
- {
- id: 4,
- name: '核酸检测'
- },
- {
- id: 5,
- name: '教育资源'
- },
- {
- id: 6,
- name: '医疗卫生'
- },
- {
- id: 7,
- name: '户籍管理'
- },
- {
- id: 8,
- name: '交通服务'
- },
- ],
- // 媒体矩阵导航
- mediaCurrentTab: 0,
- // 媒体矩阵导航列表
- provList: [{
- "name": "南岸发布"
- },
- {
- "name": "微信公众号"
- },
- // {
- // "name": "新浪微博矩阵"
- // },
- {
- "name": "今日头条"
- }
- ],
- // 媒体矩阵内容选项
- mediaSelectList: [{
- id: '1',
- name: "重庆市南岸区人民政府",
- img: imgUrl + 'index-media-icon1.png'
- },
- {
- id: '2',
- name: "南岸文旅",
- img: imgUrl + 'index-media-icon2.png'
- },
- {
- id: '3',
- name: "南岸发布",
- img: imgUrl + 'index-media-icon3.png'
- },
- {
- id: '4',
- name: "南岸国资",
- img: imgUrl + 'index-media-icon4.png'
- },
- {
- id: '5',
- name: "重庆南岸消防",
- img: imgUrl + 'index-media-icon5.png'
- },
- {
- id: '6',
- name: "南岸生态环境",
- img: imgUrl + 'index-media-icon6.png'
- },
- {
- id: '7',
- name: "南岸健康卫士",
- img: imgUrl + 'index-media-icon7.png'
- },
- {
- id: '8',
- name: "南岸公安",
- img: imgUrl + 'index-media-icon8.png'
- },
- {
- id: '9',
- name: "遇见南坪",
- img: imgUrl + 'index-media-icon9.png'
- },
- {
- id: '10',
- name: "书香南岸",
- img: imgUrl + 'index-media-icon10.png'
- },
- {
- id: '11',
- name: "南岸卫生健康监督",
- img: imgUrl + 'index-media-icon11.png'
- },
- {
- id: '12',
- name: "南岸司法",
- img: imgUrl + 'index-media-icon12.png'
- },
- {
- id: '13',
- name: "广阳岛绿色发展公司",
- img: imgUrl + 'index-media-icon13.png'
- },
- {
- id: '14',
- name: "南岸人力社保",
- img: imgUrl + 'index-media-icon14.png'
- },
- {
- id: '15',
- name: "广阳湾智创生态城",
- img: imgUrl + 'index-media-icon15.png'
- },
- {
- id: '16',
- name: "南岸智慧城管",
- img: imgUrl + 'index-media-icon16.png'
- }
- ]
- },
- onReady() {},
- onShow() {
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({
- selected: 0
- })
- }
- this.setData({
- naItem: 0
- }),
- this.setData({
- naItemTab: 1
- })
- },
- // 点击服务
- clickService1(e) {
- const index = e.currentTarget.dataset.item
- switch (index) {
- case 0: {
- wx.navigateToMiniProgram({
- appId: 'wxd2ade0f25a874ee2',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 1: {
- wx.navigateToMiniProgram({
- appId: 'wxfc86707bae655315',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 2: {
- wx.navigateToMiniProgram({
- appId: 'wx0bff7955e6e8b2bb',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 3: {
- wx.navigateToMiniProgram({
- appId: 'wxfc86707bae655315',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 4: {
- wx.navigateToMiniProgram({
- appId: 'wxfc86707bae655315',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- }
- },
- // 点击服务
- clickService2(e) {
- const index = e.currentTarget.dataset.item
- switch (index) {
- case 0: {
- wx.navigateToMiniProgram({
- appId: 'wxfc86707bae655315',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 1: {
- wx.navigateToMiniProgram({
- appId: 'wxbb58374cdce267a6',
- success(res) {
- // 打开成功
- }
- })
- };
- break;
- case 2: {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/maps/sy_mobile.html&se=核酸检测",
- })
- };
- break;
- case 3: {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "http://221.7.85.104:9999/zfjyjgfwpt/main/mobilepage/guidepage.html",
- })
- };
- break;
- }
- },
- toDataCenter() {
- wx.navigateTo({
- url: '/pages/dataCenter/dataCenter',
- })
- },
- onHide() {
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- this.getTabBar().setData({
- selected: -1
- })
- }
- },
- onLoad() {
- // 加载字体
- wx.loadFontFace({
- family: 'DOUYU',
- // source: 'url("https://hui.yrslm.com:8089/douyu.ttf")',
- source: 'url("http://116.63.49.144:8081/applet/font/douyu.ttf")',
- success: function (e) {
- console.log(e, '动态加载字体成功')
- },
- fail: function (e) {
- console.log(e, '动态加载字体失败')
- },
- })
- // 获取好差评图表
- this.barComponent3 = this.selectComponent('#streetlinechart3');
- this.init_bar3();
- // 获取本年办件数
- this.getOfficeNumberByAreaInfo();
- // 意见征集数据
- this.yjzjData()
- this.setData({
- navHeight: app.globalData.navHeight + app.globalData.menuHeight / 2
- })
- // wx.login({
- // success(res) {
- // if (res.code) {
- // //发起网络请求
- // login(res.code).then(res => {
- // console.log(res)
- // wx.setStorageSync("token", res.data.data)
- // })
- // } else {
- // console.log('登录失败!' + res.errMsg)
- // }
- // }
- // })
- },
- // canvas转图片
- canvasToTempImage() {
- wx.canvasToTempFilePath({
- canvas: this.barComponent3.canvasNode,
- success: (res) => {
- this.setData({
- canvasImg: res.tempFilePath
- });
- }
- }, this);
- },
- // 加载评价图表
- init_bar3() {
- let that = this;
- this.barComponent3.init((canvas, width, height, dpr) => {
- // 初始化图表
- const barChart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- barChart.setOption(this.getScaOption2());
- request({
- url: '/goodOrbad/getGoodOrBadByYearAndArea?area=1',
- method: 'GET'
- }).then(res => {
- if (res.result === 'ok') {
- let temp = [];
- temp.push(res.data.veryDissatisfied);
- temp.push(res.data.notSatisfied);
- temp.push(res.data.basicSatisfied);
- temp.push(res.data.satisfied);
- temp.push(res.data.great);
- this.setData({
- evalutionNum: res.data.goodOrBad,
- evalutionRate: Math.round(res.data.good / res.data.goodOrBad * 100)
- })
- barChart.setOption({
- series: [{
- data: temp
- }]
- })
- }
- })
- barChart.on("finished", function () {
- that.canvasToTempImage();
- });
- // 注意这里一定要返回 chart 实例,否则会影响事件处理等
- return barChart;
- });
- },
- getScaOption2() {
- //请求数据
- let xAxis = {
- type: 'value',
- interval: 500000
- },
- yAxis = {
- type: 'category',
- data: [
- '非常不满意', '不满意', '基本满意', '满意', '非常满意'
- ]
- },
- grid = {
- left: '20%',
- top: '10%',
- bottom: '10%',
- right: '20%'
- },
- series = [{
- data: [],
- type: 'bar',
- barWidth: 14,
- itemStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
- offset: 0,
- color: '#3977E6'
- },
- {
- offset: 1,
- color: '#37BBF8'
- }
- ]),
- // emphasis: {
- // barBorderRadius: 7
- // },
- // normal: {
- // barBorderRadius: 7
- // }
- },
- label: {
- show: true,
- position: 'right',
- valueAnimation: true
- }
- }]
- return {
- backgroundColor: '#FFFFFF',
- xAxis: xAxis,
- yAxis: yAxis,
- grid: grid,
- series: series,
- animationDelay: function (idx) {
- return idx * 50;
- },
- animationEasing: 'elasticOut'
- };
- },
- // 获取本年办件数
- getOfficeNumberByAreaInfo() {
- request({
- url: '/department/getOfficeNumberByAreaInfo?area=1&timeType=3',
- method: 'GET'
- }).then(res => {
- let temp = [];
- temp.push(res.data.acceptNumber);
- temp.push(res.data.serialNumber);
- temp.push(res.data.applicationNumberNetwork);
- this.setData({
- officeNumber: temp
- })
- })
- },
- // 搜索框
- bindKeyInput: function (e) {
- this.setData({
- searchInput: e.detail.value
- })
- },
- // 南岸咨询tab
- naChangeItem: function (e) {
- this.setData({
- naItem: e.currentTarget.dataset.item
- })
- if (this.data.naItem == 0) {
- this.setData({
- naItemTabList: [{
- id: 1,
- name: '政策.咨询'
- },
- {
- id: 2,
- name: '党建.服务'
- },
- {
- id: 3,
- name: '抗疫.复工'
- },
- {
- id: 4,
- name: '功能.服务'
- }
- ]
- })
- } else {
- this.setData({
- naItemTabList: [{
- id: 1,
- name: '天气.咨询'
- },
- {
- id: 2,
- name: '外出.服务'
- },
- {
- id: 3,
- name: '打工.复工'
- },
- {
- id: 4,
- name: '娱乐.服务'
- }
- ]
- })
- }
- },
- naChangeTab: function (e) {
- this.setData({
- naTab: e.detail.current
- })
- if (this.data.naTab == 0) {
- this.setData({
- naItemTabList: [{
- id: 1,
- name: '政策.咨询'
- },
- {
- id: 2,
- name: '党建.服务'
- },
- {
- id: 3,
- name: '抗疫.复工'
- },
- {
- id: 4,
- name: '功能.服务'
- }
- ]
- })
- } else {
- this.setData({
- naItemTabList: [{
- id: 1,
- name: '天气.咨询'
- },
- {
- id: 2,
- name: '外出.服务'
- },
- {
- id: 3,
- name: '打工.复工'
- },
- {
- id: 4,
- name: '娱乐.服务'
- }
- ]
- })
- }
- // 重置咨询title-tab
- this.setData({
- naItemTab: 1
- })
- },
- // 南岸咨询子集菜单点击
- clickNaTilteTab: function (e) {
- this.setData({
- naItemTab: e.currentTarget.dataset.item.id
- })
- const ran = Math.random() * 100 + 41
- this.setData({
- naContentList: [{
- id: 1,
- name: `${ran}2洪斌在全区疫情防控工作会议上强调,坚持不松懈的精神,努力工作,开展创先争优活动,激励人民发扬美好传统美德!`
- },
- {
- id: 2,
- name: `${ran}坚持不松劲渝事好商量`
- },
- {
- id: 3,
- name: '2南岸实践工作全面启动'
- },
- {
- id: 4,
- name: '2首条直达南滨路人防隧道开建'
- },
- {
- id: 5,
- name: '2全市首个!南岸区便民数字地图上线啦~'
- }
- ]
- })
- },
- // 南岸咨询内容点击
- clickNaContent: function (e) {
- console.log(e)
- },
- // 南岸咨询更多
- naMore: function (e) {
- let title = this.data.naTab == 0 ? '南岸动态' : this.data.naTab == 1 ? '今日重庆' : '国务院信息';
- wx.navigateTo({
- url: '/pages/aticleList/aticleList?title=' + title,
- })
- },
- // 政民互动
- communicateChangeItem: function (e) {
- this.setData({
- communicateItem: e.currentTarget.dataset.item
- })
- },
- communicateChangeTab: function (e) {
- this.setData({
- communicateTab: e.detail.current
- })
- },
- // 意见征集接口
- yjzjData() {
- yjzjList().then(res => {
- var list = []
- if (res.statusCode == 200 && res.datas.pageInfo.totalResults > 0) {
- list = res.datas.data
- for (var i = 0; i < list.length; i++) {
- list[i].beginTime = this.formatDateNumber(new Date(list[i].beginTime * 1))
- list[i].endTime = this.formatDateNumber(new Date(list[i].endTime * 1))
- }
- this.setData({
- 'yjzjDataList': list
- })
- }
- })
- },
- goYjzjDetail(e) {
- var html = e.currentTarget.dataset.item
- wx.navigateTo({
- url: "/pages/yjzjDetail/yjzjDetail?html=" + encodeURIComponent(html)
- })
- },
- // 日期格式化
- formatDateNumber: function (date) {
- let myYear = date.getFullYear();
- let myMonth = date.getMonth() + 1;
- let myWeekDay = date.getDate();
- return myYear + "-" + myMonth + "-" + myWeekDay
- },
- toList: function () {
- wx.navigateTo({
- url: '/pages/programList/programList',
- })
- },
- toLeaveMessage: function () {
- wx.navigateTo({
- url: '/pages/leaveMessage/leaveMessage',
- })
- },
- // 媒体矩阵
- swichNav: function (e) {
- var that = this;
- if (this.data.mediaCurrentTab === e.target.dataset.current) {
- return false;
- } else {
- that.setData({
- mediaCurrentTab: e.target.dataset.current,
- navScrollLeft: e.target.dataset.current >= 2 ? ((e.target.dataset.current - 1) * 215) : 0
- })
- }
- },
- mediaBindChange: function (e) {
- var that = this;
- that.setData({
- mediaCurrentTab: e.detail.current,
- navScrollLeft: e.detail.current >= 2 ? ((e.detail.current - 1) * 215) : 0
- });
- },
- getUserProfile() {
- wx.setStorageSync('nickname', "");
- wx.setStorageSync('avatarUrl', "");
- wx.getUserProfile({
- desc: '获取用户信息',
- success: (res) => {
- wx.setStorageSync('nickname', res.userInfo.nickName);
- wx.setStorageSync('avatarUrl', res.userInfo.avatarUrl);
- wx.login({
- success(res) {
- if (res.code) {
- //发起网络请求
- data = {
- code: res.code
- }
- login(data).then(res => {
- console.log(res)
- wx.setStorageSync("token", res.data.data)
- })
- } else {
- console.log('登录失败!' + res.errMsg)
- }
- }
- })
- },
- fail(res) {
- console.log("获取用户信息失败", res)
- }
- })
- },
- //印象南岸进入
- toYxna() {
- wx.navigateTo({
- url: "/pages/yxnaJfq/yxnaJfq",
- })
- },
- toJfq: function () {
- wx.navigateTo({
- url: '/pages/yxnaJfq/yxnaJfq',
- })
- },
- toJfh: function () {
- wx.navigateTo({
- url: '/pages/yxnaJfh/yxnaJfh',
- })
- },
- toXsj: function () {
- wx.navigateTo({
- url: '/pages/yxna/yxna',
- })
- },
- toQxn: function () {
- wx.navigateTo({
- url: '/pages/yxnaQxn/yxnaQxn',
- })
- },
- gotoSjzx() {
- wx.navigateTo({
- url: '/pages/dataCenter/dataCenter',
- })
- },
- gotoZWTJ() {
- wx.navigateTo({
- url: '/pages/dataCenterZWTJ/dataCenterZWTJ',
- })
- },
- gotoNewsPaper() {
- wx.navigateTo({
- url: '/pages/newsPaper/newsPaper',
- })
- },
- gotoZlwd() {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/ghwd/znwd/mobile/index.html",
- })
- },
- gotoDTSS(e) {
- const search = e.currentTarget.dataset.item
- if (search && search != '') {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/maps/sy_mobile.html&se=" + search,
- })
- } else {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "https://www.cqna.gov.cn/maps/sy_mobile.html",
- })
- }
- },
- gotoMTJZ() {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "https://data.cqna.gov.cn/newMedia/officialAccounts.html",
- })
- },
- gotoSPTJ() {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "http://www.cqna.com.cn/na_Class/node_24133.html",
- })
- },
- gotoNAB() {
- wx.navigateTo({
- url: '/pages/web/web?url=' + "http://www.cqna.com.cn/na_Class/node_24150.html",
- })
- }
- })
|