|
|
|
@ -8,83 +8,138 @@ |
|
|
|
<view style="height:57.5vh;background-color: white;"> |
|
|
|
<view class="title">A股竞价</view> |
|
|
|
<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> |
|
|
|
<view class="active-dot" v-if="aStockBid === 0"></view> |
|
|
|
<view class="active-dot" v-if="aStockBid === 'auto'"></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> |
|
|
|
<view class="active-dot" v-if="aStockBid === 1"></view> |
|
|
|
<view class="active-dot" v-if="aStockBid === 'open'"></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> |
|
|
|
<view class="active-dot" v-if="aStockBid === 2"></view> |
|
|
|
<view class="active-dot" v-if="aStockBid === 'close'"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="title">K线样式</view> |
|
|
|
<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" /> |
|
|
|
<text>普通</text> |
|
|
|
<view class="active-dot" v-if="kStyle === 0"></view> |
|
|
|
<view class="active-dot" v-if="kStyle === 'common'"></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" /> |
|
|
|
<text>轮廓图</text> |
|
|
|
<view class="active-dot" v-if="kStyle === 1"></view> |
|
|
|
<view class="active-dot" v-if="kStyle === 'Outline'"></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" /> |
|
|
|
<text>折线图</text> |
|
|
|
<view class="active-dot" v-if="kStyle === 2"></view> |
|
|
|
<view class="active-dot" v-if="kStyle === 'polylines'"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="title">除权类型</view> |
|
|
|
<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> |
|
|
|
<view class="active-dot" v-if="exRights === 0"></view> |
|
|
|
<view class="active-dot" v-if="exRights === 'exRights'"></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> |
|
|
|
<view class="active-dot" v-if="exRights === 1"></view> |
|
|
|
<view class="active-dot" v-if="exRights === 'normal'"></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> |
|
|
|
<view class="active-dot" v-if="exRights === 2"></view> |
|
|
|
<view class="active-dot" v-if="exRights === 'Weighted'"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="title">涨跌颜色</view> |
|
|
|
<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"> |
|
|
|
<img src="/static/my/greenRise.png" class="kline-icon" /> |
|
|
|
</view> |
|
|
|
<text>绿涨红跌</text> |
|
|
|
<view class="active-dot" v-if="rfColor === 0"></view> |
|
|
|
<view class="active-dot" v-if="rfColor === 'green'"></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"> |
|
|
|
<img src="/static/my/redRise.png" class="kline-icon" /> |
|
|
|
</view> |
|
|
|
<text>红涨绿跌</text> |
|
|
|
<view class="active-dot" v-if="rfColor === 1"></view> |
|
|
|
<view class="active-dot" v-if="rfColor === 'red'"></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="title">副图指标个数</view> |
|
|
|
<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> |
|
|
|
</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> |
|
|
|
</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> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -107,20 +162,91 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup> |
|
|
|
import { |
|
|
|
ref, |
|
|
|
onMounted |
|
|
|
} from 'vue' |
|
|
|
import { ref, onMounted } from 'vue' |
|
|
|
import { getMarketSetting, updateMarketSetting } from "@/api/setting/market" |
|
|
|
|
|
|
|
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') // A股竞价:auto/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 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(() => { |
|
|
|
iSMT.value = uni.getSystemInfoSync().statusBarHeight; |
|
|
|
getMarketSettings() |
|
|
|
}) |
|
|
|
</script> |
|
|
|
|
|
|
|
@ -206,7 +332,7 @@ |
|
|
|
|
|
|
|
.indicator-text { |
|
|
|
font-size: 28rpx; |
|
|
|
flex:1; |
|
|
|
flex: 1; |
|
|
|
} |
|
|
|
|
|
|
|
.indicator-icons { |
|
|
|
|