diff --git a/App.vue b/App.vue index 42a70c28aca7bf240fba373db156227623bc9486..15e70b16533ecae46e985fd793d9243d9375a381 100644 --- a/App.vue +++ b/App.vue @@ -1,7 +1,9 @@ + + diff --git a/components/uni-popup/message.js b/components/uni-popup/message.js new file mode 100644 index 0000000000000000000000000000000000000000..0ff9a0242c1a2ed1899a36629cf6067f13ed29df --- /dev/null +++ b/components/uni-popup/message.js @@ -0,0 +1,22 @@ +export default { + created() { + if (this.type === 'message') { + // 不显示遮罩 + this.maskShow = false + // 获取子组件对象 + this.childrenMsg = null + } + }, + methods: { + customOpen() { + if (this.childrenMsg) { + this.childrenMsg.open() + } + }, + customClose() { + if (this.childrenMsg) { + this.childrenMsg.close() + } + } + } +} diff --git a/components/uni-popup/popup.js b/components/uni-popup/popup.js new file mode 100644 index 0000000000000000000000000000000000000000..14d4b778dab2417b1170ba261a0d8010efe97f3c --- /dev/null +++ b/components/uni-popup/popup.js @@ -0,0 +1,25 @@ +import message from './message.js'; +// 定义 type 类型:弹出类型:top/bottom/center +const config = { + // 顶部弹出 + top:'top', + // 底部弹出 + bottom:'bottom', + // 居中弹出 + center:'center', + // 消息提示 + message:'top', + // 对话框 + dialog:'center', + // 分享 + share:'bottom', +} + +export default { + data(){ + return { + config:config + } + }, + mixins: [message] +} diff --git a/components/uni-popup/share.js b/components/uni-popup/share.js new file mode 100644 index 0000000000000000000000000000000000000000..462bb83ab3cbf468e41f4faa3463e1a68d3d6941 --- /dev/null +++ b/components/uni-popup/share.js @@ -0,0 +1,16 @@ +export default { + created() { + if (this.type === 'share') { + // 关闭点击 + this.mkclick = false + } + }, + methods: { + customOpen() { + console.log('share 打开了'); + }, + customClose() { + console.log('share 关闭了'); + } + } +} diff --git a/components/uni-popup/uni-popup.vue b/components/uni-popup/uni-popup.vue new file mode 100644 index 0000000000000000000000000000000000000000..0a509c5889db714464b6778d8e80f68677f28995 --- /dev/null +++ b/components/uni-popup/uni-popup.vue @@ -0,0 +1,296 @@ + + + + \ No newline at end of file diff --git a/components/uni-transition/uni-transition.vue b/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000000000000000000000000000000000000..ad1cb556d0c8891290e4e5344a1bf2a28b3ae8ed --- /dev/null +++ b/components/uni-transition/uni-transition.vue @@ -0,0 +1,279 @@ + + + + + \ No newline at end of file diff --git a/pages.json b/pages.json index acf7166c3b0d9969073addd317ec593385bd0d5c..33ecda36cb15ffb82541a5657314065d8a9481b7 100644 --- a/pages.json +++ b/pages.json @@ -52,7 +52,78 @@ "style":{ "navigationBarTitleText":"注册" } - }], + },{ + "path":"pages/uni-feedback/uni-feedback", + "style":{ + "navigationBarTitleText":"问题反馈" + } + } ,{ + "path" : "pages/about/about", + "style" : + { + "navigationBarTitleText": "关于" + } + + },{ + "path" : "pages/agree-list/agree-list", + "style" : + { + "navigationBarTitleText": "政策与协议" + } + + } + ,{ + "path" : "pages/agree-list/privacy/privacy", + "style" : + { + "navigationBarTitleText": "隐私政策" + } + + } + ,{ + "path" : "pages/agree-list/service/service", + "style" : + { + "navigationBarTitleText": "服务协议" + } + + },{ + "path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup", + "style": { + "disableScroll": true, + "app-plus": { + "backgroundColorTop": "transparent", + "background": "transparent", + "titleNView": false, + "scrollIndicator": false, + "popGesture": "none", + "animationType": "fade-in", + "animationDuration": 200 + + } + } + } + ,{ + "path" : "pages/settings/settings", + "style" : + { + "navigationBarTitleText": "设置" + } + + } + ,{ + "path" : "pages/ucenter/edit/edit", + "style" : + { + "navigationBarTitleText": "编辑资料" + } + },{ + "path":"pages/ucenter/edit/uploadCutImageToUnicloud", + "style":{ + "navigationStyle":"custom" + } + } + ], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "base-app", diff --git a/pages/about/about.vue b/pages/about/about.vue new file mode 100644 index 0000000000000000000000000000000000000000..5436278d5d67f6b4cd300c5291c543d4b361dafc --- /dev/null +++ b/pages/about/about.vue @@ -0,0 +1,217 @@ + + + + + diff --git a/pages/agree-list/agree-list.nvue b/pages/agree-list/agree-list.nvue new file mode 100644 index 0000000000000000000000000000000000000000..591eeb347e104a5ca0f0585d9ee0ca597e232083 --- /dev/null +++ b/pages/agree-list/agree-list.nvue @@ -0,0 +1,36 @@ + + + + + diff --git a/pages/agree-list/privacy/privacy.vue b/pages/agree-list/privacy/privacy.vue new file mode 100644 index 0000000000000000000000000000000000000000..544b5329325246dc847316ccd0cc71db4701d837 --- /dev/null +++ b/pages/agree-list/privacy/privacy.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/agree-list/service/service.vue b/pages/agree-list/service/service.vue new file mode 100644 index 0000000000000000000000000000000000000000..665729b11093e9332f8557f6c08d76901a9f937c --- /dev/null +++ b/pages/agree-list/service/service.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/login/login.vue b/pages/login/login.vue index 6c516c7139a95975a5241204b75702a3a6a5b1c7..4273ef928d2c5fc631dc80d5260a16219de1bb8c 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -48,8 +48,10 @@ - 暂无法使用苹果登录,请查阅   - Apple登录集成教程 + 登录/注册即表示您同意 + 隐私政策 + + 服务协议 @@ -122,6 +124,16 @@ login:'user/login', logout:'user/logout' }), + toPrivacy(){ + uni.navigateTo({ + url:'/pages/agree-list/privacy/privacy' + }) + }, + toService(){ + uni.navigateTo({ + url:'/pages/agree-list/service/service' + }) + }, initProvider() { const filters = ['weixin', 'qq', 'sinaweibo', 'univerify']; uni.getProvider({ diff --git a/pages/settings/settings.nvue b/pages/settings/settings.nvue new file mode 100644 index 0000000000000000000000000000000000000000..6483f3e24198a7ba3e440d493e54aad877df7a28 --- /dev/null +++ b/pages/settings/settings.nvue @@ -0,0 +1,93 @@ + + + + + diff --git a/pages/ucenter/edit/edit.nvue b/pages/ucenter/edit/edit.nvue new file mode 100644 index 0000000000000000000000000000000000000000..57ae647195142da18634a82344998c6e510dcbe4 --- /dev/null +++ b/pages/ucenter/edit/edit.nvue @@ -0,0 +1,100 @@ + + + + + diff --git a/pages/ucenter/edit/limeClipper/images/photo.svg b/pages/ucenter/edit/limeClipper/images/photo.svg new file mode 100644 index 0000000000000000000000000000000000000000..7b4b59058376794d6e6a78035f627678102f96ad --- /dev/null +++ b/pages/ucenter/edit/limeClipper/images/photo.svg @@ -0,0 +1,19 @@ + + + + + + + + + diff --git a/pages/ucenter/edit/limeClipper/images/rotate.svg b/pages/ucenter/edit/limeClipper/images/rotate.svg new file mode 100644 index 0000000000000000000000000000000000000000..0143706ca7adea484ed38339980c2cc23559595e --- /dev/null +++ b/pages/ucenter/edit/limeClipper/images/rotate.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/pages/ucenter/edit/limeClipper/index.styl b/pages/ucenter/edit/limeClipper/index.styl new file mode 100644 index 0000000000000000000000000000000000000000..8168258f1d1b06f87bb4932a7732984de8850656 --- /dev/null +++ b/pages/ucenter/edit/limeClipper/index.styl @@ -0,0 +1,134 @@ +$edge-border-width = 6rpx +.flex-auto + flex auto +.bg-transparent + background-color rgba(0, 0, 0, 0.9) + transition-duration 0.35s +.l-clipper + width 100vw + height calc( 100vh - var(--window-top)) + background-color rgba(0, 0, 0, 0.9) + position fixed + top var(--window-top) + left 0 + z-index 1 + &-mask + position relative + z-index 2 + pointer-events: none + &__content + pointer-events: none; + position absolute + border 1rpx solid rgba(255,255,255,.3) + box-sizing border-box + box-shadow: rgba(0, 0, 0, 0.5) 0 0 0 80vh; + background: transparent; + &::before,&::after + content '' + position absolute + border 1rpx dashed rgba(255,255,255,.3) + &::before + width 100% + top 33.33% + height 33.33% + border-left none + border-right none + &::after + width 33.33% + left 33.33% + height 100% + border-top none + border-bottom none + &__edge + position absolute + // left 6rpx + width 34rpx + height 34rpx + border $edge-border-width solid #ffffff + pointer-events auto + &::before + content '' + position absolute + width 40rpx + height 40rpx + background-color transparent + &:nth-child(1) + left: - $edge-border-width + top: - $edge-border-width + border-bottom-width 0 !important + border-right-width 0 !important + &:before + top -50% + left -50% + &:nth-child(2) + right: - $edge-border-width + top: - $edge-border-width + border-bottom-width 0 !important + border-left-width 0 !important + &:before + top -50% + left 50% + &:nth-child(3) + left: - $edge-border-width + bottom: - $edge-border-width + border-top-width 0 !important + border-right-width 0 !important + &:before + bottom -50% + left -50% + &:nth-child(4) + right: - $edge-border-width + bottom: - $edge-border-width + border-top-width 0 !important + border-left-width 0 !important + &:before + bottom -50% + left 50% + &-image + width 100% + border-style none + position absolute + top 0 + left 0 + z-index 1 + -webkit-backface-visibility hidden + backface-visibility hidden + transform-origin center + &-canvas + position fixed + z-index 10 + left -200vw + top -200vw + pointer-events none + &-tools + position fixed + left 0 + bottom 10px + width 100% + z-index 99 + color #fff + &__btns + font-weight bold + display flex + align-items center + justify-content space-between + width 100% + padding 20rpx 40rpx + box-sizing border-box + .cancel + width 112rpx + height 60rpx + text-align center + line-height 60rpx + .confirm + width 112rpx + height 60rpx + line-height 60rpx + background-color #07c160 + border-radius 6rpx + text-align center + image + display block + width 60rpx + height 60rpx + diff --git a/pages/ucenter/edit/limeClipper/limeClipper.vue b/pages/ucenter/edit/limeClipper/limeClipper.vue new file mode 100644 index 0000000000000000000000000000000000000000..5eb630d430afc46a18cca7a9e92f067dbc01914d --- /dev/null +++ b/pages/ucenter/edit/limeClipper/limeClipper.vue @@ -0,0 +1,694 @@ + + + + + diff --git a/pages/ucenter/edit/limeClipper/utils.js b/pages/ucenter/edit/limeClipper/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..39f07cfffc313b9f174f475cb01bfa36f5440594 --- /dev/null +++ b/pages/ucenter/edit/limeClipper/utils.js @@ -0,0 +1,280 @@ + +/** + * h5网络地址转base64 + */ +export function pathToBase64(path) { + // #ifdef H5 + return new Promise((resolve, reject) => { + const _fileReader = (blob) => { + const fileReader = new FileReader(); + fileReader.onload = (e) => { + resolve(e.target.result); + }; + fileReader.readAsDataURL(blob); + fileReader.onerror = (error) => { + console.error('blobToBase64 error:', JSON.stringify(error)) + reject(new Error('blobToBase64 error')); + }; + } + if (/^(http|\/\/)/.test(path) && typeof FileReader === 'function') { + window.URL = window.URL || window.webkitURL; + const xhr = new XMLHttpRequest(); + xhr.open("get", path, true); + xhr.timeout = 2000; + xhr.responseType = "blob"; + xhr.onload = function() { + if (this.status == 200) { + _fileReader(this.response) + } + } + xhr.send(); + } + }) + // #endif +} + +/** + * 判断手指触摸位置 + */ +export function determineDirection(cutX, cutY, clipWidth, clipHeight, currentX, currentY) { + const EXPAND_SIZE = 24; + + let leftx1 = cutX - EXPAND_SIZE; + let leftx2 = cutX + EXPAND_SIZE; + + let topy1 = cutY - EXPAND_SIZE; + let topy2 = cutY + EXPAND_SIZE; + + let rightx1 = cutX + clipWidth - EXPAND_SIZE; + let rightx2 = cutX + clipWidth + EXPAND_SIZE; + + let bottomy1 = cutY + clipHeight - EXPAND_SIZE; + let bottomy2 = cutY + clipHeight + EXPAND_SIZE; + let corner; + const isRight = currentX > rightx1 && currentX < rightx2; + const isLeft = currentX > leftx1 && currentX < leftx2; + const isBottom = currentY > bottomy1 && currentY < bottomy2; + const isTop = currentY > topy1 && currentY < topy2; + if (isRight && isBottom) { + corner = 1; + } else if (isRight && isTop) { + corner = 2; + } else if (isLeft && isTop) { + corner = 3; + } else if (isLeft && isBottom) { + corner = 4; + } + return corner; +} + +/** + * 图片边缘检测检测时,计算图片偏移量 + */ +export function calcImageOffset(data, scale) { + let { + imageLeft: left, + imageTop: top, + imageWidth, + imageHeight, + cutX, + clipWidth, + cutY, + clipHeight + } = data + scale = scale || data.scale; + if ((data.angle / 90) % 2) { + imageWidth = mageHeight; + imageHeight = mageWidth; + } + + // 当前图片宽度/高度 + const currentImageSize = (size) => (size * scale) / 2; + const currentImageWidth = currentImageSize(imageWidth); + const currentImageHeight = currentImageSize(imageHeight); + + left = cutX + currentImageWidth >= left ? left : cutX + currentImageWidth; + left = cutX + clipWidth - currentImageWidth <= left ? left : cutX + clipWidth - currentImageWidth; + top = cutY + currentImageHeight >= top ? top : cutY + currentImageHeight; + top = cutY + clipHeight - currentImageHeight <= top ? top : cutY + clipHeight - currentImageHeight; + return { + left, + top, + scale + }; +} + +/** + * 图片边缘检测时,计算图片缩放比例 + */ +export function calcImageScale(data, scale) { + scale = scale || data.scale; + let { + imageWidth, + imageHeight, + clipWidth, + clipHeight, + angle + } = data + if ((angle / 90) % 2) { + imageWidth = imageHeight; + imageHeight = imageWidth; + } + if (imageWidth * scale < clipWidth) { + scale = clipWidth / imageWidth; + } + if (imageHeight * scale < clipHeight) { + scale = Math.max(scale, clipHeight / imageHeight); + } + return scale; +} + +/** + * 计算图片尺寸 + */ +export function calcImageSize(width, height, data) { + let imageWidth = width, + imageHeight = height; + let { + clipWidth, + clipHeight, + sysinfo, + width: oWidth, + height: oHeight + } = data + if (imageWidth && imageHeight) { + if (imageWidth / imageHeight > (clipWidth || oWidth) / (clipWidth || oHeight)) { + imageHeight = clipHeight || oHeight; + imageWidth = (width / height) * imageHeight; + } else { + imageWidth = clipWidth || oWidth; + imageHeight = (height / width) * imageWidth; + } + } else { + let sys = sysinfo || uni.getSystemInfoSync(); + imageWidth = sys.windowWidth; + imageHeight = 0; + } + return { + imageWidth, + imageHeight + }; +} + +/** + * 勾股定理求斜边 + */ +export function calcPythagoreanTheorem(width, height) { + return Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); +} + +/** + * 拖动裁剪框时计算 + */ +export function clipTouchMoveOfCalculate(data, event) { + const clientX = event.touches[0].clientX; + const clientY = event.touches[0].clientY; + + const { + clipWidth, + clipHeight, + cutY: oldCutY, + cutX: oldCutX, + cutstart, + isLockRatio + } = data; + let { + maxWidth, + minWidth, + maxHeight, + minHeight + } = data; + maxWidth = maxWidth / 2; + minWidth = minWidth / 2; + minHeight = minHeight / 2; + maxHeight = maxHeight / 2; + + let width = clipWidth, + height = clipHeight, + cutY = oldCutY, + cutX = oldCutX, + sizecorrect = () => { + width = width <= maxWidth ? (width >= minWidth ? width : minWidth) : maxWidth; + height = height <= maxHeight ? (height >= minHeight ? height : minHeight) : maxHeight; + }, + sizeinspect = () => { + sizecorrect(); + if ((width > maxWidth || width < minWidth || height > maxHeight || height < minHeight) && isLockRatio) { + return false; + } else { + return true; + } + }; + if (cutstart.corner) { + height = cutstart.height + (cutstart.corner > 1 && cutstart.corner < 4 ? 1 : -1) * (cutstart.y - clientY); + } + switch (cutstart.corner) { + case 1: + width = cutstart.width - cutstart.x + clientX; + if (isLockRatio) { + height = width / (clipWidth / clipHeight); + } + if (!sizeinspect()) return; + break; + case 2: + width = cutstart.width - cutstart.x + clientX; + if (isLockRatio) { + height = width / (clipWidth / clipHeight); + } + if (!sizeinspect()) { + return; + } else { + cutY = cutstart.cutY - (height - cutstart.height); + } + + break; + case 3: + width = cutstart.width + cutstart.x - clientX; + if (isLockRatio) { + height = width / (clipWidth / clipHeight); + } + if (!sizeinspect()) { + return; + } else { + cutY = cutstart.cutY - (height - cutstart.height); + cutX = cutstart.cutX - (width - cutstart.width); + } + + break; + case 4: + width = cutstart.width + cutstart.x - clientX; + if (isLockRatio) { + height = width / (clipWidth / clipHeight); + } + if (!sizeinspect()) { + return; + } else { + cutX = cutstart.cutX - (width - cutstart.width); + } + break; + default: + break; + } + return { + width, + height, + cutX, + cutY + }; +} + +/** + * 单指拖动图片计算偏移 + */ +export function imageTouchMoveOfCalcOffset(data, clientXForLeft, clientYForLeft) { + let left = clientXForLeft - data.touchRelative[0].x, + top = clientYForLeft - data.touchRelative[0].y; + return { + left, + top + }; +} diff --git a/pages/ucenter/edit/main.js b/pages/ucenter/edit/main.js new file mode 100644 index 0000000000000000000000000000000000000000..30c951a6bd42c95733220ffdb5b9275ca5367d18 --- /dev/null +++ b/pages/ucenter/edit/main.js @@ -0,0 +1,19 @@ +export default (callback,options)=>{ + options = options||{"width":600,"height":600}; + uni.chooseImage({ + sizeType:['original'], + count:1, + ...options, + complete:({tempFiles:[{path}]})=> { + uni.navigateTo({ + url:'/common/uploadCutImageToUnicloud/uploadCutImageToUnicloud?path='+path+"&options="+JSON.stringify(options), + animationType:'fade-in', + events:{ + url(url){ + callback(url) + } + } + }) + } + }) +} \ No newline at end of file diff --git a/pages/ucenter/edit/uploadCutImageToUnicloud.vue b/pages/ucenter/edit/uploadCutImageToUnicloud.vue new file mode 100644 index 0000000000000000000000000000000000000000..9a94d3a56864ceee9ea448ee0360a39a88caa5c9 --- /dev/null +++ b/pages/ucenter/edit/uploadCutImageToUnicloud.vue @@ -0,0 +1,58 @@ + + + + \ No newline at end of file diff --git a/pages/ucenter/ucenter.nvue b/pages/ucenter/ucenter.nvue index 2f098c250ebd112cd62c09c1e04ded7fee716bbb..d09f27bc867e245bbc3ba450ee2a74636cf922e0 100644 --- a/pages/ucenter/ucenter.nvue +++ b/pages/ucenter/ucenter.nvue @@ -1,7 +1,7 @@