diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index 2a3f43d..f1dfc07 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -3,10 +3,11 @@
"configurations" : [
{
"customPlaygroundType" : "local",
- "playground" : "custom",
+ "playground" : "standard",
"type" : "uni-app:app-android"
- // "playground" : "standard",
- // "type" : "uni-app:app-ios"
}
]
}
+// "playground" : "standard",
+// "type" : "uni-app:app-ios"
+
diff --git a/api/setting/general.js b/api/setting/general.js
index d5e45d1..63b4892 100644
--- a/api/setting/general.js
+++ b/api/setting/general.js
@@ -9,3 +9,11 @@ export const getSetting = (data) => {
data: data,
})
}
+
+export const updateSetting = (data) => {
+ return http({
+ method: 'POST',
+ url: '/api/my/updateSetting',
+ data: data,
+ })
+}
diff --git a/api/setting/market.js b/api/setting/market.js
new file mode 100644
index 0000000..6601f4f
--- /dev/null
+++ b/api/setting/market.js
@@ -0,0 +1,19 @@
+import { http } from '../../utils/http'
+
+
+
+export const getMarketSetting = (data) => {
+ return http({
+ method: 'POST',
+ url: '/api/my/getQuotationSetting',
+ data: data,
+ })
+}
+
+export const updateMarketSetting = (data) => {
+ return http({
+ method: 'POST',
+ url: '/api/my/updateQuotationSetting',
+ data: data,
+ })
+}
diff --git a/api/tcpConnection.js b/api/tcpConnection.js
index c31188e..819051f 100644
--- a/api/tcpConnection.js
+++ b/api/tcpConnection.js
@@ -6,7 +6,7 @@
*/
// 引用TCP插件
-const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
+//const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
// const TCPSocket = uni.requireNativePlugin("Aimer-TCPPlugin");
// TCP连接配置
@@ -67,52 +67,52 @@ class TCPConnection {
}
console.log('开始建立TCP连接:', connectionConfig);
- TCPSocket.connect(
- connectionConfig,
- result => {
- /**
- * status : 0 连接成功
- * status : 1 断开连接
- * receivedMsg : 服务器返回字符串(普通的字符串交互)
- * receivedHexMsg : 服务器返回字节数组(单片机、智能家居等硬件数据交互)
- */
- if (result.status == '0') {
- // TCP连接成功
- this.channelConnections.set(connectionConfig.channel, true);
- console.log(`TCP连接成功 - Channel ${connectionConfig.channel}`);
- this._notifyConnectionCallbacks('connected', result, connectionConfig.channel);
- } else if (result.status == '1') {
- // TCP断开连接
- this.channelConnections.set(connectionConfig.channel, false);
- console.log(`TCP断开连接 - Channel ${connectionConfig.channel}`);
- this._notifyConnectionCallbacks('disconnected', result, connectionConfig.channel);
- }
+ // TCPSocket.connect(
+ // connectionConfig,
+ // result => {
+ // /**
+ // * status : 0 连接成功
+ // * status : 1 断开连接
+ // * receivedMsg : 服务器返回字符串(普通的字符串交互)
+ // * receivedHexMsg : 服务器返回字节数组(单片机、智能家居等硬件数据交互)
+ // */
+ // if (result.status == '0') {
+ // // TCP连接成功
+ // this.channelConnections.set(connectionConfig.channel, true);
+ // console.log(`TCP连接成功 - Channel ${connectionConfig.channel}`);
+ // this._notifyConnectionCallbacks('connected', result, connectionConfig.channel);
+ // } else if (result.status == '1') {
+ // // TCP断开连接
+ // this.channelConnections.set(connectionConfig.channel, false);
+ // console.log(`TCP断开连接 - Channel ${connectionConfig.channel}`);
+ // this._notifyConnectionCallbacks('disconnected', result, connectionConfig.channel);
+ // }
- if (result.receivedMsg) {
- // 服务器返回字符串
- console.log('收到字符串消息:', result.receivedMsg);
- this._notifyMessageCallbacks('string', result.receivedMsg, null, connectionConfig.channel);
- }
+ // if (result.receivedMsg) {
+ // // 服务器返回字符串
+ // console.log('收到字符串消息:', result.receivedMsg);
+ // this._notifyMessageCallbacks('string', result.receivedMsg, null, connectionConfig.channel);
+ // }
- // if (result.receivedHexMsg) {
- // // 硬件服务器返回16进制数据
- // console.log('收到16进制消息:', result.receivedHexMsg);
- // let msg = result.receivedHexMsg;
- // let sum = msg.length / 2;
- // let arr = [];
- // for (let k = 0; k < sum; k++) {
- // let i = msg.substring(k * 2, k * 2 + 2);
- // arr.push(i);
- // }
- // console.log('解析后的16进制数组:', arr);
- // this._notifyMessageCallbacks('hex', result.receivedHexMsg, arr);
- // }
+ // // if (result.receivedHexMsg) {
+ // // // 硬件服务器返回16进制数据
+ // // console.log('收到16进制消息:', result.receivedHexMsg);
+ // // let msg = result.receivedHexMsg;
+ // // let sum = msg.length / 2;
+ // // let arr = [];
+ // // for (let k = 0; k < sum; k++) {
+ // // let i = msg.substring(k * 2, k * 2 + 2);
+ // // arr.push(i);
+ // // }
+ // // console.log('解析后的16进制数组:', arr);
+ // // this._notifyMessageCallbacks('hex', result.receivedHexMsg, arr);
+ // // }
- // 执行回调函数
- if (callback && typeof callback === "function") {
- callback(result);
- }
- });
+ // // 执行回调函数
+ // if (callback && typeof callback === "function") {
+ // callback(result);
+ // }
+ // });
}
/**
@@ -144,7 +144,7 @@ class TCPConnection {
sendConfig.charsetname = config.charsetname;
}
- TCPSocket.send(sendConfig);
+ //TCPSocket.send(sendConfig);
console.log("js成功发送TCP消息:", messageStr);
return true;
}
@@ -159,7 +159,7 @@ class TCPConnection {
channel: channel
};
- TCPSocket.disconnect(disconnectConfig);
+ //TCPSocket.disconnect(disconnectConfig);
this.channelConnections.set(channel, false);
console.log(`TCP连接已断开 - Channel ${channel}`, disconnectConfig);
}
diff --git a/pages.json b/pages.json
index c90736c..8549911 100644
--- a/pages.json
+++ b/pages.json
@@ -246,14 +246,12 @@
"path": "pages/setting/phone",
"style": {
"navigationBarTitleText": "绑定账号"
- // 其实是绑定手机号
}
},
{
"path": "pages/setting/email",
"style": {
"navigationBarTitleText": "绑定账号"
- // 其实是绑定邮箱
}
},
{
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 466b9b0..f9c46a3 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -192,7 +192,7 @@
import footerBar from '../../components/footerBar.vue'
import MarketOverview from '../../components/MarketOverview.vue'
import DeepMate from '../../components/DeepMate.vue'
-import tcpConnection from '../../api/tcpConnection.js'
+// import tcpConnection from '../../api/tcpConnection.js'
import th from '../../static/language/th'
import MySelectionsAPI from '../../api/home/mySelections.js'
import { useUserStore } from '../../stores/modules/userInfo'
diff --git a/pages/home/member.vue b/pages/home/member.vue
index af72e68..5ea9e75 100644
--- a/pages/home/member.vue
+++ b/pages/home/member.vue
@@ -1,4 +1,5 @@
+
diff --git a/pages/setting/account.vue b/pages/setting/account.vue
index fd64eed..8dbcfe8 100644
--- a/pages/setting/account.vue
+++ b/pages/setting/account.vue
@@ -27,9 +27,7 @@
-
{{ userInfoRes.hasPwd === 0 ? '创建密码' : '修改密码' }}
-
@@ -67,19 +65,34 @@
ref,
onMounted
} from 'vue'
-
- import {useUserStore} from "../../stores/modules/userInfo"
import {
getUserInfo
- } from "@/api/member";
+ } from "@/api/member"
+ import {
+ useUserStore
+ } from "../../stores/modules/userInfo"
+
+ const userStore = useUserStore()
const iSMT = ref(0)
// const dccode = ref('')
const userInfoRes = ref({})
const showLogout = ref(false)
- const userStore = useUserStore()
-
- const handleConfirmLogout = () => {
+ 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 = () => {
userStore.clearUserInfo()
showLogout.value = false
uni.showToast({
diff --git a/pages/setting/bind.vue b/pages/setting/bind.vue
index 5a221cc..eeb7577 100644
--- a/pages/setting/bind.vue
+++ b/pages/setting/bind.vue
@@ -8,7 +8,9 @@
手机号
- 未绑定
+
+ {{ userStore.userInfo?.phone || '未绑定' }}
+
@@ -16,7 +18,9 @@
邮箱
- analsak@163.com
+
+ {{ userStore.userInfo?.email || '未绑定' }}
+
@@ -29,6 +33,8 @@
ref,
onMounted
} from 'vue'
+ import { useUserStore } from "../../stores/modules/userInfo"
+ const userStore = useUserStore()
const iSMT = ref(0)
const goToBindPhone = () =>{
uni.navigateTo({
@@ -46,6 +52,7 @@
// 状态栏高度
iSMT.value = uni.getSystemInfoSync().statusBarHeight;
console.log('看看高度', iSMT.value)
+ console.log('看看用户信息',userStore.userInfo)
})
diff --git a/pages/setting/createPwd.vue b/pages/setting/createPwd.vue
index f2db2fd..a151fd5 100644
--- a/pages/setting/createPwd.vue
+++ b/pages/setting/createPwd.vue
@@ -83,13 +83,24 @@
}
-const goToPwdNext = async () => {
- if (!userEmail.value) {
- uni.showToast({
- title: '请输入邮箱',
- icon: 'none'
- })
- return
+ const goToPwdNext = async () => {
+ console.log('发请求之前的activeTab', activeTab.value)
+ if (activeTab.value === 'email') {
+ if (!userEmail.value) {
+ uni.showToast({
+ title: '请输入邮箱',
+ icon: 'none'
+ })
+ return
+ }
+ } else {
+ if (!userPhone.value) {
+ uni.showToast({
+ title: '请输入手机号',
+ icon: 'none'
+ })
+ return
+ }
}
if (!verifyCode.value) {
uni.showToast({
@@ -99,6 +110,7 @@ const goToPwdNext = async () => {
return
}
+
try {
let param;
if (activeTab.value === 'email') {
diff --git a/pages/setting/font.vue b/pages/setting/font.vue
index cd3efaf..0218970 100644
--- a/pages/setting/font.vue
+++ b/pages/setting/font.vue
@@ -5,17 +5,17 @@
标准
+ @click="selectFont('small')" />
中号
+ @click="selectFont('medium')" />
大号
+ @click="selectFont('large')" />
@@ -27,32 +27,50 @@
onMounted
} from 'vue'
import {
- getSetting
+ getSetting,
+ updateSetting
} from "@/api/setting/general"
const iSMT = ref(0)
const selectedIndex = ref(0)
+ const fontTypeMap = {
+ 'small': 0,
+ 'medium': 1,
+ 'large': 2
+ }
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;
+ selectedIndex.value = fontTypeMap[fontSize] ?? 0
}
} catch (err) {
- console.error("获取字体设置失败:", err);
+ console.error("获取字体设置失败:", err)
}
}
- const selectFont = (index) => {
- selectedIndex.value = index
- console.log('看看选中状态', selectedIndex.value)
+ const selectFont = async (fontType) => {
+ try {
+ selectedIndex.value = fontTypeMap[fontType]
+ console.log('字体类型:', fontType, ',looklook索引:', selectedIndex.value)
+
+ const updateRes = await updateSetting({
+ fontSize: fontType
+ })
+ if (updateRes.code === 200) {
+ uni.showToast({
+ title: '字体大小设置成功',
+ icon: 'none'
+ })
+ }
+ } catch (err) {
+ console.error("更新字体设置失败:", err)
+ uni.showToast({
+ title: '设置失败,请重试',
+ icon: 'none'
+ })
+ }
}
onMounted(() => {
// 状态栏高度
diff --git a/pages/setting/market.vue b/pages/setting/market.vue
index 170b3cb..0524fd2 100644
--- a/pages/setting/market.vue
+++ b/pages/setting/market.vue
@@ -8,83 +8,138 @@
A股竞价
-
+
智能开启
-
+
-
+
保持开启
-
+
-
-
+
保持关闭
-
+
K线样式
-
+
普通
-
+
-
+
轮廓图
-
+
-
+
折线图
-
+
除权类型
-
+
除权
-
+
-
+
普通
-
+
-
+
加权
-
+
涨跌颜色
-
+
绿涨红跌
-
+
-
+
红涨绿跌
-
+
副图指标个数
-
+
1
-
+
2
-
+
3
@@ -107,20 +162,91 @@
@@ -206,7 +332,7 @@
.indicator-text {
font-size: 28rpx;
- flex:1;
+ flex: 1;
}
.indicator-icons {
diff --git a/pages/setting/password.vue b/pages/setting/password.vue
index f2db2fd..d65798d 100644
--- a/pages/setting/password.vue
+++ b/pages/setting/password.vue
@@ -84,6 +84,7 @@
}
const goToPwdNext = async () => {
+ if (activeTab.value === 'email') {
if (!userEmail.value) {
uni.showToast({
title: '请输入邮箱',
@@ -91,6 +92,15 @@ const goToPwdNext = async () => {
})
return
}
+ }else{
+ if (!userPhone.value) {
+ uni.showToast({
+ title: '请输入手机号',
+ icon: 'none'
+ })
+ return
+ }
+ }
if (!verifyCode.value) {
uni.showToast({
title: '请输入验证码',
diff --git a/pages/setting/server.vue b/pages/setting/server.vue
index 9524cfc..4ff2def 100644
--- a/pages/setting/server.vue
+++ b/pages/setting/server.vue
@@ -5,17 +5,17 @@
自动选择
+ :checked="selectedIndex === 0" @click="selectFont('auto')" />
新加坡服务器
+ :checked="selectedIndex === 1" @click="selectFont('singapore')" />
香港服务器
+ :checked="selectedIndex === 2" @click="selectFont('hongkong')" />
@@ -27,33 +27,51 @@
onMounted
} from 'vue'
import {
- getSetting
+ getSetting,
+ updateSetting
} from "@/api/setting/general"
const iSMT = ref(0)
const selectedIndex = ref(0)
+ const servertypeMap = {
+ 'auto': 0,
+ 'singapore': 1,
+ 'hongkong': 2
+ }
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;
+ const serverSelection = res.data.serverSelection
+ selectedIndex.value = servertypeMap[serverSelection] ?? 0;
}
} catch (err) {
console.error("获取服务器设置失败:", err);
}
}
- const selectFont = (index) => {
- selectedIndex.value = index
- console.log('看看选中状态',selectedIndex.value)
+ const selectFont = async (servertype) => {
+ try {
+ selectedIndex.value = servertypeMap[servertype]
+ console.log('服务器类型:', servertype, ',looklook索引:', selectedIndex.value)
+
+ const updateRes = await updateSetting({
+ serverSelection: servertype
+ })
+ if (updateRes.code === 200) {
+ uni.showToast({
+ title: '服务器大小设置成功',
+ icon: 'none'
+ })
+ }
+ } catch (err) {
+ console.error("更新服务器设置失败:", err);
+ uni.showToast({
+ title: '设置失败,请重试',
+ icon: 'none'
+ })
+ }
}
onMounted(() => {
diff --git a/pages/setting/theme.vue b/pages/setting/theme.vue
index 43573d9..1ee0658 100644
--- a/pages/setting/theme.vue
+++ b/pages/setting/theme.vue
@@ -5,12 +5,12 @@
+ @click="updateTheme('light')" />
+ @click="updateTheme('dark')" />
@@ -22,32 +22,51 @@
onMounted
} from 'vue'
import {
- getSetting
+ getSetting,
+ updateSetting
} from "@/api/setting/general"
const iSMT = ref(0)
const selectedIndex = ref(0)
-
+ const themeTypeMap = {
+ 'light': 0,
+ 'dark': 1
+ }
+
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;
+ selectedIndex.value = themeTypeMap[theme] ?? 0
}
} catch (err) {
console.error("获取主题设置失败:", err);
}
}
- const selectFont = (index) => {
- selectedIndex.value = index
- console.log('看看选中状态', selectedIndex.value)
+ const updateTheme = async (themeType) => {
+ try {
+ selectedIndex.value = themeTypeMap[themeType]
+ console.log('主题:', themeType, ',looklook索引:', selectedIndex.value)
+
+ const updateRes = await updateSetting({
+ theme: themeType
+ })
+ if (updateRes.code === 200) {
+ uni.showToast({
+ title: '主题设置成功',
+ icon: 'none'
+ })
+ }
+ } catch (err) {
+ console.error("更新主题设置失败:", err);
+ uni.showToast({
+ title: '设置失败,请重试',
+ icon: 'none'
+ })
+ }
}
+
onMounted(() => {
// 状态栏高度
iSMT.value = uni.getSystemInfoSync().statusBarHeight;
diff --git a/utils/http.js b/utils/http.js
index dcae7e5..b85b36c 100644
--- a/utils/http.js
+++ b/utils/http.js
@@ -2,8 +2,8 @@ import { useUserStore } from "../stores/modules/userInfo"
import { useDeviceStore } from "../stores/modules/deviceInfo"
import { useLoginStore } from "../stores/modules/login"
-const baseURL = "https://dbqb.nfdxy.net/testApi"
-
+// const baseURL = "https://dbqb.nfdxy.net/testApi"
+const baseURL = "http://192.168.40.8:9000"
const httpInterceptor = {
// 拦截前触发