Browse Source

修改认证有中文,新增用户是否在线

master
liaoxinyu 2 years ago
parent
commit
fe22cd3a70
  1. 45
      App.vue
  2. 7
      api/home.js
  3. 2
      pages/auth/certification.vue
  4. 4
      pages/exchange/open-position.vue
  5. 4
      pages/login/index.vue
  6. 4
      static/chart_main/sevencoin.js
  7. 1
      uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue

45
App.vue

@ -2,6 +2,7 @@
import Member from "@/api/member";
import { mapActions } from "vuex";
import app from "@/app.js"
import Home from "@/api/home";
export default {
onLaunch: function () {
setInterval(() => {
@ -26,6 +27,34 @@ export default {
});
});
},
sendHeartbeat() {
Home.online().then((response) => {
console.log('心跳机制');
}).catch((err) => {});
},
startHeartbeat() {
if (!this.heartbeatInterval && this.isLogin) {
this.heartbeatInterval = setInterval(this.sendHeartbeat, 100000); // 3
console.log('心跳机制已启动');
}
},
stopHeartbeat() {
if (this.heartbeatInterval) {
clearInterval(this.heartbeatInterval);
this.heartbeatInterval = null;
console.log('心跳机制已停止');
}
},
handleVisibilityChange() {
if (document.visibilityState === 'visible') {
//
this.startHeartbeat();
} else {
//
this.stopHeartbeat();
}
}
// update(){
// var baseUrl=app.baseUrl + '/api/app/getNewestVersion'
// console.log(baseUrl)
@ -128,7 +157,23 @@ export default {
uni.$emit("appShow");
this.$navFontColor();
},
computed:{
isLogin() {
return Boolean(uni.getStorageSync("token"));
},
},
beforeDestroy() {
//
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
this.stopHeartbeat();
},
onHide: function () {},
mounted() {
//
document.addEventListener('visibilitychange', this.handleVisibilityChange);
//
this.startHeartbeat();
},
};
</script>

7
api/home.js

@ -20,6 +20,13 @@ class Home {
static option(data){
return Serve.post('/option',data)
}
/*
* 获取用户在线接口
*/
static online(){
return Serve.get('/online')
}
}
export default Home;

2
pages/auth/certification.vue

@ -304,7 +304,7 @@
// uni-datetime-picker
.uni-picker-view-indicator,
.uni-picker-view-mask {
background-color: rgba(255, 255, 255, 0.5) !important;
background-color: rgba(255, 255, 255, 0.7) !important;
}
// uni-datetime-picker,

4
pages/exchange/open-position.vue

@ -215,7 +215,7 @@
@input="sliderChange" -->
<el-slider
v-model="activeStep"
@change="sliderChange"
@input="sliderChange"
:step="25"
show-stops
:marks="marks"
@ -1013,7 +1013,7 @@ export default {
75: '75%',
100: '100%',
},
activeStep: 0,
activeStep: 100,
showsStopLoss:false
};
},

4
pages/login/index.vue

@ -124,6 +124,7 @@
</template>
<script>
import Member from "@/api/member";
import Home from "@/api/home";
import { mapActions, mapState } from "vuex";
export default {
data() {
@ -180,6 +181,9 @@ export default {
} else {
this.loginSuccess(res.data);
}
Home.online().then((response) => {
console.log('心跳机制');
}).catch((err) => {});
})
.catch(() => {
});

4
static/chart_main/sevencoin.js

@ -402,13 +402,13 @@ $(function () {
}
// 获取数据
getBars(symbolInfo, resolution, rangeStartDate, rangeEndDate, onDataCallback, onErrorCallback, isFirstCall) {
let page = this.page > 3 ? 3 : this.page;
let page = this.page > 50 ? 50 : this.page;
let data = {
symbol: symbolInfo.name,
period: this.resolution(resolution),
form: rangeStartDate,
to: rangeEndDate,
size: page * 200,
size: page * 400,
zip: 2
}
this.page++

1
uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue

@ -386,6 +386,7 @@
},
},
created() {
uni.setLocale('en');
//
this.cale = new Calendar({
selected: this.selected,

Loading…
Cancel
Save