Browse Source

Merge branch 'milestone-20251031-简版功能开发' into zhaowenkang/feature-20251028181547-行情页面

zhaowenkang/feature-20251028181547-行情页面
zhaowenkang 4 weeks ago
parent
commit
017f0b1a58
  1. 7
      .hbuilderx/launch.json
  2. 8
      api/setting/general.js
  3. 19
      api/setting/market.js
  4. 92
      api/tcpConnection.js
  5. 2
      pages.json
  6. 2
      pages/home/home.vue
  7. 1
      pages/home/member.vue
  8. 29
      pages/setting/account.vue
  9. 11
      pages/setting/bind.vue
  10. 26
      pages/setting/createPwd.vue
  11. 48
      pages/setting/font.vue
  12. 198
      pages/setting/market.vue
  13. 10
      pages/setting/password.vue
  14. 48
      pages/setting/server.vue
  15. 45
      pages/setting/theme.vue
  16. 4
      utils/http.js

7
.hbuilderx/launch.json

@ -3,10 +3,11 @@
"configurations" : [ "configurations" : [
{ {
"customPlaygroundType" : "local", "customPlaygroundType" : "local",
"playground" : "custom",
"playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
// "playground" : "standard",
// "type" : "uni-app:app-ios"
} }
] ]
} }
// "playground" : "standard",
// "type" : "uni-app:app-ios"

8
api/setting/general.js

@ -9,3 +9,11 @@ export const getSetting = (data) => {
data: data, data: data,
}) })
} }
export const updateSetting = (data) => {
return http({
method: 'POST',
url: '/api/my/updateSetting',
data: data,
})
}

19
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,
})
}

92
api/tcpConnection.js

@ -6,7 +6,7 @@
*/ */
// 引用TCP插件 // 引用TCP插件
const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
//const TCPSocket = uni.requireNativePlugin('Aimer-TCPPlugin');
// const TCPSocket = uni.requireNativePlugin("Aimer-TCPPlugin"); // const TCPSocket = uni.requireNativePlugin("Aimer-TCPPlugin");
// TCP连接配置 // TCP连接配置
@ -67,52 +67,52 @@ class TCPConnection {
} }
console.log('开始建立TCP连接:', connectionConfig); 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; sendConfig.charsetname = config.charsetname;
} }
TCPSocket.send(sendConfig);
//TCPSocket.send(sendConfig);
console.log("js成功发送TCP消息:", messageStr); console.log("js成功发送TCP消息:", messageStr);
return true; return true;
} }
@ -159,7 +159,7 @@ class TCPConnection {
channel: channel channel: channel
}; };
TCPSocket.disconnect(disconnectConfig);
//TCPSocket.disconnect(disconnectConfig);
this.channelConnections.set(channel, false); this.channelConnections.set(channel, false);
console.log(`TCP连接已断开 - Channel ${channel}`, disconnectConfig); console.log(`TCP连接已断开 - Channel ${channel}`, disconnectConfig);
} }

2
pages.json

@ -246,14 +246,12 @@
"path": "pages/setting/phone", "path": "pages/setting/phone",
"style": { "style": {
"navigationBarTitleText": "绑定账号" "navigationBarTitleText": "绑定账号"
//
} }
}, },
{ {
"path": "pages/setting/email", "path": "pages/setting/email",
"style": { "style": {
"navigationBarTitleText": "绑定账号" "navigationBarTitleText": "绑定账号"
//
} }
}, },
{ {

2
pages/home/home.vue

@ -192,7 +192,7 @@
import footerBar from '../../components/footerBar.vue' import footerBar from '../../components/footerBar.vue'
import MarketOverview from '../../components/MarketOverview.vue' import MarketOverview from '../../components/MarketOverview.vue'
import DeepMate from '../../components/DeepMate.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 th from '../../static/language/th'
import MySelectionsAPI from '../../api/home/mySelections.js' import MySelectionsAPI from '../../api/home/mySelections.js'
import { useUserStore } from '../../stores/modules/userInfo' import { useUserStore } from '../../stores/modules/userInfo'

1
pages/home/member.vue

@ -1,4 +1,5 @@
<template> <template>
<LoginPrompt ref="loginPrompt"></LoginPrompt>
<view class="main"> <view class="main">
<view class="top"> <view class="top">
<view class="bell"> <view class="bell">

29
pages/setting/account.vue

@ -27,9 +27,7 @@
</view> </view>
<view class="setting-item" @click="goToPassword"> <view class="setting-item" @click="goToPassword">
<text class="item-label"> <text class="item-label">
<template #default>
{{ userInfoRes.hasPwd === 0 ? '创建密码' : '修改密码' }} {{ userInfoRes.hasPwd === 0 ? '创建密码' : '修改密码' }}
</template>
</text> </text>
<uni-icons type="arrowright" size="16"></uni-icons> <uni-icons type="arrowright" size="16"></uni-icons>
</view> </view>
@ -67,19 +65,34 @@
ref, ref,
onMounted onMounted
} from 'vue' } from 'vue'
import {useUserStore} from "../../stores/modules/userInfo"
import { import {
getUserInfo getUserInfo
} from "@/api/member";
} from "@/api/member"
import {
useUserStore
} from "../../stores/modules/userInfo"
const userStore = useUserStore()
const iSMT = ref(0) const iSMT = ref(0)
// const dccode = ref('') // const dccode = ref('')
const userInfoRes = ref({}) const userInfoRes = ref({})
const showLogout = ref(false) 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() userStore.clearUserInfo()
showLogout.value = false showLogout.value = false
uni.showToast({ uni.showToast({

11
pages/setting/bind.vue

@ -8,7 +8,9 @@
<view class="top-list" @click="goToBindPhone"> <view class="top-list" @click="goToBindPhone">
<text class="label">手机号</text> <text class="label">手机号</text>
<view class="right"> <view class="right">
<text style="font-size: 28rpx;">未绑定</text>
<text style="font-size: 28rpx;">
{{ userStore.userInfo?.phone || '未绑定' }}
</text>
<uni-icons type="arrowright" size="16" /> <uni-icons type="arrowright" size="16" />
</view> </view>
</view> </view>
@ -16,7 +18,9 @@
<view class="top-list" @click="goToBindEmail"> <view class="top-list" @click="goToBindEmail">
<text class="label">邮箱</text> <text class="label">邮箱</text>
<view class="right"> <view class="right">
<text style="font-size: 28rpx;">analsak@163.com</text>
<text style="font-size: 28rpx;">
{{ userStore.userInfo?.email || '未绑定' }}
</text>
<uni-icons type="arrowright" size="16" /> <uni-icons type="arrowright" size="16" />
</view> </view>
</view> </view>
@ -29,6 +33,8 @@
ref, ref,
onMounted onMounted
} from 'vue' } from 'vue'
import { useUserStore } from "../../stores/modules/userInfo"
const userStore = useUserStore()
const iSMT = ref(0) const iSMT = ref(0)
const goToBindPhone = () =>{ const goToBindPhone = () =>{
uni.navigateTo({ uni.navigateTo({
@ -46,6 +52,7 @@
// //
iSMT.value = uni.getSystemInfoSync().statusBarHeight; iSMT.value = uni.getSystemInfoSync().statusBarHeight;
console.log('看看高度', iSMT.value) console.log('看看高度', iSMT.value)
console.log('看看用户信息',userStore.userInfo)
}) })
</script> </script>

26
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) { if (!verifyCode.value) {
uni.showToast({ uni.showToast({
@ -99,6 +110,7 @@ const goToPwdNext = async () => {
return return
} }
try { try {
let param; let param;
if (activeTab.value === 'email') { if (activeTab.value === 'email') {

48
pages/setting/font.vue

@ -5,17 +5,17 @@
<view class="top-list"> <view class="top-list">
<text>标准</text> <text>标准</text>
<radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0" <radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0"
@click="selectFont(0)" />
@click="selectFont('small')" />
</view> </view>
<view class="top-list"> <view class="top-list">
<text>中号</text> <text>中号</text>
<radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1" <radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1"
@click="selectFont(1)" />
@click="selectFont('medium')" />
</view> </view>
<view class="top-list"> <view class="top-list">
<text>大号</text> <text>大号</text>
<radio value="2" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 2" <radio value="2" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 2"
@click="selectFont(2)" />
@click="selectFont('large')" />
</view> </view>
</view> </view>
</view> </view>
@ -27,32 +27,50 @@
onMounted onMounted
} from 'vue' } from 'vue'
import { import {
getSetting
getSetting,
updateSetting
} from "@/api/setting/general" } from "@/api/setting/general"
const iSMT = ref(0) const iSMT = ref(0)
const selectedIndex = ref(0) const selectedIndex = ref(0)
const fontTypeMap = {
'small': 0,
'medium': 1,
'large': 2
}
const getFont = async () => { const getFont = async () => {
try { try {
const res = await getSetting() const res = await getSetting()
if (res.code === 200) { if (res.code === 200) {
const fontSize = res.data.fontSize 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) { } 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(() => { onMounted(() => {
// //

198
pages/setting/market.vue

@ -8,83 +8,138 @@
<view style="height:57.5vh;background-color: white;"> <view style="height:57.5vh;background-color: white;">
<view class="title">A股竞价</view> <view class="title">A股竞价</view>
<view class="top-options"> <view class="top-options">
<view class="option-btn" :class="{ 'active': aStockBid === 0 }" @click="aStockBid = 0">
<view
class="option-btn"
:class="{ 'active': aStockBid === 'auto' }"
@click="handleAStockBidChange('auto')"
>
<text>智能开启</text> <text>智能开启</text>
<view class="active-dot" v-if="aStockBid === 0"></view>
<view class="active-dot" v-if="aStockBid === 'auto'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': aStockBid === 1 }" @click="aStockBid = 1">
<view
class="option-btn"
:class="{ 'active': aStockBid === 'open' }"
@click="handleAStockBidChange('open')"
>
<text>保持开启</text> <text>保持开启</text>
<view class="active-dot" v-if="aStockBid === 1"></view>
<view class="active-dot" v-if="aStockBid === 'open'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': aStockBid === 2 }" @click="aStockBid = 2">
<view
class="option-btn"
:class="{ 'active': aStockBid === 'close' }"
@click="handleAStockBidChange('close')"
>
<text>保持关闭</text> <text>保持关闭</text>
<view class="active-dot" v-if="aStockBid === 2"></view>
<view class="active-dot" v-if="aStockBid === 'close'"></view>
</view> </view>
</view> </view>
<view class="title">K线样式</view> <view class="title">K线样式</view>
<view class="top-options"> <view class="top-options">
<view class="option-btn" :class="{ 'active': kStyle === 0 }" @click="kStyle = 0">
<view
class="option-btn"
:class="{ 'active': kStyle === 'common' }"
@click="handleKStyleChange('common')"
>
<img src="/static/my/common.png" class="kline-icon" /> <img src="/static/my/common.png" class="kline-icon" />
<text>普通</text> <text>普通</text>
<view class="active-dot" v-if="kStyle === 0"></view>
<view class="active-dot" v-if="kStyle === 'common'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': kStyle === 1 }" @click="kStyle = 1">
<view
class="option-btn"
:class="{ 'active': kStyle === 'Outline' }"
@click="handleKStyleChange('Outline')"
>
<img src="/static/my/outline.png" class="kline-icon" /> <img src="/static/my/outline.png" class="kline-icon" />
<text>轮廓图</text> <text>轮廓图</text>
<view class="active-dot" v-if="kStyle === 1"></view>
<view class="active-dot" v-if="kStyle === 'Outline'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': kStyle === 2 }" @click="kStyle = 2">
<view
class="option-btn"
:class="{ 'active': kStyle === 'polylines' }"
@click="handleKStyleChange('polylines')"
>
<img src="/static/my/polylines.png" class="kline-icon" /> <img src="/static/my/polylines.png" class="kline-icon" />
<text>折线图</text> <text>折线图</text>
<view class="active-dot" v-if="kStyle === 2"></view>
<view class="active-dot" v-if="kStyle === 'polylines'"></view>
</view> </view>
</view> </view>
<view class="title">除权类型</view> <view class="title">除权类型</view>
<view class="top-options"> <view class="top-options">
<view class="option-btn" :class="{ 'active': exRights === 0 }" @click="exRights = 0">
<view
class="option-btn"
:class="{ 'active': exRights === 'exRights' }"
@click="handleExRightsChange('exRights')"
>
<text>除权</text> <text>除权</text>
<view class="active-dot" v-if="exRights === 0"></view>
<view class="active-dot" v-if="exRights === 'exRights'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': exRights === 1 }" @click="exRights = 1">
<view
class="option-btn"
:class="{ 'active': exRights === 'normal' }"
@click="handleExRightsChange('normal')"
>
<text>普通</text> <text>普通</text>
<view class="active-dot" v-if="exRights === 1"></view>
<view class="active-dot" v-if="exRights === 'normal'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': exRights === 2 }" @click="exRights = 2">
<view
class="option-btn"
:class="{ 'active': exRights === 'Weighted' }"
@click="handleExRightsChange('Weighted')"
>
<text>加权</text> <text>加权</text>
<view class="active-dot" v-if="exRights === 2"></view>
<view class="active-dot" v-if="exRights === 'Weighted'"></view>
</view> </view>
</view> </view>
<view class="title">涨跌颜色</view> <view class="title">涨跌颜色</view>
<view class="top-options"> <view class="top-options">
<view class="option-btn" :class="{ 'active': rfColor === 0 }" @click="rfColor = 0">
<view
class="option-btn"
:class="{ 'active': rfColor === 'green' }"
@click="handleRfColorChange('green')"
>
<view class="color-icon"> <view class="color-icon">
<img src="/static/my/greenRise.png" class="kline-icon" /> <img src="/static/my/greenRise.png" class="kline-icon" />
</view> </view>
<text>绿涨红跌</text> <text>绿涨红跌</text>
<view class="active-dot" v-if="rfColor === 0"></view>
<view class="active-dot" v-if="rfColor === 'green'"></view>
</view> </view>
<view class="option-btn" :class="{ 'active': rfColor === 1 }" @click="rfColor = 1">
<view
class="option-btn"
:class="{ 'active': rfColor === 'red' }"
@click="handleRfColorChange('red')"
>
<view class="color-icon"> <view class="color-icon">
<img src="/static/my/redRise.png" class="kline-icon" /> <img src="/static/my/redRise.png" class="kline-icon" />
</view> </view>
<text>红涨绿跌</text> <text>红涨绿跌</text>
<view class="active-dot" v-if="rfColor === 1"></view>
<view class="active-dot" v-if="rfColor === 'red'"></view>
</view> </view>
</view> </view>
<view class="title">副图指标个数</view> <view class="title">副图指标个数</view>
<view class="top-options"> <view class="top-options">
<view class="option-btn" :class="{ 'active': indexCount === 0 }" @click="indexCount = 0">
<view
class="option-btn"
:class="{ 'active': indexCount === 1 }"
@click="handleIndexCountChange(1)"
>
<text>1</text> <text>1</text>
</view> </view>
<view class="option-btn" :class="{ 'active': indexCount === 1 }" @click="indexCount = 1">
<view
class="option-btn"
:class="{ 'active': indexCount === 2 }"
@click="handleIndexCountChange(2)"
>
<text>2</text> <text>2</text>
</view> </view>
<view class="option-btn" :class="{ 'active': indexCount === 2 }" @click="indexCount = 2">
<view
class="option-btn"
:class="{ 'active': indexCount === 3 }"
@click="handleIndexCountChange(3)"
>
<text>3</text> <text>3</text>
</view> </view>
</view> </view>
@ -107,20 +162,91 @@
</template> </template>
<script setup> <script setup>
import {
ref,
onMounted
} from 'vue'
import { ref, onMounted } from 'vue'
import { getMarketSetting, updateMarketSetting } from "@/api/setting/market"
const iSMT = ref(0) const iSMT = ref(0)
const aStockBid = ref(0) // Stock bidding
const kStyle = ref(0) // k线
const exRights = ref(0) // Ex-rights
const rfColor = ref(0) // rise-fall
const indexCount = ref(0) //
const aStockBid = ref('auto') // Aauto/open/close
const kStyle = ref('common') // K线common/Outline/polylines
const exRights = ref('exRights') // exRights/normal/Weighted
const rfColor = ref('green') // green/red
const indexCount = ref(1) // 1/2/3
const indicatorList = ref(['K线', '均线', '成交量', 'KDJ', 'MACD', 'RSI']) const indicatorList = ref(['K线', '均线', '成交量', 'KDJ', 'MACD', 'RSI'])
const getMarketSettings = async () => {
try {
const res = await getMarketSetting()
if (res.code === 200) {
aStockBid.value = res.data.auctionDisplay ?? 'auto'
kStyle.value = res.data.klineStyle ?? 'common'
exRights.value = res.data.rightsIssueType ?? 'exRights'
rfColor.value = res.data.priceColorScheme ?? 'green'
indexCount.value = res.data.subChartCount ?? 1
}
} catch (err) {
console.error("获取市场设置失败:", err)
}
}
const updateSetting = async () => {
try {
const params = {
auctionDisplay: aStockBid.value,
klineStyle: kStyle.value,
rightsIssueType: exRights.value,
priceColorScheme: rfColor.value,
subChartCount: indexCount.value
}
const res = await updateMarketSetting(params)
if (res.code === 200) {
uni.showToast({ title: '设置已更新', icon: 'none' })
} else {
uni.showToast({ title: '更新失败', icon: 'none' })
}
} catch (err) {
console.error("更新设置失败:", err)
uni.showToast({ title: '更新失败', icon: 'none' })
}
}
const handleAStockBidChange = (newValue) => {
if (newValue !== aStockBid.value) {
aStockBid.value = newValue
updateSetting()
}
}
const handleKStyleChange = (newValue) => {
if (newValue !== kStyle.value) {
kStyle.value = newValue
updateSetting()
}
}
const handleExRightsChange = (newValue) => {
if (newValue !== exRights.value) {
exRights.value = newValue
updateSetting()
}
}
const handleRfColorChange = (newValue) => {
if (newValue !== rfColor.value) {
rfColor.value = newValue
updateSetting()
}
}
const handleIndexCountChange = (newValue) => {
if (newValue !== indexCount.value) {
indexCount.value = newValue
updateSetting()
}
}
onMounted(() => { onMounted(() => {
iSMT.value = uni.getSystemInfoSync().statusBarHeight; iSMT.value = uni.getSystemInfoSync().statusBarHeight;
getMarketSettings()
}) })
</script> </script>
@ -206,7 +332,7 @@
.indicator-text { .indicator-text {
font-size: 28rpx; font-size: 28rpx;
flex:1;
flex: 1;
} }
.indicator-icons { .indicator-icons {

10
pages/setting/password.vue

@ -84,6 +84,7 @@
} }
const goToPwdNext = async () => { const goToPwdNext = async () => {
if (activeTab.value === 'email') {
if (!userEmail.value) { if (!userEmail.value) {
uni.showToast({ uni.showToast({
title: '请输入邮箱', title: '请输入邮箱',
@ -91,6 +92,15 @@ const goToPwdNext = async () => {
}) })
return return
} }
}else{
if (!userPhone.value) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
})
return
}
}
if (!verifyCode.value) { if (!verifyCode.value) {
uni.showToast({ uni.showToast({
title: '请输入验证码', title: '请输入验证码',

48
pages/setting/server.vue

@ -5,17 +5,17 @@
<view class="top-list"> <view class="top-list">
<text>自动选择</text> <text>自动选择</text>
<radio value="0" class="radio-btn" activeBackgroundColor="red" <radio value="0" class="radio-btn" activeBackgroundColor="red"
:checked="selectedIndex === 0" @click="selectFont(0)" />
:checked="selectedIndex === 0" @click="selectFont('auto')" />
</view> </view>
<view class="top-list"> <view class="top-list">
<text>新加坡服务器</text> <text>新加坡服务器</text>
<radio value="1" class="radio-btn" activeBackgroundColor="red" <radio value="1" class="radio-btn" activeBackgroundColor="red"
:checked="selectedIndex === 1" @click="selectFont(1)" />
:checked="selectedIndex === 1" @click="selectFont('singapore')" />
</view> </view>
<view class="top-list"> <view class="top-list">
<text>香港服务器</text> <text>香港服务器</text>
<radio value="2" class="radio-btn" activeBackgroundColor="red" <radio value="2" class="radio-btn" activeBackgroundColor="red"
:checked="selectedIndex === 2" @click="selectFont(2)" />
:checked="selectedIndex === 2" @click="selectFont('hongkong')" />
</view> </view>
</view> </view>
</view> </view>
@ -27,33 +27,51 @@
onMounted onMounted
} from 'vue' } from 'vue'
import { import {
getSetting
getSetting,
updateSetting
} from "@/api/setting/general" } from "@/api/setting/general"
const iSMT = ref(0) const iSMT = ref(0)
const selectedIndex = ref(0) const selectedIndex = ref(0)
const servertypeMap = {
'auto': 0,
'singapore': 1,
'hongkong': 2
}
const getServer = async () => { const getServer = async () => {
try { try {
const res = await getSetting() const res = await getSetting()
if (res.code === 200) { 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) { } catch (err) {
console.error("获取服务器设置失败:", 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(() => { onMounted(() => {

45
pages/setting/theme.vue

@ -5,12 +5,12 @@
<view class="left"> <view class="left">
<image class="img-theme" src="/static/my/whiteTheme.png" mode="widthFix" /> <image class="img-theme" src="/static/my/whiteTheme.png" mode="widthFix" />
<radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0" <radio value="0" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 0"
@click="selectFont(0)" />
@click="updateTheme('light')" />
</view> </view>
<view class="left"> <view class="left">
<image class="img-theme" src="/static/my/blackTheme.png" mode="widthFix" /> <image class="img-theme" src="/static/my/blackTheme.png" mode="widthFix" />
<radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1" <radio value="1" class="radio-btn" activeBackgroundColor="red" :checked="selectedIndex === 1"
@click="selectFont(1)" />
@click="updateTheme('dark')" />
</view> </view>
</view> </view>
</view> </view>
@ -22,32 +22,51 @@
onMounted onMounted
} from 'vue' } from 'vue'
import { import {
getSetting
getSetting,
updateSetting
} from "@/api/setting/general" } from "@/api/setting/general"
const iSMT = ref(0) const iSMT = ref(0)
const selectedIndex = ref(0) const selectedIndex = ref(0)
const themeTypeMap = {
'light': 0,
'dark': 1
}
const getTheme = async () => { const getTheme = async () => {
try { try {
const res = await getSetting() const res = await getSetting()
if (res.code === 200) { if (res.code === 200) {
const theme = res.data.theme 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) { } catch (err) {
console.error("获取主题设置失败:", 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(() => { onMounted(() => {
// //
iSMT.value = uni.getSystemInfoSync().statusBarHeight; iSMT.value = uni.getSystemInfoSync().statusBarHeight;

4
utils/http.js

@ -2,8 +2,8 @@ import { useUserStore } from "../stores/modules/userInfo"
import { useDeviceStore } from "../stores/modules/deviceInfo" import { useDeviceStore } from "../stores/modules/deviceInfo"
import { useLoginStore } from "../stores/modules/login" 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 = { const httpInterceptor = {
// 拦截前触发 // 拦截前触发

Loading…
Cancel
Save