@kaiyinchem/ky-uniui 1.0.48 → 1.1.0

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.
@@ -35,7 +35,7 @@
35
35
  <view v-if="!right && isInput" class="opt-val opt-input">
36
36
  <input
37
37
  v-if="type === 'text'"
38
- :placeholder="placeholder || `请输入${label}`"
38
+ :placeholder="placeholder || $t('inputTips') + label"
39
39
  :disabled="disabled"
40
40
  :maxlength="maxlength"
41
41
  type="text"
@@ -48,7 +48,7 @@
48
48
  />
49
49
  <input
50
50
  v-if="type === 'number'"
51
- :placeholder="placeholder || `请输入${label}`"
51
+ :placeholder="placeholder || $t('inputTips') + label"
52
52
  :disabled="disabled"
53
53
  :maxlength="maxlength"
54
54
  type="number"
@@ -61,7 +61,7 @@
61
61
  />
62
62
  <input
63
63
  v-if="type === 'digit'"
64
- :placeholder="placeholder || `请输入${label}`"
64
+ :placeholder="placeholder || $t('inputTips') + label"
65
65
  :disabled="disabled"
66
66
  :maxlength="maxlength"
67
67
  type="digit"
@@ -74,7 +74,7 @@
74
74
  />
75
75
  <view v-if="type === 'textarea'" class="opt-textarea">
76
76
  <textarea
77
- :placeholder="placeholder || `请输入${label}`"
77
+ :placeholder="placeholder || $t('inputTips') + label"
78
78
  :disabled="disabled"
79
79
  :maxlength="maxlength"
80
80
  placeholder-class="input-placeholder"
@@ -97,7 +97,7 @@
97
97
  style="width: 100%;"
98
98
  @change="onDateChange"
99
99
  >
100
- <text class="opt-val">{{ content || placeholder || `请选择${label}` }}</text>
100
+ <text class="opt-val">{{ content || placeholder || $t('selectTips') + label }}</text>
101
101
  </picker>
102
102
 
103
103
  </template>
@@ -2,7 +2,7 @@
2
2
  <view class="ky-empty-wrap">
3
3
  <view class="ky-empty-box">
4
4
  <image v-if="icon" class="ky-empty-icon" src="/static/img/nodata.png"></image>
5
- <text v-if="msg" class="ky-empty-msg">{{ msg }}</text>
5
+ <text v-if="errMsg" class="ky-empty-msg">{{ errMsg }}</text>
6
6
  <slot></slot>
7
7
  </view>
8
8
  </view>
@@ -17,14 +17,26 @@
17
17
  },
18
18
  msg: {
19
19
  type: String,
20
- default: '暂无数据'
20
+ default: ''
21
21
  },
22
- },
22
+ },
23
+ watch: {
24
+ msg(v) {
25
+ if (v) {
26
+ this.errMsg = this.msg
27
+ }
28
+ },
29
+ },
23
30
  data() {
24
- return {
25
-
31
+ return {
32
+ errMsg: this.$t('noData')
26
33
  }
27
- }
34
+ },
35
+ mounted() {
36
+ if (this.msg) {
37
+ this.errMsg = this.msg
38
+ }
39
+ },
28
40
  }
29
41
  </script>
30
42
 
@@ -23,7 +23,7 @@
23
23
  <image v-else-if="loadState === -2" class="ky-fetch-err-img" src="@/static/img/request_error.png"></image>
24
24
  <image v-else class="ky-fetch-err-img" src="@/static/img/network_error.png"></image>
25
25
  </template>
26
- <text class="ky-fetch-err-txt">{{ msg || noDataMsg || (loadState === -1 ? '暂无相关内容' : '加载失败,请点击重试') }}</text>
26
+ <text class="ky-fetch-err-txt">{{ msg || noDataMsg || (loadState === -1 ? $t('noData') : $t('loadFaild')) }}</text>
27
27
  </view>
28
28
 
29
29
  <view v-if="$slots.nodata && loadState === -1" class="ky-fetch-error-tip">
@@ -115,7 +115,7 @@
115
115
  },
116
116
  data: {},
117
117
  list: [],
118
- tips: '没有更多了',
118
+ tips: this.$t('noMore'),
119
119
  loadError: false,
120
120
  loading: false,
121
121
  isChangeCondition: false,
@@ -234,7 +234,7 @@
234
234
  this.noMore = this.list.length >= count
235
235
  }
236
236
 
237
- this.tips = this.noMore ? '没有更多了' : '加载中...'
237
+ this.tips = this.noMore ? this.$t('noMore') : this.$t('loading')
238
238
 
239
239
  if (this.autoHideLoading) {
240
240
  this.loadState = isNoData ? -1 : 1
@@ -256,7 +256,7 @@
256
256
  if (e.code === 504) {
257
257
  this.loadState = -3
258
258
  }
259
- this.tips = e.msg || '加载失败,请点击重试'
259
+ this.tips = e.msg || this.$t('loadFaild')
260
260
  this.msg = this.tips
261
261
  this.loadError = true
262
262
  this.$emit('error', e)
@@ -27,7 +27,7 @@
27
27
 
28
28
  <!--通用头部-->
29
29
  <view v-if="title" :class="{ noClose, 'white-bg': type === 'pop', txtLeft: titleAlign === 'left' }" class="pop-top">
30
- <text v-if="showTopBtn" class="pop-close" @click="close">取消</text>
30
+ <text v-if="showTopBtn" class="pop-close" @click="close">{{ $t('cancel') }}</text>
31
31
  <text class="pop-title">{{ title }}</text>
32
32
  <text v-if="!noClose && !showTopBtn && position !== 'top'" class="pop-close iconfont" @click="close">&#xe634;</text>
33
33
  <button v-if="!noClose && showTopBtn" :disabled="disabled" :class="{ disabled }" class="pop-top-btn" @click="confirm">{{ confirmText }}</button>
@@ -130,6 +130,8 @@
130
130
  </template>
131
131
 
132
132
  <script>
133
+ import i18n from '@/utils/i18n.js'
134
+
133
135
  export default {
134
136
  emits: ['change', 'update:value', 'confirm', 'cancel', 'input'],
135
137
  props: {
@@ -161,11 +163,11 @@
161
163
  },
162
164
  cancelText: {
163
165
  type: String,
164
- default: '取消',
166
+ default: i18n.global.t('cancel'),
165
167
  },
166
168
  confirmText: {
167
169
  type: String,
168
- default: '确定',
170
+ default: i18n.global.t('confirm'),
169
171
  },
170
172
  // 输入框类型
171
173
  inputType: {
@@ -178,7 +180,7 @@
178
180
  },
179
181
  placeholder: {
180
182
  type: String,
181
- default: '请输入'
183
+ default: i18n.global.t('inputTips'),
182
184
  },
183
185
  width: {
184
186
  type: String,
@@ -362,7 +364,7 @@
362
364
  },
363
365
  confirm() {
364
366
  if (this.type === 'input' && this.inputVal === '') {
365
- this.$toast('内容不能为空')
367
+ this.$toast(this.$t('noContentTips'))
366
368
  return
367
369
  }
368
370
  this.$emit('confirm', this.type === 'input' ? this.inputVal : true)
@@ -465,6 +467,7 @@
465
467
  align-items: center;
466
468
  justify-content: space-between;
467
469
  border-bottom: 1px solid var(--border-1);
470
+ background: var(--bg-white);
468
471
  .pop-top-btn {
469
472
  padding: 0;
470
473
  margin: 0;
@@ -17,7 +17,7 @@
17
17
  />
18
18
  <text v-if="str" class="iconfont gray-color ky-search-clear" @click.stop="handleClear">&#xe634;</text>
19
19
  </view>
20
- <ky-btn width="150rpx" height="75rpx" radius="0" size="small" @click="handleSearch">搜索</ky-btn>
20
+ <ky-btn width="150rpx" height="75rpx" radius="0" size="small" @click="handleSearch">{{ $t('search') }}</ky-btn>
21
21
  </view>
22
22
  </view>
23
23
  <!-- #endif -->
@@ -26,7 +26,7 @@
26
26
  <view v-if="historyList.length && state" class="ky-search-history-wrap white-bg">
27
27
  <view class="ky-search-history-main">
28
28
  <view class="ky-search-history-head">
29
- <text class="ky-search-history-title">搜索历史</text>
29
+ <text class="ky-search-history-title">{{ $t('searchHistory') }}</text>
30
30
  <text class="iconfont" @click="clearHistory">&#xe614;</text>
31
31
  </view>
32
32
  <view class="ky-search-history-list">
@@ -42,6 +42,8 @@
42
42
  </template>
43
43
 
44
44
  <script>
45
+ import i18n from '@/utils/i18n.js'
46
+
45
47
  export default {
46
48
  emits: ['select', 'search', 'update:keyword', 'update:visible'],
47
49
  props: {
@@ -64,7 +66,7 @@
64
66
  },
65
67
  placeholder: {
66
68
  type: String,
67
- default: '请输入关键词'
69
+ default: i18n.global.t('inputTips')
68
70
  },
69
71
  },
70
72
  data() {
@@ -138,7 +140,7 @@
138
140
  }
139
141
  },
140
142
  clearHistory() {
141
- this.$confirm({ content: '确定清除全部历史吗?' }, (res) => {
143
+ this.$confirm({ content: i18n.global.t('confirmClearHistory') }, (res) => {
142
144
  if (res.confirm) {
143
145
  this.historyList = []
144
146
  this.$db.set(this.keyStr, [])
@@ -5,17 +5,12 @@
5
5
  type="text"
6
6
  size="small"
7
7
  >
8
- {{ isGetCode ? `重发${countDownTime}s` : '获取验证码' }}
8
+ {{ isGetCode ? `${countDownTime}s` : $t('getVerifyCode') }}
9
9
  </ky-btn>
10
10
  </template>
11
11
 
12
12
  <script>
13
- const code_type = {
14
- login: '登录',
15
- reg: '注册',
16
- find: '找回密码',
17
- change: '修改密码'
18
- }
13
+
19
14
  export default {
20
15
  props: {
21
16
  mobile: {
@@ -40,14 +35,14 @@
40
35
  this.$db.del('isToLogin')
41
36
  this.code = ''
42
37
  if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
43
- this.$toast('请输入正确的手机号码')
38
+ this.$toast(this.$t('phoneTips'))
44
39
  return;
45
40
  }
46
41
  try {
47
42
  await this.$api.user.GetSmsCode(this.mobile)
48
43
  this.isGetCode = true;
49
44
  this.is_success = true
50
- this.$toast('验证码已发送')
45
+ this.$toast(this.$t('codeSendSuccess'))
51
46
  this.timeInterval = setInterval(() => {
52
47
  if (this.countDownTime === 0) {
53
48
  clearInterval(this.timeInterval);
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "style"
8
8
  ],
9
9
  "description": "an uniapp ui",
10
- "version": "1.0.48",
10
+ "version": "1.1.0",
11
11
  "repository": {
12
12
  "type": "git",
13
13
  "url": "git+https://github.com/yezipi/ky-uniui.git"
@@ -25,6 +25,7 @@
25
25
  "scripts": {},
26
26
  "license": "ISC",
27
27
  "dependencies": {
28
- "@dcloudio/uni-ui": "^1.4.28"
28
+ "@dcloudio/uni-ui": "^1.4.28",
29
+ "vue-i18n": "^9.13.1"
29
30
  }
30
31
  }
@@ -1,47 +0,0 @@
1
- <template>
2
- <!--未登录遮罩-->
3
- <view class="nologin-mask">
4
- <view class="nologin-btn">
5
- <slot></slot>
6
- <text class="block ft-24 mb-12 gray-color">{{ msg }}</text>
7
- <ky-btn size="mini" width="200rpx" round @click="$nav.push('Login')">去登录</ky-btn>
8
- </view>
9
- </view>
10
- <!--end 未登录遮罩-->
11
- </template>
12
-
13
- <script>
14
- export default {
15
- props: {
16
- msg: {
17
- type: String,
18
- default: ''
19
- }
20
- }
21
- }
22
- </script>
23
-
24
- <style scoped lang="scss">
25
- .nologin-mask {
26
- position: fixed;
27
- z-index: 2;
28
- left: 0;
29
- right: 0;
30
- top: 0;
31
- bottom: 0;
32
- width: 100%;
33
- height: 100%;
34
- background: linear-gradient(to top, var(--color-white) 45%, rgba(var(--rgb-white), 0.25));
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- .nologin-btn {
39
- margin-top: 100rpx;
40
- width: 480rpx;
41
- display: flex;
42
- align-items: center;
43
- justify-content: center;
44
- flex-direction: column;
45
- }
46
- }
47
- </style>
@@ -1,86 +0,0 @@
1
- <!--悬浮电话按钮 首页、推荐产品页,产品详情页)-->
2
- <template>
3
- <view class="float-icon-box">
4
- <view class="float-icon-wrap">
5
- <view class="float-item" @click.stop="toPage('/pages/User/Feedback/Create')">
6
- <text class="iconfont" style="font-size: 22rpx;">&#xe60e;</text>
7
- <text class="iconname">建议</text>
8
- </view>
9
- <view class="float-item" @click.stop="callPhone">
10
- <text v-if="noPhone" class="iconfont" >&#xe680;</text>
11
- <text v-else class="iconfont">&#xe8ab;</text>
12
- <text class="iconname">{{ !noPhone ? '客服' : '经纪人' }}</text>
13
- </view>
14
- </view>
15
- </view>
16
- </template>
17
-
18
- <script>
19
- import { useUserInfo, useToken } from '@/stores/index.js'
20
- import config from '@/config.js'
21
-
22
- export default {
23
- data() {
24
- return {}
25
- },
26
- computed: {
27
- noPhone() {
28
- return useUserInfo().value && useUserInfo().value.customerOwnerPhone
29
- }
30
- },
31
- methods: {
32
- callPhone() {
33
- const user = useUserInfo().value
34
- const phoneNumber = user.customerOwnerPhone || config.CONTACT
35
- uni.makePhoneCall({ phoneNumber })
36
- },
37
-
38
- toPage(url) {
39
- this.$nav.push(useToken().value ? url : '/pages/Login')
40
- },
41
- }
42
- }
43
- </script>
44
-
45
- <style scoped lang="scss">
46
- .float-icon-box {
47
- position: fixed;
48
- bottom: calc(var(--window-bottom) + env(safe-area-inset-bottom) + 24rpx);
49
- right: 24rpx;
50
- z-index: 99;
51
- width: 75rpx;
52
- }
53
- .float-icon-menu {
54
- position: relative;
55
- z-index: 1;
56
- }
57
- .float-item {
58
- width: 100%;
59
- height: 75rpx;
60
- background: linear-gradient(to bottom, var(--color-light-primary), var(--color-primary));
61
- box-shadow: 0 0 12rpx rgba(0,0,0,.2);
62
- display: flex;
63
- flex-direction: column;
64
- align-items: center;
65
- justify-content: center;
66
- border-radius: 50%;
67
- margin-bottom: 24rpx;
68
- &:active {
69
- filter: contrast(2);
70
- }
71
- .iconfont {
72
- display: block;
73
- color: #f5f5f5;
74
- font-size: 24rpx;
75
- }
76
- .iconname {
77
- font-size: 14rpx;
78
- color: #f5f5f5;
79
- line-height: 10rpx;
80
- margin-top: 8rpx;
81
- /* #ifdef H5 */
82
- transform: scale(0.7);
83
- /* #endif */
84
- }
85
- }
86
- </style>
@@ -1,97 +0,0 @@
1
- <!--价格展示组件,2022-10-10-->
2
- <template>
3
- <view class="ky-price-wrap">
4
- <view v-if="Number(data.unitPrice) > 0 && Number(data.priceType) !== 3" class="ky-price-main">
5
- <view class="ky-price-text price-color">
6
- <text class="ky-price-symbol">¥</text>
7
- <text :style="{ 'font-size': fontSize + 'rpx' }" class="ky-price-num">{{ data.unitPrice }}</text>
8
- <text v-if="data.unitName || data.unit || data.skuUnitName" class="ky-price-name">/{{ data.unitName || data.unit || data.skuUnitName }}</text>
9
- </view>
10
- <view v-if="Number(data.priceTrend) < 0" class="ky-price-trend price-trend-down">
11
- <text class="iconfont">&#xeb0a;</text>
12
- <text>{{ data.priceTrend }}%</text>
13
- </view>
14
- <view v-if="Number(data.priceTrend) > 0" class="ky-price-trend price-trend-up">
15
- <text class="iconfont">&#xeb0b;</text>
16
- <text>{{ data.priceTrend }}%</text>
17
- </view>
18
- <view v-if="Number(data.priceTrend) === 0" class="ky-price-trend price-trend-none gray-color">
19
- <text class="iconfont" style="transform: rotate(90deg);">&#xeb0b;</text>
20
- <text>{{ data.priceTrend }}%</text>
21
- </view>
22
- </view>
23
- <view
24
- v-if="Number(data.unitPrice) <= 0 || Number(data.priceType) === 3"
25
- :style="{ 'font-size': (fontSize * 0.8) + 'rpx' }"
26
- >
27
- <text v-if="Number(data.unitPrice) <= 0 && Number(data.priceType) !== 3" class="ky-price-invalid gray-color">暂无报价</text>
28
- <text v-else class="ky-price-callphone price-color">来电询价</text>
29
- </view>
30
- </view>
31
- </template>
32
-
33
- <script>
34
- export default {
35
- props: {
36
- /**
37
- * 价格对象data
38
- * @property { Number } data.unitPrice 价格
39
- */
40
- data: {
41
- type: Object,
42
- default: () => {
43
- return {
44
- unitPrice: 0, // 单位价格
45
- unitName: '', // 单位名称
46
- priceTrend: NaN, // 价格涨跌,百分比
47
- priceType: 0, // 价格类型,为3显示来电询价
48
- skuUnitName: '',
49
- unit: ''
50
- }
51
- }
52
- },
53
- fontSize: {
54
- type: Number,
55
- default: 28
56
- }
57
- },
58
- data() {
59
- return {
60
-
61
- }
62
- }
63
- }
64
- </script>
65
-
66
- <style scoped lang="scss">
67
- .ky-price-wrap {
68
- display: flex;
69
- align-items: center;
70
- .ky-price-main {
71
- display: flex;
72
- align-items: center;
73
- .ky-price-num {
74
- font-weight: bold;
75
- font-size: 32rpx;
76
- }
77
- .ky-price-name, .ky-price-symbol {
78
- font-size: 24rpx;
79
- }
80
- }
81
- .ky-price-trend {
82
- display: flex;
83
- align-items: center;
84
- margin-left: 12rpx;
85
- .iconfont {
86
- display: inline-block;
87
- margin-right: 12rpx;
88
- }
89
- &.price-trend-down {
90
- color: #07d007;
91
- }
92
- &.price-trend-up {
93
- color: #ff201c;
94
- }
95
- }
96
- }
97
- </style>