diff --git a/api/member.js b/api/member.js new file mode 100644 index 0000000..58dd7fc --- /dev/null +++ b/api/member.js @@ -0,0 +1,37 @@ +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, + header:{ + token:'014de5283d2930af6481ede591afd087' + } + }) +} \ No newline at end of file diff --git a/api/setting/general.js b/api/setting/general.js new file mode 100644 index 0000000..d5e45d1 --- /dev/null +++ b/api/setting/general.js @@ -0,0 +1,11 @@ +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..e175656 --- /dev/null +++ b/api/setting/password.js @@ -0,0 +1,45 @@ +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, + }) +} + +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 0af07b3..8fb591c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -608,6 +608,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/pages.json b/pages.json index 125617a..299278f 100644 --- a/pages.json +++ b/pages.json @@ -298,6 +298,13 @@ "style" : { "navigationBarTitleText": "选股策略" + } + }, + { + "path" : "pages/setting/createPwd", + "style" : + { + "navigationBarTitleText" : "创建密码" } } ], diff --git a/pages/home/member.vue b/pages/home/member.vue index 4805ac3..af72e68 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 2080ad1..fd64eed 100644 --- a/pages/setting/account.vue +++ b/pages/setting/account.vue @@ -9,41 +9,37 @@ 头像 - + 昵称 - DeepChart - + {{userInfoRes.dcname}} + ID - {{ jwcode }} - - - - - 密码 - - qwertyuiop - + {{ userInfoRes.dccode }} - 修改密码 - + + + + 注销账号 - + 绑定账号 - + @@ -73,8 +69,12 @@ } from 'vue' import {useUserStore} from "../../stores/modules/userInfo" + import { + getUserInfo + } from "@/api/member"; const iSMT = ref(0) - const jwcode = ref('90047681') + // const dccode = ref('') + const userInfoRes = ref({}) const showLogout = ref(false) const userStore = useUserStore() @@ -91,17 +91,23 @@ url: '/pages/start/login/login' }) } - - 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(() => { @@ -111,7 +117,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 cbf21c0..d60d59d 100644 --- a/pages/setting/general.vue +++ b/pages/setting/general.vue @@ -1,165 +1,186 @@ \ 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/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..f2db2fd 100644 --- a/pages/setting/password.vue +++ b/pages/setting/password.vue @@ -10,7 +10,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -41,34 +41,107 @@ ref, onMounted } from 'vue' + import { + sendEmail, + validateCode, + sendPhone + } from "@/api/setting/password"; const iSMT = ref(0) const activeTab = ref('email') const gettingCode = ref(false) const time = ref(60) + const userEmail = ref('') + const userPhone = ref('') + const verifyCode = ref('') + + 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 = 60 + time.value = 2 } }, 1000) + if (activeTab.value === 'email') { + sendEmail({ + email: userEmail.value + }) + } else { + sendPhone({ + phone: userPhone.value + }) + } + } - - const goToPwdNext = () =>{ - uni.navigateTo({ - url:'../setting/nextPwd' - }) + +const goToPwdNext = async () => { + if (!userEmail.value) { + uni.showToast({ + title: '请输入邮箱', + icon: 'none' + }) + return + } + if (!verifyCode.value) { + uni.showToast({ + title: '请输入验证码', + icon: 'none' + }) + return + } + + try { + let param; + if (activeTab.value === 'email') { + param = { + loginType: 'EMAIL', + account: userEmail.value, + verifyCode: verifyCode.value + } + } else { + param = { + loginType: 'PHONE', + account: userPhone.value, + verifyCode: verifyCode.value + } + } + const res = await validateCode(param) + console.log('看看参数', param) + console.log('看看结果', res) + // 如果返回成功 + if (res.code === 200) { + uni.showToast({ + title: '验证成功', + icon: 'success' + }) + uni.navigateTo({ + url: '../setting/nextPwd' + }) + } else { + uni.showToast({ + title: res.msg || '验证失败', + icon: 'none' + }) + } + } catch (err) { + console.error(err) + uni.showToast({ + title: '请求出错', + icon: 'none' + }) + } } + onMounted(() => { // 获取状态栏高度 iSMT.value = uni.getSystemInfoSync().statusBarHeight; @@ -105,7 +178,8 @@ transform: translateX(-50%); width: 40rpx; height: 6rpx; - background-color: #000;/* ????? */ + background-color: #000; + /* ????? */ } .switch-tab { @@ -149,9 +223,9 @@ background-color: #ccc; color: #999; } - - .btn-area{ - height:8vh; + + .btn-area { + height: 8vh; background-color: white; padding-top: 120rpx; } 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/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