Files
SkinCamera/unpackage/dist/dev/.uvue/app-android/pages/index/index.uvue
T
2026-03-13 13:28:03 +08:00

72 lines
2.8 KiB
Plaintext

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(SkinCameraComponent.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 { SkinCameraComponent } from '@/uni_modules/Skin-cameraUTS?uts-proxy';
//# sourceMappingURL=index.uvue.map