//index.js
|
//获取应用实例
|
const app = getApp()
|
Page({
|
data: {
|
src: app.globalData.imgUrl + '/image/bg1.jpg',
|
logo: app.globalData.imgUrl + '/image/logo.png',
|
bszn: app.globalData.imgUrl + '/image/bszn.svg',
|
njhd: app.globalData.imgUrl + '/image/njhd.svg',
|
zxfw: app.globalData.imgUrl + '/image/zxfw.svg',
|
xxgk: app.globalData.imgUrl + '/image/xxgk.svg',
|
tsjy: app.globalData.imgUrl + '/image/tsjy.svg',
|
ywbl: app.globalData.imgUrl + '/image/ywbl.svg',
|
sjxf: app.globalData.imgUrl + '/image/sjxf.svg',
|
user: app.globalData.imgUrl + '/image/user.svg',
|
gyssp: app.globalData.imgUrl + '/image/suishoupai.svg',
|
shce: app.globalData.imgUrl + '/image/saoheichue.svg',
|
userCenter: app.globalData.imgUrl + '/image/icon_geren.svg',
|
llz: app.globalData.imgUrl + '/image/icon_lianluo.svg',
|
flxc: app.globalData.imgUrl + '/image/icon_flxc.svg',
|
ywbl1: './../images/home/1.png',
|
showModel: false,
|
code: '',
|
moduleDiv: 0,
|
TabCur: 0,
|
list: [{
|
name: '业务办理'
|
}, {
|
name: '办事指南'
|
}, {
|
name: '智慧未检'
|
}, {
|
name: '企业服务'
|
}, {
|
name: '智能问答'
|
}, {
|
name: '南检活动'
|
}, {
|
name: '检务公开'
|
}, {
|
name: '知识产权'
|
}],
|
},
|
//事件处理函数
|
|
businessHandling: function() {
|
wx.navigateTo({
|
url: '../businessHandling/businessHandling',
|
})
|
},
|
me: function() {
|
wx.navigateTo({
|
url: '../me/me',
|
})
|
},
|
guide: function() {
|
wx.navigateTo({
|
url: '../guide/guide',
|
|
})
|
},
|
//自助咨询
|
artificial1: function() {
|
wx.navigateTo({
|
url: '../artificial1/artificial1',
|
})
|
},
|
activityMessage: function() {
|
wx.navigateTo({
|
url: '../activityMessage/activityMessage',
|
})
|
},
|
budget: function() {
|
wx.navigateTo({
|
url: '../budget/budget',
|
})
|
},
|
suggest: function() {
|
wx.navigateTo({
|
url: '../suggest/suggest',
|
})
|
},
|
artificial: function() {
|
|
var url = '../artificial/artificial'
|
if (this.data.shouldAuth) {
|
wx.showModal({
|
title: '人脸识别确认',
|
content: '为了保证您信息的真实性,请前往人脸认证',
|
cancelText: '回到首页',
|
confirmText: '前往认证',
|
success: function(res) {
|
if (res.confirm) {
|
wx.navigateTo({
|
url: '../face/face?url=' + encodeURIComponent(url),
|
})
|
} else if (res.cancel) {
|
wx.redirectTo({
|
url: '../index/index',
|
})
|
}
|
}
|
})
|
} else {
|
wx.navigateTo({
|
url: url,
|
})
|
}
|
},
|
dissDetail: function() {
|
wx.navigateTo({
|
url: '../dissDetail/dissDetail?name=公益随手拍',
|
})
|
},
|
face: function() {
|
wx.navigateTo({
|
url: '../face/face',
|
})
|
},
|
legalServices: function() {
|
wx.navigateTo({
|
url: '../login/login',
|
})
|
},
|
massesSuggest: function() {
|
wx.navigateTo({
|
url: '../massesSuggest/massesSuggest',
|
})
|
},
|
// 检任公开
|
infoPublication: function(e) {
|
var flag = e.currentTarget.dataset.flag;
|
wx.navigateTo({
|
url: '../infoPublication/infoPublication?flag=' + flag,
|
})
|
},
|
// 法律宣传
|
login: function(e) {
|
var url = e.currentTarget.dataset.url;
|
console.log(url)
|
wx.navigateTo({
|
url: '../lawServiceLogin/lawServiceLogin?url=' + url,
|
})
|
},
|
|
|
tabSelect(e) {
|
console.log(e.currentTarget.dataset.id)
|
this.setData({
|
moduleDiv: e.currentTarget.dataset.id,
|
TabCur: e.currentTarget.dataset.id,
|
})
|
},
|
|
|
linkFunction: function(event) {
|
var str = event.currentTarget.dataset['str'];
|
wx.navigateTo({
|
url: '../' + str + '/' + str
|
})
|
},
|
|
clinkFunction: function(event) {
|
var str = event.currentTarget.dataset['str'];
|
var id = event.currentTarget.dataset['id'];
|
console.log(id)
|
wx.navigateTo({
|
url: '../' + str + '/' + str + '?id=' + id
|
})
|
},
|
|
onLoad: function() {
|
var that = this;
|
// 登录
|
wx.login({
|
success: res => {
|
console.log(res);
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
this.setData({
|
code: res.code
|
})
|
// 获取用户信息
|
wx.getSetting({
|
success: res => {
|
if (res.authSetting['scope.userInfo']) {
|
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
|
wx.getUserInfo({
|
success: res => {
|
// 可以将 res 发送给后台解码出 unionId
|
console.log(res);
|
wx.setStorageSync('userInfo', res.userInfo)
|
this.saveUserInfo(that.data.code, res.userInfo)
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
// 所以此处加入 callback 以防止这种情况
|
if (this.userInfoReadyCallback) {
|
this.userInfoReadyCallback(res)
|
}
|
}
|
})
|
} else {
|
that.setData({
|
showModel: true
|
})
|
}
|
}
|
})
|
}
|
})
|
},
|
|
bindGetUserInfo: function(e) {
|
//设置用户信息本地存储
|
try {
|
this.setData({
|
showModel: false
|
})
|
console.log(e.detail.userInfo, this.data.code)
|
wx.setStorageSync('userInfo', e.detail.userInfo)
|
this.saveUserInfo(this.data.code, e.detail.userInfo)
|
} catch (e) {
|
wx.showToast({
|
title: '系统提示:网络错误',
|
icon: 'warn',
|
duration: 1500,
|
})
|
}
|
|
},
|
|
saveUserInfo: function(code, userInfo) { //提交用户信息 获取用户id
|
var that = this
|
wx.request({
|
url: app.globalData.url + '/wechat/ma/user/login',
|
method: 'POST',
|
header: {
|
"Content-Type": "application/json"
|
},
|
data: {
|
'code': code,
|
'nickName': userInfo.nickName,
|
'sex': userInfo.gender,
|
'avatarUrl': userInfo.avatarUrl,
|
},
|
success: function(res) {
|
if (res.data.code == '0') {
|
wx.setStorageSync('user', res.data.data.user);
|
wx.setStorageSync('openId', res.data.data.openId);
|
wx.setStorageSync('sessionKey', res.data.data.sessionKey);
|
} else {
|
wx.showToast({
|
title: '网络请求失败,请稍后再试!',
|
})
|
}
|
}
|
})
|
},
|
|
developIng: function() {
|
app.developIng()
|
},
|
|
scanEvildoing: function() {
|
wx.navigateTo({
|
url: '../scanEvildoing/scanEvildoing?id=new',
|
})
|
},
|
|
//联络站
|
junctionStation: function(e) {
|
wx.navigateTo({
|
url: '../junctionStation/junctionStation?id=new&flag=renda',
|
})
|
},
|
|
//扫黑除恶须知
|
scanEvildoingInfo: function() {
|
wx.navigateTo({
|
url: '../dissDetail/dissDetail?name=扫黑除恶',
|
})
|
},
|
|
activity: function() {
|
wx.navigateTo({
|
url: '../activityList/activityList?id=new',
|
})
|
},
|
|
//在线申诉
|
complain: function() {
|
wx.navigateTo({
|
url: '../excess/excess?name=申诉人&name1=代理人&url=' + ['../complain/complain'],
|
})
|
},
|
// 国家赔偿
|
compensation: function() {
|
wx.navigateTo({
|
url: '../excess/excess?name=请求人&name1=代理人&url=' + ['../compensation/compensation'],
|
})
|
},
|
|
//信访预约
|
petitionLetters: function() {
|
wx.navigateTo({
|
url: '../excess/excess?name=信访人&name1=代理人&url=' + ['../petitionLetters/petitionLetters'],
|
})
|
},
|
|
//司法救助
|
judicial: function() {
|
var url = '../judicial/judicial?id=new';
|
if (this.data.shouldAuth) {
|
wx.showModal({
|
title: '人脸识别确认',
|
content: '为了保证您信息的真实性,请前往人脸认证',
|
cancelText: '回到首页',
|
confirmText: '前往认证',
|
success: function(res) {
|
if (res.confirm) {
|
wx.navigateTo({
|
url: '../face/face?url=' + encodeURIComponent(url),
|
})
|
} else if (res.cancel) {
|
wx.redirectTo({
|
url: '../index/index',
|
})
|
}
|
}
|
})
|
} else {
|
wx.navigateTo({
|
url: url,
|
})
|
}
|
|
},
|
|
//案件进度查询
|
progressQuery: function() {
|
var url = '../progressQuery/progressQuery?id=new';
|
if (this.data.shouldAuth) {
|
wx.showModal({
|
title: '人脸识别确认',
|
content: '为了保证您信息的真实性,请前往人脸认证',
|
cancelText: '回到首页',
|
confirmText: '前往认证',
|
success: function(res) {
|
if (res.confirm) {
|
wx.navigateTo({
|
url: '../face/face?url=' + encodeURIComponent(url),
|
})
|
} else if (res.cancel) {
|
wx.redirectTo({
|
url: '../index/index',
|
})
|
}
|
}
|
})
|
} else {
|
wx.navigateTo({
|
url: url,
|
})
|
}
|
},
|
|
|
})
|