123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //index.js
- //获取应用实例
- const app = getApp()
- var abouturl = '';
- Page({
- data: {
- realName: '',
- count: '',
- program: '',
- code: '',
- userInfo:{},
- appVersion: app.globalData.appVersion
- },
- onLoad: function () {
- this.getCode();
- this.getStaticurl();
- this.getUserInfo();
- },
- getCode(){
- let that = this;
- wx.login({
- success: function (ret) {
- that.code = ret.code;
- }
- });
- },
- getStatic: function(){
-
- },
-
- onShow:function(){
- var that = this;
- app.ajaxReadyCallback = res => {
- var apiname = res.data.apiname;
- if (apiname == 'logout'){
- app.globalData.isTourist = false;
- app.globalData.userinfo = {};
- wx.clearStorageSync();
- wx.reLaunch({ //关闭所有页面,打开到应用内的某个页面
- url: '/pages/splash/splash'
- })
- } else if (apiname == 'staticurl'){
- abouturl = res.data.data.aboutUrl;
- }else if (apiname == 'userInfo'){
- that.setData({
- userInfo:res.data.data
- })
- }else{
- that.setData({
- count: res.data.data
- });
- }
- }
- // this.getUnreadCount();
- },
- logout:function(e){
- app.globalData.userinfo = {};
- app.logout();
- setTimeout(function(){
- wx.reLaunch({ //关闭所有页面,打开到应用内的某个页面
- url: '/pages/splash/splash'
- })
- },2000);
- },
- getUserInfo(){
- app.ajax({
- url: app.globalData.serverUrl + '/User/info',
- type: 'POST',
- apiname:'userInfo',
- data: {
- }
- });
- },
- getStaticurl:function(){
- var org = app.globalData.userinfo.org;
- app.ajax({
- url: app.globalData.serverUrl + '/Login/staticUrl',
- type: 'POST',
- apiname:'staticurl',
- data: {
- }
- });
- },
- getUnreadCount:function(){
- var org = app.globalData.userinfo.org;
-
- app.ajax({
- url: app.globalData.serverUrl + 'server/notice/queryNoticeCount',
- type: 'POST',
- data: {
- orgId: org.orgId
- }
- });
- },
- about: function(e){
- console.log(abouturl)
- if (!abouturl){
- return false;
- }
- app.gotopage('/pages/webview/index', { url: abouturl });
- return false;
- }
-
- })
|