123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- const app = getApp()
- Page({
- data: {
- // 是否显示信息
- showSystemInfo: false,
- //系统信息
- systemInfo: null,
- //系统信息字符串展示
- systemInfoStr: null,
- //是否是K8容器中运行的小程序
- isKEightDevice: false,
- /**
- * 初始化刷脸服务
- */
- //入参打印
- initObj: null,
- //结果
- initResult: null,
- //初始化入参
- initParams: {},
- /**
- * 调用1:N刷脸
- */
- //入参打印
- oneVNObj: null,
- //结果
- oneVNResult: null,
- //调用服务入参
- oneVNParams: {},
- //服务编码
- oneVNServiceCode: "",
- /**
- * 调用订阅授权服务
- */
- //入参打印
- authObj: null,
- //结果
- authResult: null,
- //调用服务入参
- authParams: {},
- //服务编码
- authServiceCode: "",
- /**
- * ampe通道调用参数
- */
- ampe_params: [
- {
- name: '隐藏导航栏(仅本次运⾏有效)',
- aromeCode: "",
- number: "I1",
- initParams: {
- "action": "deviceConfig",
- "event": "open",
- "params": {
- "deviceConfig": {
- "hideNavigationBar": 1
- }
- }
- }
- },
- {
- name: '开启导航栏(仅本次运⾏有效)',
- aromeCode: "",
- number: "I2",
- initParams: {
- "action": "deviceConfig",
- "event": "open",
- "params": {
- "deviceConfig": {
- "hideNavigationBar": 2
- }
- }
- }
- },
- {
- name: '隐藏通知栏(仅本次运⾏有效)',
- aromeCode: "",
- number: "I1",
- initParams: {
- "action": "deviceConfig",
- "event": "open",
- "params": {
- "deviceConfig": {
- "hideNotificationBar": 1
- }
- }
- }
- },
- {
- name: '开启通知栏(仅本次运⾏有效)',
- aromeCode: "",
- number: "I2",
- initParams: {
- "action": "deviceConfig",
- "event": "open",
- "params": {
- "deviceConfig": {
- "hideNotificationBar": 2
- }
- }
- }
- },
- {
- name: '关闭⼩程序',
- aromeCode: "",
- number: "I1",
- initParams: {
- "action": "deviceConfig",
- "event": "open",
- "params": {
- "deviceConfig": {
- "exitApplet": 1
- }
- }
- }
- },
- {
- name: "刷脸初始化请求",
- number: "A",
- aromeCode: "",
- initParams: {
- "action": "initFace",
- "event": "open",
- "taskId": "5",
- "params": {
- "serviceId": "",
- "query": "",
- "scope": ""
- }
- }
- },
- {
- name: '调用刷脸(老年食堂)',
- aromeCode: "",
- number: "H1",
- initParams: {
- "action": "doStorageFaceInfo",
- "params": {
- "appid": "2021003181682188",
- "orgOutId": "hanghuijingquTest3",
- "componentOutId": "day_label_sign_online",
- "isvPid": "2088721034139660"
- }
- // "params": {
- // "appId":"2021004147600083",
- // "orgOutId":"huanggangzhangzheshitang",
- // "componentOutId":"day_label_sign_online",
- // "isvPid":"2088741779695636"
- // }
- }
- },
- {
- name: '调用刷证/输证入库(老年食堂)',
- aromeCode: "",
- number: "H1",
- initParams: {
- "action": "doStorageFaceInfo",
- "params": {
- "uniqueId": "2021003181682188",
- "name": "刘琳琳",
- "certNo": "430822199903010465",
- "phone": "15674931071"
- }
- }
- },
- {
- name: '启动NFC轮询',
- aromeCode: "",
- number: "G1",
- initParams: {
- "action": "startCPUCardLoopRead",
- "params": {
- "intervalTime": "5000",
- }
- }
- },
- {
- name: '启动NFC轮询2',
- aromeCode: "",
- number: "G9",
- initParams: {
- "action": "startCPUCardLoopRead",
- "params": {
- "intervalTime": "5000",
- "isComeBackFailed": true
- }
- }
- },
- {
- name: '停止NFC轮询',
- aromeCode: "",
- number: "G2",
- initParams: {
- "action": "stopCPUCardLoopRead",
- }
- },
- {
- name: 'NFC监听',
- aromeCode: "CPUCardListener",
- number: "G3",
- initParams: {
- }
- },
- {
- name: '单次读取NFC',
- aromeCode: "",
- number: "G4",
- initParams: {
- "action": "readOnceCPUCardInfo",
- }
- },
- {
- name: '发送NFC-apdu命令',
- aromeCode: "",
- number: "G5",
- initParams: {
- "action": "sendCPUCardCommand",
- "params": {
- "commandApdu": "0084000008",
- "isPsamCommand": false,
- }
- }
- },
- {
- name: '启动蜂鸣器',
- aromeCode: "",
- number: "G6",
- initParams: {
- "action": "startBuzzer",
- "params": {
- "beep": "50",
- }
- }
- },
- {
- name: '冷复位',
- aromeCode: "",
- number: "G7",
- initParams: {
- "action": "psamCardColdReset",
- }
- },
- {
- name: 'CPU',
- aromeCode: "",
- number: "G8",
- initParams: {
- "action": "sendCPUCardApduCommands",
- "event": "open",
- "params": {
- "commandApdus": ["0084000008", "0084000008", "0084000008"],
- "type": "1",
- "slot": "1"
- }
- }
- },
- {
- name: '社保卡单次读取',
- aromeCode: "",
- number: "F1",
- initParams: {
- "action": "getSocialSecurityCardInfo",
- }
- },
- {
- name: '社保卡持续推送接受',
- aromeCode: "socialSecurityCardListener",
- number: "F2",
- initParams: {
- }
- },
- {
- name: '社保卡持续推送注册',
- aromeCode: "",
- number: "F1",
- initParams: {
- "action": "socialSecurityCardConfig",
- }
- },
- {
- name: "授权弹框",
- aromeCode: "",
- number: "Z1",
- initParams: {}
- },
- {
- name: "开始超时监听",
- aromeCode: "ampeStartOperationWatcher",
- number: "Z1",
- initParams: {}
- },
- {
- name: "超时监听",
- aromeCode: "ampeOperationTimeout",
- number: "Z1",
- initParams: {}
- },
- // {
- // name: "刷脸初始化请求",
- // number: "A",
- // aromeCode: "",
- // initParams: {
- // "action": "initFace",
- // "event": "open",
- // "taskId": "5",
- // "params": {
- // "serviceId": "",
- // "query": "",
- // "scope": ""
- // }
- // }
- // },
- {
- name: "刷脸请求1:1",
- number: "B1",
- aromeCode: "",
- initParams: {
- "action": "getFaceInfoPersonCard",
- "event": "open",
- "taskId": "7",
- "params": {
- "certName": "",
- "certNo": "",
- "certPhotoBase64Str": ""
- }
- }
- },
- {
- name: "刷脸请求1:N",
- number: "B2",
- aromeCode: "",
- initParams: {
- "action": "getFaceInfo",
- "event": "open",
- "taskId": "2"
- }
- },
- {
- name: "开启刷⼆维码(单次)",
- number: "C1",
- aromeCode: "",
- initParams: {
- "action": "getQRCode",
- "event": "open",
- "taskId": "1"
- }
- },
- {
- name: "二维码持续监听",
- aromeCode: "initQRListener",
- number: "Z1",
- initParams: {}
- },
- {
- name: "开启刷身份证(单次)",
- number: "D1",
- aromeCode: '',
- initParams: {
- "action": "getIDCardInfo",
- "event": "open",
- "taskId": "3",
- "params": {
- "infoType": "base,photo,other"
- }
- }
- },
- {
- name: "身份证持续监听",
- aromeCode: "initIDCardListener",
- number: "Z2",
- initParams: {}
- },
- {
- name: "⼿输身份证号",
- aromeCode: "",
- number: "D2",
- initParams: {
- "action": "enterIDNumber",
- "event": "open",
- "taskId": "9"
- }
- },
- {
- name: "设备信息请求",
- aromeCode: "",
- number: "E",
- initParams: {
- "action": "getDeviceInfo",
- "event": "open",
- "taskId": "4"
- }
- },
- {
- name: "语⾳播报请求",
- aromeCode: "",
- number: "F",
- initParams: {
- "action": "speech",
- "event": "open",
- "taskId": "8",
- "params": {
- "text": "要播报的⽂字内容",
- "pitch": 1.0,
- "rate": 1.0
- }
- }
- },
- {
- name: "⼩票打印机⼩程序",
- number: "G",
- aromeCode: "",
- initParams: {
- "action": "receiptPrinting",
- "event": "open",
- "taskId": "10",
- "params": {
- "printList": [{
- "text": "测试⽂字打印",
- "textSize": 26,
- "bold": false,
- "algin": "left"
- }, {
- "imageBase64": "测试图⽚打印,实际传⼊base64图⽚值/9j/4AAQSkZJRgABAgAAAQABABntRS5Sj//",
- "width": 376,
- "height": 376
- }]
- }
- }
- },
- ]
- },
- //切换系统信息的显示
- changeMsg() {
- let { showSystemInfo } = this.data;
- this.setData({
- showSystemInfo: !showSystemInfo
- })
- },
- //初始化接口
- doInit() {
- let that = this
- let params = JSON.parse(JSON.stringify(that.data.initParams))
- this.setData({
- initObj: JSON.stringify(params)
- })
- my.call("aromeInitBpaasService", params, (res) => {
- that.setData({
- initResult: JSON.stringify(res)
- })
- })
- },
- //调用刷脸
- doOneVN() {
- let that = this
- let params = JSON.parse(JSON.stringify(that.data.oneVNParams))
- that.setData({
- oneVNObj: JSON.stringify(params) + "----服务编码: " + that.data.oneVNServiceCode
- })
- console.log(JSON.stringify(params) + "----服务编码: " + that.data.oneVNServiceCode)
- my.call('aromeStartBpaasService', {
- serviceCode: that.data.oneVNServiceCode,
- params: params,
- taskId: parseInt(Math.random() * 1000000 + 1)
- }, (res) => {
- that.setData({
- oneVNResult: JSON.stringify(res)
- })
- app.data.authParams.user_id = res.alipayUid || ""
- app.data.authParams.ftoken = res.ftoken || ""
- })
- },
- //调用授权服务
- doAuth() {
- let that = this
- let params = JSON.parse(JSON.stringify(that.data.authParams))
- that.setData({
- authObj: JSON.stringify(params) + "----服务编码: " + that.data.authServiceCode
- })
- my.call('aromeStartBpaasService', {
- serviceCode: that.data.authServiceCode,
- params: params,
- taskId: parseInt(Math.random() * 1000000 + 1)
- }, (res) => {
- that.setData({
- authResult: JSON.stringify(res)
- })
- })
- },
- //关闭结果
- close(e) {
- let type = e.currentTarget.dataset.type
- switch (type) {
- case "init":
- this.setData({
- initResult: null,
- initObj: null
- })
- break;
- case "oneVN":
- this.setData({
- oneVNResult: null,
- oneVNObj: null
- })
- break;
- case "auth":
- this.setData({
- authObj: null,
- authResult: null
- })
- break;
- default:
- break;
- }
- },
- //进入设置页
- doSetting(e) {
- let route = {
- init: "/pages/setInit/setInit",
- oneVN: "/pages/setOneVN/setOneVN",
- auth: "/pages/setAuth/setAuth"
- }
- let type = e.currentTarget.dataset.type
- my.navigateTo({
- url: route[type]
- })
- },
- //更新配置信息
- updateConfig() {
- this.data.initParams = app.data.initParams;
- this.data.oneVNParams = app.data.oneVNParams;
- this.data.oneVNServiceCode = app.data.oneVNServiceCode;
- this.data.authParams = app.data.authParams;
- this.data.authServiceCode = app.data.authServiceCode;
- },
- onLoad(query) {
- },
- onReady() {
- // 页面加载完成
- },
- onShow() {
- this.setData({
- systemInfo: app.data.systemInfo,
- systemInfoStr: JSON.stringify(app.data.systemInfo),
- isKEightDevice: app.data.isKEightDevice,
- initObj: null,
- initResult: null,
- oneVNObj: null,
- oneVNResult: null,
- authObj: null,
- authResult: null
- });
- this.updateConfig();
- },
- onHide() {
- // 页面隐藏
- },
- onUnload() {
- // 页面被关闭
- },
- onTitleClick() {
- // 标题被点击
- },
- onPullDownRefresh() {
- // 页面被下拉
- },
- onReachBottom() {
- // 页面被拉到底部
- },
- onShareAppMessage() {
- // 返回自定义分享信息
- },
- });
|