index.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287
  1. const app = getApp()
  2. import { debounce, getDetectFileType } from '../../utils/util/util'
  3. import FileUploader from '../../utils/upload/upload_file_chunk'
  4. Page({
  5. data: {
  6. // 是否显示信息
  7. showSystemInfo: false,
  8. //系统信息
  9. systemInfo: null,
  10. //系统信息字符串展示
  11. systemInfoStr: null,
  12. //是否是K8容器中运行的小程序
  13. isKEightDevice: false,
  14. /**
  15. * 初始化刷脸服务
  16. */
  17. //入参打印
  18. initObj: null,
  19. //结果
  20. initResult: null,
  21. //初始化入参
  22. initParams: {},
  23. /**
  24. * 调用1:N刷脸
  25. */
  26. //入参打印
  27. oneVNObj: null,
  28. //结果
  29. oneVNResult: null,
  30. //调用服务入参
  31. oneVNParams: {},
  32. //服务编码
  33. oneVNServiceCode: "",
  34. /**
  35. * 调用订阅授权服务
  36. */
  37. //入参打印
  38. authObj: null,
  39. //结果
  40. authResult: null,
  41. //调用服务入参
  42. authParams: {},
  43. //服务编码
  44. authServiceCode: "",
  45. downloadFileChunkItem: {
  46. status: '',
  47. errorTips: '',
  48. chunkIndex: 0,
  49. totalChunks: 0,
  50. url: '',
  51. fileType: '',
  52. fileName: '测试',
  53. originalUrl: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/img/localPreviewPageUrl.jpg',
  54. // originalUrl: 'https://vipmp4i.vodfile.m1905.com/202411161120/d92631080d326316a8d249a67161916d/video/moss/2024/11/15/v202411152H376OYBGLJZWLWT/v202411152H376OYBGLJZWLWT.mp4',
  55. // 'https://vipmp4i.vodfile.m1905.com/202411161120/d92631080d326316a8d249a67161916d/video/moss/2024/11/15/v202411152H376OYBGLJZWLWT/v202411152H376OYBGLJZWLWT.mp4'
  56. },
  57. videoChunkItem: {
  58. chunkIndex: 0,
  59. totalChunks: 0,
  60. url: '',
  61. width: 0,
  62. height: 0,
  63. },
  64. activeTab: 0,
  65. menuList: [
  66. /*{
  67. name: 'web-view',
  68. id: -1,
  69. ampe_params: []
  70. },*/
  71. {
  72. name: '系统信息',
  73. id: 0,
  74. ampe_params: []
  75. },
  76. {
  77. name: '刷脸指令',
  78. id: 1,
  79. ampe_params: [
  80. {
  81. name: "刷脸初始化请求",
  82. number: "A1",
  83. aromeCode: "",
  84. initParams: {
  85. "action": "initFace",
  86. "event": "open",
  87. "taskId": "A1",
  88. "params": {
  89. "serviceId": "",
  90. "query": "",
  91. "scope": ""
  92. }
  93. }
  94. },
  95. {
  96. name: "唤起刷脸请求1:N",
  97. number: "A2",
  98. aromeCode: "",
  99. initParams: {
  100. "action": "getFaceInfo",
  101. "event": "open",
  102. "taskId": "A2"
  103. }
  104. },
  105. {
  106. name: "唤起刷脸请求1:1",
  107. number: "A3",
  108. aromeCode: "",
  109. initParams: {
  110. "action": "getFaceInfoPersonCard",
  111. "event": "open",
  112. "taskId": "A3",
  113. "params": {
  114. "certName": "",
  115. "certNo": "",
  116. "certPhotoBase64Str": ""
  117. }
  118. }
  119. },
  120. {
  121. name: '刷脸入库',
  122. tips: '调用刷脸(老年食堂)',
  123. aromeCode: "",
  124. number: "A4",
  125. initParams: {
  126. "action": "doStorageFaceInfo",
  127. "event": "open",
  128. "taskId": "A4",
  129. "params": {
  130. "appid": "2021003181682188",
  131. "orgOutId": "hanghuijingquTest3",
  132. "componentOutId": "day_label_sign_online",
  133. "isvPid": "2088721034139660"
  134. }
  135. // "params": {
  136. // "appId":"2021004147600083",
  137. // "orgOutId":"huanggangzhangzheshitang",
  138. // "componentOutId":"day_label_sign_online",
  139. // "isvPid":"2088741779695636"
  140. // }
  141. }
  142. },
  143. {
  144. name: '刷证/输证⼊库',
  145. tips: '调用刷证/输证入库(老年食堂)',
  146. aromeCode: "",
  147. number: "A5",
  148. initParams: {
  149. "action": "doStorageFaceInfo",
  150. "event": "open",
  151. "taskId": "A5",
  152. "params": {
  153. "uniqueId": "2021003181682188",
  154. "name": "XXXXXX",
  155. "certNo": "XXXXXX",
  156. "phone": "XXXXXX"
  157. }
  158. }
  159. },
  160. ]
  161. },
  162. {
  163. name: '刷身份证',
  164. id: 2,
  165. ampe_params: [
  166. {
  167. name: "开启刷身份证(单次)",
  168. number: "B1",
  169. aromeCode: '',
  170. initParams: {
  171. "action": "getIDCardInfo",
  172. "event": "open",
  173. "taskId": "B1",
  174. "params": {
  175. "infoType": "base,photo,other"
  176. }
  177. }
  178. },
  179. {
  180. name: "关闭刷身份证(单次)",
  181. number: "B2",
  182. aromeCode: '',
  183. initParams: {
  184. "action": "closeIDCardInfo",
  185. "event": "open",
  186. "taskId": "B2",
  187. "params": {
  188. "infoType": "base,photo,other"
  189. }
  190. }
  191. },
  192. {
  193. name: "身份证持续监听",
  194. aromeCode: "initIDCardListener",
  195. number: "B3",
  196. initParams: {}
  197. },
  198. ]
  199. },
  200. {
  201. name: '二维码',
  202. id: 3,
  203. ampe_params: [
  204. {
  205. name: "开启刷⼆维码(单次)",
  206. number: "C1",
  207. aromeCode: "",
  208. initParams: {
  209. "action": "getQRCode",
  210. "event": "open",
  211. "taskId": "C1"
  212. }
  213. },
  214. {
  215. name: "二维码持续监听",
  216. aromeCode: "initQRListener",
  217. number: "C2",
  218. initParams: {}
  219. },
  220. ]
  221. },
  222. {
  223. name: '麦克风',
  224. id: 4,
  225. ampe_params: [
  226. {
  227. name: "开启⻨克⻛(持续)",
  228. tips: 'app持续发录⾳数据给小程序',
  229. number: "D1",
  230. aromeCode: "",
  231. initParams: {
  232. "action": "startMicrophoneListener",
  233. "event": "open",
  234. "taskId": "D1",
  235. "params": {
  236. "intervalTime": 1000,//2.9.0版本及之后版本已废弃该字段
  237. "isMicrophoneSourceData": false //2.9.8版本添加
  238. }
  239. }
  240. },
  241. {
  242. name: "停⽌⻨克⻛监听",
  243. number: "D3",
  244. aromeCode: "",
  245. initParams: {
  246. "action": "stopMicrophoneListener",
  247. "event": "open",
  248. "taskId": "D3",
  249. }
  250. },
  251. {
  252. name: "⻨克⻛持续监听",
  253. aromeCode: "initMicrophoneListener",
  254. number: "D2",
  255. isCumulative: false,
  256. initParams: {}
  257. },
  258. ]
  259. },
  260. {
  261. name: '设备信息',
  262. id: 5,
  263. ampe_params: [
  264. {
  265. name: "开启设备信息请求",
  266. number: "E1",
  267. aromeCode: "",
  268. initParams: {
  269. "action": "getDeviceInfo",
  270. "event": "open",
  271. "taskId": "E1",
  272. }
  273. },
  274. ]
  275. },
  276. {
  277. name: '语音播报请求',
  278. id: 6,
  279. ampe_params: [
  280. {
  281. name: "语⾳播报请求",
  282. aromeCode: "",
  283. number: "F1",
  284. initParams: {
  285. "action": "speech",
  286. "event": "open",
  287. "taskId": "F1",
  288. "params": {
  289. "text": "要播报的⽂字内容",
  290. "pitch": 1.0,
  291. "rate": 1.0
  292. }
  293. }
  294. },
  295. {
  296. name: "语音停止请求",
  297. aromeCode: "",
  298. number: "F2",
  299. initParams: {
  300. "action": "speechStop",
  301. "event": "open",
  302. "taskId": "F2",
  303. }
  304. },
  305. ]
  306. },
  307. {
  308. name: '手输身份证号',
  309. id: 7,
  310. ampe_params: [
  311. {
  312. name: "手输身份证号",
  313. aromeCode: "",
  314. number: "G1",
  315. initParams: {
  316. "action": "enterIDNumber",
  317. "event": "open",
  318. "taskId": "G1"
  319. }
  320. },
  321. ]
  322. },
  323. {
  324. name: '小票打印机小程序',
  325. id: 8,
  326. ampe_params: [
  327. {
  328. name: "小票打印机小程序",
  329. number: "H1",
  330. aromeCode: "",
  331. initParams: {
  332. "action": "receiptPrinting",
  333. "event": "open",
  334. "taskId": "H1",
  335. "params": {
  336. "printList": [{
  337. "text": "测试⽂字打印",
  338. "textSize": 26,
  339. "bold": false,
  340. "algin": "left"
  341. }, {
  342. "imageBase64": "测试图⽚打印,实际传⼊base64图⽚值/9j/4AAQSkZJRgABAgAAAQABABntRS5Sj//",
  343. "width": 376,
  344. "height": 376
  345. }]
  346. }
  347. }
  348. },
  349. ]
  350. },
  351. {
  352. name: '小程序超时',
  353. id: 9,
  354. ampe_params: [
  355. {
  356. name: "超时监听",
  357. aromeCode: "ampeOperationTimeout",
  358. number: "I1",
  359. initParams: {}
  360. },
  361. ]
  362. },
  363. {
  364. name: '红外感应',
  365. id: 10,
  366. ampe_params: [
  367. {
  368. name: "开启红外感应监听",
  369. aromeCode: "",
  370. number: "J1",
  371. initParams: {
  372. "action": "startInfraredInductionListener",
  373. "event": "open",
  374. "taskId": "J1",
  375. "params": {
  376. "intervalTime": 3000
  377. }
  378. }
  379. },
  380. {
  381. name: "停⽌红外感应监听",
  382. aromeCode: "",
  383. number: "J3",
  384. initParams: {
  385. "action": "stopInfraredInductionListener",
  386. "event": "open",
  387. "taskId": "J3",
  388. }
  389. },
  390. {
  391. name: "红外感应持续监听",
  392. aromeCode: "initInfraredInductionListener",
  393. number: "J2",
  394. initParams: {}
  395. },
  396. ]
  397. },
  398. {
  399. name: '双屏异显',
  400. id: 11,
  401. ampe_params: [
  402. {
  403. name: "副屏显示不同⻚⾯",
  404. aromeCode: "",
  405. number: "K1",
  406. initParams: {
  407. "action": "openSecondaryScreen",
  408. "event": "open",
  409. "taskId": "K1",
  410. "params": {
  411. "secondaryScreenBase64": "https://tx.hz-hanghui.com:8088/yx-fyzd/file/upload/imagesnew/20241107/570733822954438656.png"
  412. }
  413. }
  414. },
  415. {
  416. name: "关闭副屏显示",
  417. aromeCode: "",
  418. number: "K2",
  419. initParams: {
  420. "action": "closeSecondaryScreen",
  421. "event": "close",
  422. "taskId": "K2",
  423. }
  424. },
  425. {
  426. name: "获取副屏显示/关闭的状态",
  427. aromeCode: "",
  428. number: "K3",
  429. initParams: {
  430. "action": "getSecondaryScreenState",
  431. "event": "open",
  432. "taskId": "K3",
  433. }
  434. },
  435. ]
  436. },
  437. {
  438. name: '社保卡',
  439. id: 12,
  440. ampe_params: [
  441. {
  442. name: '读取社保卡信息(单次)',
  443. aromeCode: "",
  444. number: "L1",
  445. initParams: {
  446. "action": "getSocialSecurityCardInfo",
  447. "event": "open",
  448. "taskId": "K3",
  449. }
  450. },
  451. {
  452. name: '获取社保卡配置信息(单次)',
  453. aromeCode: "",
  454. number: "L2",
  455. initParams: {
  456. "action": "socialSecurityCardConfig",
  457. "event": "open",
  458. "taskId": "K3",
  459. }
  460. },
  461. {
  462. name: '开启社保卡读取监听(持续)',
  463. aromeCode: "socialSecurityCardListener",
  464. number: "L3",
  465. initParams: {}
  466. },
  467. ]
  468. },
  469. {
  470. name: 'NFC',
  471. id: 13,
  472. ampe_params: [
  473. {
  474. name: '启动NFC轮询A',
  475. aromeCode: "",
  476. number: "M1-1",
  477. initParams: {
  478. "action": "startCPUCardLoopRead",
  479. "event": "open",
  480. "taskId": "M1-1",
  481. "params": {
  482. "intervalTime": "5000",
  483. }
  484. }
  485. },
  486. {
  487. name: '启动NFC轮询B',
  488. aromeCode: "",
  489. number: "M1-2",
  490. initParams: {
  491. "action": "startCPUCardLoopRead",
  492. "event": "open",
  493. "taskId": "M1-2",
  494. "params": {
  495. "intervalTime": "5000",
  496. "isComeBackFailed": true //2.9.8版本添加
  497. }
  498. }
  499. },
  500. {
  501. name: '停止NFC轮询',
  502. aromeCode: "",
  503. number: "M3",
  504. initParams: {
  505. "action": "stopCPUCardLoopRead",
  506. }
  507. },
  508. {
  509. name: 'NFC监听',
  510. aromeCode: "CPUCardListener",
  511. number: "M2",
  512. initParams: {}
  513. },
  514. {
  515. name: '单次读取NFC',
  516. aromeCode: "",
  517. number: "M4",
  518. initParams: {
  519. "action": "readOnceCPUCardInfo",
  520. }
  521. },
  522. {
  523. name: '发送NFC-APDU命令',
  524. aromeCode: "",
  525. number: "M5",
  526. initParams: {
  527. "action": "sendCPUCardCommand",
  528. "event": "open",
  529. "taskId": "M5",
  530. "params": {
  531. "commandApdu": "0084000008",
  532. "type": "1",
  533. "slot": "1"
  534. }
  535. }
  536. },
  537. {
  538. name: '发送NFC-APDU命令集',
  539. aromeCode: "",
  540. number: "M6",
  541. initParams: {
  542. "action": "sendCPUCardApduCommands",
  543. "event": "open",
  544. "taskId": "M6",
  545. "params": {
  546. "commandApdus": ["0084000008", "0084000008", "0084000008"],
  547. "type": "1",
  548. "slot": "1"
  549. }
  550. }
  551. },
  552. {
  553. name: '冷复位',
  554. aromeCode: "",
  555. number: "M7",
  556. initParams: {
  557. "action": "psamCardColdReset",
  558. "event": "open",
  559. "taskId": "M7",
  560. "params": {
  561. "slot": "1"
  562. }
  563. }
  564. },
  565. {
  566. name: '启动蜂鸣器',
  567. aromeCode: "",
  568. number: "M8",
  569. initParams: {
  570. "action": "startBuzzer",
  571. "event": "open",
  572. "taskId": "M8",
  573. "params": {
  574. "beep": "50",
  575. }
  576. }
  577. },
  578. ]
  579. },
  580. {
  581. name: 'M1卡',
  582. id: 14,
  583. ampe_params: [
  584. {
  585. name: '关闭循环读取M1卡',
  586. aromeCode: "",
  587. number: "N3",
  588. initParams: {
  589. "action": "doM1Listener",
  590. "event": "stop",
  591. "taskId": "N3",
  592. }
  593. },
  594. {
  595. name: '开始循环读取M1卡',
  596. aromeCode: "",
  597. number: "N2",
  598. initParams: {
  599. "action": "doM1Listener",
  600. "event": "start",
  601. "taskId": "N2",
  602. "params": {
  603. //读取的扇区
  604. "sector": 15,
  605. //读取的块:支持指定多个块区,返回的数据会将0,1,2,3块区的内容按顺序拼接返回
  606. "block": "0,1,2,3",
  607. //读取密钥
  608. "secretKey": "FFFFFFFFFFFF"
  609. }
  610. }
  611. },
  612. {
  613. name: 'M1卡读取监听',
  614. aromeCode: "initM1Listener",
  615. number: "N1",
  616. initParams: {}
  617. },
  618. {
  619. name: '单次M1卡写入',
  620. aromeCode: "",
  621. number: "N4",
  622. initParams: {
  623. "action": "doM1Write",
  624. "event": "",
  625. "taskId": "N4",
  626. "params": {
  627. //写入的扇区
  628. "sector": 15,
  629. //写入的块: 只能指定一个块区,如需要写入多个块,可以调用多次
  630. "block": 0,
  631. //写入密钥
  632. "secretKey": "FFFFFFFFFFFF",
  633. //写入内容
  634. "content": "字符串utf-8"
  635. }
  636. }
  637. },
  638. {
  639. name: '擦除M1卡内容',
  640. aromeCode: "",
  641. number: "N5",
  642. initParams: {
  643. "action": "doM1Clear",
  644. "event": "",
  645. "taskId": "N5",
  646. "params": {
  647. //清空的扇区
  648. "sector": 15,
  649. //清空的块: 只能指定一个块区,如需要清空多个块,可以调用多次
  650. "block": 0,
  651. //写入密钥
  652. "secretKey": "FFFFFFFFFFFF",
  653. //填入的初始值-Number
  654. "value": 0
  655. }
  656. }
  657. },
  658. ]
  659. },
  660. {
  661. name: 'ASR(数科版)',
  662. id: 20,
  663. ampe_params: [
  664. {
  665. name: '初始化语音识别配置',
  666. aromeCode: "",
  667. number: "S1",
  668. initParams: {
  669. "action": "doASR",
  670. "event": "init",
  671. "taskId": "3",
  672. "params": {
  673. //租户ID,咨询服务商提供
  674. "tenantCode": "hanghui",
  675. //识别语种,非必填,默认中文-cn;英⽂-en,⻄班⽛⽂-es,菲律宾文-phl,印尼⽂-id
  676. "lang": "cn"
  677. }
  678. }
  679. },
  680. {
  681. name: '声明语音识别监听回调函数',
  682. aromeCode: "initASR",
  683. number: "S2",
  684. initParams: {}
  685. },
  686. {
  687. name: '开始语音识别',
  688. aromeCode: "",
  689. number: "S3",
  690. initParams: {
  691. "action": "doASR",
  692. "event": "start",
  693. "taskId": "S3",
  694. "params": {}
  695. }
  696. },
  697. {
  698. name: '停止语音识别',
  699. aromeCode: "",
  700. number: "S4",
  701. initParams: {
  702. "action": "doASR",
  703. "event": "stop",
  704. "taskId": "S4",
  705. "params": {}
  706. }
  707. },
  708. ]
  709. },
  710. {
  711. name: '关闭小程序',
  712. id: 15,
  713. ampe_params: [
  714. {
  715. name: '关闭小程序',
  716. aromeCode: "",
  717. number: "O1",
  718. initParams: {
  719. "action": "deviceConfig",
  720. "event": "open",
  721. "taskId": "O1",
  722. "params": {
  723. "deviceConfig": {
  724. "exitApplet": 1
  725. }
  726. }
  727. }
  728. },
  729. ]
  730. },
  731. {
  732. name: '显示/隐藏导航栏',
  733. id: 16,
  734. ampe_params: [
  735. {
  736. name: '开启导航栏(仅本次运⾏有效)',
  737. aromeCode: "",
  738. number: "P1",
  739. initParams: {
  740. "action": "deviceConfig",
  741. "event": "open",
  742. "taskId": "P1",
  743. "params": {
  744. "deviceConfig": {
  745. "hideNavigationBar": 2
  746. }
  747. }
  748. }
  749. },
  750. {
  751. name: '隐藏导航栏(仅本次运⾏有效)',
  752. aromeCode: "",
  753. number: "P2",
  754. initParams: {
  755. "action": "deviceConfig",
  756. "event": "open",
  757. "taskId": "P2",
  758. "params": {
  759. "deviceConfig": {
  760. "hideNavigationBar": 1
  761. }
  762. }
  763. }
  764. },
  765. ]
  766. },
  767. {
  768. name: '显示/隐藏通知栏',
  769. id: 17,
  770. ampe_params: [
  771. {
  772. name: '开启通知栏(仅本次运⾏有效)',
  773. aromeCode: "",
  774. number: "Q1",
  775. initParams: {
  776. "action": "deviceConfig",
  777. "event": "open",
  778. "taskId": "Q1",
  779. "params": {
  780. "deviceConfig": {
  781. "hideNotificationBar": 2
  782. }
  783. }
  784. }
  785. },
  786. {
  787. name: '隐藏通知栏(仅本次运⾏有效)',
  788. aromeCode: "",
  789. number: "Q2",
  790. initParams: {
  791. "action": "deviceConfig",
  792. "event": "open",
  793. "taskId": "Q2",
  794. "params": {
  795. "deviceConfig": {
  796. "hideNotificationBar": 1
  797. }
  798. }
  799. }
  800. },
  801. ]
  802. },
  803. {
  804. name: '右上角悬浮关闭小程序按钮',
  805. id: 18,
  806. ampe_params: [
  807. {
  808. name: '右上角悬浮关闭小程序按钮(根据指定AppId)',
  809. aromeCode: "",
  810. number: "R1",
  811. initParams: {
  812. "action": "floatingExitButton",
  813. "event": "open",
  814. "taskId": "R1",
  815. "params": {
  816. "isOpen": true,
  817. "appId": "123456"
  818. }
  819. }
  820. },
  821. ]
  822. },
  823. {
  824. name: '扬声器',
  825. id: 20,
  826. ampe_params: [
  827. {
  828. name: '获取扬声器音量',
  829. aromeCode: "",
  830. number: "R1",
  831. initParams: {
  832. "action": "loudspeaker",
  833. "event": "get",
  834. "taskId": "R1",
  835. "params": {
  836. }
  837. }
  838. }, {
  839. name: '设置扬声器音量',
  840. aromeCode: "",
  841. number: "R1",
  842. initParams: {
  843. "action": "loudspeaker",
  844. "event": "set",
  845. "taskId": "R1",
  846. "params": {
  847. "volume": "0.95"
  848. }
  849. }
  850. }, {
  851. name: '获取缓存文件列表',
  852. aromeCode: "",
  853. number: "z1",
  854. initParams: {
  855. "action": "storage",
  856. "event": "get",
  857. "taskId": "z1",
  858. "params": {}
  859. }
  860. }, {
  861. name: '缓存文件',
  862. aromeCode: "",
  863. number: "z2",
  864. initParams: {
  865. "action": "storage",
  866. "event": "set",
  867. "taskId": "z2",
  868. "params": {
  869. fileName: "夏伟浩.mp4",
  870. fileUrl: "https://wallpaper-static.cheetahfun.com/wallpaper/sites/dynamics/vm5.mp4"
  871. }
  872. }
  873. }, {
  874. name: '移除缓存文件',
  875. aromeCode: "",
  876. number: "z3",
  877. initParams: {
  878. "action": "storage",
  879. "event": "remove",
  880. "taskId": "z3",
  881. "params": {
  882. fileName: "夏伟浩",
  883. fileType: ".mp4",
  884. path: "/storage/emulated/0/Download/夏伟浩.mp4"
  885. }
  886. }
  887. },
  888. ]
  889. },
  890. // {
  891. // name: '附件上传',
  892. // id: 19,
  893. // ampe_params: []
  894. // },
  895. ],
  896. },
  897. onLoad(query) {
  898. this.setData({
  899. activeTab: 0,
  900. })
  901. my.pageScrollTo({
  902. selector: `.menu-box-0`,
  903. // offsetTop: -12,//偏移的位置
  904. duration: 300,
  905. });
  906. },
  907. // 切换 Menu
  908. onMenuChange(e) {
  909. console.log(e)
  910. let currentItem = e.currentTarget.dataset.item;
  911. this.setData({
  912. activeTab: currentItem.id,
  913. })
  914. my.pageScrollTo({
  915. selector: `.menu-box-${currentItem.id}`,
  916. // offsetTop: -12,//偏移的位置
  917. duration: 300,
  918. });
  919. },
  920. //切换系统信息的显示
  921. changeMsg() {
  922. let { showSystemInfo } = this.data;
  923. this.setData({
  924. showSystemInfo: !showSystemInfo
  925. })
  926. },
  927. //初始化接口
  928. doInit() {
  929. let that = this
  930. let params = JSON.parse(JSON.stringify(that.data.initParams))
  931. this.setData({
  932. initObj: JSON.stringify(params)
  933. })
  934. my.call("aromeInitBpaasService", params, (res) => {
  935. that.setData({
  936. initResult: JSON.stringify(res)
  937. })
  938. })
  939. },
  940. //调用刷脸
  941. doOneVN() {
  942. let that = this
  943. let params = JSON.parse(JSON.stringify(that.data.oneVNParams))
  944. that.setData({
  945. oneVNObj: JSON.stringify(params) + "----服务编码: " + that.data.oneVNServiceCode
  946. })
  947. console.log(JSON.stringify(params) + "----服务编码: " + that.data.oneVNServiceCode)
  948. my.call('aromeStartBpaasService', {
  949. serviceCode: that.data.oneVNServiceCode,
  950. params: params,
  951. taskId: parseInt(Math.random() * 1000000 + 1)
  952. }, (res) => {
  953. that.setData({
  954. oneVNResult: JSON.stringify(res)
  955. })
  956. app.data.authParams.user_id = res.alipayUid || ""
  957. app.data.authParams.ftoken = res.ftoken || ""
  958. })
  959. },
  960. //调用授权服务
  961. doAuth() {
  962. let that = this
  963. let params = JSON.parse(JSON.stringify(that.data.authParams))
  964. that.setData({
  965. authObj: JSON.stringify(params) + "----服务编码: " + that.data.authServiceCode
  966. })
  967. my.call('aromeStartBpaasService', {
  968. serviceCode: that.data.authServiceCode,
  969. params: params,
  970. taskId: parseInt(Math.random() * 1000000 + 1)
  971. }, (res) => {
  972. that.setData({
  973. authResult: JSON.stringify(res)
  974. })
  975. })
  976. },
  977. //关闭结果
  978. close(e) {
  979. let type = e.currentTarget.dataset.type
  980. switch (type) {
  981. case "init":
  982. this.setData({
  983. initResult: null,
  984. initObj: null
  985. })
  986. break;
  987. case "oneVN":
  988. this.setData({
  989. oneVNResult: null,
  990. oneVNObj: null
  991. })
  992. break;
  993. case "auth":
  994. this.setData({
  995. authObj: null,
  996. authResult: null
  997. })
  998. break;
  999. case "imgUpload":
  1000. this.setData({
  1001. 'downloadFileChunkItem.status': '',
  1002. 'downloadFileChunkItem.errorTips': '',
  1003. 'downloadFileChunkItem.chunkIndex': 0,
  1004. 'downloadFileChunkItem.totalChunks': 0,
  1005. 'downloadFileChunkItem.url': '',
  1006. 'downloadFileChunkItem.fileType': '',
  1007. 'downloadFileChunkItem.fileName': '测试',
  1008. 'downloadFileChunkItem.originalUrl': 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/img/localPreviewPageUrl.jpg',
  1009. // 'downloadFileChunkItem.originalUrl': 'https://vipmp4i.vodfile.m1905.com/202411161120/d92631080d326316a8d249a67161916d/video/moss/2024/11/15/v202411152H376OYBGLJZWLWT/v202411152H376OYBGLJZWLWT.mp4',
  1010. })
  1011. break;
  1012. case "videoUpload":
  1013. this.setData({
  1014. 'videoChunkItem.chunkIndex': 0,
  1015. 'videoChunkItem.totalChunks': 0,
  1016. 'videoChunkItem.url': '',
  1017. 'videoChunkItem.width': 0,
  1018. 'videoChunkItem.height': 0,
  1019. })
  1020. break;
  1021. default:
  1022. break;
  1023. }
  1024. },
  1025. //进入设置页
  1026. doSetting(e) {
  1027. let route = {
  1028. init: "/pages/setInit/setInit",
  1029. oneVN: "/pages/setOneVN/setOneVN",
  1030. auth: "/pages/setAuth/setAuth"
  1031. }
  1032. let type = e.currentTarget.dataset.type
  1033. my.navigateTo({
  1034. url: route[type]
  1035. })
  1036. },
  1037. //更新配置信息
  1038. updateConfig() {
  1039. this.data.initParams = app.data.initParams;
  1040. this.data.oneVNParams = app.data.oneVNParams;
  1041. this.data.oneVNServiceCode = app.data.oneVNServiceCode;
  1042. this.data.authParams = app.data.authParams;
  1043. this.data.authServiceCode = app.data.authServiceCode;
  1044. },
  1045. handleChange(e) {
  1046. let field = e.currentTarget.dataset.field;
  1047. let json = e.detail.value
  1048. console.log(json)
  1049. this.setData({
  1050. [`downloadFileChunkItem.${field}`]: json
  1051. })
  1052. },
  1053. async handleUpload(e) {
  1054. let type = e.currentTarget.dataset.type;
  1055. let _this = this
  1056. // my.downloadFile({
  1057. // url: 'http://img.alicdn.com/tfs/TB1x669SXXXXXbdaFXXXXXXXXXX-520-280.jpg',
  1058. // success(res) {
  1059. // console.log('downloadFile success:',res.apFilePath,res.tempFilePath); // apFilePath 与 tempFilePath 等价
  1060. // },
  1061. // fail(res) {
  1062. // console.log('downloadFile fail:',res);
  1063. // },
  1064. // });
  1065. // 数据重置
  1066. this.setData({
  1067. 'downloadFileChunkItem.status': 'padding',
  1068. 'downloadFileChunkItem.chunkIndex': 0,
  1069. 'downloadFileChunkItem.totalChunks': 0,
  1070. 'downloadFileChunkItem.url': '',
  1071. 'downloadFileChunkItem.fileType': '',
  1072. })
  1073. const uploader = new FileUploader({
  1074. url: _this.data.downloadFileChunkItem.originalUrl, // 文件路径
  1075. chunkSize: 512 * 1024, // 每片大小为 512KB
  1076. fileName: _this.data.downloadFileChunkItem.fileName, // 文件名
  1077. retryLimit: 3 // 每片的最大重试次数
  1078. });
  1079. // 开始上传
  1080. await uploader.startUpload((status, res) => {
  1081. console.log('callback', res)
  1082. _this.setData({
  1083. 'downloadFileChunkItem.status': status,
  1084. })
  1085. if (status == 'success') {
  1086. let params = res.params
  1087. _this.setData({
  1088. 'downloadFileChunkItem.chunkIndex': params.currentIndex + 1,
  1089. 'downloadFileChunkItem.totalChunks': params.totalChunks,
  1090. })
  1091. } else {
  1092. _this.setData({
  1093. 'downloadFileChunkItem.errorTips': res,
  1094. })
  1095. }
  1096. })
  1097. _this.setData({
  1098. 'downloadFileChunkItem.url': uploader.filePath,
  1099. 'downloadFileChunkItem.fileType': (uploader.fileType || '').match(/^[^\/]+/)[0],
  1100. })
  1101. console.log(uploader.filePath)
  1102. /* if (type == 'img') {
  1103. my.chooseImage({
  1104. // 可以根据您的业务按需选择使用 ['album'] 或 ['camera'] 或 ['album', 'camera']
  1105. sourceType: ['album'],
  1106. success: function (res) {
  1107. console.log(res);
  1108. let tempFilePath = res.tempFilePaths[0]
  1109. let arr = []
  1110. const uploader = new FileUploader({
  1111. filePath: 'https://tx.hz-hanghui.com:8088/yx-fyzd/file/img/localPreviewPageUrl.jpg', // 文件路径
  1112. chunkSize: 512 * 1024, // 每片大小为 512KB
  1113. fileName: '测试图片', // 文件名
  1114. // retryLimit: 3 // 每片的最大重试次数
  1115. });
  1116. // 开始上传
  1117. uploader.startUpload((e) => {
  1118. console.log('callback', e)
  1119. _this.setData({
  1120. 'imgChunkItem.chunkIndex': e.chunkIndex + 1,
  1121. 'imgChunkItem.totalChunks': e.totalChunks,
  1122. })
  1123. })
  1124. _this.setData({
  1125. 'imgChunkItem.url': tempFilePath,
  1126. })
  1127. // const fs = my.getFileSystemManager();
  1128. // fs.readFile({
  1129. // // readFile 不传入 encodding 参数,则以 ArrayBuffer 方式读取
  1130. // filePath: `${res.tempFilePaths[0]}`,
  1131. // success: ({ data }) => {
  1132. // console.log(data)
  1133. // const arrayBuffer = data; // 文件的 ArrayBuffer 数据
  1134. // const base64 = my.arrayBufferToBase64(arrayBuffer);
  1135. // _this.setData({
  1136. // fileUrl: `data:image/png;base64,${base64}`
  1137. // })
  1138. // console.log("base64", `data:image/png;base64,${base64}`);
  1139. // },
  1140. // });
  1141. },
  1142. fail: function (err) {
  1143. console.log(err);
  1144. },
  1145. });
  1146. } else if (type == 'video') {
  1147. my.chooseVideo({
  1148. // 可以根据您的业务按需选择使用 [‘camera'] 或者 ['album', 'camera']
  1149. sourceType: ['album'],
  1150. success: async function (res) {
  1151. console.log(res);
  1152. const tempFilePath = res.tempFilePath;
  1153. const uploader = new FileUploader({
  1154. filePath: tempFilePath, // 文件路径
  1155. chunkSize: 512 * 1024, // 每片大小为 512KB
  1156. fileName: '测试视频', // 文件名
  1157. retryLimit: 3 // 每片的最大重试次数
  1158. });
  1159. // 开始上传
  1160. uploader.startUpload((e) => {
  1161. console.log('callback', e)
  1162. _this.setData({
  1163. 'videoChunkItem.chunkIndex': e.chunkIndex + 1,
  1164. 'videoChunkItem.totalChunks': e.totalChunks,
  1165. })
  1166. })
  1167. _this.setData({
  1168. 'videoChunkItem.url': tempFilePath,
  1169. 'videoChunkItem.width': res.width,
  1170. 'videoChunkItem.height': res.height,
  1171. })
  1172. // // 2. 读取文件内容为 ArrayBuffer
  1173. // const fileManager = my.getFileSystemManager();
  1174. // fileManager.readFile({
  1175. // filePath: tempFilePath,
  1176. // success: ({ data }) => {
  1177. // const arrayBuffer = data; // 文件的 ArrayBuffer 数据
  1178. // console.log(arrayBuffer)
  1179. // },
  1180. // fail: (err) => {
  1181. // console.error('文件读取失败', err);
  1182. // }
  1183. // });
  1184. },
  1185. fail: function (err) {
  1186. console.log(err);
  1187. },
  1188. });
  1189. }*/
  1190. },
  1191. goToWebView() {
  1192. // my.getLocation({
  1193. // type: 1, // 获取经纬度和省市区县数据
  1194. // success: (res) => {
  1195. // console.log(res);
  1196. // my.showModal({
  1197. // title: '提示',
  1198. // content: res && JSON.stringify(res),
  1199. // success: function(res) {
  1200. // console.log(res);
  1201. // },
  1202. // fail: function(err) {
  1203. // console.log(err);
  1204. // }
  1205. // });
  1206. // },
  1207. // fail: (error) => {
  1208. // console.error('定位失败: ', JSON.stringify(error));
  1209. // },
  1210. // complete: (res) => {
  1211. // console.log(res);
  1212. // },
  1213. // });
  1214. my.navigateTo({
  1215. url: '/pages/digitalHumans/digitalHumans'
  1216. })
  1217. },
  1218. onReady() {
  1219. // 页面加载完成
  1220. },
  1221. onShow() {
  1222. this.setData({
  1223. systemInfo: app.data.systemInfo,
  1224. systemInfoStr: JSON.stringify(app.data.systemInfo),
  1225. isKEightDevice: app.data.isKEightDevice,
  1226. initObj: null,
  1227. initResult: null,
  1228. oneVNObj: null,
  1229. oneVNResult: null,
  1230. authObj: null,
  1231. authResult: null
  1232. });
  1233. this.updateConfig();
  1234. },
  1235. onHide() {
  1236. // 页面隐藏
  1237. },
  1238. onUnload() {
  1239. // 页面被关闭
  1240. },
  1241. onTitleClick() {
  1242. // 标题被点击
  1243. },
  1244. onPullDownRefresh() {
  1245. // 页面被下拉
  1246. },
  1247. onReachBottom() {
  1248. // 页面被拉到底部
  1249. },
  1250. onShareAppMessage() {
  1251. // 返回自定义分享信息
  1252. },
  1253. // 页面的 onPageScroll 事件处理函数
  1254. onPageScroll: debounce(function (e) {
  1255. // 创建选择器对象
  1256. const query = my.createSelectorQuery();
  1257. console.log(e)
  1258. query.selectAll('.scroll-item')
  1259. .boundingClientRect()
  1260. .exec((res) => {
  1261. // console.log('ssssssssssssssssssssss===', res[0]);
  1262. let obj = (res[0] || []).filter(fv => fv.bottom > 0)[0] || {}
  1263. console.log(obj, obj.dataset.id)
  1264. this.setData({
  1265. activeTab: obj.dataset.id
  1266. })
  1267. // bottom height
  1268. });
  1269. }, 100),
  1270. });