success
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
|
||||
import {
|
||||
takePhoto,
|
||||
TakePhotoOption,
|
||||
TakePhotoSuccessCallbackResult,
|
||||
GeneralCallbackResult
|
||||
} from '@/uni_modules/Skin-cameraUTS'
|
||||
|
||||
|
||||
const __sfc__ = defineComponent({
|
||||
data() {
|
||||
return {
|
||||
yanse: "red",
|
||||
widthNum: 750,
|
||||
heightNum: 200,
|
||||
|
||||
flash: "on",
|
||||
device: "front",
|
||||
imagePath: "",
|
||||
videoPath: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// let permissionNeed = ["android.permission.CAMERA", "android.permission.RECORD_AUDIO",
|
||||
// "android.permission.WRITE_EXTERNAL_STORAGE"]
|
||||
// // 请求权限
|
||||
// UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
|
||||
// if (allRight) {
|
||||
// // 权限请求成功
|
||||
// } else {
|
||||
// //用户拒绝了部分权限
|
||||
// }
|
||||
// }, function (_ : boolean, _ : string[]) {
|
||||
// //用户拒绝了部分权限
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
onError(res : any) {
|
||||
console.log(res, " at pages/index/index.uvue:54")
|
||||
},
|
||||
_takePhoto() {
|
||||
takePhoto({
|
||||
success: (res : TakePhotoSuccessCallbackResult) => {
|
||||
console.log('takePhoto', res, " at pages/index/index.uvue:59")
|
||||
this.imagePath = res.tempImagePath;
|
||||
// _previewImage();
|
||||
},
|
||||
fail: (res : GeneralCallbackResult) => {
|
||||
console.log('takePhoto', res, " at pages/index/index.uvue:64")
|
||||
}
|
||||
} as TakePhotoOption)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
export default __sfc__
|
||||
function GenPagesIndexIndexRender(this: InstanceType<typeof __sfc__>): any | null {
|
||||
const _ctx = this
|
||||
const _cache = this.$.renderCache
|
||||
return _cE("scroll-view", _uM({ class: "page-scroll-view" }), [
|
||||
_cE("view", null, [
|
||||
_cE("button", _uM({ onClick: _ctx._takePhoto }), "拍照", 8 /* PROPS */, ["onClick"]),
|
||||
_cE(XfCameraComponent.name, _uM({
|
||||
style: _nS(_uM({"height":"750rpx","background-color":"red"})),
|
||||
onError: _ctx.onError,
|
||||
flash: _ctx.flash,
|
||||
position: _ctx.device
|
||||
}), null, 44 /* STYLE, PROPS, NEED_HYDRATION */, ["onError", "flash", "position"]),
|
||||
isTrue(_ctx.imagePath)
|
||||
? _cE("image", _uM({
|
||||
key: 0,
|
||||
mode: "aspectFit",
|
||||
src: _ctx.imagePath
|
||||
}), null, 8 /* PROPS */, ["src"])
|
||||
: _cC("v-if", true)
|
||||
])
|
||||
])
|
||||
}
|
||||
const GenPagesIndexIndexStyles = [_uM([["video", _pS(_uM([["width", "100%"], ["height", 200]]))]])]
|
||||
|
||||
import { XfCameraComponent } from '@/uni_modules/Skin-cameraUTS?uts-proxy'
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user