Commit 36f318b1 authored by Tang Xinwei's avatar Tang Xinwei

Merge branch 'add_dealer' into 'master'

Add VS dealer info on profile and UserInfo page

See merge request !1
parents 1dce3e65 96c31a64
Pipeline #25407 passed with stages
in 2 minutes and 3 seconds
......@@ -8,8 +8,9 @@
<div class="caption">
<h3><i class="glyphicon glyphicon-user"></i> <strong>{{ user.username }}</strong></h3>
<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" v-if="showActivity" style="font-size:20px;">{{ activity.name }}首胜:
{{ activity.total }}/{{ activity.max }} </p> -->
<p class="text-muted" style="font-size:20px;">VS发牌姬:胜{{ vsDealerStats.win }}/负{{ vsDealerStats.lose }}/总{{ vsDealerStats.total }}</p>
</div>
</div>
</div>
......@@ -158,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;
......@@ -191,6 +193,11 @@ export default {
athletic_wl_ratio: 0,
arena_rank: 0
},
vsDealerStats: { //发牌姬战绩
win: 0,
lose: 0,
total: 0
}
}
},
computed: {
......@@ -230,15 +237,38 @@ export default {
'username': this.user.username
}
// 获取VS发牌姬战绩
this.fetchVsDealerStats().then(vsDealerStats => {
this.vsDealerStats = vsDealerStats;
});
API.getUserInfo(opt).then((res) => {
this.user_info = res.data
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
// res)
});
},
methods: {
// VS发牌姬成绩
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
......
......@@ -26,7 +26,8 @@
<h3> <i class="glyphicon glyphicon-user"></i> <strong>{{username}}</strong></h3>
<!--<p class="text-nowrap text-muted" style="font-size:20px;">有妞不泡,大逆不道;遇妞则泡,替天行道。 </p>-->
<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" v-if="showActivity" style="font-size:20px;">{{activity.name}}首胜: {{activity.total}}/{{activity.max}} </p> -->
<p class="text-muted" style="font-size:20px;">VS发牌姬: 胜{{ vsDealerStats.win }}/负{{ vsDealerStats.lose }}/总{{ vsDealerStats.total }}</p>
</div>
</div>
</div>
......@@ -199,6 +200,11 @@
athletic_all: 0,
athletic_wl_ratio: 0,
arena_rank: 0
},
vsDealerStats: { //发牌姬战绩
win: 0,
lose: 0,
total: 0
}
}
},
......@@ -216,6 +222,11 @@
this.isMobile = true;
}
// 获取VS发牌姬战绩
this.fetchVsDealerStats().then(vsDealerStats => {
this.vsDealerStats = vsDealerStats;
});
},
watch: {
......@@ -233,6 +244,7 @@
window.onhashchange = this.init;
},
computed: {
...mapGetters({
lang: 'getLang',
......@@ -279,6 +291,22 @@
this.searchByUsername(username)
},
// VS发牌姬成绩
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;
}
},
renderPage: function () {
if (rankTable) {
rankTable.destroy();
......
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