UNPKG

fastlion-amis

Version:

一种MIS页面生成工具

97 lines (96 loc) 4.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LionScanCodeRenderer = exports.LionScanCode = void 0; var tslib_1 = require("tslib"); var react_1 = (0, tslib_1.__importDefault)(require("react")); var factory_1 = require("../../../../factory"); var msgsub_1 = (0, tslib_1.__importDefault)(require("../../utils/msgsub")); var index_1 = require("../../../../utils/shell/index"); var index_2 = require("../../../../index"); var LionScanCode = /** @class */ (function (_super) { (0, tslib_1.__extends)(LionScanCode, _super); function LionScanCode() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.handleOpenCamera = function () { index_1.Shell.getScanCode().then(function (res) { var _a, _b, _c, _d, _e; var _f = _this.props, render = _f.render, title = _f.title; if (res.success) { var content = res.data.content; if (content.includes('.weixin.qq.com')) { msgsub_1.default._info('请用微信扫码', (_a = _this.props.env) === null || _a === void 0 ? void 0 : _a.getModalContainer); } else if (content.includes('qr_type') && content.includes('qr_key')) { // 页面数据分享 // FLRule.toShareView(content); msgsub_1.default._success(content, (_b = _this.props.env) === null || _b === void 0 ? void 0 : _b.getModalContainer); } else if (typeof content === 'string' && (content === null || content === void 0 ? void 0 : content.length) === 5) { // 终端互联连接 // this.connect(content); msgsub_1.default._success(content, (_c = _this.props.env) === null || _c === void 0 ? void 0 : _c.getModalContainer); } else { msgsub_1.default._success(content, (_d = _this.props.env) === null || _d === void 0 ? void 0 : _d.getModalContainer); } } else { msgsub_1.default._info(res === null || res === void 0 ? void 0 : res.msg, (_e = _this.props.env) === null || _e === void 0 ? void 0 : _e.getModalContainer); } }); }; return _this; } // private openCamera = () => { // Shell.openCamera(1).then(res => { // if (res.success === true) { // console.log('camera', res) // let waitUploadList = handleTempFiles(res.data.tempFiles, 'needUpload'); // console.log('waitUploadList', waitUploadList) // Shell.uploadFile({ // path: waitUploadList[0].sourceFileUrl, // url: this.props.url, // chunkUpload: false, // formData: { // } // }, (info) => { // console.log('info', info) // }, (res) => { // console.log('res', res) // }, (fail) => { // console.log('fail', fail) // }) // this.setState({ // waitUploadList: [...this.state.waitUploadList, ...waitUploadList] // }) // } // }) // } LionScanCode.prototype.render = function () { var title = this.props.title; // 自定义你的代码逻辑 return (0, index_2.render)({ "type": "action", "label": title, "level": "primary", "onAction": this.handleOpenCamera }); }; LionScanCode.defaultProps = {}; return LionScanCode; }(react_1.default.Component)); exports.LionScanCode = LionScanCode; var LionScanCodeRenderer = /** @class */ (function (_super) { (0, tslib_1.__extends)(LionScanCodeRenderer, _super); function LionScanCodeRenderer() { return _super !== null && _super.apply(this, arguments) || this; } LionScanCodeRenderer = (0, tslib_1.__decorate)([ (0, factory_1.Renderer)({ type: 'lion-scan-code' }) ], LionScanCodeRenderer); return LionScanCodeRenderer; }(LionScanCode)); exports.LionScanCodeRenderer = LionScanCodeRenderer; //# sourceMappingURL=./renderers/Lion/components/LionScanCode/index.js.map