diff --git a/src/api/AIxiaocaishen.js b/src/api/AIxiaocaishen.js index 92327aa..c1650ac 100644 --- a/src/api/AIxiaocaishen.js +++ b/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 \ No newline at end of file diff --git a/src/views/homePage.vue b/src/views/homePage.vue index b4b7433..ac61f56 100644 --- a/src/views/homePage.vue +++ b/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(() => {
精网号:{{ userInfo.jwcode }}
-
兑换规则:{{ changeRule }}
+
兑换规则:{{ changeRule.gold }}金币={{ changeRule.token }}Token
+
兑换Token
@@ -1669,9 +1680,8 @@ body { cursor: pointer; } -.backToHomeBtn:hover{ +.backToHomeBtn:hover { transform: scale(1.05); - } .backImg {