Browse Source

接获取兑换列表的接口

milestone-20250820-金币兑换Token
no99 4 days ago
parent
commit
596d0775b3
  1. 15
      src/api/AIxiaocaishen.js
  2. 46
      src/views/homePage.vue

15
src/api/AIxiaocaishen.js

@ -303,3 +303,18 @@ export const clickRecordAPI = function (params) {
data: params,
});
};
// 8.18金币兑换Token start
export const showExchangeAPI = function (params) {
return request({
url: `http://192.168.1.22:8080/api/showExchange`,
method: "POST",
data: params,
headers: {
token: localStorage.getItem("localToken"),
},
});
};
// 8.18金币兑换Token end

46
src/views/homePage.vue

@ -2,7 +2,7 @@
//
import { ref, computed, onMounted, watch, nextTick, onUnmounted, h } from "vue";
import { setHeight } from "../utils/setHeight";
import { getUserCountAPI } from "../api/AIxiaocaishen";
import { getUserCountAPI, showExchangeAPI } from "../api/AIxiaocaishen";
import { ElMessage } from "element-plus";
import AIchat from "./AIchat.vue";
import AIfind from "./AIfind.vue";
@ -348,17 +348,6 @@ const showFeedback = () => {
}
};
//
// ref
const dialogVisible = ref(false);
//
const showCount = () => {
console.log("显示剩余次数");
//
dialogVisible.value = true;
console.log("dialogVisible 的值:", dialogVisible.value); //
};
//
const tabContentAIchat = ref(null);
@ -909,7 +898,10 @@ const userInfo = ref({
jwcode: "90042088",
img: " https://d31zlh4on95l9h.cloudfront.net/images/403ef762dd2f335df3b0c9e3fe488375.png",
});
const changeRule = ref("1金币=1Token");
const changeRule = ref({
gold:1,
token:1,
});
const changeLevelList = ref([
{ position: 10, calculatedPosition: 10 },
{ position: 20, calculatedPosition: 20 },
@ -922,12 +914,30 @@ const changeLevelList = ref([
const activeLevel = ref(
changeLevelList.value[0] || { position: 10, calculatedPosition: 10 }
);
const gold = ref(100);
const gold = ref(90);
//
// ref
const dialogVisible = ref(false);
const rechargeDialogVisible = ref(false);
const confirmDialogVisible = ref(false);
const changeSuccessDialogVisible = ref(false);
//
const showCount = async () => {
try {
const res = await showExchangeAPI();
changeLevelList.value = res.data;
activeLevel.value = changeLevelList.value[0];
changeRule.value.token=res.data[0].ratio;
//
dialogVisible.value = true;
console.log("dialogVisible 的值:", dialogVisible.value); //
} catch (e) {
console.error("获取兑换列表出错", e);
}
};
const chooseLevel = (item) => {
activeLevel.value = item;
};
@ -1317,7 +1327,8 @@ onUnmounted(() => {
<div class="changeJwcode">精网号{{ userInfo.jwcode }}</div>
</div>
</div>
<div class="changeRule">兑换规则{{ changeRule }}</div>
<div class="changeRule">兑换规则{{ changeRule.gold }}金币={{ changeRule.token }}Token</div>
</div>
<div class="changeLevel">
<div class="changeLevelTitle">兑换Token</div>
@ -1669,9 +1680,8 @@ body {
cursor: pointer;
}
.backToHomeBtn:hover{
.backToHomeBtn:hover {
transform: scale(1.05);
}
.backImg {

Loading…
Cancel
Save