diff --git a/api/home/mySelections.js b/api/home/mySelections.js
new file mode 100644
index 0000000..6801ebc
--- /dev/null
+++ b/api/home/mySelections.js
@@ -0,0 +1,185 @@
+/**
+ * 我的自选股相关API接口封装
+ * 使用utils/http.js中的拦截器封装请求方法
+ */
+
+import { http } from '../../utils/http.js'
+
+/**
+ * 我的自选股API接口类
+ */
+class MySelectionsAPI {
+
+ /**
+ * 判断用户是否存在自选股分组
+ * @param {Function} successCallback - 成功回调函数
+ * @param {Function} failCallback - 失败回调函数
+ * @param {Object} data - 请求参数
+ * @returns {Promise}
+ */
+ static async checkExist(successCallback, failCallback = null, data = {}) {
+ const url = '/api/homePage/userStock/checkExist'
+
+ try {
+ const response = await http({
+ url: url,
+ method: 'POST',
+ data: data
+ })
+
+ console.log('检查用户自选股分组存在性 - 响应:', response)
+ if (successCallback && typeof successCallback === 'function') {
+ successCallback(response)
+ }
+ return response
+ } catch (error) {
+ console.error('检查用户自选股分组存在性 - 失败:', error)
+ if (failCallback && typeof failCallback === 'function') {
+ failCallback(error)
+ }
+ throw error
+ }
+ }
+
+ /**
+ * 查询用户所有自选股分组
+ * @param {Function} successCallback - 成功回调函数
+ * @param {Function} failCallback - 失败回调函数
+ * @param {Object} data - 请求参数
+ * @returns {Promise}
+ */
+ static async getUserStockGroupList(successCallback, failCallback = null, data = {}) {
+ const url = '/api/homePage/userStockGroup/list'
+
+ try {
+ const response = await http({
+ url: url,
+ method: 'POST',
+ data: data
+ })
+
+ console.log('查询用户自选股分组列表 - 响应:', response)
+ if (successCallback && typeof successCallback === 'function') {
+ successCallback(response)
+ }
+ return response
+ } catch (error) {
+ console.error('查询用户自选股分组列表 - 失败:', error)
+ if (failCallback && typeof failCallback === 'function') {
+ failCallback(error)
+ }
+ throw error
+ }
+ }
+
+ /**
+ * 分页查询某一个分组下的所有自选股
+ * @param {Function} successCallback - 成功回调函数
+ * @param {Function} failCallback - 失败回调函数
+ * @param {Object} data - 请求参数 {groupId, pageNum, pageSize, ...}
+ * @returns {Promise}
+ */
+ static async getUserStockList(successCallback, failCallback = null, data = {}) {
+ const url = '/api/homePage/userStock/list'
+
+ // 设置默认分页参数
+ const requestData = {
+ pageNum: 1,
+ pageSize: 20,
+ ...data
+ }
+
+ try {
+ const response = await http({
+ url: url,
+ method: 'POST',
+ data: requestData
+ })
+
+ console.log('分页查询分组自选股 - 响应:', response)
+ if (successCallback && typeof successCallback === 'function') {
+ successCallback(response)
+ }
+ return response
+ } catch (error) {
+ console.error('分页查询分组自选股 - 失败:', error)
+ if (failCallback && typeof failCallback === 'function') {
+ failCallback(error)
+ }
+ throw error
+ }
+ }
+
+ /**
+ * 查询默认自选股
+ * @param {Function} successCallback - 成功回调函数
+ * @param {Function} failCallback - 失败回调函数
+ * @param {Object} data - 请求参数
+ * @returns {Promise}
+ */
+ static async getUserOrDefault(successCallback, failCallback = null, data = {}) {
+ const url = '/api/homePage/userStock/getUserOrDefault'
+
+ try {
+ const response = await http({
+ url: url,
+ method: 'POST',
+ data: data
+ })
+
+ console.log('查询默认自选股 - 响应:', response)
+ if (successCallback && typeof successCallback === 'function') {
+ successCallback(response)
+ }
+ return response
+ } catch (error) {
+ console.error('查询默认自选股 - 失败:', error)
+ if (failCallback && typeof failCallback === 'function') {
+ failCallback(error)
+ }
+ throw error
+ }
+ }
+
+ /**
+ * 游客查询默认自选股
+ * @param {Function} successCallback - 成功回调函数
+ * @param {Function} failCallback - 失败回调函数
+ * @returns {Promise}
+ */
+ static async getDefaultStocks(successCallback, failCallback = null) {
+ const url = '/api/homePage/userStock/getDefaultStocks'
+
+ try {
+ const response = await http({
+ url: url,
+ method: 'POST',
+ data: {}
+ })
+
+ console.log('游客查询默认自选股 - 响应:', response)
+ if (successCallback && typeof successCallback === 'function') {
+ successCallback(response)
+ }
+ return response
+ } catch (error) {
+ console.error('游客查询默认自选股 - 失败:', error)
+ if (failCallback && typeof failCallback === 'function') {
+ failCallback(error)
+ }
+ throw error
+ }
+ }
+}
+
+// 导出API类
+export default MySelectionsAPI
+
+// 也可以导出单个方法供直接使用
+export const {
+ checkExist,
+ getUserStockGroupList,
+ getUserStockList,
+ getUserOrDefault,
+ getDefaultStocks
+} = MySelectionsAPI
\ No newline at end of file
diff --git a/api/marketSituation/marketSituation.js b/api/marketSituation/marketSituation.js
new file mode 100644
index 0000000..9452062
--- /dev/null
+++ b/api/marketSituation/marketSituation.js
@@ -0,0 +1,70 @@
+/** @format */
+
+import { http } from "../../utils/http";
+
+export const getData = () => {
+ return http({
+ method: "GET",
+ url: "/ka",
+ });
+};
+
+/**
+ * 获取全球指数
+ * POST /api/global/getGlobalIndex
+ */
+export const getGlobalIndexAPI = (data) => {
+ return http({
+ method: "POST",
+ url: "/api/global/getGlobalIndex",
+ data,
+ });
+};
+
+/**
+ * 获取地区分组列表
+ * POST /api/global/regionalGroup
+ */
+export const getRegionalGroupAPI = (data) => {
+ return http({
+ method: "POST",
+ url: "/api/global/regionalGroup",
+ data,
+ });
+};
+
+/**
+ * 获取地区详情
+ * POST /api/global/regionalGroupList
+ */
+export const getRegionalGroupListAPI = (data) => {
+ return http({
+ method: "POST",
+ url: "/api/global/regionalGroupList",
+ data,
+ });
+};
+
+/**
+ * 一次性查询所有Tab栏父子结构
+ * POST /api/homework/tab/getAll
+ */
+export const getAllTabsAPI = (data) => {
+ return http({
+ method: "POST",
+ url: "/api/homework/tab/getAll",
+ data,
+ });
+};
+
+/**
+ * 通用市场数据分页查询接口(默认1页20条)
+ * POST /api/market/data/page/query
+ */
+export const queryStockDataAPI = (data) => {
+ return http({
+ method: "POST",
+ url: "/api/market/data/page/query",
+ data,
+ });
+};
diff --git a/components/IndexCard.vue b/components/IndexCard.vue
index 24d0e7e..ad1ae69 100644
--- a/components/IndexCard.vue
+++ b/components/IndexCard.vue
@@ -1,190 +1,220 @@
+
+
-
-
-
-
- {{ currentPrice }}
-
- {{ changeAmount }}
- {{ changePercent }}
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ currentPrice }}
+
+ {{ changeAmount }}
+ {{ changePercent }}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
+
diff --git a/components/login-prompt.vue b/components/login-prompt.vue
index cb13c61..23dd653 100644
--- a/components/login-prompt.vue
+++ b/components/login-prompt.vue
@@ -106,6 +106,11 @@ const continueAsVisitor = async () => {
userStore.setUserInfo(res.data);
console.log("0loginStore.loginInfo", loginStore.loginInfo);
hide();
+
+ // 发送游客登录成功事件,通知首页重新加载
+ uni.$emit('visitorLoginSuccess', {
+ userInfo: res.data
+ });
}
};
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 92f54cf..466b9b0 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -2,7 +2,8 @@
-
+
+