yangteng 1年前
コミット
f08ee8a4ed
2個のファイルの変更58行の追加7行の削除
  1. 55
    4
      components/viewfinder.vue
  2. 3
    3
      pages/index/index.vue

+ 55
- 4
components/viewfinder.vue ファイルの表示

@@ -161,6 +161,60 @@
}

function takePhoto() {
// #ifdef MP-ALIPAY
const appAuthorizeSetting = my.getAppAuthorizeSetting();
console.log("---",appAuthorizeSetting,appAuthorizeSetting['cameraAuthorized']);
if(appAuthorizeSetting['cameraAuthorized']=='authorized'){
if (prop.showStartPhoto) {
let cameraContext = null
// #ifdef MP-WEIXIN
cameraContext = uni.createCameraContext();
// #endif
// #ifdef MP-ALIPAY
cameraContext = uni.createCameraContext('camera');
// #endif
// 调用拍照方法
cameraContext.takePhoto({
quality: 'normal',
success: (res : any) => {
// 在这里处理拍照成功后的逻辑,res.tempImagePath 为拍照的图片路径
// srcImg.value = res.tempImagePath
startPhoto.value = false
cameraContext.stopRecord();
emit('confirmReturn', res)
// getViewPosition(res.tempImagePath)
return
},
fail: (error) => {
console.error('拍照失败:', error);
emit('failReturn', error);
},
});
} else {
rotateDegree.value += 90
}
}else{
uni.showModal({
title: '提示',
content: '请打开摄像头权限',
success: function (res) {
if (res.confirm) {
uni.openSetting({
success(res) {
console.log("2222")
console.log(res.authSetting)
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
// #endif
// #ifdef MP-WEIXIN
uni.authorize({
scope: 'scope.camera',
complete(res) {
@@ -187,7 +241,6 @@
emit('confirmReturn', res)
// getViewPosition(res.tempImagePath)
return
// console.log('拍照成功:', res.tempImagePath);
},
fail: (error) => {
console.error('拍照失败:', error);
@@ -217,9 +270,7 @@
}
}
})

// console.log('输出内容', '===123')
// #endif

}


+ 3
- 3
pages/index/index.vue ファイルの表示

@@ -4,19 +4,19 @@
<view class="top_title">畅行高速·全国通行95折</view>
<view class="top_bg nav">
<view class="item-box"
@click="$util.navTo('/subpackage/after-sale/activation-once-again/select-car',true)">
@click="showMask(1)">
<view class="item">
<image :src="fileURL + 'image/yxb/yxb6.png'" mode="aspectFill" />
</view>
<view class="text">客车ETC</view>
</view>
<view class="item-box"
<!-- <view class="item-box"
@click="$util.navTo('/subpackage/after-sale/activation-once-again/select-car',true)">
<view class="item ">
<image :src="fileURL + 'image/yxb/yxb7.png'" mode="aspectFill" />
</view>
<view class="text">OBU重新激活</view>
</view>
</view> -->
<view class="item-box"
@click="$util.navTo('/subpackage/personal-center/install-activation-order',true)">
<view class="item">

読み込み中…
キャンセル
保存