人民医院前端

fontSizeSetting.vue 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <!-- <page-meta :root-font-size="getRootFontSize(1)"></page-meta> -->
  3. <view id="wrap">
  4. <view class="fontContent" :style="{ fontSize: selectValue + 'rem' }">字体大小设置</view>
  5. <view class="changeFont">
  6. <view class="changeFont_left" >字号:</view>
  7. <uni-data-select
  8. v-model="selectValue"
  9. :localdata="range"
  10. @change="change"
  11. ></uni-data-select>
  12. </view>
  13. <view class="btnClass">
  14. <wButton class="wbutton" text="保存设置" :rotate="isRotate" @click="saveFont"></wButton>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import wButton from '@/components/watch-login/watch-button.vue' //button
  20. export default {
  21. data() {
  22. return {
  23. selectValue: 1,
  24. isRotate: false, //是否加载旋转
  25. range: [
  26. { value: 1, text: "小" },
  27. { value: 1.2, text: "中" },
  28. { value: 1.4, text: "大" },
  29. ],
  30. };
  31. },
  32. components: {
  33. wButton,
  34. },
  35. onLoad() {
  36. this.selectValue = uni.getStorageSync('fontSizeValue')
  37. },
  38. methods: {
  39. change(e) {
  40. console.log("e:", e);
  41. },
  42. saveFont(){
  43. uni.setStorageSync('fontSizeValue', '')
  44. uni.setStorageSync('fontSizeValue', this.selectValue)
  45. uni.showModal({
  46. title: '退出',
  47. content: '是否确认退出',
  48. success: function (res) {
  49. if (res.confirm) {
  50. uni.reLaunch({
  51. url:'/pages/login/login'
  52. })
  53. } else if (res.cancel) {
  54. this.$mHelper.toast("你需要重新登录才生效");
  55. }
  56. }
  57. });
  58. },
  59. }
  60. }
  61. </script>
  62. <style scoped>
  63. #wrap{
  64. background: #fff;
  65. padding: 15px;
  66. }
  67. .btnClass{
  68. margin-top: 30px;
  69. }
  70. .fontContent{
  71. margin-top: 30px;
  72. }
  73. .changeFont_left{
  74. width: 20%;
  75. }
  76. .changeFont{
  77. margin-top: 30px;
  78. display: flex;
  79. background: #fff;
  80. line-height: 36px;
  81. }
  82. </style>