123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- const api = require('../../utils/api.js');
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tab: {
- 'content': ['主题分类', '人生事件', '特定对象', '部门分类'],
- 'content1': ['主题分类', '对象分类', '经营活动', '部门分类'], },
- indexOf: 0,
- current: 0,
- tabindex: 0,
- sxType:1//区分是个人还是法人办事
- },
- search:function(){
- wx.navigateTo({
- url: '/pages/handle/search/search',
- })
- },
- tab: function (e) {
- let that = this;
- if(e.currentTarget.dataset.index==0){
- that.data.sxType=1
- // wx.setNavigationBarTitle({
- // title: '个人办事',
- // })
- }else{
- that.data.sxType=2
- that.req('ENTERPRISE_ZT')
- // wx.setNavigationBarTitle({
- // title: '法人办事',
- // })
- }
- console.log(that.data.PERSON_ZT)
- that.setData({
- tabindex: e.currentTarget.dataset.index,
- current: 0,
- index: 0,
- fileNme: that.data.sxType == 1 ? 'PERSON_ZT' :'ENTERPRISE_ZT',
- sxType:that.data.sxType
- })
- },
- change: function (e) {
- let that=this
- if (e.detail.current == 0 && this.data.sxType == 1){
- if (!that.data.PERSON_ZT){
- this.req('PERSON_ZT');
- that.setData({
- fileNme: 'PERSON_ZT',
- indexOf: e.detail.current
- })
- }else{
- that.setData({
- fileNme: 'PERSON_ZT',
- indexOf: e.detail.current
- })
- }
- } else if (e.detail.current == 1 && this.data.sxType == 1){
- if (!that.data.PERSON_RSSJ) {
- this.req('PERSON_RSSJ');
- that.setData({
- fileNme: 'PERSON_RSSJ',
- indexOf: e.detail.current
- })
- } else {
- that.setData({
- fileNme: 'PERSON_RSSJ',
- indexOf: e.detail.current
- })
- }
- } else if (e.detail.current == 2 && this.data.sxType == 1){
- if (!that.data.PERSON_TDRQ) {
- this.req('PERSON_TDRQ');
- that.setData({
- fileNme: 'PERSON_TDRQ',
- indexOf: e.detail.current
- })
- } else {
- that.setData({
- fileNme: 'PERSON_TDRQ',
- indexOf: e.detail.current
- })
- }
- } else if (e.detail.current == 0 && this.data.sxType == 2) {
- if (!that.data.ENTERPRISE_ZT) {
- this.req('ENTERPRISE_ZT');
- that.setData({
- fileNme: 'ENTERPRISE_ZT',
- indexOf: e.detail.current
- })
- } else {
- that.setData({
- fileNme: 'ENTERPRISE_ZT',
- indexOf: e.detail.current
- })
- }
- } else if (e.detail.current == 1 && this.data.sxType == 2) {
- if (!that.data.ENTERPRISE_TDDX) {
- this.req('ENTERPRISE_TDDX');
- that.setData({
- fileNme: 'ENTERPRISE_TDDX',
- indexOf: e.detail.current
- })
- } else {
- that.setData({
- fileNme: 'ENTERPRISE_TDDX',
- indexOf: e.detail.current
- })
- }
- } else if (e.detail.current == 2 && this.data.sxType == 2) {
- if (!that.data.ENTERPRISE_JYHD) {
- this.req('ENTERPRISE_JYHD');
- that.setData({
- fileNme: 'ENTERPRISE_JYHD',
- indexOf: e.detail.current
- })
- } else {
- that.setData({
- fileNme: 'ENTERPRISE_JYHD',
- indexOf: e.detail.current
- })
- }
- }
- if (e.detail.current == 3){
- that.setData({
- indexOf: e.detail.current
- })
- }
- },
- tabClick: function (e) {
- this.setData({
- current: e.currentTarget.dataset.index,
- indexOf: e.currentTarget.dataset.index
- })
- },
- details: function (e) {
- let that=this
- wx.navigateTo({
- url: '/pages/handle/details/index?unid=' + e.currentTarget.dataset.id + '&flag=' + that.data.sxType
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var that = this
- // wx.setStorageSync('userId', 92)
- var query = wx.createSelectorQuery();
- //选择id
- query.select('.top').boundingClientRect();
- query.select('.t').boundingClientRect();
- query.exec(function (res) {
- that.data.topHeight = res[0].height
- that.data.tabHeight = res[1].height
- wx.getSystemInfo({
- success: function (res) {
- that.setData({
- clientHeight: res.windowHeight - that.data.topHeight - that.data.tabHeight
- });
- }
- })
- })
- },
- req:function(type){
- wx.showLoading({
- title: '正在加载',
- })
- let that = this
- wx.request({
- url: api.server,
- data: { 'code': type },
- header: {},
- method: 'GET',
- dataType: 'json',
- responseType: 'text',
- success: function (res) {
- wx.hideLoading()
- var arr=[]
- for(var i=0;i<res.data.data.length;i++){
- res.data.data[i].imgurl = '../../images/' + type + '/' + res.data.data[i].dictValueCode+'.png'
- arr.push(res.data.data[i])
- }
- that.setData({
- [type]: res.data.data,
- fileNme: type
- })
- },
- fail: function (res) { },
- complete: function (res) { },
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- var that=this
- this.req('PERSON_ZT');
- wx.request({
- url: api.Level,
- data:{page:0,rows:100},
- success(res){
- that.setData({
- list:res.data.data
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|