From c78175f93ba16684e9292bc08cc75e8f872120e9 Mon Sep 17 00:00:00 2001 From: lihui Date: Tue, 28 Oct 2025 17:47:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?add:=E5=AF=B9=E6=8E=A5=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=EF=BC=88=E9=83=A8=E5=88=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/member.js | 46 ++++ api/setting/general.js | 13 + api/setting/nextPwd.js | 16 ++ api/setting/password.js | 31 +++ pages/home/member.vue | 583 +++++++++++++++++++++++---------------------- pages/setting/account.vue | 27 ++- pages/setting/general.vue | 331 +++++++++++++------------ pages/setting/nextPwd.vue | 303 ++++++++++++----------- pages/setting/password.vue | 362 +++++++++++++++------------- utils/http.js | 7 +- 10 files changed, 969 insertions(+), 750 deletions(-) create mode 100644 api/member.js create mode 100644 api/setting/general.js create mode 100644 api/setting/nextPwd.js create mode 100644 api/setting/password.js diff --git a/api/member.js b/api/member.js new file mode 100644 index 0000000..257801c --- /dev/null +++ b/api/member.js @@ -0,0 +1,46 @@ +import util from '../common/util.js' + +/*export const getUserInfo = (data = {}) => { + return util.request( + '/api/my/userInfo', + (res) => { + console.log('用户信息请求成功:', res); + }, + {data}, + + (err) => { + console.log('用户信息请求失败:', err); + } + ); +}; +*/ + +import { http } from '../utils/http' + + +/** + * 用户信息获取接口 + * @param data + * @returns {Promise} + */ +export const getUserInfo = (data) => { + return http({ + method: 'POST', + url: '/api/my/userInfo', + data: + data + , + }) +} + + + + + + + + + + + + diff --git a/api/setting/general.js b/api/setting/general.js new file mode 100644 index 0000000..ea0a395 --- /dev/null +++ b/api/setting/general.js @@ -0,0 +1,13 @@ +import { http } from '../utils/http' + + + +export const getSetting = (data) => { + return http({ + method: 'POST', + url: '/api/my/getSetting', + data: + data + , + }) +} diff --git a/api/setting/nextPwd.js b/api/setting/nextPwd.js new file mode 100644 index 0000000..3508c99 --- /dev/null +++ b/api/setting/nextPwd.js @@ -0,0 +1,16 @@ +import {http} from '../../utils/http' + +/** + * 修改密码 + * @param data + * @returns {*} + */ +export const updatePassword = (data) => { + return http({ + method: 'POST', + url: '/api/my/updatePassword', + data: + data + , + }) +} diff --git a/api/setting/password.js b/api/setting/password.js new file mode 100644 index 0000000..daf81f2 --- /dev/null +++ b/api/setting/password.js @@ -0,0 +1,31 @@ +import {http} from '../../utils/http' + +/** + * 验证码发送 + * @param data + * @returns {*} + */ +export const sendEmail = (data) => { + return http({ + method: 'POST', + url: '/UserLogin/sendEmail', + data: + data + , + }) +} + +/** + * 验证码验证 + * @param data + * @returns {*} + */ +export const validateCode = (data) => { + return http({ + method: 'POST', + url: '/api/my/validateCode', + data: + data + , + }) +} diff --git a/pages/home/member.vue b/pages/home/member.vue index 4805ac3..8de12f4 100644 --- a/pages/home/member.vue +++ b/pages/home/member.vue @@ -1,294 +1,305 @@ \ No newline at end of file diff --git a/pages/setting/account.vue b/pages/setting/account.vue index 5dd5a60..1c1607a 100644 --- a/pages/setting/account.vue +++ b/pages/setting/account.vue @@ -15,21 +15,21 @@ 昵称 - DeepChart + {{userInfoRes.dcname}} ID - {{ jwcode }} + {{ userInfoRes.dccode }} 密码 - qwertyuiop + {{userInfoRes.password}} @@ -71,10 +71,27 @@ ref, onMounted } from 'vue' + import {getUserInfo} from "@/api/member"; const iSMT = ref(0) - const jwcode = ref('90047681') + // const dccode = ref('') + const userInfoRes = ref({}) const showLogout = ref(false) - + + const userInfoPromise = getUserInfo() + userInfoPromise.then(res => { + if (res.code === 200){ + userInfoRes.value.dccode = res.data.dccode; + userInfoRes.value.dcname = res.data.dcname; + userInfoRes.value.password = res.data.password; + console.log('用户信息', res.data) + }else{ + uni.showToast({ + title: '用户信息请求失败', + icon: 'none', + }) + } + + }) const handleConfirmLogout = () => { showLogout.value = false uni.showToast({ diff --git a/pages/setting/general.vue b/pages/setting/general.vue index cbf21c0..a9a5931 100644 --- a/pages/setting/general.vue +++ b/pages/setting/general.vue @@ -1,165 +1,182 @@ \ No newline at end of file diff --git a/pages/setting/nextPwd.vue b/pages/setting/nextPwd.vue index e55d771..7d410d5 100644 --- a/pages/setting/nextPwd.vue +++ b/pages/setting/nextPwd.vue @@ -1,144 +1,175 @@ \ No newline at end of file diff --git a/pages/setting/password.vue b/pages/setting/password.vue index fec980a..6425aec 100644 --- a/pages/setting/password.vue +++ b/pages/setting/password.vue @@ -1,171 +1,207 @@ \ No newline at end of file diff --git a/utils/http.js b/utils/http.js index a446baf..724ebd6 100644 --- a/utils/http.js +++ b/utils/http.js @@ -1,6 +1,7 @@ import { useUserStore } from "../stores/modules/userInfo" -const baseURL = "https://hwjb.homilychart.com/testApi" +// const baseURL = "https://hwjb.homilychart.com/testApi" +const baseURL = "http://192.168.40.8:9000" const httpInterceptor = { @@ -39,8 +40,8 @@ const httpInterceptor = { //4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致 const memberStore = useUserStore() // const token = memberStore.userInfo?.token || options.data?.token - options.header.token = '790750702588f1ea79f24dc56ccd5d8a' - const token = '790750702588f1ea79f24dc56ccd5d8a' + options.header.token = '1' + const token = '1' if (token) { options.header.token = token } From e200fea054087a648ab7232108ffdf0c7f2a6340 Mon Sep 17 00:00:00 2001 From: lihuilin Date: Wed, 29 Oct 2025 17:36:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/member.js | 33 ++-- api/setting/general.js | 6 +- api/setting/password.js | 44 +++-- package-lock.json | 2 + package.json | 6 +- pages.json | 7 + pages/home/member.vue | 6 +- pages/setting/account.vue | 83 +++++---- pages/setting/createPwd.vue | 245 +++++++++++++++++++++++++ pages/setting/email.vue | 59 +++++- pages/setting/font.vue | 38 +++- pages/setting/general.vue | 30 +-- pages/setting/introduce.vue | 2 +- pages/setting/market.vue | 1 + pages/setting/message.vue | 11 +- pages/setting/password.vue | 436 ++++++++++++++++++++++++-------------------- pages/setting/phone.vue | 54 +++++- pages/setting/push.vue | 50 +++-- pages/setting/server.vue | 23 +++ pages/setting/theme.vue | 21 +++ utils/http.js | 7 +- vue.config.js | 16 +- 22 files changed, 827 insertions(+), 353 deletions(-) create mode 100644 pages/setting/createPwd.vue diff --git a/api/member.js b/api/member.js index 257801c..58dd7fc 100644 --- a/api/member.js +++ b/api/member.js @@ -15,7 +15,9 @@ import util from '../common/util.js' }; */ -import { http } from '../utils/http' +import { + http +} from '../utils/http' /** @@ -24,23 +26,12 @@ import { http } from '../utils/http' * @returns {Promise} */ export const getUserInfo = (data) => { - return http({ - method: 'POST', - url: '/api/my/userInfo', - data: - data - , - }) -} - - - - - - - - - - - - + return http({ + method: 'POST', + url: '/api/my/userInfo', + data: data, + header:{ + token:'014de5283d2930af6481ede591afd087' + } + }) +} \ No newline at end of file diff --git a/api/setting/general.js b/api/setting/general.js index ea0a395..d5e45d1 100644 --- a/api/setting/general.js +++ b/api/setting/general.js @@ -1,4 +1,4 @@ -import { http } from '../utils/http' +import { http } from '../../utils/http' @@ -6,8 +6,6 @@ export const getSetting = (data) => { return http({ method: 'POST', url: '/api/my/getSetting', - data: - data - , + data: data, }) } diff --git a/api/setting/password.js b/api/setting/password.js index daf81f2..e175656 100644 --- a/api/setting/password.js +++ b/api/setting/password.js @@ -1,4 +1,6 @@ -import {http} from '../../utils/http' +import { + http +} from '../../utils/http' /** * 验证码发送 @@ -6,13 +8,11 @@ import {http} from '../../utils/http' * @returns {*} */ export const sendEmail = (data) => { - return http({ - method: 'POST', - url: '/UserLogin/sendEmail', - data: - data - , - }) + return http({ + method: 'POST', + url: '/UserLogin/sendEmail', + data: data, + }) } /** @@ -21,11 +21,25 @@ export const sendEmail = (data) => { * @returns {*} */ export const validateCode = (data) => { - return http({ - method: 'POST', - url: '/api/my/validateCode', - data: - data - , - }) + return http({ + method: 'POST', + url: '/api/my/validateCode', + data: data, + }) } + +export const sendPhone = (data) => { + return http({ + method: 'POST', + url: '/UserLogin/sendPhone', + data: data, + }) +} + +export const changeBind = (data) => { + return http({ + method: 'POST', + url: '/api/my/bindEmailOrPhone', + data: data, + }) +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 310d170..48bcede 100644 --- a/package-lock.json +++ b/package-lock.json @@ -598,6 +598,8 @@ }, "node_modules/pinia-plugin-persistedstate": { "version": "4.5.0", + "resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-4.5.0.tgz", + "integrity": "sha512-QTkP1xJVyCdr2I2p3AKUZM84/e+IS+HktRxKGAIuDzkyaKKV48mQcYkJFVVDuvTxlI5j6X3oZObpqoVB8JnWpw==", "license": "MIT", "dependencies": { "deep-pick-omit": "^1.2.1", diff --git a/package.json b/package.json index 6f2aeb3..ba80520 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,9 @@ "@dcloudio/uni-ui": "^1.5.11", "@element-plus/icons-vue": "^2.3.2", "element-plus": "^2.11.5", - "vue-i18n": "^9.14.5", "marked": "^2.0.1", "pinia": "^3.0.3", - "pinia-plugin-persistedstate": "^4.5.0" + "pinia-plugin-persistedstate": "^4.5.0", + "vue-i18n": "^9.14.5" } - - } diff --git a/pages.json b/pages.json index b341734..7099984 100644 --- a/pages.json +++ b/pages.json @@ -266,6 +266,13 @@ "navigationBarTitleText" : "行情", "navigationStyle": "custom" } + }, + { + "path" : "pages/setting/createPwd", + "style" : + { + "navigationBarTitleText" : "创建密码" + } } ], "globalStyle": { diff --git a/pages/home/member.vue b/pages/home/member.vue index 8de12f4..af72e68 100644 --- a/pages/home/member.vue +++ b/pages/home/member.vue @@ -79,19 +79,19 @@ import { ArrowRight } from '@element-plus/icons-vue' import footerBar from '../../components/footerBar.vue' -import {getUserInfo} from "@/api/member"; +import {getUserInfo} from "@/api/member" const type = ref('member') const iSMT = ref(0) const username = ref('') const dccode = ref('') -const userInfoRes = ref() +const userInfoRes = ref()// 用户身份信息 userInfoRes.value = getUserInfo() userInfoRes.value.then(res => { username.value = res.data.username dccode.value = res.data.dccode - console.log('用户信息', res.data) + console.log('用户信息', userInfoRes.value) }) diff --git a/pages/setting/account.vue b/pages/setting/account.vue index 1c1607a..710b4ec 100644 --- a/pages/setting/account.vue +++ b/pages/setting/account.vue @@ -9,41 +9,37 @@ 头像 - + 昵称 {{userInfoRes.dcname}} - + ID {{ userInfoRes.dccode }} - - - - - 密码 - - {{userInfoRes.password}} - - 修改密码 - + + + + 注销账号 - + 绑定账号 - + @@ -71,27 +67,28 @@ ref, onMounted } from 'vue' - import {getUserInfo} from "@/api/member"; + import { + getUserInfo + } from "@/api/member"; const iSMT = ref(0) // const dccode = ref('') - const userInfoRes = ref({}) + const userInfoRes = ref({}) const showLogout = ref(false) - const userInfoPromise = getUserInfo() - userInfoPromise.then(res => { - if (res.code === 200){ - userInfoRes.value.dccode = res.data.dccode; - userInfoRes.value.dcname = res.data.dcname; - userInfoRes.value.password = res.data.password; - console.log('用户信息', res.data) - }else{ - uni.showToast({ - title: '用户信息请求失败', - icon: 'none', - }) - } - - }) + const userInfoPromise = getUserInfo() + userInfoPromise.then(res => { + if (res.code === 200) { + userInfoRes.value.dccode = res.data.dccode; + userInfoRes.value.dcname = res.data.dcname; + userInfoRes.value.hasPwd = res.data.hasPassword; + console.log('用户信息', userInfoRes.value) + } else { + uni.showToast({ + title: '用户信息请求失败', + icon: 'none', + }) + } + }) const handleConfirmLogout = () => { showLogout.value = false uni.showToast({ @@ -99,17 +96,23 @@ icon: 'none', }) } - - const goToBind = () =>{ + + const goToBind = () => { uni.navigateTo({ - url:'../setting/bind' + url: '../setting/bind' }) } - - const goToPassword = () =>{ - uni.navigateTo({ - url:'../setting/password' - }) + + const goToPassword = () => { + if (userInfoRes.value.hasPwd === 0) { + uni.navigateTo({ + url: '../setting/createPwd' + }) + } else { + uni.navigateTo({ + url: '../setting/password' + }) + } } onMounted(() => { @@ -119,7 +122,7 @@ \ No newline at end of file diff --git a/pages/setting/email.vue b/pages/setting/email.vue index b3016f6..cc39b5b 100644 --- a/pages/setting/email.vue +++ b/pages/setting/email.vue @@ -15,11 +15,10 @@ - +86 - + - @@ -35,7 +34,7 @@ - + @@ -45,23 +44,67 @@ ref, onMounted } from 'vue' + import { + getUserInfo + } from "@/api/member" + import { + sendEmail, + changeBind + } from "@/api/setting/password" const iSMT = ref(0) - const email = ref('analsak@16.com') + const email = ref('') const gettingCode = ref(false) const time = ref(60) + const userEmail = ref('') + + const userInfoPromise = getUserInfo() + userInfoPromise.then(res => { + if (res.code === 200) { + console.log('个人信息', res.data) + email.value = res.data.email + } else { + uni.showToast({ + title: '用户信息请求失败', + icon: 'none', + }) + } + }) - const getVerification = () => { + const changeAccount = () => { + const res = changeBind({ + verificateType: 0, + account: userEmail.value + }) + if(res.code === 200){ + uni.showToast({ + title: '绑定成功', + icon: 'none', + }) + }else { + uni.showToast({ + title: '用户绑定失败', + icon: 'none', + }) + } + } + + const getCode = () => { if (gettingCode.value) return gettingCode.value = true - time.value = 60 + time.value = 2 + const timer = setInterval(() => { time.value-- if (time.value <= 0) { clearInterval(timer) gettingCode.value = false + time.value = 2 } }, 1000) + sendEmail({ + email: userEmail.value + }) } onMounted(() => { @@ -131,7 +174,7 @@ .change-btn { height: 85rpx; width: 610rpx; - padding:0 20rpx; + padding: 0 20rpx; background-color: black; color: white; border-radius: 40rpx; diff --git a/pages/setting/font.vue b/pages/setting/font.vue index 357739f..cd3efaf 100644 --- a/pages/setting/font.vue +++ b/pages/setting/font.vue @@ -4,18 +4,18 @@ 标准 - + 中号 - + 大号 - + @@ -26,17 +26,39 @@ ref, onMounted } from 'vue' + import { + getSetting + } from "@/api/setting/general" const iSMT = ref(0) const selectedIndex = ref(0) + const getFont = async () => { + try { + const res = await getSetting() + if (res.code === 200) { + const fontSize = res.data.fontSize + const sizeMap = { + small: 0, + medium: 1, + large: 2 + } + console.log('看看字体', res.data.fontSize) + selectedIndex.value = sizeMap[fontSize] ?? 0; + } + } catch (err) { + console.error("获取字体设置失败:", err); + } + } + const selectFont = (index) => { selectedIndex.value = index - console.log('看看选中状态',selectedIndex.value) + console.log('看看选中状态', selectedIndex.value) } onMounted(() => { // 状态栏高度 iSMT.value = uni.getSystemInfoSync().statusBarHeight; console.log('看看高度', iSMT.value) + getFont() }) @@ -53,7 +75,7 @@ display: flex; align-items: center; margin: 0 40rpx; - padding:0 10rpx; + padding: 0 10rpx; border-bottom: 1rpx solid #eee; } diff --git a/pages/setting/general.vue b/pages/setting/general.vue index a9a5931..d60d59d 100644 --- a/pages/setting/general.vue +++ b/pages/setting/general.vue @@ -3,37 +3,37 @@ - 语言 + 语言 {{settingRes.language}} - + - 字体大小 - + 字体大小 + - 主题切换 - + 主题切换 + - 消息推送 - + 消息推送 + - 切换服务器 - + 切换服务器 + - 清理缓存 + 清理缓存 {{ cache }}M - + @@ -171,7 +171,6 @@ onMounted(() => { } .cache { - margin-left: 55%; font-size: 14px; color: rgb(203, 203, 203); } @@ -179,4 +178,9 @@ onMounted(() => { .bottom-list:last-child { border-bottom: none; } + +.label{ + flex:1; + font-size:28rpx; +} \ No newline at end of file diff --git a/pages/setting/introduce.vue b/pages/setting/introduce.vue index ff98778..6a5d07a 100644 --- a/pages/setting/introduce.vue +++ b/pages/setting/introduce.vue @@ -13,7 +13,7 @@ 的品牌标签(DeepChart=全球最懂机构行为的AI),主打"深度解读机构行为"的APP。 2.产品介绍 - DeepChart是一款以"Al智能体”为决策核心的智能投资分析平台, + DeepChart是一款以"Al智能体"为决策核心的智能投资分析平台, 专注于深度研究机构行为,专为全球散户投资者量身打造。它重新定义了人与投资工具之间的关系, 是一个真正懂投资、懂市场、更懂用户的AI投资伙伴。 diff --git a/pages/setting/market.vue b/pages/setting/market.vue index f25dcf7..170b3cb 100644 --- a/pages/setting/market.vue +++ b/pages/setting/market.vue @@ -206,6 +206,7 @@ .indicator-text { font-size: 28rpx; + flex:1; } .indicator-icons { diff --git a/pages/setting/message.vue b/pages/setting/message.vue index b40720b..e600648 100644 --- a/pages/setting/message.vue +++ b/pages/setting/message.vue @@ -3,10 +3,10 @@ - 语言 + 消息推送 通知已开启 通知未开启 - + @@ -51,12 +51,11 @@ } .message { - margin-left: 60%; font-size: 14px; color: rgb(203, 203, 203); } - - .arrow { - margin-left: auto; + + .text{ + flex:1; } \ No newline at end of file diff --git a/pages/setting/password.vue b/pages/setting/password.vue index 6425aec..f2db2fd 100644 --- a/pages/setting/password.vue +++ b/pages/setting/password.vue @@ -1,207 +1,245 @@ \ No newline at end of file diff --git a/pages/setting/phone.vue b/pages/setting/phone.vue index c33bddb..a74c916 100644 --- a/pages/setting/phone.vue +++ b/pages/setting/phone.vue @@ -11,15 +11,14 @@ 已绑手机号:{{ phone }} - +86 - + - @@ -35,7 +34,7 @@ - + @@ -45,12 +44,34 @@ ref, onMounted } from 'vue' + import { + sendPhone, + changeBind + } from "@/api/setting/password" + import { + getUserInfo + } from "@/api/member" + const iSMT = ref(0) - const phone = ref('15105421566') + const phone = ref('') const gettingCode = ref(false) const time = ref(60) + const userPhone = ref('') + + const userInfoPromise = getUserInfo() + userInfoPromise.then(res => { + if (res.code === 200) { + console.log('个人信息', res.data) + phone.value = res.data.phone + } else { + uni.showToast({ + title: '用户信息请求失败', + icon: 'none', + }) + } + }) - const getVerification = () => { + const getCode = () => { if (gettingCode.value) return gettingCode.value = true @@ -63,6 +84,27 @@ gettingCode.value = false } }, 1000) + sendPhone({ + phone: userPhone.value + }) + } + + const changeAccount = () => { + const res = changeBind({ + verificateType: 1, + account: userPhone.value + }) + if(res.code === 200){ + uni.showToast({ + title: '绑定成功', + icon: 'none', + }) + }else { + uni.showToast({ + title: '用户绑定失败', + icon: 'none', + }) + } } onMounted(() => { diff --git a/pages/setting/push.vue b/pages/setting/push.vue index 2aaecf4..9ab36c1 100644 --- a/pages/setting/push.vue +++ b/pages/setting/push.vue @@ -3,25 +3,35 @@ - 公共消息 - 重大咨询、财经要闻等系统提醒 - + 公共消息 + + 重大咨询、财经要闻等系统提醒 + + - 字体大小 - + 指标消息提醒 + + 所有指标消息的提醒 + + - 盯盘预警 - + 盯盘预警 + + 自选股预警和个性化预警设置 + + - 订阅服务 - 45.5M - + 订阅服务 + + 订阅你感兴趣的专题服务 + + @@ -53,7 +63,6 @@ height: 7vh; display: flex; align-items: center; - justify-content: center; margin: 0 40rpx; padding: 0 10rpx; border-bottom: 1rpx solid #eee; @@ -63,25 +72,24 @@ border-bottom: none; } + .right { + display: flex; + align-items: center; + gap: 10rpx; + } + .switch-btn { - width: 100rpx; transform: scale(0.6); transform-origin: center right; } .public { - width: 450rpx; - margin-left: auto; font-size: 10px; color: rgb(203, 203, 203); } - .arrow { - margin-left: auto; - } - .bottom { - height: 13.5vh; + height: 14vh; background-color: white; margin-top: 1vh; } @@ -105,4 +113,8 @@ .bottom-list:last-child { border-bottom: none; } + + .label { + flex: 1; + } \ No newline at end of file diff --git a/pages/setting/server.vue b/pages/setting/server.vue index 044d6aa..9524cfc 100644 --- a/pages/setting/server.vue +++ b/pages/setting/server.vue @@ -26,9 +26,31 @@ ref, onMounted } from 'vue' + import { + getSetting + } from "@/api/setting/general" + const iSMT = ref(0) const selectedIndex = ref(0) + const getServer = async () => { + try { + const res = await getSetting() + if (res.code === 200) { + const fontSize = res.data.fontSize + const sizeMap = { + 'auto': 0, + 'singapore': 1, + 'hongkong': 2 + } + console.log('看看服务器', res.data.fontSize) + selectedIndex.value = sizeMap[fontSize] ?? 0; + } + } catch (err) { + console.error("获取服务器设置失败:", err); + } + } + const selectFont = (index) => { selectedIndex.value = index console.log('看看选中状态',selectedIndex.value) @@ -38,6 +60,7 @@ // 状态栏高度 iSMT.value = uni.getSystemInfoSync().statusBarHeight; console.log('看看高度', iSMT.value) + getServer() }) diff --git a/pages/setting/theme.vue b/pages/setting/theme.vue index 3752eab..43573d9 100644 --- a/pages/setting/theme.vue +++ b/pages/setting/theme.vue @@ -21,8 +21,28 @@ ref, onMounted } from 'vue' + import { + getSetting + } from "@/api/setting/general" const iSMT = ref(0) const selectedIndex = ref(0) + + const getTheme = async () => { + try { + const res = await getSetting() + if (res.code === 200) { + const theme = res.data.theme + const sizeMap = { + 'light': 0, + 'dark': 1 + } + console.log('看看主题', res.data.theme) + selectedIndex.value = sizeMap[theme] ?? 0; + } + } catch (err) { + console.error("获取主题设置失败:", err); + } + } const selectFont = (index) => { selectedIndex.value = index @@ -32,6 +52,7 @@ // 状态栏高度 iSMT.value = uni.getSystemInfoSync().statusBarHeight; console.log('看看高度', iSMT.value) + getTheme() }) diff --git a/utils/http.js b/utils/http.js index 724ebd6..7d5c9b3 100644 --- a/utils/http.js +++ b/utils/http.js @@ -35,13 +35,14 @@ const httpInterceptor = { 'content-type': 'application/json', // 'contentType': 'application/json', 'version': '1', - 'client': client + 'client': client, + 'deviceId':'1' } //4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致 const memberStore = useUserStore() // const token = memberStore.userInfo?.token || options.data?.token - options.header.token = '1' - const token = '1' + options.header.token = '9cd87893b9282b6a7a6cc9b780c905db' + const token = '9cd87893b9282b6a7a6cc9b780c905db' if (token) { options.header.token = token } diff --git a/vue.config.js b/vue.config.js index 76eaa5d..0345309 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,14 +1,24 @@ module.exports = { devServer: { - proxy: { + /* proxy: { '/api': { // 你的目标服务器的请求路径前缀 target: 'https://hwjb.homilychart.com', // 目标服务器的地址 changeOrigin: true, // 是否跨域 secure: false, // 如果是https接口,需要配置这个参数 pathRewrite: { - '^/': '/testApi' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源 + '^/api': '' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源 } } - } + } */ + proxy: { + '/api': { // 你的目标服务器的请求路径前缀 + target: 'http://192.168.40.8:9000', // 目标服务器的地址 + changeOrigin: true, // 是否跨域 + secure: false, // 如果是https接口,需要配置这个参数 + pathRewrite: { + '^/api': '' // 将 /api 替换为 /testApi,以便正确请求目标服务器的资源 + } + } + } } } \ No newline at end of file