123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486 |
- var App = getApp();
- var utils = require("../../utils/http");
- var nowtimestamp = 0, stoptime = 0;
- let loginnum = 1;
- Page({
- data: {
- top: App.globalData.statusBarHeight,
- hgt: App.globalData.titleBarHeight,
- imgUrl: App.globalData.imgUrl,
- unreadNum: 0,
- personobj: App.globalData.personMsg,
- signflag: false,
- instructionsflag: false,
- num: 0,
- unlogin: false,
- indextopnumobj: {},
- userflag: false,//true是有个人信息,false没有个人信息,
- permiss: false,
- unfutureflag: false,
- companyname: App.globalData.companyname,
- contribution: 0,
- my_ranking: 0,
- my_score: 0,
- help_people: 0,
- medal: 0,
- toolnumobj:{}
- },
- onLoad: function () {
- var that = this;
- wx.showLoading({
- title: '加载中......',
- })
- that.setData({
- top: App.globalData.statusBarHeight,
- hgt: App.globalData.titleBarHeight,
- companyname: App.globalData.companyname
- })
- that.setData({
- personobj: App.globalData.personMsg,
- })
- that.unreadMsg();
- that.getContribution();
- if(App.globalData.personMsg.sign!=1){
- that.signmsgtap();
- }
- this.getdenumfun();
- if (App.globalData.official_openid == 0) {
- wx.showModal({
- content: '您未关注志远装饰公众号,请及时关注',
- showCancel: false,
- confirmText: '去关注',
- success: function (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/other/other?type=090',
- })
- }
- }
- })
- }
- },
- getdenumfun(){
- const that=this;
- utils.$post({
- url: App.globalData.webUrl + 'api/index/afszxy_count',
- header: {
- 'Authorization': 'bearer ' + App.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- toolnumobj: res.data.data,
- })
- }
- }
- })
-
- },
- casetap:function(){
- wx.navigateTo({
- url: '/pages/decorateguide/decorateguide'
- })
- },
- catetap:function(){
- wx.navigateTo({
- url: '/customer/pages/publicpraise/publicpraise'
- })
- },
- buildtap:function(){
- wx.navigateTo({
- url: '/customer/pages/site/site',
- })
- },
- onReady: function () {
- },
- goidxtap: function () {
- wx.reLaunch({
- url: '/pages/index/index?state=1',
- })
- },
- closetap: function () {
- this.setData({
- unfutureflag: false
- })
- },
- setap: function () {
- wx.navigateTo({
- url: '/mycustomer/pages/set/set'
- })
- },
- persontap: function () {
- wx.navigateTo({
- url: '/pages/other/other?type=818&empid=' + App.globalData.currentUserId,
- })
- // wx.navigateTo({
- // url: '/share/pages/brokerRegister/brokerRegister'
- // })
- },
- arrfun: function (str) {
- var that = this;
- let arr = str.split(',');
- return arr;
- },
- indexmoretap: function () {
- var that = this;
- wx.navigateTo({
- url: '/index/pages/morecontent/morecontent'
- })
- },
- friendtap: function (e) {
- wx.navigateTo({
- url: '/index/pages/friendcircle/friendcircle'
- })
- },
- servicetap: function (e) {
- wx.navigateTo({
- url: '/mycustomer/pages/scoremsg/scoremsg',
- })
- },
- findwordtap: function () {
- wx.navigateTo({
- url: '/index/pages/searchword/searchword'
- })
- },
- sharecardtap: function () {
- wx.navigateTo({
- url: '/index/pages/namecard/namecard'
- })
- },
- dailytap: function (e) {
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: '/index/pages/daily/daily'
- // })
- },
- guestcluestap: function () {
- var that = this;
- // this.setData({
- // unfutureflag:true
- // })
- wx.navigateTo({
- url: '/mycustomer/pages/guestclues/guestclues'
- })
- },
- activityTap: function () {
- // this.setData({
- // unfutureflag:true
- // })
- wx.navigateTo({
- url: '/index/pages/activity/activity'
- })
- },
- schooltap1: function () {
- var that = this;
- // this.setData({
- // unfutureflag:true
- // })
- wx.navigateTo({
- url: '/index/pages/school/school?type=121'
- })
- },
- schooltap2: function () {
- var that = this;
- // this.setData({
- // unfutureflag:true
- // })
- wx.navigateTo({
- url: '/index/pages/school/school?type=212'
- })
- },
- schooltap3: function () {
- var that = this;
- // this.setData({
- // unfutureflag:true
- // })
- wx.navigateTo({
- url: '/index/pages/school/school?type=313'
- })
- },
- instructionstap: function () {
- this.setData({
- instructionsflag: true
- })
- },
- closeinstruction: function () {
- this.setData({
- instructionsflag: false
- })
- },
- alerttextap: function () {
- this.setData({
- instructionsflag: true
- })
- },
- signmsgtap: function () {
- var that=this;
- utils.$post({
- url: App.globalData.webUrl + 'api/profile/sign',
- header: {
- 'Authorization':'bearer '+App.globalData.token
- },
- data:{
- alertshow:1
- },
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- signflag:!res.data.sign?false:true
- })
- let personobj = that.data.personobj;
- var time = !that.data.personobj.sign ? '0' : that.data.personobj.sign;
- personobj.sign = 1;
- that.setData({
- personobj: personobj
- })
- App.globalData.personMsg.sign=1;
- }else if(res.data.code=='1'){
- that.setData({
- signflag:true
- })
- }
- }
- })
- },
- signtap: function () {
- var that = this;
- let personobj = that.data.personobj;
- var time = !that.data.personobj.sign ? '0' : that.data.personobj.sign;
- personobj.sign = 1;
- that.setData({
- personobj: personobj
- })
- wx.navigateTo({
- url: '/mycustomer/pages/sign/sign?type=' + time
- })
- },
- goToMedalPage () {
- wx.navigateTo({
- url: '/pages/other/other?type=999',
- })
- },
- logintap: function () {
- this.loginbox = this.selectComponent("#loginbox");
- this.loginbox.loginfun();
- },
- getContribution: function () {
- let that = this;
- utils.$post({
- url: App.globalData.webUrl + 'api/talkskill/contribution',
- header: {
- 'Authorization': 'bearer ' + App.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- contribution: res.data.data.contribution,
- my_ranking: res.data.data.credits_ranking,
- help_people: res.data.data.help_people,
- my_score: res.data.data.integral,
- medal: res.data.data.medal
- })
- }
- }
- })
- },
- unreadMsg: function () {
- var that = this;
- App.globalData.tokenflag = true;
- this.setData({
- userflag: true,
- permiss: true
- })
- App.globalData.tabflag = true;
- that.indextopdata();
- utils.$post({
- url: App.globalData.webUrl + 'api/user_msg/unreadCount',
- header: {
- 'Authorization': 'bearer ' + App.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- unreadNum: res.data.data
- })
- App.globalData.unreadNum = res.data.data;
- }
- }
- })
- },
- indextopdata: function (text) {
- var that = this;
- wx.hideLoading()
- utils.$post({
- url: App.globalData.webUrl + 'api/index/datacount',
- header: {
- 'Authorization': 'bearer ' + App.globalData.token
- },
- data: {
- user_id: App.globalData.personMsg.id
- },
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- indextopnumobj: res.data
- })
- }
- }
- })
- },
- joincompanytap: function () {
- var that = this;
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: '/mycustomer/pages/mycompany/mycompany',
- // })
- },
- dothis: function () { },
- findsaleTap: function () {
- var that = this;
- wx.navigateTo({
- url: '/mycustomer/pages/addcustomerData/addcustomerData',
- })
- },
- managemenTap: function () {
- this.setData({
- unfutureflag: true
- })
- },
- ranktap: function () {
- var that = this;
- wx.navigateTo({
- url: '/mycustomer/pages/rankbox/rankbox',
- })
- },
- videoshareTap: function () {
- var that = this;
- wx.navigateTo({
- url: '/pages/videosharelist/videosharelist',
- })
- },
- customertap: function (e) {
- wx.navigateTo({
- url: '/index/pages/caselist/caselist',
- })
- },
- findcustomertoolTap: function (e) {
- wx.navigateTo({
- url: '/pages/findcustomertool/findcustomertool?type=' + e.currentTarget.dataset.type,
- })
- },
- editnameTap: function () {
- var that = this;
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: '/pages/editbusinesscard/editbusinesscard',
- // })
- },
- namecardTap: function () {
- var that = this;
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: '/pages/namecard/namecard',
- // })
- },
- findinformationTap: function (e) {
- var that = this;
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: '/pages/lookreference/lookreference',//网盘
- // })
- },
- informTap: function (e) {
- var that = this;
- wx.navigateTo({
- url: '/mycustomer/pages/information/information',
- })
- },
- onPlay: function () {
- },
- onPlayNav: function () {
- },
- onShow: function (e) {
- var that = this;
- that.setData({
- top: App.globalData.statusBarHeight,
- hgt: App.globalData.titleBarHeight,
- companyname: App.globalData.companyname
- })
- that.unreadMsg();
- this.setData({
- personMsg: App.globalData.personMsg
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- var timearr = App.globalData.timearr, flag = false;
- for (var i = 0; i < timearr.length; i++) {
- if (timearr[i].type == 'index') {
- timearr[i].time = timearr[i].time * 1 + stoptime * 1;
- flag = true;
- }
- }
- if (!flag) {
- var obj = {
- type: 'index',
- time: stoptime
- };
- App.globalData.timearr.push(obj);
- } else {
- App.globalData.timearr = timearr;
- }
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- var that = this;
- this.getdenumfun();
- that.unreadMsg();
- setTimeout(function () {
- wx.stopPullDownRefresh();
- }, 500)
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- var that = this;
- }
- })
|