Commit b3d56c7a authored by Tang Xinwei's avatar Tang Xinwei

fix dealer api read error

parent 42c749da
......@@ -10,7 +10,7 @@
<p class="text-muted" style="font-size:20px;">今日首胜: {{ activity.today }}/1 </p>
<p class="text-muted" v-if="showActivity" style="font-size:20px;">{{ activity.name }}首胜:
{{ activity.total }}/{{ activity.max }} </p>
<p class="text-muted" style="font-size:20px;">VS发牌姬战绩: 胜 {{ userStats.win }} / 负 {{ userStats.lose }} / 总 {{ userStats.total }}</p>
<p class="text-muted" style="font-size:20px;">VS发牌姬: 胜 {{ vsDealerStats.win }} / 负 {{ vsDealerStats.lose }} / 总 {{ vsDealerStats.total }}</p>
</div>
</div>
</div>
......@@ -159,6 +159,7 @@ import API from '../api'
import {mapGetters} from 'vuex'
import moment from 'moment'
import tb_language from './tb_lang.js'
import Vue from 'vue';
var rankTable;
......@@ -192,7 +193,7 @@ export default {
athletic_wl_ratio: 0,
arena_rank: 0
},
userStats: {
vsDealerStats: { //发牌姬战绩
win: 0,
lose: 0,
total: 0
......@@ -235,9 +236,8 @@ export default {
let opt = {
'username': this.user.username
}
this.fetchUserStats().then(userStats => {
this.userStats = userStats;
this.fetchVsDealerStats().then(vsDealerStats => {
this.vsDealerStats = vsDealerStats;
});
API.getUserInfo(opt).then((res) => {
......@@ -251,23 +251,22 @@ export default {
methods: {
// VS发牌姬成绩
fetchUserStats() {
const request = query.stringify({ 'username': this.user.username });
const apiUrl = 'https://sapi.moecube.com:444/dealer/api/user';
const url = `${apiUrl}?${request}`;
console.log('发牌姬API',url)
return Vue.http.get(url)
.then(response => {
return response.json();
})
.then(data => {
console.log('发牌姬信息',data);
})
.catch(error => {
console.error('Error fetching user stats:', error);
});
async fetchVsDealerStats() {
try {
const apiUrl = 'https://sapi.moecube.com:444/dealer/api/user';
const url = `${apiUrl}/${this.user.username}`;
console.log('发牌姬API', url);
const response = await Vue.http.get(url);
const jsonData = await response.json();
console.log('发牌姬response', jsonData.data);
return jsonData.data;
} catch (error) {
console.error('Error fetching user stats:', error);
throw error;
}
},
exchangeUserInfo(info) {
let userName = this.user.username
let exchangeInfo = info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment