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 @@ ...@@ -8,8 +8,9 @@
<div class="caption"> <div class="caption">
<h3><i class="glyphicon glyphicon-user"></i> <strong>{{ user.username }}</strong></h3> <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" style="font-size:20px;">今日首胜: {{ activity.today }}/1 </p>
<p class="text-muted" v-if="showActivity" style="font-size:20px;">{{ activity.name }}首胜: <!-- <p class="text-muted" v-if="showActivity" style="font-size:20px;">{{ activity.name }}首胜:
{{ activity.total }}/{{ activity.max }} </p> {{ activity.total }}/{{ activity.max }} </p> -->
<p class="text-muted" style="font-size:20px;">VS发牌姬:胜{{ vsDealerStats.win }}/负{{ vsDealerStats.lose }}/总{{ vsDealerStats.total }}</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -158,6 +159,7 @@ import API from '../api' ...@@ -158,6 +159,7 @@ import API from '../api'
import {mapGetters} from 'vuex' import {mapGetters} from 'vuex'
import moment from 'moment' import moment from 'moment'
import tb_language from './tb_lang.js' import tb_language from './tb_lang.js'
import Vue from 'vue';
var rankTable; var rankTable;
...@@ -191,6 +193,11 @@ export default { ...@@ -191,6 +193,11 @@ export default {
athletic_wl_ratio: 0, athletic_wl_ratio: 0,
arena_rank: 0 arena_rank: 0
}, },
vsDealerStats: { //发牌姬战绩
win: 0,
lose: 0,
total: 0
}
} }
}, },
computed: { computed: {
...@@ -230,15 +237,38 @@ export default { ...@@ -230,15 +237,38 @@ export default {
'username': this.user.username 'username': this.user.username
} }
// 获取VS发牌姬战绩
this.fetchVsDealerStats().then(vsDealerStats => {
this.vsDealerStats = vsDealerStats;
});
API.getUserInfo(opt).then((res) => { API.getUserInfo(opt).then((res) => {
this.user_info = res.data this.user_info = res.data
// console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d', // console.log('%c ---------------------src' + '\\' + 'components' + '\\' + 'Profile.vue---------------------%c:219', 'background:#ed162b', 'background:#7d382d',
// res) // res)
}); });
}, },
methods: { 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) { exchangeUserInfo(info) {
let userName = this.user.username let userName = this.user.username
let exchangeInfo = info let exchangeInfo = info
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
<h3> <i class="glyphicon glyphicon-user"></i> <strong>{{username}}</strong></h3> <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-nowrap text-muted" style="font-size:20px;">有妞不泡,大逆不道;遇妞则泡,替天行道。 </p>-->
<p class="text-muted" style="font-size:20px;">今日首胜: {{activity.today}}/1 </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> </div>
</div> </div>
...@@ -199,6 +200,11 @@ ...@@ -199,6 +200,11 @@
athletic_all: 0, athletic_all: 0,
athletic_wl_ratio: 0, athletic_wl_ratio: 0,
arena_rank: 0 arena_rank: 0
},
vsDealerStats: { //发牌姬战绩
win: 0,
lose: 0,
total: 0
} }
} }
}, },
...@@ -216,6 +222,11 @@ ...@@ -216,6 +222,11 @@
this.isMobile = true; this.isMobile = true;
} }
// 获取VS发牌姬战绩
this.fetchVsDealerStats().then(vsDealerStats => {
this.vsDealerStats = vsDealerStats;
});
}, },
watch: { watch: {
...@@ -233,6 +244,7 @@ ...@@ -233,6 +244,7 @@
window.onhashchange = this.init; window.onhashchange = this.init;
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
lang: 'getLang', lang: 'getLang',
...@@ -279,6 +291,22 @@ ...@@ -279,6 +291,22 @@
this.searchByUsername(username) 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 () { renderPage: function () {
if (rankTable) { if (rankTable) {
rankTable.destroy(); 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