优化字体显示

This commit is contained in:
binbin_pan 2024-12-25 15:32:57 +08:00
parent 480225f049
commit fa1daf92ea
2 changed files with 25 additions and 11 deletions

View File

@ -2,7 +2,9 @@
<view :style="{ fontSize: fontSize + 'px' }"> <view :style="{ fontSize: fontSize + 'px' }">
<u-navbar leftIcon="" title="考试" :placeholder="true"> <u-navbar leftIcon="" title="考试" :placeholder="true">
<view class="u-nav-slot" slot="right"> <view class="u-nav-slot" slot="right">
<u-number-box v-model="fontSize" @change="changeFont" button-size="36"></u-number-box> <u-tag text="小" :type="fontSize == 19 ? 'primary' : 'info'" @click="changeFont(19)" style="margin-right: 8px" ></u-tag>
<u-tag text="中" :type="fontSize == 21 ? 'primary' : 'info'" @click="changeFont(21)" style="margin-right: 8px"></u-tag>
<u-tag text="大" :type="fontSize == 23 ? 'primary' : 'info'" @click="changeFont(23)"></u-tag>
</view> </view>
</u-navbar> </u-navbar>
<div class="content" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd"> <div class="content" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd">
@ -113,6 +115,7 @@
</div> </div>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<div style="height: 75px"></div>
<div class="bottom-btn"> <div class="bottom-btn">
<div class="btn" v-show="currentIndex != 0"> <div class="btn" v-show="currentIndex != 0">
<u-button shape="circle" text="上一题" @click="currentIndex--" /> <u-button shape="circle" text="上一题" @click="currentIndex--" />
@ -201,7 +204,7 @@ export default {
startY: 0, // Y startY: 0, // Y
endX: 0, // X endX: 0, // X
endY: 0, // Y endY: 0, // Y
fontSize: 20, fontSize: 19,
timeData: {} timeData: {}
} }
}, },
@ -247,9 +250,9 @@ export default {
// this.handleConfirmSubmit() // this.handleConfirmSubmit()
// }, // },
methods: { methods: {
changeFont(e) { changeFont(size) {
console.log('🚀 ~ changeFont ~ e:', e) console.log('🚀 ~ changeFont ~ size:', size)
this.fontSize = e.value this.fontSize = size
}, },
// //
async getList() { async getList() {
@ -673,6 +676,11 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.u-nav-slot {
display: flex;
justify-content: flex-end;
align-items: center;
}
.content { .content {
width: 100vw; width: 100vw;
height: 90vh; height: 90vh;
@ -765,7 +773,6 @@ export default {
.options { .options {
margin-top: 10px; margin-top: 10px;
margin-bottom: 30px; margin-bottom: 30px;
max-height: 330px;
overflow: auto; overflow: auto;
.option-wrapper { .option-wrapper {
max-height: 200px; max-height: 200px;

View File

@ -2,7 +2,9 @@
<view class="wrapper" :style="{ fontSize: fontSize + 'px' }"> <view class="wrapper" :style="{ fontSize: fontSize + 'px' }">
<u-navbar leftIcon="" title="" :placeholder="true"> <u-navbar leftIcon="" title="" :placeholder="true">
<view class="u-nav-slot" slot="right"> <view class="u-nav-slot" slot="right">
<u-number-box v-model="fontSize" @change="changeFont" button-size="36"></u-number-box> <u-tag text="小" :type="fontSize == 19 ? 'primary' : 'info'" @click="changeFont(19)" style="margin-right: 8px" ></u-tag>
<u-tag text="中" :type="fontSize == 21 ? 'primary' : 'info'" @click="changeFont(21)" style="margin-right: 8px"></u-tag>
<u-tag text="大" :type="fontSize == 23 ? 'primary' : 'info'" @click="changeFont(23)"></u-tag>
</view> </view>
</u-navbar> </u-navbar>
<div class="top-time">已用时间 {{ usedTime }}</div> <div class="top-time">已用时间 {{ usedTime }}</div>
@ -277,7 +279,7 @@ export default {
startY: 0, // Y startY: 0, // Y
endX: 0, // X endX: 0, // X
endY: 0, // Y endY: 0, // Y
fontSize: 20 fontSize: 19
} }
}, },
onLoad(opt) { onLoad(opt) {
@ -301,9 +303,9 @@ export default {
this.handleClose() this.handleClose()
}, },
methods: { methods: {
changeFont(e) { changeFont(size) {
console.log('🚀 ~ changeFont ~ e:', e) console.log('🚀 ~ changeFont ~ size:', size)
this.fontSize = e.value this.fontSize = size
}, },
// - // -
getPracticeItData() { getPracticeItData() {
@ -913,6 +915,11 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.u-nav-slot {
display: flex;
justify-content: flex-end;
align-items: center;
}
.wrapper { .wrapper {
height: 100vh; height: 100vh;
/* background: url('/static/images/question-bg.png') no-repeat; */ /* background: url('/static/images/question-bg.png') no-repeat; */