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 Member from "@/api/member";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import app from "@/app.js" import app from "@/app.js"
import Home from "@/api/home";
export default { export default {
onLaunch: function () { onLaunch: function () {
setInterval(() => { 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(){ // update(){
// var baseUrl=app.baseUrl + '/api/app/getNewestVersion' // var baseUrl=app.baseUrl + '/api/app/getNewestVersion'
// console.log(baseUrl) // console.log(baseUrl)
@ -128,7 +157,23 @@ export default {
uni.$emit("appShow"); uni.$emit("appShow");
this.$navFontColor(); this.$navFontColor();
}, },
computed:{
isLogin() {
return Boolean(uni.getStorageSync("token"));
},
},
beforeDestroy() {
//
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
this.stopHeartbeat();
},
onHide: function () {}, onHide: function () {},
mounted() {
//
document.addEventListener('visibilitychange', this.handleVisibilityChange);
//
this.startHeartbeat();
},
}; };
</script> </script>

7
api/home.js

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

2
pages/auth/certification.vue

@ -304,7 +304,7 @@
// uni-datetime-picker // uni-datetime-picker
.uni-picker-view-indicator, .uni-picker-view-indicator,
.uni-picker-view-mask { .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, // uni-datetime-picker,

4
pages/exchange/open-position.vue

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

4
pages/login/index.vue

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

4
static/chart_main/sevencoin.js

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

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

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

Loading…
Cancel
Save