优化
This commit is contained in:
+35
-16
@@ -1,3 +1,5 @@
|
||||
import _console from "../TUIKit/utils/console"
|
||||
|
||||
// custom-tab-bar/index.js
|
||||
const app = getApp()
|
||||
Component({
|
||||
@@ -56,9 +58,11 @@ Component({
|
||||
index_info: "",
|
||||
wenzhen_info: "",
|
||||
my_info: "",
|
||||
next_url: "/Pages/yishi/identity/index"
|
||||
next_url: "/Pages/yishi/identity/index",
|
||||
info_inter: 0
|
||||
},
|
||||
attached() {
|
||||
ready() {
|
||||
console.log("readyreadyreadyreadyreadyready")
|
||||
const usertype = wx.getStorageSync('usertype')
|
||||
if (usertype == 2) {
|
||||
this.setData({
|
||||
@@ -71,22 +75,37 @@ Component({
|
||||
items: this.data.listAll.list1
|
||||
})
|
||||
}
|
||||
let _this = this;
|
||||
let userID = wx.getStorageSync('user_id_'+usertype);
|
||||
let info_inter = setInterval(() => {
|
||||
let index_info = wx.getStorageSync(userID+'_index_info');
|
||||
let wenzhen_info = wx.getStorageSync(userID+'_wenzhen_info');
|
||||
let my_info = wx.getStorageSync(userID+'_my_info');
|
||||
_this.setData({
|
||||
index_info: index_info,
|
||||
wenzhen_info: wenzhen_info,
|
||||
my_info: my_info,
|
||||
})
|
||||
}, 500);
|
||||
|
||||
app.globalData.app_inter.push(info_inter);
|
||||
|
||||
},
|
||||
methods: {
|
||||
startInterval(){
|
||||
let _this = this;
|
||||
const usertype = wx.getStorageSync('usertype')
|
||||
let userID = wx.getStorageSync('user_id_'+usertype);
|
||||
let info_inter = setInterval(() => {
|
||||
if(app.globalData.config.userID == userID){
|
||||
let index_info = wx.getStorageSync(userID+'_index_info');
|
||||
let wenzhen_info = wx.getStorageSync(userID+'_wenzhen_info');
|
||||
let my_info = wx.getStorageSync(userID+'_my_info');
|
||||
_this.setData({
|
||||
index_info: this.formatNum(index_info),
|
||||
wenzhen_info: this.formatNum(wenzhen_info),
|
||||
my_info: this.formatNum(my_info),
|
||||
})
|
||||
}
|
||||
}, 500);
|
||||
this.setData({
|
||||
info_inter: info_inter
|
||||
})
|
||||
},
|
||||
stopInterval(){
|
||||
clearInterval(this.data.info_inter)
|
||||
},
|
||||
formatNum(val){
|
||||
if(val > 99) val = '+99';
|
||||
if(val == 0) val = '';
|
||||
return val;
|
||||
},
|
||||
// swichNav: function (e) {
|
||||
// console.log(123);
|
||||
// let that = this;
|
||||
|
||||
Reference in New Issue
Block a user