diff --git a/package1/AI/AIInventoryList.vue b/package1/AI/AIInventoryList.vue index 7793c87..ac5a40c 100644 --- a/package1/AI/AIInventoryList.vue +++ b/package1/AI/AIInventoryList.vue @@ -21,13 +21,36 @@ + + 入库列表 - + @@ -170,10 +193,17 @@ url: '/pages/inventory/AIInventory' }) }, - goAiPicture(){ - uni.navigateTo({ - url: '/package1/AI/AIPicture' - }) + goAiPicture(type){ + if(type == 'pai'){ + uni.navigateTo({ + url: '/package1/AI/AIPicture' + }) + }else{ + uni.navigateTo({ + url: '/package1/AI/voiceInventory' + }) + } + }, //删除单条入库单 delItem(id){ @@ -398,5 +428,65 @@ position: absolute; top: 59rpx; left: 40rpx; + } + .bottom-box { + background: rgba(255, 255, 255, 0.3); + width: 100rpx; + height: 100rpx; + border-radius: 10px; + margin: 25rpx; + position: relative; + font-size: 60rpx; + color: #fff; + font-weight: 800; + text-align: center; + line-height: 100rpx; + background: #fff; + overflow: hidden; + float: left; + + img { + width: 100%; + height: 100%; + border-radius: 10px; + /* background: #fff; */ + // margin-top: -16rpx; + animation: jump 1.5s infinite; + } + + @keyframes jump { + 0% { + margin-top: 0; + } + + 50% { + margin-top: -15rpx; + } + + 100% { + margin-top: 0; + } + } + } + .banner { + height: 150rpx; + display: flex; + margin-top: 20rpx; + } + + .banner-left, + .banner-right { + width: 49%; + margin-left: 1%; + margin-right: 2%; + background: linear-gradient(126.07deg, rgba(100, 132, 250, 1) 0%, rgba(102, 232, 255, 1) 100%); + border-radius: 10px; + } + + .banner-text { + margin-top: 20rpx; + line-height: 60rpx; + font-size: 36rpx; + color: #fff; } \ No newline at end of file diff --git a/package1/AI/AIPicture.vue b/package1/AI/AIPicture.vue index 8fc647a..853f4ae 100644 --- a/package1/AI/AIPicture.vue +++ b/package1/AI/AIPicture.vue @@ -165,7 +165,18 @@ - + + + + + + + + + + + + @@ -193,7 +204,8 @@ size:"", keyBoardHeight:0, name:'', - nameText:'' + nameText:'', + isTake:false } }, onShow() { @@ -369,15 +381,15 @@ let that = this; uni.getSystemInfo({ success: function (res) { - if(res.osName == 'ios'){ - that.upLoadImg('ios') - }else if(res.osName == 'android'){ + // if(res.osName == 'ios'){ + // that.upLoadImg('ios') + // }else if(res.osName == 'android'){ that.$refs.popup.open('bottom') - } + // } } }); }, - upLoadImg(type) { + async upLoadImg(type) { uni.showLoading({ title: '加载中...', mask:true @@ -396,28 +408,42 @@ } }) }else if(type == 'pai'){ - uni.chooseMedia({ - count: 1, - mediaType: ['image'], - sourceType: ['camera'], - camera: 'back', - success(res) { - console.log('拍照',res) - setTimeout(res=>{ - uni.chooseMedia({ - count: 1, - mediaType: ['image'], - sourceType: ['album'], - success(res1) { - console.log('选图',res1) - that.upLoadFile(res1.tempFiles[0].tempFilePath) - } - }) - },1000) - },fail(){ - uni.hideLoading(); + uni.authorize({ + scope: 'scope.writePhotosAlbum', + success() { + that.isTake = true + uni.hideLoading(); + },fail(){ + that.tui.toast("您未授权,AI入库功能可能会出现错误") } }) + + // uni.authorize({ + // scope: 'scope.writePhotosAlbum', + // success() { + // uni.chooseMedia({ + // count: 1, + // mediaType: ['image'], + // sourceType: ['camera'], + // sizeType:['original', 'compressed'], + // camera: 'back', + // success(res) { + // console.log('拍照成功',res) + // uni.saveImageToPhotosAlbum({ + // filePath: res.tempFiles[0].tempFilePath, + // success: function () { + // that.cameraUpload() + // } + // }); + // },fail(err){ + // console.log('错误',err) + // uni.hideLoading(); + // } + // }) + // },fail(){ + // that.tui.toast("您未授权,AI入库功能可能会出现错误") + // } + // }) }else if(type == 'xuan'){ uni.chooseMedia({ count: 1, @@ -430,9 +456,47 @@ } }) } - this.$refs.popup.close() + await this.$refs.popup.close() // uni.hideLoading(); }, + async takePhoto(){ + let that = this; + const ctx = uni.createCameraContext(); + await ctx.takePhoto({ + quality: 'high', + success: (res) => { + let ttt = that + uni.saveImageToPhotosAlbum({ + filePath: res.tempImagePath, + success: function () { + ttt.cameraUpload() + } + }); + },fail(err){ + console.log('原相机',err) + that.isTake = false + } + }); + + }, + cameraUpload(){ + let that = this; + uni.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['album'], + success(res1) { + that.isTake = false + console.log('选图',res1) + that.upLoadFile(res1.tempFiles[0].tempFilePath) + },fail(){ + that.isTake = false + uni.hideLoading(); + },complete(res){ + console.log('拍照',res) + } + }) + }, async upLoadFile(path){ let that = this; uni.showLoading({ diff --git a/package1/AI/voiceInventory.vue b/package1/AI/voiceInventory.vue new file mode 100644 index 0000000..db2f56b --- /dev/null +++ b/package1/AI/voiceInventory.vue @@ -0,0 +1,2660 @@ + + + + + + \ No newline at end of file