提交 dad10953 编写于 作者: DCloud_JSON's avatar DCloud_JSON

- APP端支持vue3 (hbuilderx 3.2.5+) - 支持国际化 中英文切换 - 新增留言板示例 - 修复签到的时区问题

上级 e15e0a4d
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
this.globalData.$i18n = this.$i18n this.globalData.$i18n = this.$i18n
this.globalData.$t = str => this.$t(str) this.globalData.$t = str => this.$t(str)
...@@ -39,10 +40,11 @@ ...@@ -39,10 +40,11 @@
} }
}); });
}*/ }*/
console.log("国际化语言检测:" + plus.os.language);
// #endif // #endif
let updateTabbar = () => { let initLanguageAfter = () => {
console.log(this.$t('tabbar'));
//底部tabbar更新
this.$t('tabbar').split(',').forEach((text, index) => { this.$t('tabbar').split(',').forEach((text, index) => {
uni.setTabBarItem({ uni.setTabBarItem({
index, index,
...@@ -51,12 +53,38 @@ ...@@ -51,12 +53,38 @@
// console.log("e: " + JSON.stringify(e)); // console.log("e: " + JSON.stringify(e));
} }
}) })
}) })
} //更新 uni-starter.config
updateTabbar() //agreements
let agreements = [{
"title": "用户服务协议", //协议名称
"url": "请填写用户服务协议链接" //对应的网络链接
},
{
"title": "隐私政策",
"url": "请填写隐私政策链接"
}
]
if(getApp().$i18n.locale == 'en'){
agreements = [{
"title": "User service agreement", //协议名称
"url": "请填写用户服务协议链接" //对应的网络链接
},
{
"title": "Privacy policy",
"url": "请填写隐私政策链接"
}
]
}
console.log(getApp().globalData.config)
getApp().globalData.config.about.agreements = agreements
}
setTimeout(()=>{
initLanguageAfter()
},1000)
uni.$on('changeLanguage', e => { uni.$on('changeLanguage', e => {
console.log('changeLanguage',e); console.log('changeLanguage',e);
updateTabbar() initLanguageAfter(e)
}) })
}, },
onShow: function() { onShow: function() {
......
## 1.0.49(2021-08-24) ## 1.0.49(2021-08-27)
支持国际化 - APP端支持vue3 (hbuilderx 3.2.5+)
- 支持国际化 中英文切换
- 新增留言板示例
- 修复签到的时区问题
## 1.0.48(2021-08-10) ## 1.0.48(2021-08-10)
- 修复登陆成功后响应体包含`userInfo.password`的问题 - 修复登陆成功后响应体包含`userInfo.password`的问题
- 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题 - 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题
......
<template> <template>
<view :style="{width,height}"> <view @click="onClick" :style="{width,height}">
<image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image> <image v-if="cSrc" :style="{width,height}" :src="cSrc" :mode="mode"></image>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: "cloud-image", name: "cloud-image",
emits:['click','switchChange'],
props: { props: {
mode: { mode: {
type:String, type:String,
...@@ -54,6 +55,11 @@ ...@@ -54,6 +55,11 @@
}, },
async mounted() { async mounted() {
},
methods:{
onClick(){
this.$emit('click')
}
}, },
data() { data() {
return { return {
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
<view class="root"> <view class="root">
<checkbox-group @change="setAgree" class="checkbox-group"> <checkbox-group @change="setAgree" class="checkbox-group">
<checkbox style="transform: scale(0.7);" /> <checkbox style="transform: scale(0.7);" />
<text>同意</text> <text>{{$t('common.agree')}}</text>
</checkbox-group> </checkbox-group>
<view class="item" v-for="(agreement,index) in agreements" :key="index"> <view class="item" v-for="(agreement,index) in agreements" :key="index">
<text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text> <text class="agreement" @click="navigateTo(agreement)">{{agreement.title}}</text>
<text class="hint" v-if="hasAnd(agreements,index)"></text> <text class="hint" v-if="hasAnd(agreements,index)">&</text>
</view> </view>
</view> </view>
</template> </template>
......
{
"noData": "No Data",
"noNetwork": "Network error",
"toSet": "Go to settings",
"error": "error"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
export default {
en,
'zh-Hans': zhHans
}
{
"noData": "暂无数据",
"noNetwork": "网络异常",
"toSet": "前往设置",
"error": "错误"
}
...@@ -2,24 +2,44 @@ ...@@ -2,24 +2,44 @@
<view style="width: 750rpx;"> <view style="width: 750rpx;">
<template v-if="!state.error"> <template v-if="!state.error">
<uni-load-more v-if="state.loading||state.pagination.current!=1||state.data.length!=0" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more> <uni-load-more v-if="state.loading||state.pagination.current!=1||state.data.length!=0" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more>
<text class="noData" v-else>{{$t('loadMore.noData')}}</text> <text class="noData" v-else>{{noData}}</text>
</template> </template>
<view v-else> <view v-else>
<view class="box" v-if="networkType == 'none'"> <view class="box" v-if="networkType == 'none'">
<image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image> <image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image>
<text class="tip-text">{{$t('loadMore.noNetwork')}}</text> <text class="tip-text">{{noNetwork}}</text>
<view class="btn btn-default" @click="openSettings"> <view class="btn btn-default" @click="openSettings">
<text class="btn-text">{{$t('loadMore.toSet')}}</text> <text class="btn-text">{{toSet}}</text>
</view> </view>
</view> </view>
<text class="err" v-else>{{$t('loadMore.error')}}:{{JSON.stringify(state.error)}}</text> <text class="err" v-else>{{error}}:{{JSON.stringify(state.error)}}</text>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
name: "uni-load-state", name: "uni-load-state",
computed:{
noData(){
return t('noData')
},
noNetwork(){
return t('noNetwork')
},
toSet(){
return t('toSet')
},
error(){
return t('error')
}
},
data() { data() {
return { return {
"networkType": "" "networkType": ""
...@@ -122,7 +142,7 @@ ...@@ -122,7 +142,7 @@
text-align: center; text-align: center;
padding: 30rpx; padding: 30rpx;
width: 750rpx; width: 750rpx;
/* #ifndef APP-NVUE */ /* #ifndef APP-PLUS-NVUE */
display: block; display: block;
/* #endif */ /* #endif */
} }
......
...@@ -4,7 +4,8 @@ export default { ...@@ -4,7 +4,8 @@ export default {
wechatFriends: "friends", wechatFriends: "friends",
wechatBbs: "bbs", wechatBbs: "bbs",
weibo: "weibo", weibo: "weibo",
more: "more", more: "more",
agree:"agree",
copy: "copy", copy: "copy",
wechatApplet: "applet", wechatApplet: "applet",
cancelShare: "cancel sharing", cancelShare: "cancel sharing",
...@@ -53,7 +54,7 @@ export default { ...@@ -53,7 +54,7 @@ export default {
signIn: "Check In Reward", signIn: "Check In Reward",
toEvaluate: "To Evaluate", toEvaluate: "To Evaluate",
readArticles: "Read Articles", readArticles: "Read Articles",
myScore: "My Integral", myScore: "My Score",
invite: "Invite Friends", invite: "Invite Friends",
guestBook: "Guest Book Example", guestBook: "Guest Book Example",
feedback: "Problems And Feedback", feedback: "Problems And Feedback",
...@@ -143,7 +144,7 @@ export default { ...@@ -143,7 +144,7 @@ export default {
}, },
about: { about: {
sacnQR: "Scan the QR Code and your friends can also download it", sacnQR: "Scan the QR Code and your friends can also download it",
client: "APP", client: "applCantion",
and: "And", and: "And",
about: "About", about: "About",
}, },
......
import langEn from './en' import langEn from './en'
import langZhCN from './zh-CN' import zhHans from './zh-Hans'
const messages = { const messages = {
'en': langEn, 'en': langEn,
'zh-CN': langZhCN 'zh-Hans': zhHans
} }
let currentLang = uni.getStorageSync('CURRENT_LANG') let currentLang = uni.getStorageSync('CURRENT_LANG')
if (!currentLang) { if (!currentLang) {
// 获取设备信息 if(uni.getLocale){
uni.getSystemInfo({ console.log('获取应用语言:',uni.getLocale() );
success: function (res) { let language = 'zh-Hans'
uni.setStorageSync('CURRENT_LANG', res.language) if(uni.getLocale() != 'zh-Hans'){
currentLang = res.language language = 'en'
} }
}) uni.setStorageSync('CURRENT_LANG', language)
currentLang = language
}else{
uni.getSystemInfo({
success: function (res) {
uni.getSystemInfo({
success: function (res) {
console.log('获取设备信息:',res);
let language = 'zh-Hans'
if(res.language != 'zh-Hans'){
language = 'en'
}
uni.setStorageSync('CURRENT_LANG', language)
currentLang = language
},
fail: (err) => {
console.error(err)
}
})
},
fail: (err) => {
console.error(err)
}
})
}
} }
let i18nConfig = { let i18nConfig = {
locale: currentLang, // set locale locale: currentLang, // set locale
......
...@@ -4,7 +4,8 @@ export default { ...@@ -4,7 +4,8 @@ export default {
wechatFriends: "微信好友", wechatFriends: "微信好友",
wechatBbs: "微信朋友圈", wechatBbs: "微信朋友圈",
weibo:"微博", weibo:"微博",
more: "更多", more: "更多",
agree:"同意",
copy: "复制", copy: "复制",
wechatApplet: "微信小程序", wechatApplet: "微信小程序",
cancelShare: "取消分享", cancelShare: "取消分享",
......
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.0.48", "version": "1.0.49",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
"登录", "登录",
"搜索", "搜索",
"uni-id例子" "uni-id例子"
], ],
"repository": "https://codechina.csdn.net/dcloud/uni-starter.git", "repository": "https://codechina.csdn.net/dcloud/uni-starter.git",
"engines": { "engines": {
"HBuilderX": "^3.1.20" "HBuilderX": "^3.1.20"
......
{ {
"pages": [ "pages": [{
{
"path": "pages/list/list", "path": "pages/list/list",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
{ {
"path": "pages/grid/grid", "path": "pages/grid/grid",
"style": { "style": {
...@@ -59,11 +58,6 @@ ...@@ -59,11 +58,6 @@
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "uni_modules/uni-feedback/pages/uni-feedback/uni-feedback",
"style": {
"navigationBarTitleText": "问题反馈"
}
}, { }, {
"path": "pages/ucenter/about/about", "path": "pages/ucenter/about/about",
"style": { "style": {
...@@ -163,39 +157,39 @@ ...@@ -163,39 +157,39 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, {
"path": "pages/ucenter/settings/deactivate/deactivate",
"style": {
"navigationBarTitleText": "注销提醒",
"enablePullDownRefresh": false
}
}, {
"path": "uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback",
"style": {
"navigationBarTitleText": "意见反馈",
"enablePullDownRefresh": false
}
}, {
"path": "pages/ucenter/guestbook/guestbook",
"style": {
"navigationBarTitleText": "留言板",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": {
"buttons": [{
"text": "切换",
"fontSize": "12px"
},
{
"text": "注销",
"fontSize": "12px"
}
]
}
}
}
} }
,{ ],
"path" : "pages/ucenter/settings/deactivate/deactivate",
"style" :
{
"navigationBarTitleText": "注销提醒",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/ucenter/guestbook/guestbook",
"style" :
{
"navigationBarTitleText": "留言板",
"enablePullDownRefresh": false,
"app-plus":{
"titleNView":{
"buttons":[
{
"text":"切换",
"fontSize":"12px"
},
{
"text":"注销",
"fontSize":"12px"
}
]
}
}
}
}
],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-starter", "navigationBarTitleText": "uni-starter",
...@@ -206,7 +200,7 @@ ...@@ -206,7 +200,7 @@
"condition": { "condition": {
"list": [{ "list": [{
"path": "pages/list/detail" "path": "pages/list/detail"
},{ }, {
"path": "pages/list/list" "path": "pages/list/list"
}, },
{ {
......
...@@ -7,6 +7,18 @@ ...@@ -7,6 +7,18 @@
<script> <script>
export default { export default {
onLoad({url,title}) { onLoad({url,title}) {
if(url.substring(0, 4) != 'http'){
return uni.showModal({
title:"错误",
content: '不是一个有效的网站链接,'+'"'+url+'"',
showCancel: false,
confirmText:"知道了",
complete: () => {
uni.navigateBack()
}
});
}
console.log(url,title); console.log(url,title);
this.url = url; this.url = url;
if(title){ if(title){
......
...@@ -5,10 +5,9 @@ ...@@ -5,10 +5,9 @@
<!-- #endif --> <!-- #endif -->
<!-- 搜索功能 --> <!-- 搜索功能 -->
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100" <uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" disabled :placeholder="$t('list.inputPlaceholder')" /> cancelButton="none" disabled :placeholder="inputPlaceholder" />
<view class="cover-search-bar" @click="searchClick"></view> <view class="cover-search-bar" @click="searchClick"></view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror" <unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10" :where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username"> field="avatar,title,last_modify_date,user_id.username">
...@@ -54,6 +53,15 @@ ...@@ -54,6 +53,15 @@
export default { export default {
components: { components: {
statusBar statusBar
},
computed:{
inputPlaceholder(e){
if(uni.getStorageSync('CURRENT_LANG') == "en"){
return 'Please enter the search content'
}else{
return '请输入搜索内容'
}
}
}, },
data() { data() {
return { return {
...@@ -79,7 +87,16 @@ ...@@ -79,7 +87,16 @@
// #ifndef APP-NVUE // #ifndef APP-NVUE
this.listHight = 'auto' this.listHight = 'auto'
// #endif // #endif
cdbRef = this.$refs.udb cdbRef = this.$refs.udb
// #ifdef VUE3
console.log('vue3')
// #endif
// #ifdef VUE2
console.log('vue2')
// #endif
}, },
async onShow() { async onShow() {
this.keyword = getApp().globalData.searchText this.keyword = getApp().globalData.searchText
...@@ -89,8 +106,11 @@ ...@@ -89,8 +106,11 @@
// uni.showLoading({ // uni.showLoading({
// title:"获取定位中" // title:"获取定位中"
// }); // });
// #ifndef H5
let location = await gps.getLocation({geocode:true}) let location = await gps.getLocation({geocode:true})
console.log(location); console.log(location);
// #endif
// if(location){ // if(location){
// uni.showToast({ // uni.showToast({
// title: JSON.stringify(location), // title: JSON.stringify(location),
...@@ -122,7 +142,7 @@ ...@@ -122,7 +142,7 @@
}, },
onqueryerror(e){ onqueryerror(e){
console.log(e); console.log(e);
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.refresh() this.refresh()
......
<template> <template>
<view class="page"> <view class="page">
<unicloud-db ref="udb" class="content" v-slot:default="{data,pagination,hasMore, loading, error}" <unicloud-db ref="udb" class="content" v-slot:default="{data,pagination,hasMore, loading, error}"
collection="guestbook,uni-id-users" :where="udbWhere" field="uid.username,uid._id,uid.avatar_file,text,_id,state"> collection="guestbook,uni-id-users" :where="udbWhere" field="user_id.nickname,user_id._id,user_id.avatar_file,text,_id,state">
<view v-if="error">{{error.message}}</view> <view v-if="error">{{error.message}}</view>
<view v-else> <view v-else>
<view v-for="(item,index) in data" :key="index" class="item"> <view v-for="(item,index) in data" :key="index" class="item">
<view class="main"> <view class="main">
<!-- <uni-file-picker v-if="item.uid[0].avatar_file" v-model="item.uid[0].avatar_file" <cloud-image :src="item.user_id[0].avatar_file.url"></cloud-image>
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled
></uni-file-picker> -->
<cloud-image :src="item.uid[0].avatar_file.url"></cloud-image>
<view> <view>
<text class="username">{{item.uid[0].username}}</text> <text class="nickname">{{item.user_id[0].nickname}}</text>
<text>{{item.text}}</text> <text>{{item.text}}</text>
</view> </view>
</view> </view>
...@@ -46,7 +42,15 @@ ...@@ -46,7 +42,15 @@
hasLogin: 'user/hasLogin' hasLogin: 'user/hasLogin'
}), }),
udbWhere(){ udbWhere(){
return this.hasLogin?'':{state:true} if(this.hasLogin){
if( this.uniIDHasRole('AUDITOR') ){
return ''
}else{
return 'state==true || user_id._id==$cloudEnv_uid'
}
}else{
return '"state"==true'
}
} }
}, },
data() { data() {
...@@ -97,12 +101,13 @@ ...@@ -97,12 +101,13 @@
}, },
send() { send() {
this.$refs.udb.add({ this.$refs.udb.add({
text: this.text text: this.text
},{ },{
toastTitle:this.$t('guestbook.addSucceeded'), // toast提示语 toastTitle:this.$t('guestbook.addSucceeded'), // toast提示语
success: (res) => { // 新增成功后的回调 success: (res) => { // 新增成功后的回调
let {code,message} = res let {code,message} = res
console.log(code,message); console.log(code,message);
this.text = ''
this.$refs.udb.refresh() //{clear:true} this.$refs.udb.refresh() //{clear:true}
}, },
fail: (err) => { // 新增失败后的回调 fail: (err) => { // 新增失败后的回调
...@@ -162,7 +167,7 @@ ...@@ -162,7 +167,7 @@
font-size: 24rpx; font-size: 24rpx;
} }
.item .main .username { .item .main .nickname {
font-weight: 600; font-weight: 600;
} }
......
...@@ -5,22 +5,22 @@ ...@@ -5,22 +5,22 @@
<uni-list-item :title="$t('settings.userInfo')" to="/pages/ucenter/userinfo/userinfo" link="navigateTo"></uni-list-item> <uni-list-item :title="$t('settings.userInfo')" to="/pages/ucenter/userinfo/userinfo" link="navigateTo"></uni-list-item>
<uni-list-item v-if="userInfo.mobile" :title="$t('settings.changePassword')" :to="'/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber='+ userInfo.mobile" link="navigateTo"></uni-list-item> <uni-list-item v-if="userInfo.mobile" :title="$t('settings.changePassword')" :to="'/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber='+ userInfo.mobile" link="navigateTo"></uni-list-item>
</uni-list> </uni-list>
<uni-list class="mt10" :border="false"> <uni-list class="mt10" :border="false">
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<!-- 检查push过程未结束不显示,push设置项 --> <!-- 检查push过程未结束不显示,push设置项 -->
<uni-list-item :title="$t('settings.clearTmp')" @click="clearTmp" link></uni-list-item> <uni-list-item :title="$t('settings.clearTmp')" @click="clearTmp" link></uni-list-item>
<uni-list-item v-if="pushIsOn != 'wait'" @click.native="pushIsOn?pushServer.off():pushServer.on()" :title="$t('settings.pushServer')" showSwitch :switchChecked="pushIsOn"></uni-list-item> <uni-list-item v-show="pushIsOn != 'wait'" :title="$t('settings.pushServer')" @click.native="pushIsOn?pushServer.off():pushServer.on()" showSwitch :switchChecked="pushIsOn"></uni-list-item>
<!-- #endif --> <!-- #endif -->
<uni-list-item v-if="supportMode.includes('fingerPrint')" :title="$t('settings.fingerPrint')" @click.native="startSoterAuthentication('fingerPrint')" link></uni-list-item> <uni-list-item v-if="supportMode.includes('fingerPrint')" :title="$t('settings.fingerPrint')" @click.native="startSoterAuthentication('fingerPrint')" link></uni-list-item>
<uni-list-item v-if="supportMode.includes('facial')" :title="$t('settings.facial')" @click="startSoterAuthentication('facial')" link></uni-list-item> <uni-list-item v-if="supportMode.includes('facial')" :title="$t('settings.facial')" @click="startSoterAuthentication('facial')" link></uni-list-item>
<!-- #endif --> <!-- #endif -->
<uni-list-item :title="$t('settings.changeLanguage')" @click="changeLanguage" :rightText="currentLanguage" link></uni-list-item> <uni-list-item :title="$t('settings.changeLanguage')" @click="changeLanguage" :rightText="currentLanguage" link></uni-list-item>
</uni-list> </uni-list>
<uni-list class="mt10" :border="false"> <uni-list class="mt10" :border="false">
<uni-list-item @click="deactivate" :title="$t('settings.deactivate')" link="navigateTo"></uni-list-item> <uni-list-item @click="deactivate" :title="$t('settings.deactivate')" link="navigateTo"></uni-list-item>
</uni-list> </uni-list>
<!-- 退出/登录 按钮 --> <!-- 退出/登录 按钮 -->
<view class="bottom-back" @click="clickLogout"> <view class="bottom-back" @click="clickLogout">
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
return { return {
pushServer:pushServer, pushServer:pushServer,
supportMode:[], supportMode:[],
pushIsOn:"wait", pushIsOn:"wait",
currentLanguage:"" currentLanguage:""
} }
}, },
...@@ -49,10 +49,10 @@ ...@@ -49,10 +49,10 @@
...mapGetters({ ...mapGetters({
'userInfo': 'user/info', 'userInfo': 'user/info',
'hasLogin': 'user/hasLogin', 'hasLogin': 'user/hasLogin',
}) })
}, },
onLoad() { onLoad() {
this.currentLanguage = uni.getStorageSync('CURRENT_LANG') == "en"?'English':'简体中文' this.currentLanguage = uni.getStorageSync('CURRENT_LANG') == "en"?'English':'简体中文'
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.$t('settings.navigationBarTitle') title: this.$t('settings.navigationBarTitle')
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
console.log(err); console.log(err);
} }
}) })
// #endif // #endif
}, },
onShow() { onShow() {
// 检查手机端获取推送是否开启 // 检查手机端获取推送是否开启
...@@ -85,11 +85,11 @@ ...@@ -85,11 +85,11 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/userinfo/userinfo' url: '/pages/ucenter/userinfo/userinfo'
}); });
}, },
deactivate(){ deactivate(){
uni.navigateTo({ uni.navigateTo({
url:"/pages/ucenter/settings/deactivate/deactivate" url:"/pages/ucenter/settings/deactivate/deactivate"
}) })
}, },
changePwd() { changePwd() {
uni.navigateTo({ uni.navigateTo({
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
console.log(err); console.log(err);
console.log(`认证失败:${err.errCode}`); console.log(`认证失败:${err.errCode}`);
uni.showToast({ uni.showToast({
title:this.$t('settings.authFailed'), title:this.$t('settings.authFailed'),
// title: `认证失败`, // title: `认证失败`,
icon: 'none' icon: 'none'
}); });
...@@ -240,37 +240,38 @@ ...@@ -240,37 +240,38 @@
console.log(e); console.log(e);
} }
}); });
}, },
changeLanguage(){ changeLanguage(){
console.log('语言切换') console.log('语言切换')
uni.showActionSheet({ uni.showActionSheet({
itemList: ["English","简体中文"], itemList: ["English","简体中文"],
success: res => { success: res => {
console.log(res.tapIndex); console.log(res.tapIndex);
let language = uni.getStorageSync('CURRENT_LANG') let language = uni.getStorageSync('CURRENT_LANG')
if( if(
!res.tapIndex && language=='zh-CN' || res.tapIndex && language=='en' !res.tapIndex && language=='zh-Hans' || res.tapIndex && language=='en'
){ ){
const globalData = getApp().globalData const globalData = getApp().globalData
if (language === 'en') { if (language === 'en') {
language = globalData.locale = 'zh-CN' language = globalData.locale = 'zh-Hans'
} else { } else {
language = globalData.locale = 'en' language = globalData.locale = 'en'
} }
uni.setStorageSync('CURRENT_LANG', language) uni.setStorageSync('CURRENT_LANG', language)
getApp().$i18n.locale = language getApp().$i18n.locale = language
this.currentLanguage = res.tapIndex?'简体中文':'English' this.currentLanguage = res.tapIndex?'简体中文':'English'
uni.reLaunch({ uni.setLocale(language)
url: '/pages/list/list', uni.reLaunch({
complete: () => { url: '/pages/list/list',
uni.$emit("changeLanguage",language) complete: () => {
} uni.$emit("changeLanguage",language)
}) }
} })
}, }
fail: () => {}, },
complete: () => {} fail: () => {},
}); complete: () => {}
});
} }
} }
} }
...@@ -325,14 +326,14 @@ ...@@ -325,14 +326,14 @@
.mt10 { .mt10 {
margin-top: 10px; margin-top: 10px;
} }
/* #ifndef APP-NVUE || VUE3 */ /* #ifndef APP-NVUE || VUE3 */
.content /deep/ .uni-list { .content /deep/ .uni-list {
background-color: #F9F9F9; background-color: #F9F9F9;
} }
.content /deep/ .uni-list-item--disabled,.list-item { .content /deep/ .uni-list-item--disabled,.list-item {
height: 50px; height: 50px;
margin-bottom: 1px; margin-bottom: 1px;
} }
/* #endif */ /* #endif */
</style> </style>
\ No newline at end of file
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
"icon": "chat" "icon": "chat"
},{ },{
"title": this.$t('mine.feedback'), "title": this.$t('mine.feedback'),
"to": '/uni_modules/uni-feedback/pages/uni-feedback/uni-feedback', "to": '/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback',
"icon": "help" "icon": "help"
}, { }, {
"title": this.$t('mine.settings'), "title": this.$t('mine.settings'),
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<template v-slot:body> <template v-slot:body>
<view class="item"> <view class="item">
<text>{{$t('userinfo.ProfilePhoto')}}</text> <text>{{$t('userinfo.ProfilePhoto')}}</text>
<cloud-image @click.native="uploadAvatarImg" v-if="avatar_file" :src="avatar_file.url" width="50px" height="50px"></cloud-image> <cloud-image @click="uploadAvatarImg" v-if="avatar_file" :src="avatar_file.url" width="50px" height="50px"></cloud-image>
<uni-icons v-else class="chooseAvatar" type="plusempty" size="30" color="#dddddd"></uni-icons> <uni-icons @click="uploadAvatarImg" v-else class="chooseAvatar" type="plusempty" size="30" color="#dddddd"></uni-icons>
</view> </view>
</template> </template>
</uni-list-item> </uni-list-item>
......
文件已添加
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可 未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可
根据数组的第0项,决定登录方式的第一优先级。 根据数组的第0项,决定登录方式的第一优先级。
*/ */
"login": ["univerify","username","weixin", "smsCode", "apple"] "login": ["username","univerify","weixin", "smsCode", "apple"]
}, },
//关于应用 //关于应用
"about": { "about": {
......
...@@ -9,4 +9,4 @@ ...@@ -9,4 +9,4 @@
// 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery // 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery
// 下面示例查询uni-id-users表的所有数据 // 下面示例查询uni-id-users表的所有数据
db.collection('uni-id-users').get(); db.collection('guestbook, uni-id-users').where('user_id._id=="610a6daa506cc7000100c07f"').get();
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"update":"'AUDITOR' in auth.role" "update":"'AUDITOR' in auth.role"
} }
}, },
"uid": { "user_id": {
"forceDefaultValue": { "forceDefaultValue": {
"$env": "uid" "$env": "uid"
}, },
......
...@@ -156,6 +156,9 @@ ...@@ -156,6 +156,9 @@
$bage-height: 20px; $bage-height: 20px;
.uni-badge--x { .uni-badge--x {
/* #ifdef APP-NVUE */
// align-self: flex-start;
/* #endif */
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: inline-block; display: inline-block;
/* #endif */ /* #endif */
......
## 1.4.2(2021-08-24)
- 新增 支持国际化
## 1.4.1(2021-08-05) ## 1.4.1(2021-08-05)
- 修复 弹出层被 tabbar 遮盖 bug - 修复 弹出层被 tabbar 遮盖 bug
## 1.4.0(2021-07-30) ## 1.4.0(2021-07-30)
......
{
"uni-calender.ok": "ok",
"uni-calender.cancel": "cancel",
"uni-calender.today": "today",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-calender.ok": "确定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}
{
"uni-calender.ok": "確定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
<view class="uni-calendar-item__weeks-box" :class="{ <view class="uni-calendar-item__weeks-box" :class="{
'uni-calendar-item--disable':weeks.disable, 'uni-calendar-item--disable':weeks.disable,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) , 'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
'uni-calendar-item--before-checked':weeks.beforeMultiple, 'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple, 'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
}" }"
@click="choiceDate(weeks)"> @click="choiceDate(weeks)">
<view class="uni-calendar-item__weeks-box-item"> <view class="uni-calendar-item__weeks-box-item">
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text> <text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
<text class="uni-calendar-item__weeks-box-text" :class="{ <text class="uni-calendar-item__weeks-box-text" :class="{
'uni-calendar-item--isDay-text': weeks.isDay, 'uni-calendar-item--isDay-text': weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple, 'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple, 'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable, 'uni-calendar-item--disable':weeks.disable,
}">{{weeks.date}}</text> }">{{weeks.date}}</text>
...@@ -23,26 +23,26 @@ ...@@ -23,26 +23,26 @@
'uni-calendar-item--isDay-text':weeks.isDay, 'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple, 'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple, 'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
}">今天</text> }">{{todayText}}</text>
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{ <text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
'uni-calendar-item--isDay-text':weeks.isDay, 'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple, 'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple, 'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable, 'uni-calendar-item--disable':weeks.disable,
}">{{weeks.isDay?'今天': (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text> }">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{ <text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
'uni-calendar-item--extra':weeks.extraInfo.info, 'uni-calendar-item--extra':weeks.extraInfo.info,
'uni-calendar-item--isDay-text':weeks.isDay, 'uni-calendar-item--isDay-text':weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
'uni-calendar-item--before-checked':weeks.beforeMultiple, 'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple, 'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable, 'uni-calendar-item--disable':weeks.disable,
}">{{weeks.extraInfo.info}}</text> }">{{weeks.extraInfo.info}}</text>
...@@ -51,6 +51,11 @@ ...@@ -51,6 +51,11 @@
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
emits:['change'], emits:['change'],
props: { props: {
...@@ -77,8 +82,13 @@ ...@@ -77,8 +82,13 @@
default: false default: false
} }
}, },
computed: {
todayText() {
return t("uni-calender.today")
},
},
methods: { methods: {
choiceDate(weeks) { choiceDate(weeks) {
this.$emit('change', weeks) this.$emit('change', weeks)
} }
} }
...@@ -159,13 +169,13 @@ ...@@ -159,13 +169,13 @@
background-color: $uni-color-primary; background-color: $uni-color-primary;
color: #fff; color: #fff;
opacity: 0.8; opacity: 0.8;
}
.uni-calendar-item--before-checked {
background-color: #ff5a5f;
color: #fff;
}
.uni-calendar-item--after-checked {
background-color: #ff5a5f;
color: #fff;
} }
</style> .uni-calendar-item--before-checked {
background-color: #ff5a5f;
color: #fff;
}
.uni-calendar-item--after-checked {
background-color: #ff5a5f;
color: #fff;
}
</style>
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}"> <view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top"> <view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
<view class="uni-calendar__header-btn-box" @click="close"> <view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text> <text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text>
</view> </view>
<view class="uni-calendar__header-btn-box" @click="confirm"> <view class="uni-calendar__header-btn-box" @click="confirm">
<text class="uni-calendar__header-text uni-calendar--fixed-width">确定</text> <text class="uni-calendar__header-text uni-calendar--fixed-width">{{okText}}</text>
</view> </view>
</view> </view>
<view class="uni-calendar__header"> <view class="uni-calendar__header">
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
<view class="uni-calendar__header-btn uni-calendar--left"></view> <view class="uni-calendar__header-btn uni-calendar--left"></view>
</view> </view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange"> <picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +''+( nowDate.month||'') +''}}</text> <text class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text>
</picker> </picker>
<view class="uni-calendar__header-btn-box" @click.stop="next"> <view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view> <view class="uni-calendar__header-btn uni-calendar--right"></view>
</view> </view>
<text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> <text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text>
</view> </view>
<view class="uni-calendar__box"> <view class="uni-calendar__box">
...@@ -29,25 +29,25 @@ ...@@ -29,25 +29,25 @@
</view> </view>
<view class="uni-calendar__weeks"> <view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{monText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{THUText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{SATText}}</text>
</view> </view>
</view> </view>
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
...@@ -63,6 +63,11 @@ ...@@ -63,6 +63,11 @@
<script> <script>
import Calendar from './util.js'; import Calendar from './util.js';
import calendarItem from './uni-calendar-item.vue' import calendarItem from './uni-calendar-item.vue'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* Calendar 日历 * Calendar 日历
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
...@@ -74,7 +79,7 @@ ...@@ -74,7 +79,7 @@
* @property {Boolean} range 范围选择 * @property {Boolean} range 范围选择
* @property {Boolean} insert = [true|false] 插入模式,默认为false * @property {Boolean} insert = [true|false] 插入模式,默认为false
* @value true 弹窗模式 * @value true 弹窗模式
* @value false 插入模式 * @value false 插入模式
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
* @property {Boolean} showMonth 是否选择月份为背景 * @property {Boolean} showMonth 是否选择月份为背景
...@@ -137,16 +142,52 @@ ...@@ -137,16 +142,52 @@
aniMaskShow: false aniMaskShow: false
} }
}, },
computed:{
/**
* for i18n
*/
okText() {
return t("uni-calender.ok")
},
cancelText() {
return t("uni-calender.cancel")
},
todayText() {
return t("uni-calender.today")
},
monText() {
return t("uni-calender.MON")
},
TUEText() {
return t("uni-calender.TUE")
},
WEDText() {
return t("uni-calender.WED")
},
THUText() {
return t("uni-calender.THU")
},
FRIText() {
return t("uni-calender.FRI")
},
SATText() {
return t("uni-calender.SAT")
},
SUNText() {
return t("uni-calender.SUN")
},
},
watch: { watch: {
date(newVal) { date(newVal) {
// this.cale.setDate(newVal) // this.cale.setDate(newVal)
this.init(newVal) this.init(newVal)
}, },
startDate(val){ startDate(val){
this.cale.resetSatrtDate(val) this.cale.resetSatrtDate(val)
}, },
endDate(val){ endDate(val){
this.cale.resetEndDate(val) this.cale.resetEndDate(val)
}, },
selected(newVal) { selected(newVal) {
this.cale.setSelectInfo(this.nowDate.fullDate, newVal) this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
...@@ -179,7 +220,7 @@ ...@@ -179,7 +220,7 @@
* 初始化日期显示 * 初始化日期显示
* @param {Object} date * @param {Object} date
*/ */
init(date) { init(date) {
this.cale.setDate(date) this.cale.setDate(date)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date) this.nowDate = this.calendar = this.cale.getInfo(date)
...@@ -189,7 +230,7 @@ ...@@ -189,7 +230,7 @@
*/ */
open() { open() {
// 弹窗模式并且清理数据 // 弹窗模式并且清理数据
if (this.clearDate && !this.insert) { if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus() this.cale.cleanMultipleStatus()
// this.cale.setDate(this.date) // this.cale.setDate(this.date)
this.init(this.date) this.init(this.date)
...@@ -208,7 +249,7 @@ ...@@ -208,7 +249,7 @@
this.aniMaskShow = false this.aniMaskShow = false
this.$nextTick(() => { this.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
this.show = false this.show = false
this.$emit('close') this.$emit('close')
}, 300) }, 300)
}) })
...@@ -267,8 +308,8 @@ ...@@ -267,8 +308,8 @@
* 选择天触发 * 选择天触发
* @param {Object} weeks * @param {Object} weeks
*/ */
choiceDate(weeks) { choiceDate(weeks) {
if (weeks.disable) return if (weeks.disable) return
this.calendar = weeks this.calendar = weeks
// 设置多选 // 设置多选
this.cale.setMultiple(this.calendar.fullDate) this.cale.setMultiple(this.calendar.fullDate)
...@@ -503,4 +544,4 @@ ...@@ -503,4 +544,4 @@
line-height: 1; line-height: 1;
/* #endif */ /* #endif */
} }
</style> </style>
{ {
"id": "uni-calendar", "id": "uni-calendar",
"displayName": "uni-calendar 日历", "displayName": "uni-calendar 日历",
"version": "1.4.1", "version": "1.4.2",
"description": "日历组件", "description": "日历组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
......
## 1.1.2(2021-08-24)
- 新增 支持国际化
## 1.1.1(2021-07-30) ## 1.1.1(2021-07-30)
- 优化 vue3下小程序事件警告的问题 - 优化 vue3下小程序事件警告的问题
## 1.1.0(2021-07-30) ## 1.1.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.5(2021-06-18) ## 1.0.5(2021-06-18)
- 修复 uni-countdown 重复赋值跳两秒的 bug - 修复 uni-countdown 重复赋值跳两秒的 bug
## 1.0.4(2021-05-12) ## 1.0.4(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.0.3(2021-05-08) ## 1.0.3(2021-05-08)
- 修复 uni-countdown 不能控制倒计时的 bug - 修复 uni-countdown 不能控制倒计时的 bug
## 1.0.2(2021-02-04) ## 1.0.2(2021-02-04)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
{
"uni-countdown.day": "day",
"uni-countdown.h": "h",
"uni-countdown.m": "m",
"uni-countdown.s": "s"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-countdown.day": "天",
"uni-countdown.h": "时",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}
{
"uni-countdown.day": "天",
"uni-countdown.h": "時",
"uni-countdown.m": "分",
"uni-countdown.s": "秒"
}
...@@ -2,19 +2,24 @@ ...@@ -2,19 +2,24 @@
<view class="uni-countdown"> <view class="uni-countdown">
<text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" <text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ d }}</text> class="uni-countdown__number">{{ d }}</text>
<text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor"></text> <text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{dayText}}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" <text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ h }}</text> class="uni-countdown__number">{{ h }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '' }}</text> <text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : hourText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" <text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ i }}</text> class="uni-countdown__number">{{ i }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '' }}</text> <text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : minuteText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" <text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
class="uni-countdown__number">{{ s }}</text> class="uni-countdown__number">{{ s }}</text>
<text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor"></text> <text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{secondText}}</text>
</view> </view>
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* Countdown 倒计时 * Countdown 倒计时
* @description 倒计时组件 * @description 倒计时组件
...@@ -97,6 +102,20 @@ ...@@ -97,6 +102,20 @@
seconds: 0 seconds: 0
} }
}, },
computed: {
dayText() {
return t("uni-countdown.day")
},
hourText(val) {
return t("uni-countdown.h")
},
minuteText(val) {
return t("uni-countdown.m")
},
secondText(val) {
return t("uni-countdown.s")
},
},
watch: { watch: {
day(val) { day(val) {
this.changeFlag() this.changeFlag()
...@@ -115,7 +134,7 @@ ...@@ -115,7 +134,7 @@
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal) { if (newVal) {
this.startData(); this.startData();
} else { } else {
if (!oldVal) return if (!oldVal) return
clearInterval(this.timer) clearInterval(this.timer)
} }
...@@ -180,7 +199,7 @@ ...@@ -180,7 +199,7 @@
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second) this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
if (this.seconds <= 0) { if (this.seconds <= 0) {
return return
} }
clearInterval(this.timer) clearInterval(this.timer)
this.countDown() this.countDown()
this.timer = setInterval(() => { this.timer = setInterval(() => {
...@@ -238,4 +257,4 @@ ...@@ -238,4 +257,4 @@
text-align: center; text-align: center;
font-size: $uni-font-size-sm; font-size: $uni-font-size-sm;
} }
</style> </style>
{ {
"id": "uni-countdown", "id": "uni-countdown",
"displayName": "uni-countdown 倒计时", "displayName": "uni-countdown 倒计时",
"version": "1.1.1", "version": "1.1.2",
"description": "CountDown 倒计时组件", "description": "CountDown 倒计时组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"countdown", "countdown",
"倒计时" "倒计时"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
}
}
}
}
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。 > 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
> - 组件需要依赖 `sass` 插件 ,请自行手动安装 > - 组件需要依赖 `sass` 插件 ,请自行手动安装
> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 > - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
> - `<uni-data-picker>` 内部包含了弹出层组件 `<uni-data-pickerview>` 外层的布局可能会影响弹出层,[详情](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Common_CSS_Questions) > - `<uni-data-picker>` 内部包含了弹出层组件 `<uni-data-pickerview>` 外层的布局可能会影响弹出层,[详情](https://developer.mozilla.org/zh-Hans/docs/Web/CSS/Common_CSS_Questions)
......
## 2.1.1(2021-08-24)
- 新增 支持国际化
- 优化 范围选择器在 pc 端过宽的问题
## 2.1.0(2021-08-09) ## 2.1.0(2021-08-09)
- 新增 适配 vue3 - 新增 适配 vue3
## 2.0.19(2021-08-09) ## 2.0.19(2021-08-09)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</view> </view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange"> <picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text <text
class="uni-calendar__header-text">{{ (nowDate.year||'') +''+( nowDate.month||'') +''}}</text> class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text>
</picker> </picker>
<view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next"> <view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view> <view class="uni-calendar__header-btn uni-calendar--right"></view>
...@@ -25,25 +25,25 @@ ...@@ -25,25 +25,25 @@
</view> </view>
<view class="uni-calendar__weeks"> <view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{monText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{THUText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
</view> </view>
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text"></text> <text class="uni-calendar__weeks-day-text">{{SATText}}</text>
</view> </view>
</view> </view>
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</view> </view>
<view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top" <view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"
style="padding: 0 40px;"> style="padding: 0 40px;">
<text class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : '选择日期'}}</text> <text class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</text>
<time-picker type="time" :start="reactStartTime" :end="reactEndTime" v-model="time" <time-picker type="time" :start="reactStartTime" :end="reactEndTime" v-model="time"
:disabled="!tempSingleDate" :border="false" class="time-picker-style"> :disabled="!tempSingleDate" :border="false" class="time-picker-style">
</time-picker> </time-picker>
...@@ -65,14 +65,14 @@ ...@@ -65,14 +65,14 @@
<view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"> <view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top">
<view class="uni-date-changed--time-start"> <view class="uni-date-changed--time-start">
<text class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : '开始日期'}}</text> <text class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}</text>
<time-picker type="time" :start="reactStartTime" v-model="timeRange.startTime" :border="false" <time-picker type="time" :start="reactStartTime" v-model="timeRange.startTime" :border="false"
:disabled="!tempRange.before" class="time-picker-style"> :disabled="!tempRange.before" class="time-picker-style">
</time-picker> </time-picker>
</view> </view>
<uni-icons type="arrowthinright" color="#999" style="line-height: 50px;"></uni-icons> <uni-icons type="arrowthinright" color="#999" style="line-height: 50px;"></uni-icons>
<view class="uni-date-changed--time-end"> <view class="uni-date-changed--time-end">
<text class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : '结束日期'}}</text> <text class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</text>
<time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false" <time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false"
:disabled="!tempRange.after" class="time-picker-style"> :disabled="!tempRange.after" class="time-picker-style">
</time-picker> </time-picker>
...@@ -80,11 +80,8 @@ ...@@ -80,11 +80,8 @@
</view> </view>
<view v-if="!insert" class="uni-date-changed uni-calendar__header" @click="confirm"> <view v-if="!insert" class="uni-date-changed uni-calendar__header" @click="confirm">
<!-- <view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">取消</text>
</view> -->
<view class="uni-calendar__header-btn-box"> <view class="uni-calendar__header-btn-box">
<text class="uni-calendar__button-text uni-calendar--fixed-width">确定</text> <text class="uni-calendar__button-text uni-calendar--fixed-width">{{okText}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -95,6 +92,11 @@ ...@@ -95,6 +92,11 @@
import Calendar from './util.js'; import Calendar from './util.js';
import calendarItem from './calendar-item.vue' import calendarItem from './calendar-item.vue'
import timePicker from './time-picker.vue' import timePicker from './time-picker.vue'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* Calendar 日历 * Calendar 日历
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
...@@ -220,10 +222,10 @@ ...@@ -220,10 +222,10 @@
watch: { watch: {
date: { date: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (!this.range) if (!this.range)
setTimeout(() => { setTimeout(() => {
this.init(newVal) this.init(newVal)
}, 100) }, 100)
} }
}, },
...@@ -291,7 +293,43 @@ ...@@ -291,7 +293,43 @@
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
const res = activeDate === this.endDate ? this.selectableTimes.end : '' const res = activeDate === this.endDate ? this.selectableTimes.end : ''
return res return res
} },
/**
* for i18n
*/
selectDateText() {
return t("uni-datetime-picker.selectDate")
},
startDateText() {
return this.startPlaceholder || t("uni-datetime-picker.startDate")
},
endDateText() {
return this.endPlaceholder || t("uni-datetime-picker.endDate")
},
okText() {
return t("uni-datetime-picker.ok")
},
monText() {
return t("uni-calender.MON")
},
TUEText() {
return t("uni-calender.TUE")
},
WEDText() {
return t("uni-calender.WED")
},
THUText() {
return t("uni-calender.THU")
},
FRIText() {
return t("uni-calender.FRI")
},
SATText() {
return t("uni-calender.SAT")
},
SUNText() {
return t("uni-calender.SUN")
},
}, },
created() { created() {
// 获取日历方法实例 // 获取日历方法实例
...@@ -356,17 +394,17 @@ ...@@ -356,17 +394,17 @@
this.cale.setDate(date) this.cale.setDate(date)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date) this.nowDate = this.calendar = this.cale.getInfo(date)
}, },
// choiceDate(weeks) { // choiceDate(weeks) {
// if (weeks.disable) return // if (weeks.disable) return
// this.calendar = weeks // this.calendar = weeks
// // 设置多选 // // 设置多选
// this.cale.setMultiple(this.calendar.fullDate, true) // this.cale.setMultiple(this.calendar.fullDate, true)
// this.weeks = this.cale.weeks // this.weeks = this.cale.weeks
// this.tempSingleDate = this.calendar.fullDate // this.tempSingleDate = this.calendar.fullDate
// this.tempRange.before = this.cale.multipleStatus.before // this.tempRange.before = this.cale.multipleStatus.before
// this.tempRange.after = this.cale.multipleStatus.after // this.tempRange.after = this.cale.multipleStatus.after
// this.change() // this.change()
// }, // },
/** /**
* 打开日历弹窗 * 打开日历弹窗
...@@ -760,4 +798,4 @@ ...@@ -760,4 +798,4 @@
.mr-10 { .mr-10 {
margin-right: 10px; margin-right: 10px;
} }
</style> </style>
{
"uni-datetime-picker.selectDate": "select date",
"uni-datetime-picker.selectTime": "select time",
"uni-datetime-picker.selectDateTime": "select datetime",
"uni-datetime-picker.startDate": "start date",
"uni-datetime-picker.endDate": "end date",
"uni-datetime-picker.startTime": "start time",
"uni-datetime-picker.endTime": "end time",
"uni-datetime-picker.ok": "ok",
"uni-datetime-picker.clear": "clear",
"uni-datetime-picker.cancel": "cancel",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-datetime-picker.selectDate": "选择日期",
"uni-datetime-picker.selectTime": "选择时间",
"uni-datetime-picker.selectDateTime": "选择日期时间",
"uni-datetime-picker.startDate": "开始日期",
"uni-datetime-picker.endDate": "结束日期",
"uni-datetime-picker.startTime": "开始时间",
"uni-datetime-picker.endTime": "结束时间",
"uni-datetime-picker.ok": "确定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}
{
"uni-datetime-picker.selectDate": "選擇日期",
"uni-datetime-picker.selectTime": "選擇時間",
"uni-datetime-picker.selectDateTime": "選擇日期時間",
"uni-datetime-picker.startDate": "開始日期",
"uni-datetime-picker.endDate": "結束日期",
"uni-datetime-picker.startTime": "開始时间",
"uni-datetime-picker.endTime": "結束时间",
"uni-datetime-picker.ok": "確定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
:class="{'uni-datetime-picker-disabled': disabled, 'uni-datetime-picker-timebox': border}"> :class="{'uni-datetime-picker-disabled': disabled, 'uni-datetime-picker-timebox': border}">
<text class="uni-datetime-picker-text">{{time}}</text> <text class="uni-datetime-picker-text">{{time}}</text>
<view v-if="!time" class="uni-datetime-picker-time"> <view v-if="!time" class="uni-datetime-picker-time">
<text class="uni-datetime-picker-text">选择{{title}}</text> <text class="uni-datetime-picker-text">{{selectTimeText}}</text>
</view> </view>
</view> </view>
</slot> </slot>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<view v-if="visible" class="uni-datetime-picker-popup" :class="[dateShow && timeShow ? '' : 'fix-nvue-height']" <view v-if="visible" class="uni-datetime-picker-popup" :class="[dateShow && timeShow ? '' : 'fix-nvue-height']"
:style="fixNvueBug"> :style="fixNvueBug">
<view class="uni-title"> <view class="uni-title">
<text class="uni-datetime-picker-text">设置{{title}}</text> <text class="uni-datetime-picker-text">{{selectTimeText}}</text>
</view> </view>
<view v-if="dateShow" class="uni-datetime-picker__container-box"> <view v-if="dateShow" class="uni-datetime-picker__container-box">
<picker-view class="uni-datetime-picker-view" :indicator-style="indicatorStyle" :value="ymd" <picker-view class="uni-datetime-picker-view" :indicator-style="indicatorStyle" :value="ymd"
...@@ -65,14 +65,14 @@ ...@@ -65,14 +65,14 @@
</view> </view>
<view class="uni-datetime-picker-btn"> <view class="uni-datetime-picker-btn">
<view @click="clearTime"> <view @click="clearTime">
<text class="uni-datetime-picker-btn-text">清空</text> <text class="uni-datetime-picker-btn-text">{{clearText}}</text>
</view> </view>
<view class="uni-datetime-picker-btn-group"> <view class="uni-datetime-picker-btn-group">
<view class="uni-datetime-picker-cancel" @click="tiggerTimePicker"> <view class="uni-datetime-picker-cancel" @click="tiggerTimePicker">
<text class="uni-datetime-picker-btn-text">取消</text> <text class="uni-datetime-picker-btn-text">{{cancelText}}</text>
</view> </view>
<view @click="setTime"> <view @click="setTime">
<text class="uni-datetime-picker-btn-text">确定</text> <text class="uni-datetime-picker-btn-text">{{okText}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -87,6 +87,11 @@ ...@@ -87,6 +87,11 @@
// #ifdef H5 // #ifdef H5
import keypress from './keypress' import keypress from './keypress'
// #endif // #endif
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* DatetimePicker 时间选择器 * DatetimePicker 时间选择器
...@@ -149,10 +154,10 @@ ...@@ -149,10 +154,10 @@
value: { value: {
type: [String, Number], type: [String, Number],
default: '' default: ''
}, },
modelValue: { modelValue: {
type: [String, Number], type: [String, Number],
default: '' default: ''
}, },
start: { start: {
type: [Number, String], type: [Number, String],
...@@ -405,6 +410,22 @@ ...@@ -405,6 +410,22 @@
return 59 return 59
} }
} }
},
/**
* for i18n
*/
selectTimeText() {
return t("uni-datetime-picker.selectTime")
},
okText() {
return t("uni-datetime-picker.ok")
},
clearText() {
return t("uni-datetime-picker.clear")
},
cancelText() {
return t("uni-datetime-picker.cancel")
} }
}, },
...@@ -681,11 +702,11 @@ ...@@ -681,11 +702,11 @@
if (!emit) return if (!emit) return
if (this.returnType === 'timestamp' && this.type !== 'time') { if (this.returnType === 'timestamp' && this.type !== 'time') {
this.$emit('change', this.createTimeStamp(this.time)) this.$emit('change', this.createTimeStamp(this.time))
this.$emit('input', this.createTimeStamp(this.time)) this.$emit('input', this.createTimeStamp(this.time))
this.$emit('update:modelValue', this.createTimeStamp(this.time)) this.$emit('update:modelValue', this.createTimeStamp(this.time))
} else { } else {
this.$emit('change', this.time) this.$emit('change', this.time)
this.$emit('input', this.time) this.$emit('input', this.time)
this.$emit('update:modelValue', this.time) this.$emit('update:modelValue', this.time)
} }
}, },
...@@ -730,7 +751,7 @@ ...@@ -730,7 +751,7 @@
clearTime() { clearTime() {
this.time = '' this.time = ''
this.$emit('change', this.time) this.$emit('change', this.time)
this.$emit('input', this.time) this.$emit('input', this.time)
this.$emit('update:modelValue', this.time) this.$emit('update:modelValue', this.time)
this.tiggerTimePicker() this.tiggerTimePicker()
}, },
......
...@@ -8,20 +8,20 @@ ...@@ -8,20 +8,20 @@
<view class="uni-date__icon-logo"> <view class="uni-date__icon-logo">
<image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image>
</view> </view>
<input class="uni-date__input" type="text" v-model="singleVal" :placeholder="placeholder" <input class="uni-date__x-input" type="text" v-model="singleVal" :placeholder="singlePlaceholderText"
:disabled="true" /> :disabled="true" />
</view> </view>
<view v-else class="uni-date-x uni-date-range"> <view v-else class="uni-date-x uni-date-range">
<view class="uni-date__icon-logo"> <view class="uni-date__icon-logo">
<image class="uni-date-editor--logo" :src="iconBase64" mode=""></image> <image class="uni-date-editor--logo" :src="iconBase64" mode=""></image>
</view> </view>
<input class="uni-date__input uni-date-range__input" type="text" v-model="range.startDate" <input class="uni-date__x-input t-c" type="text" v-model="range.startDate"
:placeholder="startPlaceholder" :disabled="true" /> :placeholder="startPlaceholderText" :disabled="true" />
<slot> <slot>
<view class="">{{rangeSeparator}}</view> <view class="">{{rangeSeparator}}</view>
</slot> </slot>
<input class="uni-date__input uni-date-range__input" type="text" v-model="range.endDate" <input class="uni-date__x-input t-c" type="text" v-model="range.endDate"
:placeholder="endPlaceholder" :disabled="true" /> :placeholder="endPlaceholderText" :disabled="true" />
</view> </view>
<view <view
v-show="clearIcon && !disabled && !isPhone && (singleVal || (range.startDate && range.endDate))" v-show="clearIcon && !disabled && !isPhone && (singleVal || (range.startDate && range.endDate))"
...@@ -36,18 +36,18 @@ ...@@ -36,18 +36,18 @@
<view v-if="!isPhone" ref="datePicker" v-show="popup" class="uni-date-picker__container"> <view v-if="!isPhone" ref="datePicker" v-show="popup" class="uni-date-picker__container">
<view v-if="!isRange" class="uni-date-single--x" :style="popover"> <view v-if="!isRange" class="uni-date-single--x" :style="popover">
<view v-show="hasTime" class="uni-date-changed popup-x-header"> <view v-show="hasTime" class="uni-date-changed popup-x-header">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempSingleDate" <input class="uni-date__input t-c" type="text" v-model="tempSingleDate"
placeholder="选择日期" /> :placeholder="selectDateText" />
<time-picker type="time" v-model="time" :border="false" :disabled="!tempSingleDate" <time-picker type="time" v-model="time" :border="false" :disabled="!tempSingleDate"
:start="reactStartTime" :end="reactEndTime"> :start="reactStartTime" :end="reactEndTime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="time" placeholder="选择时间" :disabled="!tempSingleDate" /> <input class="uni-date__input t-c" type="text" v-model="time" :placeholder="selectTimeText" :disabled="!tempSingleDate" />
</time-picker> </time-picker>
</view> </view>
<calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate" <calendar ref="pcSingle" class="uni-date_calendar-pc" :showMonth="false" :start-date="caleRange.startDate"
:end-date="caleRange.endDate" :date="defSingleDate" @change="singleChange" /> :end-date="caleRange.endDate" :date="defSingleDate" @change="singleChange" />
<view v-if="hasTime" class="popup-x-footer"> <view v-if="hasTime" class="popup-x-footer">
<!-- <text class="">此刻</text> --> <!-- <text class="">此刻</text> -->
<text class="confirm" @click="confirmSingleChange">确定</text> <text class="confirm" @click="confirmSingleChange">{{okText}}</text>
</view> </view>
<view class="uni-date-popper__arrow"></view> <view class="uni-date-popper__arrow"></view>
</view> </view>
...@@ -56,36 +56,36 @@ ...@@ -56,36 +56,36 @@
<view v-show="hasTime" class="popup-x-header uni-date-changed"> <view v-show="hasTime" class="popup-x-header uni-date-changed">
<view class="popup-x-header--datetime"> <view class="popup-x-header--datetime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate"
placeholder="开始日期" /> :placeholder="startDateText" />
<time-picker type="time" v-model="tempRange.startTime" :start="reactStartTime" :border="false" <time-picker type="time" v-model="tempRange.startTime" :start="reactStartTime" :border="false"
:disabled="!tempRange.startDate"> :disabled="!tempRange.startDate">
<input class="uni-date__input uni-date-range__input" type="text" <input class="uni-date__input uni-date-range__input" type="text"
v-model="tempRange.startTime" placeholder="开始时间" :disabled="!tempRange.startDate" /> v-model="tempRange.startTime" :placeholder="startTimeText" :disabled="!tempRange.startDate" />
</time-picker> </time-picker>
</view> </view>
<uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons> <uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons>
<view class="popup-x-header--datetime"> <view class="popup-x-header--datetime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endDate" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endDate"
placeholder="结束日期" /> :placeholder="endDateText" />
<time-picker type="time" v-model="tempRange.endTime" :end="reactEndTime" :border="false" <time-picker type="time" v-model="tempRange.endTime" :end="reactEndTime" :border="false"
:disabled="!tempRange.endDate"> :disabled="!tempRange.endDate">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endTime" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endTime"
placeholder="结束时间" :disabled="!tempRange.endDate" /> :placeholder="endTimeText" :disabled="!tempRange.endDate" />
</time-picker> </time-picker>
</view> </view>
</view> </view>
<view class="popup-x-body"> <view class="popup-x-body">
<calendar ref="left" :showMonth="false" :start-date="caleRange.startDate" <calendar ref="left" class="uni-date_calendar-pc" :showMonth="false" :start-date="caleRange.startDate"
:end-date="caleRange.endDate" :range="true" @change="leftChange" :pleStatus="endMultipleStatus" :end-date="caleRange.endDate" :range="true" @change="leftChange" :pleStatus="endMultipleStatus"
@firstEnterCale="updateRightCale" @monthSwitch="leftMonthSwitch" style="padding-right: 16px;" /> @firstEnterCale="updateRightCale" @monthSwitch="leftMonthSwitch" />
<calendar ref="right" :showMonth="false" :start-date="caleRange.startDate" <calendar ref="right" class="uni-date_calendar-pc" :showMonth="false" :start-date="caleRange.startDate"
:end-date="caleRange.endDate" :range="true" @change="rightChange" :end-date="caleRange.endDate" :range="true" @change="rightChange"
:pleStatus="startMultipleStatus" @firstEnterCale="updateLeftCale" :pleStatus="startMultipleStatus" @firstEnterCale="updateLeftCale"
@monthSwitch="rightMonthSwitch" style="padding-left: 16px;border-left: 1px solid #F1F1F1;" /> @monthSwitch="rightMonthSwitch" style="border-left: 1px solid #F1F1F1;" />
</view> </view>
<view v-if="hasTime" class="popup-x-footer"> <view v-if="hasTime" class="popup-x-footer">
<text class="" @click="clear">清空</text> <text class="" @click="clear">{{clearText}}</text>
<text class="confirm" @click="confirmRangeChange">确定</text> <text class="confirm" @click="confirmRangeChange">{{okText}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -96,9 +96,6 @@ ...@@ -96,9 +96,6 @@
</view> </view>
</template> </template>
<script> <script>
import calendar from './calendar.vue'
import timePicker from './time-picker.vue'
/** /**
* DatetimePicker 时间选择器 * DatetimePicker 时间选择器
* @description 同时支持 PC 和移动端使用日历选择日期和日期范围 * @description 同时支持 PC 和移动端使用日历选择日期和日期范围
...@@ -116,6 +113,13 @@ ...@@ -116,6 +113,13 @@
* @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用) * @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用)
* @event {Function} change 确定日期时触发的事件 * @event {Function} change 确定日期时触发的事件
**/ **/
import calendar from './calendar.vue'
import timePicker from './time-picker.vue'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
name: 'UniDatetimePicker', name: 'UniDatetimePicker',
...@@ -182,10 +186,10 @@ ...@@ -182,10 +186,10 @@
value: { value: {
type: [String, Number, Array, Date], type: [String, Number, Array, Date],
default: '' default: ''
}, },
modelValue: { modelValue: {
type: [String, Number, Array, Date], type: [String, Number, Array, Date],
default: '' default: ''
}, },
start: { start: {
type: [Number, String], type: [Number, String],
...@@ -201,15 +205,15 @@ ...@@ -201,15 +205,15 @@
}, },
placeholder: { placeholder: {
type: String, type: String,
default: '选择日期' default: ''
}, },
startPlaceholder: { startPlaceholder: {
type: String, type: String,
default: '起始日期' default: ''
}, },
endPlaceholder: { endPlaceholder: {
type: String, type: String,
default: '结束日期' default: ''
}, },
rangeSeparator: { rangeSeparator: {
type: String, type: String,
...@@ -311,6 +315,43 @@ ...@@ -311,6 +315,43 @@
datePopupWidth() { datePopupWidth() {
// todo // todo
return this.isRange ? 653 : 301 return this.isRange ? 653 : 301
},
/**
* for i18n
*/
singlePlaceholderText() {
return this.placeholder || this.type === 'date' ? this.selectDateText : t("uni-datetime-picker.selectDateTime")
},
startPlaceholderText() {
return this.startPlaceholder || this.startDateText
},
endPlaceholderText() {
return this.endPlaceholder || this.endDateText
},
selectDateText() {
return t("uni-datetime-picker.selectDate")
},
selectTimeText() {
return t("uni-datetime-picker.selectTime")
},
startDateText() {
return this.startPlaceholder || t("uni-datetime-picker.startDate")
},
startTimeText() {
return t("uni-datetime-picker.startTime")
},
endDateText() {
return this.endPlaceholder || t("uni-datetime-picker.endDate")
},
endTimeText() {
return t("uni-datetime-picker.endTime")
},
okText() {
return t("uni-datetime-picker.ok")
},
clearText() {
return t("uni-datetime-picker.clear")
} }
}, },
created() { created() {
...@@ -639,7 +680,7 @@ ...@@ -639,7 +680,7 @@
if (needEmit) { if (needEmit) {
this.formItem && this.formItem.setValue('') this.formItem && this.formItem.setValue('')
this.$emit('change', '') this.$emit('change', '')
this.$emit('input', '') this.$emit('input', '')
this.$emit('update:modelValue', '') this.$emit('update:modelValue', '')
} }
} else { } else {
...@@ -671,7 +712,7 @@ ...@@ -671,7 +712,7 @@
if (needEmit) { if (needEmit) {
this.formItem && this.formItem.setValue([]) this.formItem && this.formItem.setValue([])
this.$emit('change', []) this.$emit('change', [])
this.$emit('input', []) this.$emit('input', [])
this.$emit('update:modelValue', []) this.$emit('update:modelValue', [])
} }
} }
...@@ -752,16 +793,28 @@ ...@@ -752,16 +793,28 @@
/* #endif */ /* #endif */
} }
.uni-date__x-input {
padding: 0 8px;
height: 40px;
width: 100%;
line-height: 40px;
font-size: 14px;
}
.t-c {
text-align: center;
}
.uni-date__input { .uni-date__input {
height: 40px; height: 40px;
width: 100%; width: 100%;
padding: 0 8px;
line-height: 40px; line-height: 40px;
font-size: 14px; font-size: 14px;
} }
.uni-date-range__input { .uni-date-range__input {
text-align: center; text-align: center;
max-width: 152px;
} }
.uni-date-picker__container { .uni-date-picker__container {
...@@ -789,6 +842,7 @@ ...@@ -789,6 +842,7 @@
.uni-date-single--x { .uni-date-single--x {
/* padding: 0 8px; */ /* padding: 0 8px; */
background-color: #fff;
position: absolute; position: absolute;
top: 0; top: 0;
z-index: 999; z-index: 999;
...@@ -798,7 +852,7 @@ ...@@ -798,7 +852,7 @@
} }
.uni-date-range--x { .uni-date-range--x {
padding: 0 8px; /* padding: 0 8px; */
background-color: #fff; background-color: #fff;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -891,4 +945,7 @@ ...@@ -891,4 +945,7 @@
.mr-50 { .mr-50 {
margin-right: 50px; margin-right: 50px;
} }
</style> .uni-date_calendar-pc {
padding: 0 6px;
}
</style>
{ {
"id": "uni-datetime-picker", "id": "uni-datetime-picker",
"displayName": "uni-datetime-picker 日期选择器", "displayName": "uni-datetime-picker 日期选择器",
"version": "2.1.0", "version": "2.1.1",
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
"keywords": [ "keywords": [
"uni-datetime-picker", "uni-datetime-picker",
......
## 1.1.1(2021-08-24)
- 新增 支持国际化
## 1.1.0(2021-07-13) ## 1.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.6(2021-05-12) ## 1.0.6(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.0.5(2021-04-21) ## 1.0.5(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.4(2021-02-05) ## 1.0.4(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件 - 优化 组件引用关系,通过uni_modules引用组件
## 1.0.3(2021-02-05) ## 1.0.3(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件 - 优化 组件引用关系,通过uni_modules引用组件
## 1.0.2(2021-02-05) ## 1.0.2(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
{
"uni-fav.collect": "collect",
"uni-fav.collected": "collected"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-fav.collect": "收藏",
"uni-fav.collected": "已收藏"
}
{
"uni-fav.collect": "收藏",
"uni-fav.collected": "已收藏"
}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<uni-icons :color="fgColor" :style="{color: checked ? fgColorChecked : fgColor}" class="uni-fav-star" size="14" type="star-filled" <uni-icons :color="fgColor" :style="{color: checked ? fgColorChecked : fgColor}" class="uni-fav-star" size="14" type="star-filled"
v-if="!checked && (star === true || star === 'true')" /> v-if="!checked && (star === true || star === 'true')" />
<!-- #endif --> <!-- #endif -->
<text :style="{color: checked ? fgColorChecked : fgColor}" class="uni-fav-text">{{ checked ? contentText.contentFav : contentText.contentDefault }}</text> <text :style="{color: checked ? fgColorChecked : fgColor}" class="uni-fav-text">{{ checked ? contentFav : contentDefault }}</text>
</view> </view>
</template> </template>
...@@ -30,7 +30,14 @@ ...@@ -30,7 +30,14 @@
* @property {Object} contentText = [true|false] 收藏按钮文字 * @property {Object} contentText = [true|false] 收藏按钮文字
* @event {Function} click 点击 fav按钮触发事件 * @event {Function} click 点击 fav按钮触发事件
* @example <uni-fav :checked="true"/> * @example <uni-fav :checked="true"/>
*/ */
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
name: "UniFav", name: "UniFav",
// TODO 兼容 vue3,需要注册事件 // TODO 兼容 vue3,需要注册事件
...@@ -68,11 +75,19 @@ ...@@ -68,11 +75,19 @@
type: Object, type: Object,
default () { default () {
return { return {
contentDefault: "收藏", contentDefault: "",
contentFav: "已收藏" contentFav: ""
}; };
} }
} }
},
computed: {
contentDefault() {
return this.contentText.contentDefault || t("uni-fav.collect")
},
contentFav() {
return this.contentText.contentFav || t("uni-fav.collected")
},
}, },
watch: { watch: {
checked() { checked() {
......
{ {
"id": "uni-fav", "id": "uni-fav",
"displayName": "uni-fav 收藏按钮", "displayName": "uni-fav 收藏按钮",
"version": "1.1.0", "version": "1.1.1",
"description": " Fav 收藏组件,可自定义颜色、大小。", "description": " Fav 收藏组件,可自定义颜色、大小。",
"keywords": [ "keywords": [
"fav", "fav",
"uni-ui", "uni-ui",
"uniui", "uniui",
"收藏" "收藏"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-icons" "uni-icons"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
} }
}
}
}
}
## 1.0.0(2021-05-11 ## 1.0.3(2021-08-26
升级为云端一体模板 删除多余的云函数test2
// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema // 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema
const validator = { const validator = {
"content": { "content": {
"rules": [ "rules": [
...@@ -52,4 +50,49 @@ const validator = { ...@@ -52,4 +50,49 @@ const validator = {
const enumConverter = {} const enumConverter = {}
export { validator, enumConverter } function filterToWhere(filter, command) {
let where = {}
for (let field in filter) {
let { type, value } = filter[field]
switch (type) {
case "search":
if (typeof value === 'string' && value.length) {
where[field] = new RegExp(value)
}
break;
case "select":
if (value.length) {
let selectValue = []
for (let s of value) {
selectValue.push(command.eq(s))
}
where[field] = command.or(selectValue)
}
break;
case "range":
if (value.length) {
let gt = value[0]
let lt = value[1]
where[field] = command.and([command.gte(gt), command.lte(lt)])
}
break;
case "date":
if (value.length) {
let [s, e] = value
let startDate = new Date(s)
let endDate = new Date(e)
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
case "timestamp":
if (value.length) {
let [startDate, endDate] = value
where[field] = command.and([command.gte(startDate), command.lte(endDate)])
}
break;
}
}
return where
}
export { validator, enumConverter, filterToWhere }
{ {
"id": "uni-feedback", "id": "uni-feedback",
"displayName": "问题反馈页面模板", "displayName": "问题反馈用户端页面模板",
"version": "1.0.0", "version": "1.0.3",
"description": "问题反馈页面模板,方便开发者快速搭建问题反馈界面", "description": "问题反馈用户端页面模板,方便开发者快速搭建问题反馈界面",
"keywords": [ "keywords": [
"问题反馈页面模板" "问题反馈用户端页面模板"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云端一体页面模板"
], ],
"repository": "", "sale": {
"engines": { "regular": {
"HBuilderX": "^3.1.0" "price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
}, },
"dcloudext": { "contact": {
"category": [ "qq": ""
"uniCloud", },
"云端一体页面模板" "declaration": {
], "ads": "无",
"sale": { "data": "无",
"regular": { "permissions": "无"
"price": "0.00" },
}, "npmurl": ""
"sourcecode": { },
"price": "0.00" "uni_modules": {
} "dependencies": [
"uni-forms",
"uni-file-picker",
"uni-easyinput",
"uni-load-more",
"uni-list",
"uni-fab",
"uni-link"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "u"
}, },
"contact": { "H5-mobile": {
"qq": "" "Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
}, },
"declaration": { "H5-pc": {
"ads": "无", "Chrome": "y",
"data": "无", "IE": "u",
"permissions": "无" "Edge": "y",
"Firefox": "y",
"Safari": "y"
}, },
"npmurl": "" "小程序": {
}, "微信": "y",
"uni_modules": { "阿里": "y",
"platforms": { "百度": "y",
"cloud": { "字节跳动": "y",
"tcb": "y", "QQ": "y"
"aliyun": "y" },
}, "快应用": {
"client": { "华为": "u",
"App": { "联盟": "u"
"app-vue": "u", },
"app-nvue": "u" "Vue": {
}, "vue2": "y",
"H5-mobile": { "vue3": "y"
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
} }
}
} }
}
} }
\ No newline at end of file
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, loading, error, options}" :options="options" collection="opendb-feedback" field="content,imgs,contact,mobile" :where="queryWhere" :getone="true" :manual="true">
<view v-if="error">{{error.message}}</view>
<view v-else-if="loading">
<uni-load-more :contentText="loadMore" status="loading"></uni-load-more>
</view>
<view v-else-if="data">
<view>
<text>留言内容/回复内容</text>
<text>{{data.content}}</text>
</view>
<view>
<text>图片列表</text>
<template v-for="(file, j) in data.imgs">
<uni-file-picker v-if="file.fileType == 'image'" :value="file" :file-mediatype="file.fileType" return-type="object" readonly></uni-file-picker>
<uni-link v-else :href="file.url" :text="file.url"></uni-link>
</template>
</view>
<view>
<text>联系人</text>
<text>{{data.contact}}</text>
</view>
<view>
<text>联系电话</text>
<text>{{data.mobile}}</text>
</view>
</view>
</unicloud-db>
<view class="btns">
<button type="primary" @click="handleUpdate">修改</button>
<button type="warn" class="btn-delete" @click="handleDelete">删除</button>
</view>
</view>
</template>
<script>
// 由schema2code生成,包含校验规则和enum静态数据
import { enumConverter } from '../../js_sdk/validator/opendb-feedback.js';
export default {
data() {
return {
queryWhere: '',
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
},
options: {
// 将scheme enum 属性静态数据中的value转成text
...enumConverter
}
}
},
onLoad(e) {
this._id = e.id
},
onReady() {
if (this._id) {
this.queryWhere = '_id=="' + this._id + '"'
}
},
methods: {
handleUpdate() {
// 打开修改页面
uni.navigateTo({
url: './edit?id=' + this._id,
events: {
// 监听修改页面成功修改数据后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
},
handleDelete() {
this.$refs.udb.remove(this._id, {
success: (res) => {
// 删除数据成功后跳转到list页面
uni.navigateTo({
url: './list'
})
}
})
}
}
}
</script>
<style>
.container {
padding: 10px;
}
.btns {
margin-top: 10px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.btns button {
flex: 1;
}
.btn-delete {
margin-left: 10px;
}
</style>
<template>
<view class="uni-container">
<uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast">
<uni-forms-item name="content" label="留言内容/回复内容" required>
<textarea @input="binddata('content', $event.detail.value)" class="uni-textarea-border" v-model="formData.content" trim="right"></textarea>
</uni-forms-item>
<uni-forms-item name="imgs" label="图片列表">
<uni-file-picker file-mediatype="image" :limit="6" return-type="array" v-model="formData.imgs"></uni-file-picker>
</uni-forms-item>
<uni-forms-item name="contact" label="联系人">
<uni-easyinput v-model="formData.contact" trim="both"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="mobile" label="联系电话">
<uni-easyinput v-model="formData.mobile" trim="both"></uni-easyinput>
</uni-forms-item>
<view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">提交</button>
</view>
</uni-forms>
</view>
</template>
<script>
import { validator } from '../../js_sdk/validator/opendb-feedback.js';
const db = uniCloud.database();
const dbCollectionName = 'opendb-feedback';
function getValidator(fields) {
let result = {}
for (let key in validator) {
if (fields.indexOf(key) > -1) {
result[key] = validator[key]
}
}
return result
}
export default {
data() {
let formData = {
"content": "",
"imgs": [],
"contact": "",
"mobile": ""
}
return {
formData,
formOptions: {},
rules: {
...getValidator(Object.keys(formData))
}
}
},
onLoad(e) {
if (e.id) {
const id = e.id
this.formDataId = id
this.getDetail(id)
}
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
/**
* 触发表单提交
*/
submit() {
uni.showLoading({
mask: true
})
this.$refs.form.validate().then((res) => {
this.submitForm(res)
}).catch(() => {
uni.hideLoading()
})
},
submitForm(value) {
// 使用 clientDB 提交数据
db.collection(dbCollectionName).doc(this.formDataId).update(value).then((res) => {
uni.showToast({
icon: 'none',
title: '修改成功'
})
this.getOpenerEventChannel().emit('refreshData')
setTimeout(() => uni.navigateBack(), 500)
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
},
/**
* 获取表单数据
* @param {Object} id
*/
getDetail(id) {
uni.showLoading({
mask: true
})
db.collection(dbCollectionName).doc(id).field("content,imgs,contact,mobile").get().then((res) => {
const data = res.result.data[0]
if (data) {
this.formData = data
}
}).catch((err) => {
uni.showModal({
content: err.message || '请求服务失败',
showCancel: false
})
}).finally(() => {
uni.hideLoading()
})
}
}
}
</script>
<style>
.uni-container {
padding: 15px;
}
.uni-input-border,
.uni-textarea-border {
width: 100%;
font-size: 14px;
color: #666;
border: 1px #e5e5e5 solid;
border-radius: 5px;
box-sizing: border-box;
}
.uni-input-border {
padding: 0 10px;
height: 35px;
}
.uni-textarea-border {
padding: 10px;
height: 80px;
}
.uni-button-group {
margin-top: 50px;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
}
.uni-button {
width: 184px;
padding: 12px 20px;
font-size: 14px;
border-radius: 4px;
line-height: 1;
margin: 0;
}
</style>
<template>
<view class="container">
<unicloud-db ref="udb" v-slot:default="{data, pagination, loading, hasMore, error}" collection="opendb-feedback" field="content,imgs,contact,mobile">
<view v-if="error">{{error.message}}</view>
<view v-else-if="data">
<uni-list>
<uni-list-item v-for="(item, index) in data" :key="index" showArrow :clickable="true" @click="handleItemClick(item._id)">
<template v-slot:body>
<text>
<!-- 此处默认显示为_id,请根据需要自行修改为其他字段 -->
<!-- 如果使用了联表查询,请参考生成的 admin 项目中 list.vue 页面的绑定字段的写法 -->
{{item._id}}
</text>
</template>
</uni-list-item>
</uni-list>
</view>
<uni-load-more :status="loading?'loading':(hasMore ? 'more' : 'noMore')"></uni-load-more>
</unicloud-db>
<uni-fab ref="fab" horizontal="right" vertical="bottom" :pop-menu="false" @fabClick="fabClick" />
</view>
</template>
<script>
export default {
data() {
return {
loadMore: {
contentdown: '',
contentrefresh: '',
contentnomore: ''
}
}
},
onPullDownRefresh() {
this.$refs.udb.loadData({
clear: true
}, () => {
uni.stopPullDownRefresh()
})
},
onReachBottom() {
this.$refs.udb.loadMore()
},
methods: {
handleItemClick(id) {
uni.navigateTo({
url: './detail?id=' + id
})
},
fabClick() {
// 打开新增页面
uni.navigateTo({
url: './add',
events: {
// 监听新增数据成功后, 刷新当前页面数据
refreshData: () => {
this.$refs.udb.loadData({
clear: true
})
}
}
})
}
}
}
</script>
<style>
</style>
<template> <template>
<view class="uni-container"> <view class="uni-container">
<uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast"> <uni-forms ref="form" :value="formData" validate-trigger="submit" err-show-type="toast">
<uni-forms-item name="content" :label="$t('uniFeedback.msgTitle')" required> <uni-forms-item name="content" label="留言内容/回复内容" required>
<textarea @input="binddata('content', $event.detail.value)" class="uni-textarea-border" <textarea @input="binddata('content', $event.detail.value)" class="uni-textarea-border"
:value="formData.content" trim="right"></textarea> v-model="formData.content" trim="right"></textarea>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="imgs" :label="$t('uniFeedback.imgTitle')"> <uni-forms-item name="imgs" label="图片列表">
<uni-file-picker file-mediatype="image" :limit="6" return-type="array" v-model="formData.imgs" /> <uni-file-picker file-mediatype="image" :limit="6" return-type="array" v-model="formData.imgs">
</uni-file-picker>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="contact" :label="$t('uniFeedback.contacts')"> <uni-forms-item name="contact" label="联系人">
<uni-easyinput v-model="formData.contact" trim="both" /> <uni-easyinput v-model="formData.contact" trim="both"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="mobile" :label="$t('uniFeedback.phone')"> <uni-forms-item name="mobile" label="联系电话">
<uni-easyinput v-model="formData.mobile" trim="both" /> <uni-easyinput v-model="formData.mobile" trim="both"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<view class="uni-button-group"> <view class="uni-button-group">
<button type="primary" class="uni-button" @click="submit">{{$t('uniFeedback.submit')}}</button> <button type="primary" class="uni-button" @click="submit">提交</button>
</view> </view>
</uni-forms> </uni-forms>
</view> </view>
...@@ -25,41 +25,37 @@ ...@@ -25,41 +25,37 @@
<script> <script>
import { import {
validator validator
} from '../../js_sdk/validator/uni-feedback.js'; } from '../../js_sdk/validator/opendb-feedback.js';
console.log(validator);
const db = uniCloud.database(); const db = uniCloud.database();
const dbCollectionName = 'opendb-feedback'; const dbCollectionName = 'opendb-feedback';
function getValidator(fields) { function getValidator(fields) {
let reuslt = {} let result = {}
for (let key in validator) { for (let key in validator) {
if (fields.indexOf(key) > -1) { if (fields.indexOf(key) > -1) {
reuslt[key] = validator[key] result[key] = validator[key]
} }
} }
return reuslt return result
} }
export default { export default {
data() { data() {
let formData = {
"content": "",
"imgs": [],
"contact": "",
"mobile": ""
}
return { return {
formData: { formData,
"content": "",
"imgs": [],
"contact": "",
"mobile": ""
},
formOptions: {}, formOptions: {},
rules: { rules: {
...getValidator(["content", "imgs", "contact", "mobile"]) ...getValidator(Object.keys(formData))
} }
} }
}, },
onLoad() {
uni.setNavigationBarTitle({
title:this.$t('uniFeedback.navigationBarTitle')
})
},
onReady() { onReady() {
this.$refs.form.setRules(this.rules) this.$refs.form.setRules(this.rules)
}, },
...@@ -73,7 +69,7 @@ ...@@ -73,7 +69,7 @@
}) })
this.$refs.form.validate().then((res) => { this.$refs.form.validate().then((res) => {
this.submitForm(res) this.submitForm(res)
}).catch((errors) => { }).catch(() => {
uni.hideLoading() uni.hideLoading()
}) })
}, },
...@@ -81,15 +77,12 @@ ...@@ -81,15 +77,12 @@
submitForm(value) { submitForm(value) {
// 使用 clientDB 提交数据 // 使用 clientDB 提交数据
db.collection(dbCollectionName).add(value).then((res) => { db.collection(dbCollectionName).add(value).then((res) => {
uni.showModal({ uni.showToast({
content: '提交成功,感谢您的反馈!', icon: 'none',
showCancel: false, title: '提交成功'
confirmText:"关闭", })
complete:()=>{ this.getOpenerEventChannel().emit('refreshData')
this.getOpenerEventChannel().emit('refreshData') setTimeout(() => uni.navigateBack(), 500)
// setTimeout(() => uni.navigateBack(), 500)
}
});
}).catch((err) => { }).catch((err) => {
uni.showModal({ uni.showModal({
content: err.message || '请求服务失败', content: err.message || '请求服务失败',
...@@ -121,19 +114,20 @@ ...@@ -121,19 +114,20 @@
.uni-input-border { .uni-input-border {
padding: 0 10px; padding: 0 10px;
height: 35px; height: 35px;
} }
.uni-textarea-border { .uni-textarea-border {
padding: 10px; padding: 10px;
height: 80px; height: 80px;
width: 90%;
} }
.uni-button-group { .uni-button-group {
margin-top: 50px; margin-top: 50px;
/* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */
justify-content: center; justify-content: center;
flex-direction: row;
} }
.uni-button { .uni-button {
...@@ -144,9 +138,4 @@ ...@@ -144,9 +138,4 @@
line-height: 1; line-height: 1;
margin: 0; margin: 0;
} }
/* #ifndef APP-NVUE || VUE3 */ </style>
.uni-container /deep/ .uni-file-picker__container {
flex-direction: row;
}
/* #endif */
</style>
这是一个问题反馈客户端插件,admin端插件:[https://ext.dcloud.net.cn/plugin?id=4992](https://ext.dcloud.net.cn/plugin?id=4992) 这是一个问题反馈客户端插件,admin端插件:[https://ext.dcloud.net.cn/plugin?id=4992](https://ext.dcloud.net.cn/plugin?id=4992)
\ No newline at end of file > 参考案例 [uni-starter](https://ext.dcloud.net.cn/plugin?id=5057)
\ No newline at end of file
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
"required": ["content"], "required": ["content"],
"permission": { "permission": {
"create": "auth.uid != null", "create": "auth.uid != null",
"read": "auth.uid != null", "read": true,
"delete": false, "delete": true,
"update": false "update": true
}, },
"properties": { "properties": {
"_id": { "_id": {
......
## 1.1.1(2021-08-24)
- 新增 支持国际化
## 1.1.0(2021-07-13) ## 1.1.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.7(2021-05-12) ## 1.0.7(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.0.6(2021-04-21) ## 1.0.6(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.5(2021-02-05) ## 1.0.5(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件 - 优化 组件引用关系,通过uni_modules引用组件
## 1.0.4(2021-02-05) ## 1.0.4(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
{
"uni-goods-nav.options.shop": "shop",
"uni-goods-nav.options.cart": "cart",
"uni-goods-nav.buttonGroup.addToCart": "add to cart",
"uni-goods-nav.buttonGroup.buyNow": "buy now"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-goods-nav.options.shop": "店铺",
"uni-goods-nav.options.cart": "购物车",
"uni-goods-nav.buttonGroup.addToCart": "加入购物车",
"uni-goods-nav.buttonGroup.buyNow": "立即购买"
}
{
"uni-goods-nav.options.shop": "店鋪",
"uni-goods-nav.options.cart": "購物車",
"uni-goods-nav.buttonGroup.addToCart": "加入購物車",
"uni-goods-nav.buttonGroup.buyNow": "立即購買"
}
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* GoodsNav 商品导航 * GoodsNav 商品导航
* @description 商品加入购物车、立即购买等 * @description 商品加入购物车、立即购买等
...@@ -46,10 +51,10 @@ ...@@ -46,10 +51,10 @@
default () { default () {
return [{ return [{
icon: 'shop', icon: 'shop',
text: '店铺', text: t("uni-goods-nav.options.shop"),
}, { }, {
icon: 'cart', icon: 'cart',
text: '购物车' text: t("uni-goods-nav.options.cart")
}] }]
} }
}, },
...@@ -57,12 +62,12 @@ ...@@ -57,12 +62,12 @@
type: Array, type: Array,
default () { default () {
return [{ return [{
text: '加入购物车', text: t("uni-goods-nav.buttonGroup.addToCart"),
backgroundColor: '#ffa200', backgroundColor: '#ffa200',
color: '#fff' color: '#fff'
}, },
{ {
text: '立即购买', text: t("uni-goods-nav.buttonGroup.buyNow"),
backgroundColor: '#ff0000', backgroundColor: '#ff0000',
color: '#fff' color: '#fff'
} }
...@@ -141,9 +146,9 @@ ...@@ -141,9 +146,9 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
margin: 0 10px; margin: 0 10px;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
...@@ -170,9 +175,9 @@ ...@@ -170,9 +175,9 @@
/* #endif */ /* #endif */
flex: 1; flex: 1;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
...@@ -224,4 +229,4 @@ ...@@ -224,4 +229,4 @@
.uni-tab__color-r { .uni-tab__color-r {
background-color: #ff0000; background-color: #ff0000;
} }
</style> </style>
{ {
"id": "uni-goods-nav", "id": "uni-goods-nav",
"displayName": "uni-goods-nav 商品导航", "displayName": "uni-goods-nav 商品导航",
"version": "1.1.0", "version": "1.1.1",
"description": "商品导航组件主要用于电商类应用底部导航,可自定义加入购物车,购买等操作", "description": "商品导航组件主要用于电商类应用底部导航,可自定义加入购物车,购买等操作",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"商品导航" "商品导航"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-icons" "uni-icons"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
}
}
}
}
} }
\ No newline at end of file
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@font-face { @font-face {
font-family: uniicons; font-family: uniicons;
src: url('./uni.ttf') format('truetype'); src: url('/static/uni.ttf') format('truetype');
} }
/* #endif */ /* #endif */
......
## 1.2.1(2021-08-24)
- 新增 支持国际化
## 1.2.0(2021-07-30) ## 1.2.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.8(2021-05-12) ## 1.1.8(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.1.7(2021-03-30) ## 1.1.7(2021-03-30)
- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug - 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug
## 1.1.6(2021-02-05) ## 1.1.6(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
{
"uni-load-more.contentdown": "Pull up to show more",
"uni-load-more.contentrefresh": "loading...",
"uni-load-more.contentnomore": "No more data"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-load-more.contentdown": "上拉显示更多",
"uni-load-more.contentrefresh": "正在加载...",
"uni-load-more.contentnomore": "没有更多数据了"
}
{
"uni-load-more.contentdown": "上拉顯示更多",
"uni-load-more.contentrefresh": "正在加載...",
"uni-load-more.contentnomore": "沒有更多數據了"
}
{ {
"id": "uni-load-more", "id": "uni-load-more",
"displayName": "uni-load-more 加载更多", "displayName": "uni-load-more 加载更多",
"version": "1.2.0", "version": "1.2.1",
"description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"加载更多", "加载更多",
"load-more" "load-more"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
}
}
}
}
} }
\ No newline at end of file
## 1.6.2(2021-08-24)
- 新增 支持国际化
## 1.6.1(2021-07-30) ## 1.6.1(2021-07-30)
- 优化 vue3下事件警告的问题 - 优化 vue3下事件警告的问题
## 1.6.0(2021-07-13) ## 1.6.0(2021-07-13)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.5.0(2021-06-23) ## 1.5.0(2021-06-23)
- 新增 mask-click 遮罩层点击事件 - 新增 mask-click 遮罩层点击事件
## 1.4.5(2021-06-22) ## 1.4.5(2021-06-22)
- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug - 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
## 1.4.4(2021-06-18) ## 1.4.4(2021-06-18)
- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug - 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
## 1.4.3(2021-06-08) ## 1.4.3(2021-06-08)
- 修复 错误的 watch 字段 - 修复 错误的 watch 字段
- 修复 safeArea 属性不生效的问题 - 修复 safeArea 属性不生效的问题
- 修复 点击内容,再点击遮罩无法关闭的Bug - 修复 点击内容,再点击遮罩无法关闭的Bug
## 1.4.2(2021-05-12) ## 1.4.2(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.4.1(2021-04-29) ## 1.4.1(2021-04-29)
- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 - 修复 组件内放置 input 、textarea 组件,无法聚焦的问题
## 1.4.0 (2021-04-29) ## 1.4.0 (2021-04-29)
- 新增 type 属性的 left\right 值,支持左右弹出 - 新增 type 属性的 left\right 值,支持左右弹出
- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 - 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗
- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 - 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色
- 新增 safeArea 属性,是否适配底部安全区 - 新增 safeArea 属性,是否适配底部安全区
- 修复 App\h5\微信小程序底部安全区占位不对的Bug - 修复 App\h5\微信小程序底部安全区占位不对的Bug
- 修复 App 端弹出等待的Bug - 修复 App 端弹出等待的Bug
- 优化 提升低配设备性能,优化动画卡顿问题 - 优化 提升低配设备性能,优化动画卡顿问题
- 优化 更简单的组件自定义方式 - 优化 更简单的组件自定义方式
## 1.2.9(2021-02-05) ## 1.2.9(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件 - 优化 组件引用关系,通过uni_modules引用组件
## 1.2.8(2021-02-05) ## 1.2.8(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
## 1.2.7(2021-02-05) ## 1.2.7(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
- 新增 支持 PC 端 - 新增 支持 PC 端
- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端 - 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端
<template> <template>
<view class="uni-popup-dialog"> <view class="uni-popup-dialog">
<view class="uni-dialog-title"> <view class="uni-dialog-title">
<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{title}}</text> <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{titleText}}</text>
</view> </view>
<view v-if="mode === 'base'" class="uni-dialog-content"> <view v-if="mode === 'base'" class="uni-dialog-content">
<slot> <slot>
<text class="uni-dialog-content-text">{{content}}</text> <text class="uni-dialog-content-text">{{content}}</text>
</slot>
</view>
<view v-else class="uni-dialog-content">
<slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" >
</slot> </slot>
</view>
<view v-else class="uni-dialog-content">
<slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholder" :focus="focus" >
</slot>
</view> </view>
<view class="uni-dialog-button-group"> <view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="closeDialog"> <view class="uni-dialog-button" @click="closeDialog">
<text class="uni-dialog-button-text">取消</text> <text class="uni-dialog-button-text">{{cancelText}}</text>
</view> </view>
<view class="uni-dialog-button uni-border-left" @click="onOk"> <view class="uni-dialog-button uni-border-left" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">确定</text> <text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import popup from '../uni-popup/popup.js' import popup from '../uni-popup/popup.js'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* PopUp 弹出层-对话框样式 * PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式 * @description 弹出层-对话框样式
...@@ -48,7 +53,7 @@ ...@@ -48,7 +53,7 @@
*/ */
export default { export default {
name: "uniPopupDialog", name: "uniPopupDialog",
mixins: [popup], mixins: [popup],
emits:['confirm','close'], emits:['confirm','close'],
props: { props: {
...@@ -58,7 +63,7 @@ ...@@ -58,7 +63,7 @@
}, },
placeholder: { placeholder: {
type: [String, Number], type: [String, Number],
default: '请输入内容' default: ''
}, },
type: { type: {
type: String, type: String,
...@@ -70,7 +75,7 @@ ...@@ -70,7 +75,7 @@
}, },
title: { title: {
type: String, type: String,
default: '提示' default: ''
}, },
content: { content: {
type: String, type: String,
...@@ -88,6 +93,20 @@ ...@@ -88,6 +93,20 @@
val: "" val: ""
} }
}, },
computed: {
okText() {
return t("uni-popup.ok")
},
cancelText() {
return t("uni-popup.cancel")
},
placeholderText() {
return this.placeholder || t("uni-popup.placeholder")
},
titleText() {
return this.title || t("uni-popup.title")
}
},
watch: { watch: {
type(val) { type(val) {
this.dialogType = val this.dialogType = val
...@@ -101,9 +120,9 @@ ...@@ -101,9 +120,9 @@
this.val = val this.val = val
} }
}, },
created() { created() {
// 对话框遮罩不可点击 // 对话框遮罩不可点击
this.popup.disableMask() this.popup.disableMask()
// this.popup.closeMask() // this.popup.closeMask()
if (this.mode === 'input') { if (this.mode === 'input') {
this.dialogType = 'info' this.dialogType = 'info'
...@@ -119,25 +138,25 @@ ...@@ -119,25 +138,25 @@
/** /**
* 点击确认按钮 * 点击确认按钮
*/ */
onOk() { onOk() {
if (this.mode === 'input'){ if (this.mode === 'input'){
this.$emit('confirm', this.val) this.$emit('confirm', this.val)
}else{ }else{
this.$emit('confirm') this.$emit('confirm')
} }
if(this.beforeClose) return if(this.beforeClose) return
this.popup.close() this.popup.close()
}, },
/** /**
* 点击取消按钮 * 点击取消按钮
*/ */
closeDialog() { closeDialog() {
this.$emit('close') this.$emit('close')
if(this.beforeClose) return if(this.beforeClose) return
this.popup.close() this.popup.close()
}, },
close(){ close(){
this.popup.close() this.popup.close()
} }
} }
} }
...@@ -218,11 +237,11 @@ ...@@ -218,11 +237,11 @@
.uni-dialog-input { .uni-dialog-input {
flex: 1; flex: 1;
font-size: 14px; font-size: 14px;
border: 1px #eee solid; border: 1px #eee solid;
height: 40px; height: 40px;
padding: 0 10px; padding: 0 10px;
border-radius: 5px; border-radius: 5px;
color: #555; color: #555;
} }
...@@ -241,4 +260,4 @@ ...@@ -241,4 +260,4 @@
.uni-popup__info { .uni-popup__info {
color: #909399; color: #909399;
} }
</style> </style>
<template> <template>
<view class="uni-popup-share"> <view class="uni-popup-share">
<view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view> <view class="uni-share-title"><text class="uni-share-title-text">{{shareTitleText}}</text></view>
<view class="uni-share-content"> <view class="uni-share-content">
<view class="uni-share-content-box"> <view class="uni-share-content-box">
<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)"> <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
...@@ -11,25 +11,30 @@ ...@@ -11,25 +11,30 @@
</view> </view>
</view> </view>
<view class="uni-share-button-box"> <view class="uni-share-button-box">
<button class="uni-share-button" @click="close">取消</button> <button class="uni-share-button" @click="close">{{cancelText}}</button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import popup from '../uni-popup/popup.js' import popup from '../uni-popup/popup.js'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages)
export default { export default {
name: 'UniPopupShare', name: 'UniPopupShare',
mixins:[popup], mixins:[popup],
emits:['select'], emits:['select'],
props: { props: {
title: { title: {
type: String, type: String,
default: '分享到' default: ''
}, },
beforeClose: { beforeClose: {
type: Boolean, type: Boolean,
default: false default: false
} }
}, },
data() { data() {
...@@ -68,6 +73,14 @@ ...@@ -68,6 +73,14 @@
} }
}, },
created() {}, created() {},
computed: {
cancelText() {
return t("uni-popup.cancel")
},
shareTitleText() {
return this.title || t("uni-popup.shareTitle")
}
},
methods: { methods: {
/** /**
* 选择内容 * 选择内容
...@@ -76,15 +89,15 @@ ...@@ -76,15 +89,15 @@
this.$emit('select', { this.$emit('select', {
item, item,
index index
}) })
this.close() this.close()
}, },
/** /**
* 关闭窗口 * 关闭窗口
*/ */
close() { close() {
if(this.beforeClose) return if(this.beforeClose) return
this.popup.close() this.popup.close()
} }
} }
......
{
"uni-popup.cancel": "cancel",
"uni-popup.ok": "ok",
"uni-popup.placeholder": "pleace enter",
"uni-popup.title": "Hint",
"uni-popup.shareTitle": "Share to"
}
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-popup.cancel": "取消",
"uni-popup.ok": "确定",
"uni-popup.placeholder": "请输入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
}
{
"uni-popup.cancel": "取消",
"uni-popup.ok": "確定",
"uni-popup.placeholder": "請輸入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
}
...@@ -34,7 +34,8 @@ import keypress from './keypress.js' ...@@ -34,7 +34,8 @@ import keypress from './keypress.js'
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗 * @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
* @property {String} backgroundColor 主窗口背景色 * @property {String} backgroundColor 主窗口背景色
* @property {Boolean} safeArea 是否适配底部安全区 * @property {Boolean} safeArea 是否适配底部安全区
* @event {Function} change 打开关闭弹窗触发,e={show: false} * @event {Function} change 打开关闭弹窗触发,e={show: false}
* @event {Function} maskClick 点击遮罩触发
*/ */
export default { export default {
......
{ {
"id": "uni-popup", "id": "uni-popup",
"displayName": "uni-popup 弹出层", "displayName": "uni-popup 弹出层",
"version": "1.6.1", "version": "1.6.2",
"description": " Popup 组件,提供常用的弹层", "description": " Popup 组件,提供常用的弹层",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"弹出层", "弹出层",
"弹窗", "弹窗",
"popup", "popup",
"弹框" "弹框"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-transition" "uni-transition"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
} }
}
}
}
}
## 1.1.1(2021-08-24)
- 新增 支持国际化
## 1.1.0(2021-07-30) ## 1.1.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.9(2021-05-12) ## 1.0.9(2021-05-12)
- 新增 项目示例地址 - 新增 项目示例地址
## 1.0.8(2021-04-21) ## 1.0.8(2021-04-21)
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 - 优化 添加依赖 uni-icons, 导入后自动下载依赖
## 1.0.7(2021-04-15) ## 1.0.7(2021-04-15)
- uni-ui 新增 uni-search-bar 的 focus 事件 - uni-ui 新增 uni-search-bar 的 focus 事件
## 1.0.6(2021-02-05) ## 1.0.6(2021-02-05)
- 优化 组件引用关系,通过uni_modules引用组件 - 优化 组件引用关系,通过uni_modules引用组件
## 1.0.5(2021-02-05) ## 1.0.5(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
- 新增 支持双向绑定 - 新增 支持双向绑定
- 更改 input 事件的返回值,e={value:Number} --> e=value - 更改 input 事件的返回值,e={value:Number} --> e=value
- 新增 支持图标插槽 - 新增 支持图标插槽
- 新增 支持 clear、blur 事件 - 新增 支持 clear、blur 事件
- 新增 支持 focus 属性 - 新增 支持 focus 属性
- 去掉组件背景色 - 去掉组件背景色
{
"uni-search-bar.cancel": "cancel",
"uni-search-bar.placeholder": "Search enter content"
}
\ No newline at end of file
import en from './en.json'
import zhHans from './zh-Hans.json'
import zhHant from './zh-Hant.json'
export default {
en,
'zh-Hans': zhHans,
'zh-Hant': zhHant
}
{
"uni-search-bar.cancel": "cancel",
"uni-search-bar.placeholder": "请输入搜索内容"
}
{
"uni-search-bar.cancel": "cancel",
"uni-search-bar.placeholder": "請輸入搜索內容"
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<uni-icons color="#999999" size="18" type="search" /> <uni-icons color="#999999" size="18" type="search" />
</slot> </slot>
</view> </view>
<input v-if="show || searchVal" :focus="showSync" :placeholder="placeholder" :maxlength="maxlength" class="uni-searchbar__box-search-input" <input v-if="show || searchVal" :focus="showSync" :placeholder="placeholderText" :maxlength="maxlength" class="uni-searchbar__box-search-input"
confirm-type="search" type="text" v-model="searchVal" @confirm="confirm" @blur="blur" @focus="emitFocus" /> confirm-type="search" type="text" v-model="searchVal" @confirm="confirm" @blur="blur" @focus="emitFocus" />
<text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text> <text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text>
<view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='')" class="uni-searchbar__box-icon-clear" <view v-if="show && (clearButton==='always'||clearButton==='auto'&&searchVal!=='')" class="uni-searchbar__box-icon-clear"
...@@ -16,11 +16,16 @@ ...@@ -16,11 +16,16 @@
</slot> </slot>
</view> </view>
</view> </view>
<text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelText}}</text> <text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton ==='always' || show && cancelButton ==='auto'">{{cancelTextI18n}}</text>
</view> </view>
</template> </template>
<script> <script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
/** /**
* SearchBar 搜索栏 * SearchBar 搜索栏
...@@ -53,7 +58,7 @@ ...@@ -53,7 +58,7 @@
props: { props: {
placeholder: { placeholder: {
type: String, type: String,
default: "请输入搜索内容" default: ""
}, },
radius: { radius: {
type: [Number, String], type: [Number, String],
...@@ -82,10 +87,10 @@ ...@@ -82,10 +87,10 @@
value: { value: {
type: [Number, String], type: [Number, String],
default: "" default: ""
}, },
modelValue: { modelValue: {
type: [Number, String], type: [Number, String],
default: "" default: ""
}, },
focus: { focus: {
type: Boolean, type: Boolean,
...@@ -99,6 +104,14 @@ ...@@ -99,6 +104,14 @@
searchVal: '' searchVal: ''
} }
}, },
computed:{
cancelTextI18n() {
return this.cancelText || t("uni-search-bar.cancel")
},
placeholderText() {
return this.placeholder || t("uni-search-bar.placeholder")
}
},
watch: { watch: {
value: { value: {
immediate: true, immediate: true,
...@@ -108,15 +121,15 @@ ...@@ -108,15 +121,15 @@
this.show = true this.show = true
} }
} }
}, },
modelValue: { modelValue: {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
this.searchVal = newVal this.searchVal = newVal
if (newVal) { if (newVal) {
this.show = true this.show = true
} }
} }
}, },
focus: { focus: {
immediate: true, immediate: true,
...@@ -185,9 +198,9 @@ ...@@ -185,9 +198,9 @@
this.$emit("blur", { this.$emit("blur", {
value: this.searchVal value: this.searchVal
}) })
}, },
emitFocus(e) { emitFocus(e) {
this.$emit("focus", e.detail) this.$emit("focus", e.detail)
} }
} }
}; };
...@@ -245,9 +258,9 @@ ...@@ -245,9 +258,9 @@
.uni-searchbar__box-icon-clear { .uni-searchbar__box-icon-clear {
align-items: center; align-items: center;
line-height: 24px; line-height: 24px;
padding-left: 8px; padding-left: 8px;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
...@@ -261,9 +274,9 @@ ...@@ -261,9 +274,9 @@
padding-left: 10px; padding-left: 10px;
line-height: $uni-searchbar-height; line-height: $uni-searchbar-height;
font-size: 14px; font-size: 14px;
color: $uni-text-color; color: $uni-text-color;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
</style> </style>
{ {
"id": "uni-search-bar", "id": "uni-search-bar",
"displayName": "uni-search-bar 搜索栏", "displayName": "uni-search-bar 搜索栏",
"version": "1.1.0", "version": "1.1.1",
"description": "搜索栏组件,通常用于搜索商品、文章等", "description": "搜索栏组件,通常用于搜索商品、文章等",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"搜索框", "搜索框",
"搜索栏" "搜索栏"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
"uni-icons" "uni-icons"
], ],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "u"
}
}
}
}
} }
\ No newline at end of file
## 1.0.6(2021-08-25)
兼容vue3
## 1.0.5(2021-08-05) ## 1.0.5(2021-08-05)
优化代码实现,修改原来用`eval()`函数实现的逻辑 优化代码实现,修改原来用`eval()`函数实现的逻辑
## 1.0.4(2021-06-07) ## 1.0.4(2021-06-07)
......
{ {
"id": "uni-share", "id": "uni-share",
"displayName": "uni-share", "displayName": "uni-share",
"version": "1.0.5", "version": "1.0.6",
"description": "底部弹出宫格图标式的分享菜单,可覆盖原生组件。", "description": "底部弹出宫格图标式的分享菜单,可覆盖原生组件。",
"keywords": [ "keywords": [
"分享菜单" "分享菜单"
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
}, },
"Vue": { "Vue": {
"vue2": "y", "vue2": "y",
"vue3": "u" "vue3": "y"
} }
} }
} }
......
## 1.0.2(2021-08-25)
修复时区问题
## 1.0.1(2021-08-23) ## 1.0.1(2021-08-23)
调整签到逻辑,支持查出积分的收入支出历史记录 调整签到逻辑,支持查出积分的收入支出历史记录
## 1.0.0(2021-08-05) ## 1.0.0(2021-08-05)
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<script> <script>
const db = uniCloud.database(); const db = uniCloud.database();
const signInTable = db.collection('opendb-sign-in') const signInTable = db.action('signIn').collection('opendb-sign-in')
export default { export default {
name: "uni-signIn", name: "uni-signIn",
data() { data() {
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
try{ try{
const date = new Date(new Date().toLocaleDateString()).getTime() const date = new Date(new Date().toLocaleDateString()).getTime()
let res = await signInTable let res = await signInTable
.action('signIn')
.where(`'user_id' == $env.uid && 'date' == ${date} && 'isDelete' == false`) .where(`'user_id' == $env.uid && 'date' == ${date} && 'isDelete' == false`)
.get() .get()
this.signInRes = res.result this.signInRes = res.result
...@@ -82,7 +81,7 @@ ...@@ -82,7 +81,7 @@
icon: 'none' icon: 'none'
}); });
} else { } else {
let res = await signInTable.action('signIn').add({}); let res = await signInTable.add({});
console.log(res); console.log(res);
uni.hideLoading() uni.hideLoading()
this.signInRes = res.result this.signInRes = res.result
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册