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,72 +1,72 @@
1
- <template>
2
- <!-- 商品详情-轮播图 -->
3
- <swiper indicator-dots="{{ true }}" indicator-color="#fff" autoplay="{{ true }}" class="swiper-box"
4
- style="height: {{ height }}px;">
5
- <block wx:for="{{ goodsPics }}" wx:key="index">
6
- <swiper-item>
7
- <image class="swiper-img" src="{{ imageUrl + item }}" bind:tap="handlePreview" data-url="{{ item }}" />
8
- </swiper-item>
9
- </block>
10
- </swiper>
11
- </template>
12
-
13
- <script lang="ts">
14
- import mpx, { createComponent, ref } from "@mpxjs/core"
15
- import { EventBase } from "../../api/types";
16
-
17
- createComponent({
18
- setup() {
19
- let config = getApp().globalData.config;
20
- // 静态图片资源
21
- let imageUrl = config.baseUrl + "/v1/file/image/clip/750/750/"
22
- // 接口资源路径
23
- let pathUrl = config.baseUrl + "/v1/file/path/"
24
- // 屏幕高度
25
- let height = ref(mpx.getWindowInfo().windowWidth)
26
- return {
27
- imageUrl,
28
- pathUrl,
29
- height
30
- }
31
- },
32
- properties: {
33
- // 轮播图数组-商品图
34
- goodsPics: {
35
- type: Array,
36
- value: [] as Array<string>
37
- }
38
- },
39
- methods: {
40
- // 查看图片预览
41
- handlePreview(e: EventBase) {
42
- const url = e.currentTarget.dataset.url
43
- const path = this.pathUrl + url
44
- const pathArr = this.goodsPics.map((item) => {
45
- return this.pathUrl + item
46
- })
47
- mpx.previewImage({
48
- current: path,
49
- urls: pathArr
50
- })
51
- }
52
- }
53
- })
54
- </script>
55
-
56
- <style lang="scss">
57
- .swiper-box {
58
- overflow: hidden;
59
- }
60
-
61
- .swiper-img {
62
- width: 100%;
63
- height: 100%;
64
- }
65
- </style>
66
-
67
- <script type="application/json">
68
- {
69
- "component": true,
70
- "usingComponents": {}
71
- }
1
+ <template>
2
+ <!-- 商品详情-轮播图 -->
3
+ <swiper indicator-dots="{{ true }}" indicator-color="#fff" autoplay="{{ true }}" class="swiper-box"
4
+ style="height: {{ height }}px;">
5
+ <block wx:for="{{ goodsPics }}" wx:key="index">
6
+ <swiper-item>
7
+ <image class="swiper-img" src="{{ imageUrl + item }}" bind:tap="handlePreview" data-url="{{ item }}" />
8
+ </swiper-item>
9
+ </block>
10
+ </swiper>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import mpx, { createComponent, ref } from "@mpxjs/core"
15
+ import { EventBase } from "../../api/types";
16
+
17
+ createComponent({
18
+ setup() {
19
+ let config = getApp().globalData.config;
20
+ // 静态图片资源
21
+ let imageUrl = config.baseUrl + "/v1/file/image/clip/750/750/"
22
+ // 接口资源路径
23
+ let pathUrl = config.baseUrl + "/v1/file/path/"
24
+ // 屏幕高度
25
+ let height = ref(mpx.getWindowInfo().windowWidth)
26
+ return {
27
+ imageUrl,
28
+ pathUrl,
29
+ height
30
+ }
31
+ },
32
+ properties: {
33
+ // 轮播图数组-商品图
34
+ goodsPics: {
35
+ type: Array,
36
+ value: [] as Array<string>
37
+ }
38
+ },
39
+ methods: {
40
+ // 查看图片预览
41
+ handlePreview(e: EventBase) {
42
+ const url = e.currentTarget.dataset.url
43
+ const path = this.pathUrl + url
44
+ const pathArr = this.goodsPics.map((item) => {
45
+ return this.pathUrl + item
46
+ })
47
+ mpx.previewImage({
48
+ current: path,
49
+ urls: pathArr
50
+ })
51
+ }
52
+ }
53
+ })
54
+ </script>
55
+
56
+ <style lang="scss">
57
+ .swiper-box {
58
+ overflow: hidden;
59
+ }
60
+
61
+ .swiper-img {
62
+ width: 100%;
63
+ height: 100%;
64
+ }
65
+ </style>
66
+
67
+ <script type="application/json">
68
+ {
69
+ "component": true,
70
+ "usingComponents": {}
71
+ }
72
72
  </script>
@@ -1,138 +1,138 @@
1
- <template>
2
- <cube-popup wx:if="{{ show }}" wx:ref="popup" zIndex="999999" position="bottom" transition="move-up"
3
- maskClosable="{{ true }}" styleConfig="{{ popupStyle }}" bind:maskClick="closePopup">
4
- <view class="auth-mask-popup"
5
- style="height: {{ height }}; background-color: {{ backColor }};border-top-left-radius: {{ borderRadius }};border-top-right-radius: {{ borderRadius }};width: 100%;">
6
- <view class="popup-title" wx:if="{{ titleShow }}">
7
- {{ title }}
8
- <image class="close-icon" src="{{ resourceUrl + 'close_circle2x.png' }}" mode="aspectFit"
9
- bind:tap="closePopup" />
10
- </view>
11
- <slot></slot>
12
- </view>
13
- </cube-popup>
14
- </template>
15
-
16
- <script lang="ts">
17
- import { createComponent } from "@mpxjs/core"
18
-
19
- createComponent({
20
- properties: {
21
- // 是否显示
22
- show: {
23
- type: Boolean,
24
- value: false,
25
- observer() {
26
- // 确保 popup 引用已存在
27
- if (this.$refs.popup) {
28
- this.show ? this.$refs.popup.show() : this.$refs.popup.hide()
29
- }
30
- }
31
- },
32
- // 标题
33
- title: {
34
- type: String,
35
- value: ""
36
- },
37
- // 是否显示标题
38
- titleShow: {
39
- type: Boolean,
40
- value: true
41
- },
42
- // 高
43
- height: {
44
- type: String,
45
- value: ""
46
- },
47
- // 背景色
48
- backColor: {
49
- type: String,
50
- value: "#fff"
51
- },
52
- // 圆角
53
- borderRadius: {
54
- type: String,
55
- value: "50rpx"
56
- }
57
- },
58
- setup() {
59
- let config = getApp().globalData.config;
60
- let resourceUrl = config.resourceUrl + "/images/icon_image/"
61
- let popupStyle = {
62
- mask: {
63
- backgroundColor: "rgba(0, 0, 0, 0.5)"
64
- }
65
- }
66
-
67
- return {
68
- resourceUrl,
69
- popupStyle,
70
- }
71
- },
72
- lifetimes: {
73
- ready() {
74
- // 组件初始化完成后,如果 show 为 true,显示弹窗
75
- if (this.show && this.$refs.popup) {
76
- this.$refs.popup.show()
77
- }
78
- }
79
- },
80
- methods: {
81
- // 关闭弹框
82
- closePopup() {
83
- this.triggerEvent("close")
84
- this.$refs.popup.hide()
85
- }
86
- }
87
- })
88
- </script>
89
-
90
- <style lang="scss">
91
- @use "../../styles/index.scss" as *;
92
-
93
- // 遮罩层
94
- .auth-mask-box {
95
- position: fixed;
96
- left: 0;
97
- top: 0;
98
- bottom: 0;
99
- right: 0;
100
- width: $width;
101
- background-color: rgba(0, 0, 0, 0.5);
102
- z-index: $z-index;
103
- }
104
-
105
- .auth-mask-popup {
106
- position: fixed;
107
- bottom: 0;
108
- left: 0;
109
- width: 92%;
110
- padding: 0 30rpx env(safe-area-inset-bottom);
111
- box-sizing: border-box;
112
- z-index: $z-index;
113
-
114
- .popup-title {
115
- color: $font-color;
116
- font-size: $font-size;
117
- padding: 40rpx 20rpx 20rpx;
118
- font-weight: bold;
119
- display: flex;
120
- align-items: center;
121
- justify-content: space-between;
122
-
123
- .close-icon {
124
- width: 40rpx;
125
- height: 40rpx;
126
- }
127
- }
128
- }
129
- </style>
130
-
131
- <script type="application/json">
132
- {
133
- "component": true,
134
- "usingComponents": {
135
- "cube-popup": "@mpxjs/mpx-cube-ui/src/components/popup/index"
136
- }
137
- }
1
+ <template>
2
+ <cube-popup wx:if="{{ show }}" wx:ref="popup" zIndex="999999" position="bottom" transition="move-up"
3
+ maskClosable="{{ true }}" styleConfig="{{ popupStyle }}" bind:maskClick="closePopup">
4
+ <view class="auth-mask-popup"
5
+ style="height: {{ height }}; background-color: {{ backColor }};border-top-left-radius: {{ borderRadius }};border-top-right-radius: {{ borderRadius }};width: 100%;">
6
+ <view class="popup-title" wx:if="{{ titleShow }}">
7
+ {{ title }}
8
+ <image class="close-icon" src="{{ resourceUrl + 'close_circle2x.png' }}" mode="aspectFit"
9
+ bind:tap="closePopup" />
10
+ </view>
11
+ <slot></slot>
12
+ </view>
13
+ </cube-popup>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ import { createComponent } from "@mpxjs/core"
18
+
19
+ createComponent({
20
+ properties: {
21
+ // 是否显示
22
+ show: {
23
+ type: Boolean,
24
+ value: false,
25
+ observer() {
26
+ // 确保 popup 引用已存在
27
+ if (this.$refs.popup) {
28
+ this.show ? this.$refs.popup.show() : this.$refs.popup.hide()
29
+ }
30
+ }
31
+ },
32
+ // 标题
33
+ title: {
34
+ type: String,
35
+ value: ""
36
+ },
37
+ // 是否显示标题
38
+ titleShow: {
39
+ type: Boolean,
40
+ value: true
41
+ },
42
+ // 高
43
+ height: {
44
+ type: String,
45
+ value: ""
46
+ },
47
+ // 背景色
48
+ backColor: {
49
+ type: String,
50
+ value: "#fff"
51
+ },
52
+ // 圆角
53
+ borderRadius: {
54
+ type: String,
55
+ value: "50rpx"
56
+ }
57
+ },
58
+ setup() {
59
+ let config = getApp().globalData.config;
60
+ let resourceUrl = config.resourceUrl + "/images/icon_image/"
61
+ let popupStyle = {
62
+ mask: {
63
+ backgroundColor: "rgba(0, 0, 0, 0.5)"
64
+ }
65
+ }
66
+
67
+ return {
68
+ resourceUrl,
69
+ popupStyle,
70
+ }
71
+ },
72
+ lifetimes: {
73
+ ready() {
74
+ // 组件初始化完成后,如果 show 为 true,显示弹窗
75
+ if (this.show && this.$refs.popup) {
76
+ this.$refs.popup.show()
77
+ }
78
+ }
79
+ },
80
+ methods: {
81
+ // 关闭弹框
82
+ closePopup() {
83
+ this.triggerEvent("close")
84
+ this.$refs.popup.hide()
85
+ }
86
+ }
87
+ })
88
+ </script>
89
+
90
+ <style lang="scss">
91
+ @use "../../styles/index.scss" as *;
92
+
93
+ // 遮罩层
94
+ .auth-mask-box {
95
+ position: fixed;
96
+ left: 0;
97
+ top: 0;
98
+ bottom: 0;
99
+ right: 0;
100
+ width: $width;
101
+ background-color: rgba(0, 0, 0, 0.5);
102
+ z-index: $z-index;
103
+ }
104
+
105
+ .auth-mask-popup {
106
+ position: fixed;
107
+ bottom: 0;
108
+ left: 0;
109
+ width: 92%;
110
+ padding: 0 30rpx env(safe-area-inset-bottom);
111
+ box-sizing: border-box;
112
+ z-index: $z-index;
113
+
114
+ .popup-title {
115
+ color: $font-color;
116
+ font-size: $font-size;
117
+ padding: 40rpx 20rpx 20rpx;
118
+ font-weight: bold;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: space-between;
122
+
123
+ .close-icon {
124
+ width: 40rpx;
125
+ height: 40rpx;
126
+ }
127
+ }
128
+ }
129
+ </style>
130
+
131
+ <script type="application/json">
132
+ {
133
+ "component": true,
134
+ "usingComponents": {
135
+ "cube-popup": "@mpxjs/mpx-cube-ui/src/components/popup/index"
136
+ }
137
+ }
138
138
  </script>
@@ -1,127 +1,127 @@
1
- <template>
2
- <!-- 搜索框 -->
3
- <view class="auth-search-box" style="{{ searchStyle }}">
4
- <icon type="search" color="{{ iconColor }}" size="18" class="search-icon"></icon>
5
- <input class="search-input" placeholder-style="color: {{ color }};"
6
- style="color: {{ color }}; background-color: {{ backColor }}; width: {{ isSearchBtn ? '60%' : '100%' }}; {{ isSearchBtn ? '' : 'padding-right: 40rpx' }}"
7
- focus="{{ focus }}" placeholder="{{ placeholder }}" disabled="{{ disabled }}" value="{{ likeName }}"
8
- bind:input="handleInput" bind:tap="handleTap" />
9
- <view class="search-btn" wx:if="{{ isSearchBtn }}">
10
- <slot></slot>
11
- </view>
12
- </view>
13
- </template>
14
-
15
- <script lang="ts">
16
- import { createComponent } from "@mpxjs/core";
17
- import { EventBase } from "../../api/types";
18
-
19
- createComponent({
20
- properties: {
21
- placeholder: {
22
- type: String,
23
- value: ""
24
- },
25
- disabled: {
26
- type: Boolean,
27
- value: false
28
- },
29
- // 是否显示右侧内容
30
- isSearchBtn: {
31
- type: Boolean,
32
- value: false
33
- },
34
- // 搜索内容
35
- likeName: {
36
- type: String,
37
- value: ""
38
- },
39
- // 背景色
40
- backColor: {
41
- type: String,
42
- value: "#fff"
43
- },
44
- // 字体色
45
- color: {
46
- type: String,
47
- value: "#6B7280"
48
- },
49
- // 是否有阴影
50
- searchStyle: {
51
- type: String,
52
- value: ""
53
- },
54
- // 是否聚焦
55
- focus: {
56
- type: Boolean,
57
- value: false
58
- },
59
- // 搜索图标颜色
60
- iconColor: {
61
- type: String,
62
- value: ""
63
- }
64
- },
65
- setup() {
66
- let config = getApp().globalData.config;
67
- // 资源路径
68
- let resourceUrl = config.resourceUrl + "/images";
69
-
70
- return { resourceUrl }
71
- },
72
- methods: {
73
- // 输入框输入事件
74
- handleInput(e: EventBase) {
75
- this.triggerEvent("handleSearch", e.detail.value)
76
- },
77
- // 一般用于点击搜索框跳转到搜索页
78
- handleTap() {
79
- this.triggerEvent("click")
80
- }
81
- }
82
- })
83
- </script>
84
-
85
- <style lang="scss">
86
- @use "../../styles/index.scss" as *;
87
-
88
- .auth-search-box {
89
- position: relative;
90
- width: 100%;
91
- border-radius: 50rpx;
92
- background-color: $white-color;
93
- display: flex;
94
- justify-content: space-between;
95
- align-items: center;
96
- height: 70rpx;
97
- box-sizing: border-box;
98
- overflow: hidden;
99
-
100
- .search-input {
101
- height: 70rpx;
102
- color: #6B7280;
103
- font-size: $font-size;
104
- padding-left: 80rpx;
105
- }
106
-
107
- .search-icon {
108
- width: 40rpx;
109
- height: 40rpx;
110
- position: absolute;
111
- left: 20rpx;
112
- transform: translate(0, -50%);
113
- top: 50%;
114
- }
115
-
116
- .search-btn {
117
- padding-right: 30rpx;
118
- }
119
- }
120
- </style>
121
-
122
- <script type="application/json">
123
- {
124
- "component": true,
125
- "usingComponents": {}
126
- }
1
+ <template>
2
+ <!-- 搜索框 -->
3
+ <view class="auth-search-box" style="{{ searchStyle }}">
4
+ <icon type="search" color="{{ iconColor }}" size="18" class="search-icon"></icon>
5
+ <input class="search-input" placeholder-style="color: {{ color }};"
6
+ style="color: {{ color }}; background-color: {{ backColor }}; width: {{ isSearchBtn ? '60%' : '100%' }}; {{ isSearchBtn ? '' : 'padding-right: 40rpx' }}"
7
+ focus="{{ focus }}" placeholder="{{ placeholder }}" disabled="{{ disabled }}" value="{{ likeName }}"
8
+ bind:input="handleInput" bind:tap="handleTap" />
9
+ <view class="search-btn" wx:if="{{ isSearchBtn }}">
10
+ <slot></slot>
11
+ </view>
12
+ </view>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { createComponent } from "@mpxjs/core";
17
+ import { EventBase } from "../../api/types";
18
+
19
+ createComponent({
20
+ properties: {
21
+ placeholder: {
22
+ type: String,
23
+ value: ""
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ value: false
28
+ },
29
+ // 是否显示右侧内容
30
+ isSearchBtn: {
31
+ type: Boolean,
32
+ value: false
33
+ },
34
+ // 搜索内容
35
+ likeName: {
36
+ type: String,
37
+ value: ""
38
+ },
39
+ // 背景色
40
+ backColor: {
41
+ type: String,
42
+ value: "#fff"
43
+ },
44
+ // 字体色
45
+ color: {
46
+ type: String,
47
+ value: "#6B7280"
48
+ },
49
+ // 是否有阴影
50
+ searchStyle: {
51
+ type: String,
52
+ value: ""
53
+ },
54
+ // 是否聚焦
55
+ focus: {
56
+ type: Boolean,
57
+ value: false
58
+ },
59
+ // 搜索图标颜色
60
+ iconColor: {
61
+ type: String,
62
+ value: ""
63
+ }
64
+ },
65
+ setup() {
66
+ let config = getApp().globalData.config;
67
+ // 资源路径
68
+ let resourceUrl = config.resourceUrl + "/images";
69
+
70
+ return { resourceUrl }
71
+ },
72
+ methods: {
73
+ // 输入框输入事件
74
+ handleInput(e: EventBase) {
75
+ this.triggerEvent("handleSearch", e.detail.value)
76
+ },
77
+ // 一般用于点击搜索框跳转到搜索页
78
+ handleTap() {
79
+ this.triggerEvent("click")
80
+ }
81
+ }
82
+ })
83
+ </script>
84
+
85
+ <style lang="scss">
86
+ @use "../../styles/index.scss" as *;
87
+
88
+ .auth-search-box {
89
+ position: relative;
90
+ width: 100%;
91
+ border-radius: 50rpx;
92
+ background-color: $white-color;
93
+ display: flex;
94
+ justify-content: space-between;
95
+ align-items: center;
96
+ height: 70rpx;
97
+ box-sizing: border-box;
98
+ overflow: hidden;
99
+
100
+ .search-input {
101
+ height: 70rpx;
102
+ color: #6B7280;
103
+ font-size: $font-size;
104
+ padding-left: 80rpx;
105
+ }
106
+
107
+ .search-icon {
108
+ width: 40rpx;
109
+ height: 40rpx;
110
+ position: absolute;
111
+ left: 20rpx;
112
+ transform: translate(0, -50%);
113
+ top: 50%;
114
+ }
115
+
116
+ .search-btn {
117
+ padding-right: 30rpx;
118
+ }
119
+ }
120
+ </style>
121
+
122
+ <script type="application/json">
123
+ {
124
+ "component": true,
125
+ "usingComponents": {}
126
+ }
127
127
  </script>