wangfukang 3 years ago
parent
commit
ef8e54dd7c
  1. 102
      package1/AI/AIInventoryList.vue
  2. 120
      package1/AI/AIPicture.vue
  3. 2660
      package1/AI/voiceInventory.vue

102
package1/AI/AIInventoryList.vue

@ -21,13 +21,36 @@
</view> </view>
<view class="ai-bot"></view> <view class="ai-bot"></view>
</view> </view>
</view>
<view class="banner">
<view class="banner-left" @tap="goAiPicture('pai')">
<view class="bottom-box">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/da77271d34b14b13827543389948802d.jpg"
alt="" style="width: 100%;height: 100%;">
</view>
<view class="banner-text">
<view style='font-weight: 800;'>AI图片识别</view>
<view style='font-size:22rpx;'>识别图片进行入库</view>
</view>
</view>
<view class="banner-right" @tap='goAiPicture'>
<view class="bottom-box">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png"
alt="" style="width: 100%;height: 100%;animation: none;">
</view>
<view class="banner-text">
<view style='font-weight: 800;'>AI语音识别</view>
<view style='font-size:22rpx;'>语音录入进行开单</view>
</view>
</view>
</view> </view>
<view class="content"> <view class="content">
<view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;position: relative;"> <view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;position: relative;">
入库列表 入库列表
<view @tap="goAiPicture" style="position: absolute;top: 0;right: 20rpx;"> <!-- <view @tap="goAiPicture" style="position: absolute;top: 0;right: 20rpx;">
<uni-icons type="plusempty" size="26"></uni-icons> <uni-icons type="plusempty" size="26"></uni-icons>
</view> </view> -->
</view> </view>
<view class="content-list" v-for="(item,index) in aiList" :key="index"> <view class="content-list" v-for="(item,index) in aiList" :key="index">
<view class="image-box"> <view class="image-box">
@ -170,10 +193,17 @@
url: '/pages/inventory/AIInventory' url: '/pages/inventory/AIInventory'
}) })
}, },
goAiPicture(){ goAiPicture(type){
uni.navigateTo({ if(type == 'pai'){
url: '/package1/AI/AIPicture' uni.navigateTo({
}) url: '/package1/AI/AIPicture'
})
}else{
uni.navigateTo({
url: '/package1/AI/voiceInventory'
})
}
}, },
//删除单条入库单 //删除单条入库单
delItem(id){ delItem(id){
@ -398,5 +428,65 @@
position: absolute; position: absolute;
top: 59rpx; top: 59rpx;
left: 40rpx; 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;
} }
</style> </style>

120
package1/AI/AIPicture.vue

@ -165,7 +165,18 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<view v-if="isTake" style="position: fixed;width: 100%;height: 100%;z-index: 100;top: 0;">
<camera device-position="back" flash="off" style="width: 100%; height: 100%;"></camera>
<view style="width: 100%;height: 120rpx;position: fixed;bottom:200rpx;">
<view @tap="takePhoto" style="width: 120rpx;height: 120rpx;border-radius: 120rpx;background: #fff;margin: 0 auto;border: 2px solid #eee;">
<view style="width: 116rpx;height: 116rpx;border-radius: 116rpx;background: #fff;margin: 0 auto;border: 1px solid #fff;"></view>
</view>
<view @tap="isTake = false" style="position: absolute;top: 20rpx;left: 100rpx;">
<uni-icons type="close" color="#777" size="40"></uni-icons>
</view>
</view>
</view>
</view> </view>
</template> </template>
@ -193,7 +204,8 @@
size:"", size:"",
keyBoardHeight:0, keyBoardHeight:0,
name:'', name:'',
nameText:'' nameText:'',
isTake:false
} }
}, },
onShow() { onShow() {
@ -369,15 +381,15 @@
let that = this; let that = this;
uni.getSystemInfo({ uni.getSystemInfo({
success: function (res) { success: function (res) {
if(res.osName == 'ios'){ // if(res.osName == 'ios'){
that.upLoadImg('ios') // that.upLoadImg('ios')
}else if(res.osName == 'android'){ // }else if(res.osName == 'android'){
that.$refs.popup.open('bottom') that.$refs.popup.open('bottom')
} // }
} }
}); });
}, },
upLoadImg(type) { async upLoadImg(type) {
uni.showLoading({ uni.showLoading({
title: '加载中...', title: '加载中...',
mask:true mask:true
@ -396,28 +408,42 @@
} }
}) })
}else if(type == 'pai'){ }else if(type == 'pai'){
uni.chooseMedia({ uni.authorize({
count: 1, scope: 'scope.writePhotosAlbum',
mediaType: ['image'], success() {
sourceType: ['camera'], that.isTake = true
camera: 'back', uni.hideLoading();
success(res) { },fail(){
console.log('拍照',res) that.tui.toast("您未授权,AI入库功能可能会出现错误")
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() {
// 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'){ }else if(type == 'xuan'){
uni.chooseMedia({ uni.chooseMedia({
count: 1, count: 1,
@ -430,9 +456,47 @@
} }
}) })
} }
this.$refs.popup.close() await this.$refs.popup.close()
// uni.hideLoading(); // 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){ async upLoadFile(path){
let that = this; let that = this;
uni.showLoading({ uni.showLoading({

2660
package1/AI/voiceInventory.vue

File diff suppressed because it is too large
Loading…
Cancel
Save