diff --git a/App.vue b/App.vue index 93c6884..d6e440e 100644 --- a/App.vue +++ b/App.vue @@ -45,5 +45,5 @@ // @import "@/uni_modules/uview-ui/index.scss"; // @import "common/css/demo.scss"; @import "common/css/iconfont.css"; - @import "common/css/common.less"; + // @import "common/css/common.less"; diff --git a/common/css/common.less b/common/css/common.less index 2cb2d41..e7d095c 100644 --- a/common/css/common.less +++ b/common/css/common.less @@ -1,9 +1,332 @@ -// @uni-color-normal: #2c96fb; -// @uni-color-yellow: #ffc827; -// @uni-color-origin: #ff8213; -// @uni-color-red: #ff4e20; -// @uni-color-blue: #12c8fd; -// @uni-color-green: #42bfac; +Page{ + font-family: "PingFang-SC-Regular"; + height: 100%; + font-size: 24rpx; + -webkit-text-size-adjust: none; +} +body{ + height: 100%; +} +view{ + box-sizing: border-box; +} +.bg-container{ + background: rgba(243,244,245,1); + display: flex; + height: 100%; + flex-direction: column; + box-sizing: border-box; + line-height: 1; +} +.container{ + height: 100%; +} +.greenBg{ + background-color: green; +} +//全局 +.pad-rl{ + padding: 0 28rpx; +} + +.flex-ro{ + display: flex; + flex-direction: row; + align-items: center; +} + +.flex-cu{ + display: flex; + flex-direction: column; + align-items: center; +} + +.justify-side{ + justify-content: space-between; +} + +.justify-center{ + justify-content: center; +} + +.justify-start{ + justify-content: flex-start +} +.justify-end{ + justify-content: flex-end; +} + +.align-start{ + align-items: flex-start +} +.warp{ + flex-wrap:wrap; +} + +.txt-center{ + text-align: center; +} + +.mg-center{ + margin: 0 auto; +} + +//通用字体size +.f-10{ + font-size:20rpx; +} +.f-12{ + font-size:24rpx; +} + +.f-13{ + font-size: 26rpx; +} + +.f-14{ + font-size: 28rpx; +} + +.f-15{ + font-size: 30rpx; +} +.f-16{ + font-size: 32rpx; +} + +.f-17{ + font-size: 34rpx; +} + +.f-18{ + font-size: 36rpx; +} + +.f-19{ + font-size: 38rpx; +} + +.f-20{ + font-size: 40rpx; +} + +.font-w{ + font-weight: bold; +} + +.pa-l-5{ + padding-left: 10rpx; +} +.pa-l-10{ + padding-left: 20rpx; +} +.pa-l-15{ + padding-left: 30rpx; +} +.pa-l-20{ + padding-left: 40rpx; +} + +.pa-r-5{ + padding-right: 10rpx; +} +.pa-r-10{ + padding-right: 20rpx; +} +.pa-r-15{ + padding-right: 30rpx; +} + +.pa-r-20{ + padding-right: 40rpx; +} + +.pa-d-10{ + padding-bottom: 20rpx; +} + +.pa-d-20{ + padding-bottom: 40rpx; +} + +.pa-d-5{ + padding-bottom: 10rpx; +} + +.pa-t-10{ + padding-top: 20rpx; +} +.pa-t-15{ + padding-top: 30rpx; +} +.pa-t-20{ + padding-top: 40rpx; +} + +.pa-t-5{ + padding-top: 10rpx; +} + +.mg-l-5{ + margin-left: 10rpx; +} +.mg-l-10{ + margin-left: 20rpx; +} + +.mg-r-5{ + margin-right: 10rpx; +} +.mg-r-10{ + margin-right: 20rpx; +} + +.mg-r-15{ + margin-right: 30rpx; +} + +.mg-r-20{ + margin-right: 40rpx; +} + +.mg-d-10{ + margin-bottom: 20rpx !important; +} + +.mg-d-15{ + margin-bottom: 30rpx !important; +} + +.mg-d-20{ + margin-bottom: 40rpx !important; +} +.mg-d-5{ + margin-bottom: 10rpx; +} + +.mg-t-10{ + margin-top: 20rpx; +} + +.mg-t-15{ + margin-top: 30rpx; +} + +.mg-t-20{ + margin-top: 20rpx; +} + +.mg-t-5{ + margin-top: 10rpx; +} + +.col-w{ + color: #fff; +} + +.col-h{ + color: #2f2f2f; +} + +.col-low{ + color: #3f3f3f; +} + +.col-low-down{ + color: #898989; +} + +.col-ye{ + color: #f58f13; +} + +.col-red{ + color: #E25153!important; +} + +.col-redNew{ + color: #db4e3c!important; +} + +.bg-w{ + background-color: #fff; +} + +.bg-h{ + background-color: #2f2f2f; +} + +.bg-low{ + background-color: #3f3f3f; +} + +.bg-low-down{ + background-color: #898989; +} +.bg-low-btn{ + background-color: #d4d4d4; +} + +.bg-ye{ + background-color: #f58f13; +} + +.bg-red{ + background-color: #fa2807!important; +} +.bg-green{ + background-color: #00c45d; +} + +.bg-normal{ + background-color: rgba(243,244,245,1)!important; +} + +.grad { + background-image: linear-gradient(rgb(253,118,6),rgb(252,29,12)); +} +.newGrad{ + background-image: linear-gradient(to right, #ff933e , #ea5757)!important; +} +.saveNewGrad{ + background-image: linear-gradient(to right, rgb(252,85,40) , rgb(243,50,71))!important; +} +.newGradStop{ + background-image: linear-gradient(to right, #ffc67f , #ef6a72); +} +.blueGrad{ + background-image: linear-gradient(to right, #7C98F7 , #4055EF); +} + +.centers{ + position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); +} + +.fn-c-3{ + color:#333; +} +.fn-c-6{ + color:#333; +} +.fn-c-9{ + color:#333; +} + +/deep/.uni-scroll-view ::-webkit-scrollbar { + /* 隐藏滚动条,但依旧具备可以滚动的功能 */ + display: none; + width: 0; + height: 0; + color: transparent; + background: transparent; +} +/deep/::-webkit-scrollbar { + display: none; + width: 0; + height: 0; + color: transparent; + background: transparent; +} diff --git a/common/js/utils/navigateTo.js b/common/js/utils/navigateTo.js new file mode 100644 index 0000000..66c410f --- /dev/null +++ b/common/js/utils/navigateTo.js @@ -0,0 +1,67 @@ +// 页面白名单 +const whiteList = [ + '/', + '/pages/homePages/home/home?current=2', + '/pages/homePages/home/home?current=4', + '/pages/homePages/login/login', +] + +function hasPermission (url) { + // 在白名单中或有token,直接跳转 + if(whiteList.indexOf(url) !== -1 || getApp().globalData.isLogin) { + return true + } + return false +} + +uni.addInterceptor('navigateTo', { + // 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转 + invoke (e) { + if(!hasPermission(e.url) && !getApp().globalData.isLogin){ + console.log('需要登录') + uni.navigateTo({ + url: '/pages/homePages/login/login' + }) + return false + } + console.log('正确跳转') + return true + + }, + success (e) { + console.log('success', e) + }, + fail (e) { + console.log('fail', e) + }, + complete (e) { + console.log('complete', e) + }, +}) + +uni.addInterceptor('switchTab', { + // tabbar页面跳转前进行拦截 + invoke (e) { + debugger + if(!hasPermission(e.url)){ + uni.navigateTo({ + url: '/pages/homePage/home/home?current=2' + }) + return false + } + return true + }, + success (e) { + console.log('success', e) + }, + fail (e) { + console.log('fail', e) + }, + complete (e) { + console.log('complete', e) + }, +}) + + + + diff --git a/components/tabBar/tabBar.vue b/components/tabBar/tabBar.vue index 550495f..1ddc4e2 100644 --- a/components/tabBar/tabBar.vue +++ b/components/tabBar/tabBar.vue @@ -46,29 +46,31 @@ borderStyle: 'white', backgroundColor: '#fff', position: 'bottom', - list: [{ - "type": 'normal', - "pagePath": "/pages/homePage/manifest/manifest", - "icon": 'icon-yunshu1', - "iconClick": 'icon-yunshugongsi', - "text": "舱单", - "bgColor": '#e8effc', - "fontColor": '#333333', - "title": '舱单', - }, + list: [ + // { + // "type": 'normal', + // "pagePath": "/pages/homePage/manifest/manifest", + // "icon": 'icon-yunshu1', + // "iconClick": 'icon-yunshugongsi', + // "text": "舱单", + // "bgColor": '#e8effc', + // "fontColor": '#333333', + // "title": '舱单', + // }, + // { + // "type": 'normal', + // "pagePath": "/pages/homePage/moveTrace/moveTrace", + // // "pagePath": "/pages/chatList/chatList", + // "icon": "icon-yunshu1", + // "iconClick": 'icon-yunshugongsi', + // "text": "运踪", + // "bgColor": '#e8effc', + // "fontColor": '#333333', + // "title": '运踪', + // }, { + // "type": 'center', "type": 'normal', - "pagePath": "/pages/homePage/moveTrace/moveTrace", - // "pagePath": "/pages/chatList/chatList", - "icon": "icon-yunshu1", - "iconClick": 'icon-yunshugongsi', - "text": "运踪", - "bgColor": '#e8effc', - "fontColor": '#333333', - "title": '运踪', - }, - { - "type": 'center', "pagePath": "/pages/home/home", "icon": "icon-xinzeng", "iconClick": 'icon-xinzeng', @@ -78,23 +80,22 @@ "fontColor": '#ffffff', "title": '欢迎来到大简云', }, - { - "type": 'normal', - "pagePath": "/pages/homePage/vgm/vgm", - "icon": "icon-yunshu1", - "iconClick": 'icon-yunshugongsi', - "text": "VGM", - "bgColor": '#e8effc', - "fontColor": '#333333', - "title": 'VGM', - }, + // { + // "type": 'normal', + // "pagePath": "/pages/homePage/vgm/vgm", + // "icon": "icon-yunshu1", + // "iconClick": 'icon-yunshugongsi', + // "text": "VGM", + // "bgColor": '#e8effc', + // "fontColor": '#333333', + // "title": 'VGM', + // }, { "type": 'normal', "pagePath": "/pages/mine/mine", "icon": "icon-yunshu1", "iconClick": 'icon-yunshugongsi', "text": "我的", - // "bgColor": '#f99', "bgColor": '#e9f0fd', "fontColor": '#333333', "title": '个人中心', @@ -216,7 +217,8 @@ display: flex; flex-direction: column; justify-content: center; - + /* 这里是添加样式 */ + margin: 0 auto; } .tarbar-list-li-icon { diff --git a/main.js b/main.js index 78c3eb4..d3667b3 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,8 @@ import store from './store' import validate from '@/common/js/utils/ys-validate.js' import util from '@/common/js/utils/utils.js' +// import '@/common/js/utils/navigateTo.js' + Vue.prototype.$store = store Vue.prototype.$validate = validate @@ -19,7 +21,7 @@ App.mpType = 'app' const app = new Vue({ ...App }) -app.$mount() +app.$mount(); // #endif // #ifdef VUE3 @@ -30,4 +32,6 @@ export function createApp() { app } } -// #endif \ No newline at end of file +// #endif + + diff --git a/pages.json b/pages.json index 05b9c76..68ad69d 100644 --- a/pages.json +++ b/pages.json @@ -17,6 +17,24 @@ "navigationBarTitleText": "", "enablePullDownRefresh": false } + },{ + "path": "pages/homePage/manifest/manifest", + "style": { + "navigationBarTitleText": "舱单申报", + "enablePullDownRefresh": false + } + },{ + "path": "pages/homePage/moveTrace/moveTrace", + "style": { + "navigationBarTitleText": "运踪", + "enablePullDownRefresh": false + } + },{ + "path": "pages/homePage/vgm/vgm", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } }], "subPackages": [{ "root": "pages/manifest", @@ -29,7 +47,7 @@ { "path": "newManifest/newManifest", "style": { - "navigationBarTitleText": "航单申报" + "navigationBarTitleText": "舱单申报" } }, { "path": "cabinQuery/cabinQuery", @@ -37,9 +55,14 @@ "navigationBarTitleText": "线上舱位查询", "enablePullDownRefresh": false } - + }, { + "path": "cabinHistory/cabinHistory", + "style": { + "navigationBarTitleText": "线上舱位查询结果", + "enablePullDownRefresh": false + } } - ] + ] }], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/pages/homePage/home/home.vue b/pages/homePage/home/home.vue index 3497726..8d2f55d 100644 --- a/pages/homePage/home/home.vue +++ b/pages/homePage/home/home.vue @@ -1,23 +1,22 @@ @@ -26,9 +25,9 @@ import tabBar from "@/components/tabBar/tabBar.vue" import index from "@/pages/homePage/index/index.vue" import mine from "@/pages/homePage/mine/mine.vue" - import manifest from "@/pages/homePage/manifest/manifest.vue" // 航运 - import moveTrace from "@/pages/homePage/moveTrace/moveTrace.vue" // 运踪 - import vgm from "@/pages/homePage/vgm/vgm.vue" + // import manifest from "@/pages/homePage/manifest/manifest.vue" // 航运 + // import moveTrace from "@/pages/homePage/moveTrace/moveTrace.vue" // 运踪 + // import vgm from "@/pages/homePage/vgm/vgm.vue" import { getUserInfo @@ -43,15 +42,14 @@ tabBar, index, mine, - manifest, - moveTrace, - vgm + // manifest, + // moveTrace, + // vgm }, data() { return { - currentPage: 2, - duration: 200, - backButtonPress: 0, + currentPage: 1, + duration: 200 } }, computed: { @@ -59,7 +57,8 @@ 'userInfo' ]), }, - onLoad() { + onLoad(op) { + this.currentPage = op.current ? op.current : 0; if (!uni.getStorageSync('userToken')) { getApp().globalData.isLogin = false; console.log('== 当前登录状态 ==', getApp().globalData.isLogin) @@ -72,11 +71,22 @@ 'setUserInfo' ]), changePage(index) { + // if(index == 1 && !getApp().globalData.isLogin){ + // this.$util.Tips({ + // title: "请您登录/注册", + // success: () => { + // uni.navigateTo({ + // url: '/pages/homePage/login/login' + // }) + // } + // }); + // return false + // } this.currentPage = index; }, getUserInfo() { getUserInfo().then(res => { - if (res.code == 200) { + if(res.code == 200){ this.setUserInfo(res.data); } }) @@ -85,33 +95,10 @@ this.currentPage = type; }, - changeSwiper(e) { + changeSwiper(e){ this.currentPage = e.detail.current; } - }, - // onHide(){ - // if (this.currentPage == 2) { - // this.backButtonPress++; //别忘了定义一下 - // if (this.backButtonPress > 1) { - // // plus.runtime.quit(); - // // return false; //允许返回 - // } else { - // // plus.nativeUI.toast('再按一次退出应用'); - // // return true; //阻止返回 - // return false - // } - // setTimeout(function() { - // this.backButtonPress = 0; - // }, 1000); - // } else { - // this.currentPage = 2; - // uni.switchTab({ - // url: '/pages/homePage/home/home', - // }) - // // return true; //阻止返回 - // return false - // } - // }, + } } @@ -122,7 +109,6 @@ flex-direction: column; overflow: hidden; box-sizing: border-box; - .main { flex: 1; } diff --git a/pages/homePage/index/index.vue b/pages/homePage/index/index.vue index dc3a87a..9852024 100644 --- a/pages/homePage/index/index.vue +++ b/pages/homePage/index/index.vue @@ -27,9 +27,9 @@ - - - + + + @@ -48,6 +48,14 @@ }, methods: { changePage(url){ + if(url == '/pages/homePage/vgm/vgm'){ + uni.showToast({ + title: '敬请期待', + duration: 2000, + icon: 'none' + }); + return false + } if(!getApp().globalData.isLogin){ this.$util.Tips({ title: "请您登录/注册", diff --git a/pages/homePage/manifest/manifest.less b/pages/homePage/manifest/manifest.less index 7c9db7e..8e70cc4 100644 --- a/pages/homePage/manifest/manifest.less +++ b/pages/homePage/manifest/manifest.less @@ -3,7 +3,7 @@ height: 100vh; display: flex; flex-direction: column; - padding-bottom: 167rpx; + // padding-bottom: 167rpx; box-sizing: border-box; .swipe-action-box{ flex: 1; diff --git a/pages/homePage/manifest/manifest.vue b/pages/homePage/manifest/manifest.vue index 64b41de..94e1595 100644 --- a/pages/homePage/manifest/manifest.vue +++ b/pages/homePage/manifest/manifest.vue @@ -230,7 +230,7 @@ mounted() { setTimeout(() => { this.loadingShow = false; - }, 1500) + }, 800) }, methods: { trigger(e) { diff --git a/pages/homePage/mine/mine.vue b/pages/homePage/mine/mine.vue index d7a6a7f..aa895ed 100644 --- a/pages/homePage/mine/mine.vue +++ b/pages/homePage/mine/mine.vue @@ -81,9 +81,19 @@ }, methods: { goLogin(){ + // uni.navigateTo({ + // url:'/pages/homePage/login/login' + // }) uni.navigateTo({ - url:'/pages/homePage/login/login' - }) + url: '/pages/homePage/login/login', + success(res) { + console.log('成功啦',res); + }, + fail(err) { + console.log('失败啦',err); + } + }); + }, signOut(){ this.$util.showModal('退出','确定退出登录?',()=>{ diff --git a/pages/homePage/moveTrace/moveTrace.vue b/pages/homePage/moveTrace/moveTrace.vue index 99cab66..953bdac 100644 --- a/pages/homePage/moveTrace/moveTrace.vue +++ b/pages/homePage/moveTrace/moveTrace.vue @@ -1,6 +1,6 @@ @@ -79,6 +90,9 @@ import { ListData } from '../../../common/js/api/homePage/moveTrace.js' + import { + FormatTiem + } from './time.js' import AddMoveTrace from './AddMoveTrace.vue' export default { components: { @@ -86,22 +100,43 @@ }, data() { return { + FormatTiem, ViewType: false, - form:[] + form: [], + GetData: { + "offset": 0, + "limit": 10, + }, + mblno: '' } }, - // mounted() { - // ListData().then(res => { - // console.log(123132); - // // console.log(res.DataList); - // // this.form=res.DataList - // }) - // }, mounted() { - ListData().then(res => { - }) + this.FnGetData() }, methods: { + dialogClose() { + this.$refs.alertDialog.close() + }, + dialogConfirm() { + this.$refs.alertDialog.close() + }, + dialogToggle(item) { + this.mblno = item.MBLNO + this.$refs.alertDialog.open() + }, + FnGetData() { + ListData(this.GetData).then(res => { + this.form = [...this.form, ...res.DataList] + }).catch(err => { + this.form = [...this.form, ...err.DataList] + }) + console.log(this.form, this.form.length); + }, + scrolltolower() { + ++this.GetData.offset + this.FnGetData() + + }, ChangeViewType() { this.ViewType = false }, @@ -115,9 +150,11 @@ diff --git a/pages/manifest/cabinQuery-1/cabinQuery.vue b/pages/manifest/cabinQuery-1/cabinQuery.vue new file mode 100644 index 0000000..a795525 --- /dev/null +++ b/pages/manifest/cabinQuery-1/cabinQuery.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/pages/manifest/cabinQuery/components/history.vue b/pages/manifest/cabinQuery-1/components/history.vue similarity index 100% rename from pages/manifest/cabinQuery/components/history.vue rename to pages/manifest/cabinQuery-1/components/history.vue diff --git a/pages/manifest/cabinQuery/components/query.vue b/pages/manifest/cabinQuery-1/components/query.vue similarity index 100% rename from pages/manifest/cabinQuery/components/query.vue rename to pages/manifest/cabinQuery-1/components/query.vue diff --git a/pages/manifest/cabinQuery/cabinQuery.vue b/pages/manifest/cabinQuery/cabinQuery.vue index a795525..a342d5b 100644 --- a/pages/manifest/cabinQuery/cabinQuery.vue +++ b/pages/manifest/cabinQuery/cabinQuery.vue @@ -1,42 +1,588 @@ diff --git a/pages/manifest/declarationLog/declarationLog.vue b/pages/manifest/declarationLog/declarationLog.vue index 77a2e1d..b17b032 100644 --- a/pages/manifest/declarationLog/declarationLog.vue +++ b/pages/manifest/declarationLog/declarationLog.vue @@ -56,7 +56,7 @@ mounted() { setTimeout(() => { this.loadingShow = false; - }, 3000) + }, 800) }, methods: { diff --git a/static/image/buy-3.png b/static/image/buy-3.png index 960af8e..e3fd6f4 100644 Binary files a/static/image/buy-3.png and b/static/image/buy-3.png differ diff --git a/static/image/huatai.png b/static/image/huatai.png index b681307..dba710f 100644 Binary files a/static/image/huatai.png and b/static/image/huatai.png differ diff --git a/static/image/index_bg.png b/static/image/index_bg.png index 565f787..d360829 100644 Binary files a/static/image/index_bg.png and b/static/image/index_bg.png differ diff --git a/static/image/manifest-3.png b/static/image/manifest-3.png index a560fbe..113e4ad 100644 Binary files a/static/image/manifest-3.png and b/static/image/manifest-3.png differ diff --git a/static/image/move-trace-3.png b/static/image/move-trace-3.png index 364aeed..9af79f0 100644 Binary files a/static/image/move-trace-3.png and b/static/image/move-trace-3.png differ diff --git a/static/image/vgm-3.png b/static/image/vgm-3.png index b74cc46..afe8ab1 100644 Binary files a/static/image/vgm-3.png and b/static/image/vgm-3.png differ diff --git a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue index 0077051..e30ed1c 100644 --- a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue +++ b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue @@ -244,7 +244,7 @@ .uni-fab--leftBottom { left: 15px; - bottom: 110px; + bottom: 40px; /* #ifdef H5 */ left: calc(15px + var(--window-left)); bottom: calc(30px + var(--window-bottom)); @@ -264,7 +264,7 @@ .uni-fab--rightBottom { right: 15px; - bottom: 110px; + bottom: 40px; /* #ifdef H5 */ right: calc(15px + var(--window-right)); bottom: calc(30px + var(--window-bottom)); @@ -299,7 +299,7 @@ .uni-fab__circle--leftBottom { left: 15px; - bottom: 110px; + bottom: 40px; /* #ifdef H5 */ left: calc(15px + var(--window-left)); bottom: calc(30px + var(--window-bottom)); @@ -317,7 +317,7 @@ .uni-fab__circle--rightBottom { right: 15px; - bottom: 110px; + bottom: 40px; /* #ifdef H5 */ right: calc(15px + var(--window-right)); bottom: calc(30px + var(--window-bottom)); diff --git a/uni_modules/uni-popup/changelog.md b/uni_modules/uni-popup/changelog.md new file mode 100644 index 0000000..a9e2d66 --- /dev/null +++ b/uni_modules/uni-popup/changelog.md @@ -0,0 +1,60 @@ +## 1.7.9(2022-04-02) +- 修复 弹出层内部无法滚动的bug +## 1.7.8(2022-03-28) +- 修复 小程序中高度错误的bug +## 1.7.7(2022-03-17) +- 修复 快速调用open出现问题的Bug +## 1.7.6(2022-02-14) +- 修复 safeArea 属性不能设置为false的bug +## 1.7.5(2022-01-19) +- 修复 isMaskClick 失效的bug +## 1.7.4(2022-01-19) +- 新增 cancelText \ confirmText 属性 ,可自定义文本 +- 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色 +- 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题 +## 1.7.3(2022-01-13) +- 修复 设置 safeArea 属性不生效的bug +## 1.7.2(2021-11-26) +- 优化 组件示例 +## 1.7.1(2021-11-26) +- 修复 vuedoc 文字错误 +## 1.7.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup) +## 1.6.2(2021-08-24) +- 新增 支持国际化 +## 1.6.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.6.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.5.0(2021-06-23) +- 新增 mask-click 遮罩层点击事件 +## 1.4.5(2021-06-22) +- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.4(2021-06-18) +- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.3(2021-06-08) +- 修复 错误的 watch 字段 +- 修复 safeArea 属性不生效的问题 +- 修复 点击内容,再点击遮罩无法关闭的Bug +## 1.4.2(2021-05-12) +- 新增 组件示例地址 +## 1.4.1(2021-04-29) +- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 +## 1.4.0 (2021-04-29) +- 新增 type 属性的 left\right 值,支持左右弹出 +- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 +- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 +- 新增 safeArea 属性,是否适配底部安全区 +- 修复 App\h5\微信小程序底部安全区占位不对的Bug +- 修复 App 端弹出等待的Bug +- 优化 提升低配设备性能,优化动画卡顿问题 +- 优化 更简单的组件自定义方式 +## 1.2.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.2.8(2021-02-05) +- 调整为uni_modules目录规范 +## 1.2.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 PC 端 +- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端 diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue new file mode 100644 index 0000000..a5d0f2a --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue new file mode 100644 index 0000000..91370a8 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue @@ -0,0 +1,143 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue new file mode 100644 index 0000000..5be7624 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue @@ -0,0 +1,187 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json new file mode 100644 index 0000000..7f1bd06 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "cancel", + "uni-popup.ok": "ok", + "uni-popup.placeholder": "pleace enter", + "uni-popup.title": "Hint", + "uni-popup.shareTitle": "Share to" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/index.js b/uni_modules/uni-popup/components/uni-popup/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js @@ -0,0 +1,8 @@ +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 +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json new file mode 100644 index 0000000..5e3003c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "确定", + "uni-popup.placeholder": "请输入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json new file mode 100644 index 0000000..13e39eb --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "確定", + "uni-popup.placeholder": "請輸入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js new file mode 100644 index 0000000..62dda46 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + // this.$once('hook:beforeDestroy', () => { + // document.removeEventListener('keyup', listener) + // }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js new file mode 100644 index 0000000..c4e5781 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -0,0 +1,26 @@ + +export default { + data() { + return { + + } + }, + created(){ + this.popup = this.getParent() + }, + methods:{ + /** + * 获取父元素实例 + */ + getParent(name = 'uniPopup') { + let parent = this.$parent; + let parentName = parent.$options.name; + while (parentName !== name) { + parent = parent.$parent; + if (!parent) return false + parentName = parent.$options.name; + } + return parent; + }, + } +} diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue new file mode 100644 index 0000000..db90c59 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -0,0 +1,474 @@ + + + + diff --git a/uni_modules/uni-popup/package.json b/uni_modules/uni-popup/package.json new file mode 100644 index 0000000..069e9ce --- /dev/null +++ b/uni_modules/uni-popup/package.json @@ -0,0 +1,90 @@ +{ + "id": "uni-popup", + "displayName": "uni-popup 弹出层", + "version": "1.7.9", + "description": " Popup 组件,提供常用的弹层", + "keywords": [ + "uni-ui", + "弹出层", + "弹窗", + "popup", + "弹框" + ], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-popup/readme.md b/uni_modules/uni-popup/readme.md new file mode 100644 index 0000000..fdad4b3 --- /dev/null +++ b/uni_modules/uni-popup/readme.md @@ -0,0 +1,17 @@ + + +## Popup 弹出层 +> **组件名:uni-popup** +> 代码块: `uPopup` +> 关联组件:`uni-transition` + + +弹出层组件,在应用中弹出一个消息提示窗口、提示框等 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-popup) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md new file mode 100644 index 0000000..b1a824b --- /dev/null +++ b/uni_modules/uni-transition/changelog.md @@ -0,0 +1,20 @@ +## 1.3.1(2021-11-23) +- 修复 init 方法初始化问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition) +## 1.2.1(2021-09-27) +- 修复 init 方法不生效的 Bug +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.1(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的 Bug +## 1.1.0(2021-04-22) +- 新增 通过方法自定义动画 +- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- 优化 动画触发逻辑,使动画更流畅 +- 优化 支持单独的动画类型 +- 优化 文档示例 +## 1.0.2(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js new file mode 100644 index 0000000..5f54365 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -0,0 +1,128 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + this.animation = uni.createAnimation(options) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000..0d739bd --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json new file mode 100644 index 0000000..d15fdf0 --- /dev/null +++ b/uni_modules/uni-transition/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.1", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md new file mode 100644 index 0000000..2f8a77e --- /dev/null +++ b/uni_modules/uni-transition/readme.md @@ -0,0 +1,11 @@ + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file