jmash-core-mp 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/.editorconfig +9 -9
  2. package/README.md +60 -60
  3. package/babel.config.json +34 -34
  4. package/eslint.config.mjs +7 -7
  5. package/lib/api/auth/index.d.ts +21 -21
  6. package/lib/api/auth/index.js +199 -199
  7. package/lib/api/auth/types.d.ts +86 -86
  8. package/lib/api/auth/types.js +9 -9
  9. package/lib/api/cms/index.d.ts +20 -20
  10. package/lib/api/cms/index.js +161 -161
  11. package/lib/api/cms/types.d.ts +200 -200
  12. package/lib/api/cms/types.js +1 -1
  13. package/lib/api/constant.d.ts +5 -5
  14. package/lib/api/constant.js +6 -6
  15. package/lib/api/dict/index.d.ts +18 -18
  16. package/lib/api/dict/index.js +34 -34
  17. package/lib/api/dict/types.d.ts +28 -28
  18. package/lib/api/dict/types.js +1 -1
  19. package/lib/api/dicts.d.ts +18 -18
  20. package/lib/api/dicts.js +67 -67
  21. package/lib/api/files/index.d.ts +25 -25
  22. package/lib/api/files/index.js +135 -135
  23. package/lib/api/files/types.d.ts +38 -38
  24. package/lib/api/files/types.js +1 -1
  25. package/lib/api/index.d.ts +4 -4
  26. package/lib/api/index.js +6 -6
  27. package/lib/api/myorgan/types.d.ts +22 -22
  28. package/lib/api/myorgan/types.js +1 -1
  29. package/lib/api/region/index.d.ts +7 -7
  30. package/lib/api/region/index.js +19 -19
  31. package/lib/api/region/types.d.ts +19 -19
  32. package/lib/api/region/types.js +1 -1
  33. package/lib/api/storage/index.d.ts +10 -10
  34. package/lib/api/storage/index.js +43 -43
  35. package/lib/api/storage/types.d.ts +28 -28
  36. package/lib/api/storage/types.js +1 -1
  37. package/lib/api/types.d.ts +42 -42
  38. package/lib/api/types.js +1 -1
  39. package/lib/app.mpx.d.ts +1 -1
  40. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +1 -1
  41. package/lib/components/auth-user/jmash-user.mpx.d.ts +1 -1
  42. package/lib/components/cms/jmash-cms-acticle-list.mpx.d.ts +1 -1
  43. package/lib/components/cms/jmash-cms-article-item.mpx.d.ts +1 -1
  44. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +1 -0
  45. package/lib/components/cms/jmash-cms-article.mpx.d.ts +1 -1
  46. package/lib/components/cms/jmash-cms-like.mpx.d.ts +1 -1
  47. package/lib/components/common/jmash-upload-picture.mpx.d.ts +1 -0
  48. package/lib/components/core/jmash-login.mpx.d.ts +1 -0
  49. package/lib/index.d.ts +21 -21
  50. package/lib/index.js +14 -14
  51. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +1 -1
  52. package/lib/pages/index.mpx.d.ts +1 -0
  53. package/lib/store/user.d.ts +31 -31
  54. package/lib/store/user.js +227 -227
  55. package/lib/utils/common.d.ts +35 -35
  56. package/lib/utils/common.js +166 -166
  57. package/lib/utils/config.d.ts +5 -5
  58. package/lib/utils/config.js +29 -29
  59. package/lib/utils/db.d.ts +21 -21
  60. package/lib/utils/db.js +84 -84
  61. package/lib/utils/grpc.d.ts +5 -5
  62. package/lib/utils/grpc.js +20 -20
  63. package/lib/utils/net.d.ts +7 -7
  64. package/lib/utils/net.js +15 -15
  65. package/lib/utils/request.d.ts +2 -2
  66. package/lib/utils/request.js +123 -123
  67. package/mpx.config.js +27 -27
  68. package/package.json +1 -1
  69. package/postcss.config.js +11 -11
  70. package/project.config.json +24 -24
  71. package/project.private.config.json +13 -13
  72. package/public/index.html +15 -15
  73. package/src/api/auth/index.ts +227 -227
  74. package/src/api/auth/types.ts +166 -166
  75. package/src/api/cms/index.ts +218 -218
  76. package/src/api/cms/types.ts +379 -379
  77. package/src/api/constant.ts +6 -6
  78. package/src/api/dict/index.ts +44 -44
  79. package/src/api/dict/types.ts +49 -49
  80. package/src/api/dicts.ts +72 -72
  81. package/src/api/files/index.ts +163 -163
  82. package/src/api/files/types.ts +67 -67
  83. package/src/api/index.ts +11 -11
  84. package/src/api/myorgan/types.ts +42 -42
  85. package/src/api/region/index.ts +23 -23
  86. package/src/api/region/types.ts +36 -36
  87. package/src/api/storage/index.ts +62 -62
  88. package/src/api/storage/types.ts +54 -54
  89. package/src/api/types.ts +72 -72
  90. package/src/app.mpx +71 -71
  91. package/src/components/auth-user/jmash-logout.mpx +91 -91
  92. package/src/components/auth-user/jmash-update-user.mpx +386 -386
  93. package/src/components/auth-user/jmash-update-user.web.mpx +366 -366
  94. package/src/components/auth-user/jmash-user.mpx +359 -359
  95. package/src/components/cms/jmash-cms-acticle-list.mpx +182 -182
  96. package/src/components/cms/jmash-cms-article-item.mpx +241 -241
  97. package/src/components/cms/jmash-cms-article-view.mpx +131 -131
  98. package/src/components/cms/jmash-cms-article.mpx +68 -68
  99. package/src/components/cms/jmash-cms-like.mpx +151 -151
  100. package/src/components/common/jmash-avatar-edit.mpx +153 -153
  101. package/src/components/common/jmash-cascader-region.mpx +112 -112
  102. package/src/components/common/jmash-menu.mpx +129 -129
  103. package/src/components/common/jmash-none-data.mpx +82 -82
  104. package/src/components/common/jmash-pic-swiper.mpx +71 -71
  105. package/src/components/common/jmash-popup.mpx +137 -137
  106. package/src/components/common/jmash-search.mpx +126 -126
  107. package/src/components/common/jmash-single-btn.mpx +53 -53
  108. package/src/components/common/jmash-stepper.mpx +214 -214
  109. package/src/components/common/jmash-tab-bar.mpx +50 -50
  110. package/src/components/common/jmash-textarea.mpx +88 -88
  111. package/src/components/common/jmash-top-navigation.mpx +203 -203
  112. package/src/components/common/jmash-upload-picture.mpx +129 -126
  113. package/src/components/core/jmash-cms-protocol.mpx +66 -66
  114. package/src/components/core/jmash-login.ali.mpx +284 -284
  115. package/src/components/core/jmash-login.mpx +348 -348
  116. package/src/components/core/jmash-login.web.mpx +421 -421
  117. package/src/components/core/jmash-popup-login.ali.mpx +311 -311
  118. package/src/components/core/jmash-popup-login.mpx +415 -415
  119. package/src/components/core/jmash-popup-login.web.mpx +389 -389
  120. package/src/custom-tab-bar/index.mpx +10 -10
  121. package/src/global.d.ts +11 -11
  122. package/src/index.ts +71 -71
  123. package/src/packages/index.mpx +10 -10
  124. package/src/packages/pages/auth/cms-protocol.mpx +31 -31
  125. package/src/packages/pages/auth/login.mpx +59 -59
  126. package/src/packages/pages/auth/update-user.mpx +17 -17
  127. package/src/packages/pages/cms/cms-article-list.mpx +164 -164
  128. package/src/packages/pages/cms/cms-article.mpx +32 -32
  129. package/src/pages/basic-component.mpx +30 -30
  130. package/src/pages/half-home.mpx +58 -58
  131. package/src/pages/home.mpx +52 -52
  132. package/src/pages/home2.mpx +47 -47
  133. package/src/pages/index.mpx +13 -3
  134. package/src/pages/tabbar/home.mpx +77 -77
  135. package/src/pages/tabbar/my.mpx +80 -80
  136. package/src/store/user.ts +270 -270
  137. package/src/styles/index.scss +20 -20
  138. package/src/styles/vars.scss +27 -27
  139. package/src/utils/common.ts +179 -179
  140. package/src/utils/config.ts +35 -35
  141. package/src/utils/db.ts +100 -100
  142. package/src/utils/grpc.ts +21 -21
  143. package/src/utils/net.ts +18 -18
  144. package/src/utils/request.ts +134 -134
  145. package/static/ali/mini.project.json +4 -4
  146. package/static/dd/project.config.json +15 -15
  147. package/static/swan/project.swan.json +14 -14
  148. package/static/tt/project.config.json +11 -11
  149. package/static/wx/project.config.json +40 -40
  150. package/uno.config.js +9 -9
@@ -1,88 +1,88 @@
1
- <template>
2
- <!-- 多行文本输入框 -->
3
- <view class="jmash-textarea">
4
- <textarea class="jmash-textarea-input" value="{{ textValue }}" placeholder="{{ placeholder }}"
5
- placeholder-class="jmash-textarea-placeholder" maxlength="{{ maxlength }}" bind:input="getValue" />
6
- <view wx:if="{{ maxlength > 0 }}" class="jmash-textarea-length"
7
- style="{{ textValue.length === maxlength ? 'color: red' : '' }}">
8
- {{ textValue.length }}/{{ maxlength }}
9
- </view>
10
- </view>
11
- </template>
12
-
13
- <script lang="ts">
14
- import { createComponent } from "@mpxjs/core";
15
-
16
- createComponent({
17
- /**
18
- * 组件的属性列表
19
- */
20
- properties: {
21
- // 输入框的内容
22
- textValue: {
23
- type: String,
24
- value: "",
25
- },
26
- // 输入框为空时占位符
27
- placeholder: {
28
- type: String,
29
- value: "",
30
- },
31
- // 最大输入长度
32
- maxlength: {
33
- type: Number,
34
- value: -1,
35
- },
36
- },
37
- /**
38
- * 组件的方法列表
39
- */
40
- methods: {
41
- // 获取值
42
- getValue(e: any) {
43
- this.triggerEvent("getValue", e.detail.value);
44
- },
45
- },
46
- });
47
- </script>
48
-
49
- <style lang="scss">
50
- @use "../../styles/index.scss" as *;
51
-
52
- .jmash-textarea {
53
- background-color: $white-color;
54
- border-radius: 10rpx;
55
- padding: 30rpx;
56
- box-sizing: border-box;
57
- margin: 20rpx 30rpx 0;
58
- width: 690rpx;
59
-
60
- .jmash-textarea-input {
61
- height: 200rpx;
62
- width: 100%;
63
- font-size: 28rpx;
64
- font-weight: 400;
65
- color: $font-color;
66
- }
67
-
68
- .jmash-textarea-placeholder {
69
- font-size: 28rpx;
70
- font-weight: 400;
71
- color: $font-color-grey-opacity;
72
- }
73
-
74
- .jmash-textarea-length {
75
- font-size: 24rpx;
76
- font-weight: 400;
77
- color: $font-color;
78
- text-align: right;
79
- }
80
- }
81
- </style>
82
-
83
- <script type="application/json">
84
- {
85
- "component": true,
86
- "usingComponents": {}
87
- }
88
- </script>
1
+ <template>
2
+ <!-- 多行文本输入框 -->
3
+ <view class="jmash-textarea">
4
+ <textarea class="jmash-textarea-input" value="{{ textValue }}" placeholder="{{ placeholder }}"
5
+ placeholder-class="jmash-textarea-placeholder" maxlength="{{ maxlength }}" bind:input="getValue" />
6
+ <view wx:if="{{ maxlength > 0 }}" class="jmash-textarea-length"
7
+ style="{{ textValue.length === maxlength ? 'color: red' : '' }}">
8
+ {{ textValue.length }}/{{ maxlength }}
9
+ </view>
10
+ </view>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import { createComponent } from "@mpxjs/core";
15
+
16
+ createComponent({
17
+ /**
18
+ * 组件的属性列表
19
+ */
20
+ properties: {
21
+ // 输入框的内容
22
+ textValue: {
23
+ type: String,
24
+ value: "",
25
+ },
26
+ // 输入框为空时占位符
27
+ placeholder: {
28
+ type: String,
29
+ value: "",
30
+ },
31
+ // 最大输入长度
32
+ maxlength: {
33
+ type: Number,
34
+ value: -1,
35
+ },
36
+ },
37
+ /**
38
+ * 组件的方法列表
39
+ */
40
+ methods: {
41
+ // 获取值
42
+ getValue(e: any) {
43
+ this.triggerEvent("getValue", e.detail.value);
44
+ },
45
+ },
46
+ });
47
+ </script>
48
+
49
+ <style lang="scss">
50
+ @use "../../styles/index.scss" as *;
51
+
52
+ .jmash-textarea {
53
+ background-color: $white-color;
54
+ border-radius: 10rpx;
55
+ padding: 30rpx;
56
+ box-sizing: border-box;
57
+ margin: 20rpx 30rpx 0;
58
+ width: 690rpx;
59
+
60
+ .jmash-textarea-input {
61
+ height: 200rpx;
62
+ width: 100%;
63
+ font-size: 28rpx;
64
+ font-weight: 400;
65
+ color: $font-color;
66
+ }
67
+
68
+ .jmash-textarea-placeholder {
69
+ font-size: 28rpx;
70
+ font-weight: 400;
71
+ color: $font-color-grey-opacity;
72
+ }
73
+
74
+ .jmash-textarea-length {
75
+ font-size: 24rpx;
76
+ font-weight: 400;
77
+ color: $font-color;
78
+ text-align: right;
79
+ }
80
+ }
81
+ </style>
82
+
83
+ <script type="application/json">
84
+ {
85
+ "component": true,
86
+ "usingComponents": {}
87
+ }
88
+ </script>
@@ -1,204 +1,204 @@
1
- <template>
2
- <!-- 顶部导航栏(支持滚动变色效果) -->
3
- <view class="nav-bar" style="background-color: {{ style.color || (indexBg ? 'transparent' : '#ffffff' ) }};">
4
- <view class="nav-bar-content"
5
- style="color: {{ currentTitleColor }}; height: {{ style.height }}px;padding-top: {{ style.paddingTop }}px;">
6
- <!-- 左侧区域 -->
7
- <view class="nav-bar-left" slot="left">
8
- <view class="left-icon" wx:if="{{ leftIcon }}"
9
- bind:tap="{{ leftIcon === 'home' ? 'handleIndex' : 'handleReturn' }}">
10
- <cube-icon type="{{ leftIcon === 'home' ? 'home' : 'back' }}" size="30rpx"
11
- color="{{ currentTitleColor }}" />
12
- </view>
13
- <slot />
14
- </view>
15
-
16
- <!-- 标题区域 -->
17
- <view class="nav-bar-title" wx:if="{{ title }}">
18
- {{ title }}
19
- </view>
20
-
21
- <!-- 右侧区域 -->
22
- <view class="nav-bar-right">
23
- <slot name="right" />
24
- </view>
25
- </view>
26
- </view>
27
- </template>
28
-
29
- <script lang="ts">
30
- import mpx, { createComponent, ref } from "@mpxjs/core";
31
-
32
- createComponent({
33
- options: {
34
- multipleSlots: true,
35
- },
36
- properties: {
37
- // 左侧按钮('home':首页图标, 'back':返回图标,不传或空字符串不显示)
38
- leftIcon: {
39
- type: String,
40
- value: "",
41
- },
42
- // 标题
43
- title: {
44
- type: String,
45
- value: "",
46
- },
47
- // 是否首页导航栏透明背景
48
- indexBg: {
49
- type: Boolean,
50
- value: false,
51
- },
52
- // 是否开启字体渐变 白-黑(滚动变色时)
53
- isGradient: {
54
- type: Boolean,
55
- value: false
56
- },
57
- // 字体的颜色
58
- titleColor: {
59
- type: String,
60
- value: "#333",
61
- }
62
- },
63
- setup() {
64
- // 样式控制对象
65
- const style = ref({
66
- // 导航栏的高度
67
- height: mpx.getMenuButtonBoundingClientRect().bottom - mpx.getMenuButtonBoundingClientRect().top,
68
- // 导航栏顶部内边距
69
- paddingTop: mpx.getMenuButtonBoundingClientRect().top,
70
- // 背景透明色
71
- color: "",
72
- });
73
- // 当前标题颜色
74
- const currentTitleColor = ref("#333");
75
-
76
- return {
77
- style,
78
- currentTitleColor,
79
- }
80
- },
81
- lifetimes: {
82
- attached() {
83
- // 初始化
84
- this.updateStyles();
85
- }
86
- },
87
- methods: {
88
- // 更新样式
89
- updateStyles() {
90
- // 标题颜色始终使用 titleColor(用户自定义或默认值)
91
- this.currentTitleColor = this.titleColor;
92
- // 透明背景模式
93
- if (this.indexBg) {
94
- this.style.color = "rgba(255, 255, 255, 0)";
95
- }
96
- },
97
-
98
- // 返回上一级
99
- handleReturn() {
100
- mpx.navigateBack();
101
- },
102
-
103
- // 返回首页
104
- handleIndex() {
105
- mpx.reLaunch({ url: "/pages/tabbar/home" });
106
- },
107
-
108
- // 计算导航栏透明度(供父组件调用)
109
- calculateOpacity(scrollTop: number) {
110
- const defaultTitleColorWhite = "#fff";
111
- const defaultTitleColorBlack = "#333";
112
- let color: string;
113
- // 计算标题颜色:回到顶部时使用自定义颜色,否则根据渐变模式切换
114
- let titleColor = scrollTop === 0
115
- ? this.titleColor
116
- : (this.isGradient
117
- ? (scrollTop >= 80 ? defaultTitleColorBlack : defaultTitleColorWhite)
118
- : this.titleColor);
119
-
120
- if (scrollTop === 0) {
121
- color = "rgba(255, 255, 255, 0)";
122
- } else if (scrollTop > 0 && scrollTop <= 10) {
123
- color = "rgba(255, 255, 255, 0.1)";
124
- } else if (scrollTop >= 10 && scrollTop < 20) {
125
- color = "rgba(255, 255, 255, 0.2)";
126
- } else if (scrollTop >= 20 && scrollTop < 30) {
127
- color = "rgba(255, 255, 255, 0.3)";
128
- } else if (scrollTop >= 30 && scrollTop < 40) {
129
- color = "rgba(255, 255, 255, 0.4)";
130
- } else if (scrollTop >= 40 && scrollTop < 50) {
131
- color = "rgba(255, 255, 255, 0.5)";
132
- } else if (scrollTop >= 50 && scrollTop < 60) {
133
- color = "rgba(255, 255, 255, 0.6)";
134
- } else if (scrollTop >= 60 && scrollTop < 70) {
135
- color = "rgba(255, 255, 255, 0.7)";
136
- } else if (scrollTop >= 70 && scrollTop < 80) {
137
- color = "rgba(255, 255, 255, 0.8)";
138
- } else {
139
- color = "rgba(255, 255, 255, 1)";
140
- }
141
- this.style.color = color;
142
- this.currentTitleColor = titleColor;
143
- }
144
- },
145
- })
146
- </script>
147
-
148
- <style lang="scss">
149
- @use "../../styles/index.scss" as *;
150
-
151
- .nav-bar {
152
- position: fixed;
153
- top: 0;
154
- left: 0;
155
- right: 0;
156
- z-index: 99999;
157
- transition: background-color 0.2s ease;
158
- }
159
-
160
- .nav-bar-content {
161
- display: flex;
162
- align-items: center;
163
- padding: 0 20rpx;
164
- }
165
-
166
- .nav-bar-left {
167
- display: flex;
168
- align-items: center;
169
- flex: 1;
170
- }
171
-
172
- .left-icon {
173
- display: flex;
174
- align-items: center;
175
- justify-content: center;
176
- padding: 10rpx;
177
- }
178
-
179
- .nav-bar-title {
180
- flex: 2;
181
- text-align: center;
182
- font-size: $font-size;
183
- font-weight: 500;
184
- overflow: hidden;
185
- text-overflow: ellipsis;
186
- white-space: nowrap;
187
- }
188
-
189
- .nav-bar-right {
190
- flex: 1;
191
- display: flex;
192
- align-items: center;
193
- justify-content: flex-end;
194
- }
195
- </style>
196
-
197
- <script type="application/json">
198
- {
199
- "component": true,
200
- "usingComponents": {
201
- "cube-icon": "@mpxjs/mpx-cube-ui/src/components/icon/index"
202
- }
203
- }
1
+ <template>
2
+ <!-- 顶部导航栏(支持滚动变色效果) -->
3
+ <view class="nav-bar" style="background-color: {{ style.color || (indexBg ? 'transparent' : '#ffffff' ) }};">
4
+ <view class="nav-bar-content"
5
+ style="color: {{ currentTitleColor }}; height: {{ style.height }}px;padding-top: {{ style.paddingTop }}px;">
6
+ <!-- 左侧区域 -->
7
+ <view class="nav-bar-left" slot="left">
8
+ <view class="left-icon" wx:if="{{ leftIcon }}"
9
+ bind:tap="{{ leftIcon === 'home' ? 'handleIndex' : 'handleReturn' }}">
10
+ <cube-icon type="{{ leftIcon === 'home' ? 'home' : 'back' }}" size="30rpx"
11
+ color="{{ currentTitleColor }}" />
12
+ </view>
13
+ <slot />
14
+ </view>
15
+
16
+ <!-- 标题区域 -->
17
+ <view class="nav-bar-title" wx:if="{{ title }}">
18
+ {{ title }}
19
+ </view>
20
+
21
+ <!-- 右侧区域 -->
22
+ <view class="nav-bar-right">
23
+ <slot name="right" />
24
+ </view>
25
+ </view>
26
+ </view>
27
+ </template>
28
+
29
+ <script lang="ts">
30
+ import mpx, { createComponent, ref } from "@mpxjs/core";
31
+
32
+ createComponent({
33
+ options: {
34
+ multipleSlots: true,
35
+ },
36
+ properties: {
37
+ // 左侧按钮('home':首页图标, 'back':返回图标,不传或空字符串不显示)
38
+ leftIcon: {
39
+ type: String,
40
+ value: "",
41
+ },
42
+ // 标题
43
+ title: {
44
+ type: String,
45
+ value: "",
46
+ },
47
+ // 是否首页导航栏透明背景
48
+ indexBg: {
49
+ type: Boolean,
50
+ value: false,
51
+ },
52
+ // 是否开启字体渐变 白-黑(滚动变色时)
53
+ isGradient: {
54
+ type: Boolean,
55
+ value: false
56
+ },
57
+ // 字体的颜色
58
+ titleColor: {
59
+ type: String,
60
+ value: "#333",
61
+ }
62
+ },
63
+ setup() {
64
+ // 样式控制对象
65
+ const style = ref({
66
+ // 导航栏的高度
67
+ height: mpx.getMenuButtonBoundingClientRect().bottom - mpx.getMenuButtonBoundingClientRect().top,
68
+ // 导航栏顶部内边距
69
+ paddingTop: mpx.getMenuButtonBoundingClientRect().top,
70
+ // 背景透明色
71
+ color: "",
72
+ });
73
+ // 当前标题颜色
74
+ const currentTitleColor = ref("#333");
75
+
76
+ return {
77
+ style,
78
+ currentTitleColor,
79
+ }
80
+ },
81
+ lifetimes: {
82
+ attached() {
83
+ // 初始化
84
+ this.updateStyles();
85
+ }
86
+ },
87
+ methods: {
88
+ // 更新样式
89
+ updateStyles() {
90
+ // 标题颜色始终使用 titleColor(用户自定义或默认值)
91
+ this.currentTitleColor = this.titleColor;
92
+ // 透明背景模式
93
+ if (this.indexBg) {
94
+ this.style.color = "rgba(255, 255, 255, 0)";
95
+ }
96
+ },
97
+
98
+ // 返回上一级
99
+ handleReturn() {
100
+ mpx.navigateBack();
101
+ },
102
+
103
+ // 返回首页
104
+ handleIndex() {
105
+ mpx.reLaunch({ url: "/pages/tabbar/home" });
106
+ },
107
+
108
+ // 计算导航栏透明度(供父组件调用)
109
+ calculateOpacity(scrollTop: number) {
110
+ const defaultTitleColorWhite = "#fff";
111
+ const defaultTitleColorBlack = "#333";
112
+ let color: string;
113
+ // 计算标题颜色:回到顶部时使用自定义颜色,否则根据渐变模式切换
114
+ let titleColor = scrollTop === 0
115
+ ? this.titleColor
116
+ : (this.isGradient
117
+ ? (scrollTop >= 80 ? defaultTitleColorBlack : defaultTitleColorWhite)
118
+ : this.titleColor);
119
+
120
+ if (scrollTop === 0) {
121
+ color = "rgba(255, 255, 255, 0)";
122
+ } else if (scrollTop > 0 && scrollTop <= 10) {
123
+ color = "rgba(255, 255, 255, 0.1)";
124
+ } else if (scrollTop >= 10 && scrollTop < 20) {
125
+ color = "rgba(255, 255, 255, 0.2)";
126
+ } else if (scrollTop >= 20 && scrollTop < 30) {
127
+ color = "rgba(255, 255, 255, 0.3)";
128
+ } else if (scrollTop >= 30 && scrollTop < 40) {
129
+ color = "rgba(255, 255, 255, 0.4)";
130
+ } else if (scrollTop >= 40 && scrollTop < 50) {
131
+ color = "rgba(255, 255, 255, 0.5)";
132
+ } else if (scrollTop >= 50 && scrollTop < 60) {
133
+ color = "rgba(255, 255, 255, 0.6)";
134
+ } else if (scrollTop >= 60 && scrollTop < 70) {
135
+ color = "rgba(255, 255, 255, 0.7)";
136
+ } else if (scrollTop >= 70 && scrollTop < 80) {
137
+ color = "rgba(255, 255, 255, 0.8)";
138
+ } else {
139
+ color = "rgba(255, 255, 255, 1)";
140
+ }
141
+ this.style.color = color;
142
+ this.currentTitleColor = titleColor;
143
+ }
144
+ },
145
+ })
146
+ </script>
147
+
148
+ <style lang="scss">
149
+ @use "../../styles/index.scss" as *;
150
+
151
+ .nav-bar {
152
+ position: fixed;
153
+ top: 0;
154
+ left: 0;
155
+ right: 0;
156
+ z-index: 99999;
157
+ transition: background-color 0.2s ease;
158
+ }
159
+
160
+ .nav-bar-content {
161
+ display: flex;
162
+ align-items: center;
163
+ padding: 0 20rpx;
164
+ }
165
+
166
+ .nav-bar-left {
167
+ display: flex;
168
+ align-items: center;
169
+ flex: 1;
170
+ }
171
+
172
+ .left-icon {
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ padding: 10rpx;
177
+ }
178
+
179
+ .nav-bar-title {
180
+ flex: 2;
181
+ text-align: center;
182
+ font-size: $font-size;
183
+ font-weight: 500;
184
+ overflow: hidden;
185
+ text-overflow: ellipsis;
186
+ white-space: nowrap;
187
+ }
188
+
189
+ .nav-bar-right {
190
+ flex: 1;
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: flex-end;
194
+ }
195
+ </style>
196
+
197
+ <script type="application/json">
198
+ {
199
+ "component": true,
200
+ "usingComponents": {
201
+ "cube-icon": "@mpxjs/mpx-cube-ui/src/components/icon/index"
202
+ }
203
+ }
204
204
  </script>