subGame.nvue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280
  1. <template>
  2. <view>
  3. <!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl" -->
  4. <!-- @receivedtitle="onReceivedTitle" @pagefinish="onPageFinish" http://192.168.31.223:7456/-->
  5. <view class="web-view">
  6. <web-view class="web-view-child" :src="url" ref="webview" @pagestart="onPageStart"
  7. @onPostMessage="handlePostMessage" @error="onError"></web-view>
  8. </view>
  9. <view class="web-back" @click="navBack">
  10. <image style="width: 40rpx;height: 40rpx;" src="/static/gameCloseW.png"></image>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import reqUtil from "@/util/util-js/requstUtil.js";
  16. import config from "@/common/config.js";
  17. import fruit from "@/components/fruitMachine/fruit.js"
  18. // import AccAndOri from "@/util/util-js/AccAndOri.js"
  19. import puchConfig from "@/util/util-js/puchConfig.js"
  20. import EquipmentAction from "@/util/util-js/EquipmentAction.js"
  21. import ActionJump from "@/util/util-js/action/jump-0.2.js"
  22. var currentWebview;
  23. var orientId = null,
  24. accId = null;
  25. import {
  26. mapState,
  27. mapMutations
  28. } from 'vuex';
  29. export default {
  30. computed: mapState([
  31. 'avatarUrl', 'gender', 'userName', 'city', 'BLEConnectDevice', 'instructionState',
  32. 'currentInstruction',
  33. 'cIndex', 'globalAcc', 'globalOri', 'LocationGameUrl',
  34. 'ConnectBindingDevice',
  35. 'currentModeIndex',
  36. 'bOldDeviceType'
  37. ]),
  38. data() {
  39. return {
  40. url: '',
  41. pagefinish: '',
  42. error: '',
  43. PageStart: false, // 记录网页请求的加载状态,true 加载成功 false 加载失败
  44. gameQuitListener: false, //游戏是否初始化退出监听
  45. xA: 0,
  46. yA: 0,
  47. zA: 0,
  48. oldxA: 0,
  49. oldzA: 0,
  50. bUpdateOnce: false,
  51. bDelayOnce: false,
  52. mass: puchConfig.BOXING_MASS,
  53. //X轴的变化数组值
  54. xAccArray: [],
  55. xMax: 0,
  56. maxTimeoutId: null,
  57. bMaxPause: false,
  58. xMin: 0,
  59. minTimeoutId: null,
  60. bMinPause: false,
  61. bCalculation: false,
  62. calTimeout: null,
  63. //角度比 z/x
  64. angleRatio: 1, //
  65. //当前选择的item
  66. decodeItem: null,
  67. //拳击数据判断对象
  68. EquipmentActionObj: null,
  69. BLENum: 0,
  70. BLEACX: 0,
  71. BLEACYL: 0,
  72. //是否是游戏里面开启的监听,如果是的话,退出游戏界面时候需要关闭相应的监听,如加速计和陀螺仪
  73. bGameOpenListen: false,
  74. //手机陀螺仪和加速计android模块
  75. bMyAttitudeListen: false,
  76. /**
  77. * 跳绳相应数据
  78. */
  79. //跳绳数据判断对象
  80. actionJumpObj: null,
  81. BLEAccIndex: 0
  82. }
  83. },
  84. onLoad() {
  85. let _self = this;
  86. var pages = getCurrentPages();
  87. var page = pages[pages.length - 1];
  88. currentWebview = page.$getAppWebview();
  89. //监听一次调用setOnceGameOption
  90. console.log("子组件初始化");
  91. uni.$once("setOnceGameOption", (option) => {
  92. console.log("setOnceGameOption=", option);
  93. if (option && option.item) {
  94. this.decodeItem = JSON.parse(decodeURIComponent(option.item));
  95. this.url = this.decodeItem.gameWebUrl;
  96. let temp = {
  97. fObjectId: this.decodeItem.gameId,
  98. recentlyType: 0
  99. }
  100. // console.log("game temp:", config.URL.RECENTLYPLAYINGADD);
  101. //添加最近在玩的游戏
  102. reqUtil.requestData(config.URL.RECENTLYPLAYINGADD, temp).then(res => {
  103. console.log('RECENTLYPLAYINGADD =====', res);
  104. if (res.code == 0) {}
  105. },
  106. e => {
  107. console.log(e)
  108. });
  109. }
  110. });
  111. //子窗体onload 后获取父窗体的onload数据
  112. uni.$emit("game-load");
  113. uni.getCurrentSubNVue().addEventListener("hide", function() {
  114. console.log("subNVue子窗体已隐藏!");
  115. //通知游戏,页面退出
  116. _self.sendMessage("onSubHide", {
  117. msg: '退出页面'
  118. });
  119. uni.$off('updateBLEDeviceData', _self.BLECallback);
  120. //json
  121. uni.$off('updateBLEDeviceJson', _self.BLEJsonCallback);
  122. //去掉监听
  123. if (_self.bMyAttitudeListen) {
  124. _self.gStopSimulateBLEUpdate();
  125. }
  126. // console.log(_self.BLEConnectDevice);
  127. //如果连接了蓝牙设备是手柄
  128. if (_self.BLEConnectDevice && ( _self.BLEConnectDevice.deviceType == "BLEHandle" || _self.BLEConnectDevice.deviceType == "BLEIntelligent")) {
  129. //开启设备回调 3/4关闭
  130. _self.onWriteBLEConnectionValue({
  131. value: "4"
  132. });
  133. //关闭json 回调
  134. _self.onWriteBLEConnectionValue({
  135. value: "6"
  136. });
  137. uni.$off('updateBLEDeviceData', _self.gWatchBLEUpdate);
  138. if (0 === _self.currentModeIndex) {
  139. //拳击柱
  140. _self.uploadUserData_hitCount();
  141. }
  142. } //关闭跳绳模式指令
  143. else if (_self.BLEConnectDevice && _self.BLEConnectDevice.deviceType == "BLERope") {
  144. console.warn("还没设置关闭跳绳模式")
  145. _self.B_CloseRopeSkipping();
  146. uni.$off('updateBLEDeviceData', _self.gWatchBLEUpdate);
  147. }
  148. uni.$emit("game-unload", {
  149. globalAcc: _self.globalAcc,
  150. globalOri: _self.globalOri,
  151. bGameOpenListen: _self.bGameOpenListen
  152. });
  153. });
  154. //*****注释蓝牙操作******
  155. // 监听事件
  156. // uni.$on('callbackCloseBLE', this.callbackCloseBLE);
  157. // uni.$on('callbackBLEState', this.callbackBLEState);
  158. // uni.$on('updateBLEDeviceData', this.BLECallback);
  159. //监听物理返回按钮
  160. plus.key.addEventListener('backbutton', () => {
  161. this.navBack();
  162. }, false);
  163. //设置store状态
  164. _self.$store.state.bGamePlaying = true;
  165. },
  166. onUnload() {
  167. this.$store.state.bGamePlaying = false;
  168. console.log("subNVue子窗体 onUnload!");
  169. //*****注释蓝牙操作******
  170. // uni.$off('callbackCloseBLE', this.callbackCloseBLE);
  171. // uni.$off('callbackBLEState', this.callbackBLEState);
  172. //取消相应的绑定事件
  173. uni.$off('watchAcceleration', this.gWatchAcceleration);
  174. uni.$off("watchAcceleration", this.gWatchBoxingAcc);
  175. uni.$off("watchAcceleration", this.gWatchHitBoxingAcc);
  176. uni.$off('watchOrientation', this.gWatchOrientation);
  177. uni.$emit("game-unload");
  178. },
  179. methods: {
  180. ...mapMutations(['addlocalCalorie', 'syncRequestEvent', 'onWriteBLEConnectionValue',
  181. 'gCreateFilterObj', 'gUpdateFilter', 'B_OpenRopeSkipping', 'B_CloseRopeSkipping',
  182. 'gStopSimulateBLEUpdate', 'gStartSimulateBLEUpdate', 'gIntelligentUpdateSandbagAlgorithm', 'gUpdateSandbagAlgorithm',
  183. 'gCreateSandbagAlgorithm', 'onConvertDeviceData', 'addSandbagHitCount', 'uploadUserData_hitCount',
  184. 'jumpIdenModule_onJump6AxisDataUpdate'
  185. ]),
  186. navBack() {
  187. this.sendMessage("onQuit", {
  188. type: "right-button",
  189. msg: '点击右上角按钮退出游戏'
  190. });
  191. uni.showModal({
  192. title: '提示',
  193. content: '是否退出游戏?',
  194. success: (res) => {
  195. //如果游戏需要监听退出,则需要走完游戏端流程,才能退出,否则直接退出
  196. if (this.gameQuitListener) {
  197. this.sendMessage("onQuitModal", {
  198. data: res,
  199. msg: '退出提示'
  200. });
  201. } else {
  202. if (res.confirm) {
  203. uni.getCurrentSubNVue().hide('auto');
  204. }
  205. }
  206. }
  207. })
  208. },
  209. //蓝牙断开连接时候
  210. callbackCloseBLE() {
  211. this.sendMessage("onDeviceClose", {
  212. msg: '设备断开连接。'
  213. });
  214. },
  215. //蓝牙状态回调
  216. callbackBLEState(res) {
  217. // console.log("game callbackBLEState==", res);
  218. // 暂时只返回数据连接错误信息
  219. // uni.$emit("callbackBLEState", {
  220. // state: -1,
  221. // msg: "设备数据错误"
  222. // });
  223. this.sendMessage("onDeviceState", res)
  224. },
  225. BLECallback(data) {
  226. let dataType = 'Box';
  227. // if (data.hasOwnProperty("ax")) {
  228. // dataType = "Accelerometer"
  229. // }else if(data.hasOwnProperty("gx")){
  230. // dataType = "Gyroscope"
  231. // }
  232. // 设备回调后面用这个接口
  233. let BLEState = {
  234. device: this.BLEConnectDevice, //连接的蓝牙设备
  235. instructionState: this.instructionState, //开启的指令状态
  236. currentInstruction: this.currentInstruction, //当前发送的指令记录
  237. dataType: dataType, //回调的数据类型
  238. data: data //蓝牙回调的数据
  239. }
  240. this.sendMessage("onDeviceUpdateData", BLEState);
  241. },
  242. BLEJsonCallback(data) {
  243. let dataType = 'Json';
  244. // 设备回调后面用这个接口
  245. let BLEState = {
  246. device: this.BLEConnectDevice, //连接的蓝牙设备
  247. instructionState: this.instructionState, //开启的指令状态
  248. currentInstruction: this.currentInstruction, //当前发送的指令记录
  249. dataType: dataType, //回调的数据类型
  250. data: data //蓝牙回调的数据
  251. }
  252. this.sendMessage("onDeviceUpdateJson", BLEState);
  253. },
  254. /**
  255. * 图片转化base64
  256. * @param {Object} url
  257. * @param {Object} callback
  258. */
  259. urlToBase64(url, callback) {
  260. let toBase64Url;
  261. uni.request({
  262. url: url,
  263. method: 'GET',
  264. responseType: 'arraybuffer',
  265. success: async res => {
  266. let base64 = uni.arrayBufferToBase64(res.data);
  267. toBase64Url = 'data:image/jpeg;base64,' + base64;
  268. if (callback)
  269. callback(toBase64Url, res.data);
  270. }
  271. })
  272. },
  273. /**
  274. * 初始化发送数据给游戏
  275. */
  276. sendGameInit() {
  277. console.log("this.avatarUrl:", this.avatarUrl);
  278. this.urlToBase64(this.avatarUrl, (toBase64Url) => {
  279. let device = null;
  280. /**
  281. * 卡路里消耗参数
  282. */
  283. let calorieParams = {
  284. hitUnit: 0,
  285. runUnit: puchConfig.getRunCalorie(1),
  286. jumpUnit: puchConfig.getJumpCalorie(1)
  287. };
  288. if (this.BLEConnectDevice) {
  289. // device = {
  290. // cname: this.BLEConnectDevice.cname,
  291. // ename: this.BLEConnectDevice.ename,
  292. // name: this.BLEConnectDevice.name
  293. // };
  294. // calorieParams = {
  295. // runUnit: 0.55, // 比跳的稍微大一点
  296. // jumpUnit: 0.5 // 跳的次数 * 0.5
  297. // };
  298. device = {
  299. cname: this.BLEConnectDevice.cname,
  300. ename: this.BLEConnectDevice.ename,
  301. name: this.BLEConnectDevice.name
  302. };
  303. calorieParams.hitUnit = puchConfig.getBoxingCalorie(1);
  304. } else if (this.ConnectBindingDevice) {
  305. device = {
  306. cname: this.ConnectBindingDevice.cname,
  307. ename: this.ConnectBindingDevice.ename,
  308. name: this.ConnectBindingDevice.name
  309. };
  310. calorieParams.hitUnit = puchConfig.getBoxingCalorie(1);
  311. }
  312. //到时候可能要区分是什么类型
  313. let item = {
  314. id: this.decodeItem.gameId,
  315. name: this.decodeItem.gameName
  316. };
  317. // console.log(this.BLEConnectDevice, device);
  318. let gameData = {
  319. avatarUrl: this.avatarUrl,
  320. avatarBase64Url: toBase64Url,
  321. userName: this.userName,
  322. gender: this.gender,
  323. caloriUnit: 10,
  324. calorieParams: calorieParams,
  325. //蓝牙连接的设备
  326. device: device,
  327. item: item
  328. }
  329. this.sendMessage("onGameInit", gameData);
  330. // console.log("onGameInit =", gameData);
  331. })
  332. },
  333. /**
  334. * 统一发送信息
  335. * @param {Object} gameData
  336. */
  337. sendMessage(functionName, gameData) {
  338. let data = {
  339. "funName": functionName,
  340. "gameData": gameData
  341. }
  342. if (!this.PageStart) {
  343. console.warn("页面未初始化不能传消息", data);
  344. return;
  345. }
  346. let initStr = JSON.stringify(data);
  347. // console.log(functionName);
  348. this.$refs.webview.evalJs("onWebViewMessage(" + initStr + ")");
  349. },
  350. sendMessageToWebview() {
  351. if (!this.PageStart) {
  352. uni.showModal({
  353. title: "暴躁的提示",
  354. content: "只有网页加载成功了才可以传参过去,不然无效哦。。"
  355. })
  356. return false;
  357. }
  358. /**
  359. * 下面的 jsfunction 代码你要自己在你的网页里面写一个方法 大致如下
  360. * 下面就是你基本的html知识了,我就不想说什么了,自己学。
  361. window.jsfunction = function(data){
  362. console.log('data', data);
  363. }
  364. */
  365. this.sendMessage("onDeviceUpdateData", {
  366. H: 1
  367. });
  368. },
  369. handlePostMessage: function(postData) {
  370. console.log("handlePostMessage得到参数", postData.detail);
  371. let temp = postData.detail.data[0];
  372. let gameData = temp.gameData;
  373. if (temp.funName == "uploadInfo") {
  374. //TODO:写入排行榜分数,后面需要在游戏完结里面调用
  375. //TODO: 后面游戏时间,卡路里的需要写入数据库,目前只是处理了分数
  376. // let num = Math.round(Math.random() * 10000);
  377. //1. gameScore 处理上传的分数
  378. // let _temp = {
  379. // gameId: '1595755153789139696',
  380. // score: 1230,
  381. // cityCode: '110101',
  382. // };
  383. //2. calorieBurned 处理卡路里
  384. // 记录卡路里到本地
  385. this.addlocalCalorie(gameData.calorieBurned);
  386. console.log("gameData.calorieBurned", gameData.calorieBurned);
  387. //然后更新上服务器
  388. this.syncRequestEvent({
  389. success: () => {
  390. // uni.$emit('updateArcbarData', '');
  391. let _temp = {
  392. //假如排行id 为空,排行榜就是游戏自己的id
  393. gameId: this.decodeItem.gameRankingId == null ? this.decodeItem
  394. .gameId : this.decodeItem.gameRankingId,
  395. score: gameData.gameScore,
  396. cityCode: this.city.cityCode,
  397. bMaxLimit: true
  398. }
  399. console.log('_temp =====', _temp);
  400. reqUtil.requestData(config.URL.UPLOADRANKING, _temp, "POST").then(res => {
  401. console.log('UPLOADRANKING =====', res);
  402. if (res.code == 0) {
  403. //TODO 后续游戏数据处理
  404. this.sendMessage("onUploadInfo", {
  405. code: 0,
  406. msg: '上传成功'
  407. });
  408. } else {
  409. //TODO 后续游戏数据处理
  410. this.sendMessage("onUploadInfo", {
  411. code: 400,
  412. msg: '上传失败'
  413. });
  414. }
  415. },
  416. e => {
  417. console.log(e)
  418. });
  419. },
  420. fail: () => {
  421. this.sendMessage("onUploadInfo", {
  422. code: 400,
  423. msg: '上传失败'
  424. });
  425. }
  426. });
  427. //3. gameTime 游戏时间
  428. //TODO 后面处理游戏时长
  429. } else if (temp.funName == "gameInit") {
  430. // 获取游戏信息
  431. this.sendGameInit();
  432. } else if (temp.funName == "aiRandomInfo") {
  433. // 获取aiRandomInfo
  434. reqUtil.requestData(config.URL.AIRANDOMINFO, {}).then(res => {
  435. console.log('AIRANDOMINFO =====', res);
  436. if (res.code == 0) {
  437. let data = res.data;
  438. this.urlToBase64(data.aiAvatar, (toBase64Url) => {
  439. let sendData = {
  440. aiId: data.aiId,
  441. aiName: data.aiName,
  442. aiGender: data.aiGender,
  443. aiType: data.aiType,
  444. aiAvatarBase64Url: toBase64Url
  445. }
  446. this.sendMessage("onAiRandomInfo", sendData);
  447. })
  448. }
  449. },
  450. e => {
  451. console.log(e)
  452. });
  453. } else if (temp.funName == "fruitInfo") {
  454. let fruitIndexArray = [0, 0, 0];
  455. if (gameData.hasOwnProperty("calorie")) {
  456. fruitIndexArray = fruit.getFruitIndex(gameData.calorie);
  457. }
  458. this.urlToBase64("https://bbeng-bucket.oss-cn-beijing.aliyuncs.com/cocos/fruitMachine.png", (
  459. toBase64Url) => {
  460. this.sendMessage("onFruitInfo", {
  461. // 水果雪碧图
  462. fruitBase64Url: toBase64Url,
  463. // 雪碧图 单张图片宽高
  464. unitWidth: 100,
  465. unitHeight: 100,
  466. unit: "px",
  467. imageStartPosY: 0,
  468. imageEndPosY: -1200,
  469. fruitIndexArray: fruitIndexArray
  470. });
  471. })
  472. } else if (temp.funName == "urlToBase64") {
  473. if (gameData.url) {
  474. this.urlToBase64(gameData.url, (toBase64Url) => {
  475. this.sendMessage("onUrlToBase64", {
  476. base64: toBase64Url,
  477. });
  478. })
  479. } else {
  480. this.sendMessage("onUrlToBase64", {
  481. base64: {},
  482. });
  483. }
  484. } else if (temp.funName == "openAccelerometer") {
  485. if (this.globalAcc) {
  486. uni.$off('watchAcceleration', this.gWatchAcceleration);
  487. uni.$on('watchAcceleration', this.gWatchAcceleration);
  488. } else {
  489. uni.$emit("bindAcc", {
  490. callback: (accId) => {
  491. console.log("开启的:globalAcc=", accId);
  492. this.bGameOpenListen = true;
  493. this.$store.state.globalAcc = accId;
  494. uni.$off('watchAcceleration', this.gWatchAcceleration);
  495. uni.$on('watchAcceleration', this.gWatchAcceleration);
  496. }
  497. });
  498. }
  499. } else if (temp.funName == "closeAccelerometer") {
  500. uni.$off('watchAcceleration', this.gWatchAcceleration);
  501. uni.$emit("unBindAcc", this.globalAcc);
  502. this.$store.state.globalAcc = null;
  503. } else if (temp.funName == "openOrientation") {
  504. //打开陀螺仪
  505. if (this.globalOri) {
  506. uni.$off('watchOrientation', this.gWatchOrientation);
  507. uni.$on('watchOrientation', this.gWatchOrientation);
  508. } else {
  509. uni.$emit("bindOri", {
  510. callback: (oriId) => {
  511. console.log("开启的:globalOri=", oriId);
  512. this.bGameOpenListen = true;
  513. this.$store.state.globalOri = oriId;
  514. uni.$off('watchOrientation', this.gWatchOrientation);
  515. uni.$on('watchOrientation', this.gWatchOrientation);
  516. }
  517. });
  518. }
  519. } else if (temp.funName == "closeOrientation") {
  520. uni.$off('watchOrientation', this.gWatchOrientation);
  521. uni.$emit("unBindOri", this.globalOri);
  522. this.$store.state.globalOri = null;
  523. } else if (temp.funName == "bindBoxingPost") {
  524. if (this.globalAcc) {
  525. uni.$off('watchAcceleration', this.gWatchBoxingAcc);
  526. uni.$on('watchAcceleration', this.gWatchBoxingAcc);
  527. } else {
  528. uni.$emit("bindAcc", {
  529. callback: (accId) => {
  530. console.log("bindBoxingPost开启的:globalAcc=", accId);
  531. this.bGameOpenListen = true;
  532. this.$store.state.globalAcc = accId;
  533. uni.$off('watchAcceleration', this.gWatchBoxingAcc);
  534. uni.$on('watchAcceleration', this.gWatchBoxingAcc);
  535. }
  536. });
  537. }
  538. } else if (temp.funName == "unbindBoxingPost") {
  539. uni.$off('watchAcceleration', this.gWatchBoxingAcc);
  540. uni.$emit("unBindAcc", this.globalAcc);
  541. this.$store.state.globalAcc = null;
  542. } else if (temp.funName == "setAngleRatio") {
  543. if (gameData) {
  544. this.angleRatio = Number(gameData.angleRatio);
  545. console.log("this.angleRatio:", this.angleRatio);
  546. this.sendMessage("onSetAngleRatio", {
  547. angleRatio: this.angleRatio
  548. });
  549. }
  550. } else if (temp.funName == "bindHitBoxingPost") {
  551. /**
  552. * 返回拳击柱的绑定状态
  553. */
  554. console.log("bindHitBoxingPost");
  555. if (this.ConnectBindingDevice) {
  556. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  557. uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
  558. //hotman 沙袋情景
  559. this.gCreateSandbagAlgorithm();
  560. this.gStartSimulateBLEUpdate();
  561. return;
  562. }
  563. if (!this.BLEConnectDevice) return;
  564. //用设备来区分,开启什么加速计;
  565. if (this.BLEConnectDevice.deviceType == "BLEHandle" || this.BLEConnectDevice.deviceType ==
  566. "BLEIntelligent") {
  567. //处理蓝牙设备情况下
  568. //开启设备回调 3/4关闭
  569. this.onWriteBLEConnectionValue({
  570. value: "3"
  571. });
  572. // setTimeout(() => {
  573. // //设置加速计b:20ms a:10ms
  574. // this.onWriteBLEConnectionValue({
  575. // value: config.refreshRate
  576. // });
  577. // }, 2000)
  578. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  579. uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
  580. if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode ==
  581. "general") {
  582. //手机情景或者自由模式
  583. this._createEquipmentBasedOnBoxingPostHit();
  584. } else if (this.BLEConnectDevice.usageMode == "hotman") {
  585. //hotman 沙袋情景
  586. // this.gCreateFilterObj();
  587. this.gCreateSandbagAlgorithm();
  588. }
  589. } else if (this.BLEConnectDevice.deviceType == "mySelf") {
  590. //处理手机本身情况下
  591. if (this.globalAcc) {
  592. uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
  593. uni.$on('watchAcceleration', this.gWatchHitBoxingAcc);
  594. } else {
  595. //开启手机加速计
  596. uni.$emit("bindAcc", {
  597. callback: (accId) => {
  598. console.log("bindHitBoxingPost开启的:globalAcc=", accId);
  599. this.bGameOpenListen = true;
  600. this.$store.state.globalAcc = accId;
  601. uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
  602. uni.$on('watchAcceleration', this.gWatchHitBoxingAcc);
  603. if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice
  604. .usageMode == "general") {
  605. //手机情景或者自由模式
  606. this._createEquipmentBasedOnBoxingPostHit();
  607. } else if (this.BLEConnectDevice.usageMode == "hotman") {
  608. //hotman 沙袋情景 todo
  609. console.warn("没有处理手机加速计的 gCreateFilterObj");
  610. // this.gCreateFilterObj();
  611. }
  612. }
  613. });
  614. }
  615. } else if (this.BLEConnectDevice.deviceType == "BLERope") {
  616. //todo 开启跳绳模式
  617. this.B_OpenRopeSkipping();
  618. // this._createActionJumpOnBoxingPostHit();
  619. //监听蓝牙回调
  620. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  621. uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
  622. }
  623. } else if (temp.funName == "unbindHitBoxingPost") {
  624. /**
  625. * 解绑拳击柱的绑定状态
  626. */
  627. if (this.ConnectBindingDevice) {
  628. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  629. this.gStopSimulateBLEUpdate();
  630. return;
  631. }
  632. if (this.BLEConnectDevice && (this.BLEConnectDevice.deviceType == "BLEHandle" || this
  633. .BLEConnectDevice.deviceType == "BLEIntelligent")) {
  634. //开启设备回调 3/4关闭
  635. this.onWriteBLEConnectionValue({
  636. value: "4"
  637. });
  638. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  639. } else if (this.BLEConnectDevice && this.BLEConnectDevice.deviceType == "BLERope") {
  640. console.warn("unbindHitBoxingPost 还没设置关闭跳绳模式")
  641. this.onClearData();
  642. this.B_CloseRopeSkipping();
  643. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  644. } else {
  645. uni.$off('watchAcceleration', this.gWatchHitBoxingAcc);
  646. uni.$emit("unBindAcc", this.globalAcc);
  647. this.$store.state.globalAcc = null;
  648. }
  649. } else if (temp.funName == "closeGame") {
  650. uni.getCurrentSubNVue().hide('auto');
  651. } else if (temp.funName == "addQuitModal") {
  652. this.gameQuitListener = true;
  653. this.sendMessage("onQuitModalListener", {
  654. bListener: this.gameQuitListener
  655. });
  656. } else if (temp.funName == "removeQuitModal") {
  657. this.gameQuitListener = false;
  658. this.sendMessage("onQuitModalListener", {
  659. bListener: this.gameQuitListener
  660. });
  661. } else if (temp.funName == "writeBLEConnectionValue") {
  662. if (!gameData.value || gameData.value == "") return;
  663. if (!this.BLEConnectDevice) return;
  664. //蓝牙写入数据
  665. this.onWriteBLEConnectionValue(gameData);
  666. } else if (temp.funName == "log") {
  667. console.log(gameData);
  668. } else if (temp.funName == "addDeviceUpdateListener") {
  669. uni.$off('updateBLEDeviceData', this.BLECallback);
  670. uni.$on('updateBLEDeviceData', this.BLECallback);
  671. } else if (temp.funName == "closeDeviceUpdateListener") {
  672. uni.$off('updateBLEDeviceData', this.BLECallback);
  673. } else if (temp.funName == "addDeviceJsonUpdateListener") {
  674. uni.$off('updateBLEDeviceJson', this.BLEJsonCallback);
  675. uni.$on('updateBLEDeviceJson', this.BLEJsonCallback);
  676. } else if (temp.funName == "closeDeviceJsonUpdateListener") {
  677. uni.$off('updateBLEDeviceJson', this.BLEJsonCallback);
  678. }
  679. //获取手机原始陀螺仪和加速计数据
  680. else if (temp.funName == "onStartAccAndGyro") {
  681. this.bMyAttitudeListen = true;
  682. this.gStartSimulateBLEUpdate();
  683. //监听蓝牙回调
  684. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  685. uni.$on('updateBLEDeviceData', this.gWatchBLEUpdate);
  686. } else if (temp.funName == "onStopAccAndGyro") {
  687. this.bMyAttitudeListen = false;
  688. this.gStopSimulateBLEUpdate();
  689. //监听蓝牙回调
  690. uni.$off('updateBLEDeviceData', this.gWatchBLEUpdate);
  691. }
  692. },
  693. onPageStart: function(e) {
  694. // 监听页面加载成功
  695. this.PageStart = true;
  696. console.log("onPageStart==", e);
  697. setTimeout(() => {
  698. //加载成功后,显示
  699. uni.getCurrentSubNVue().show('fade-in', 250, () => {});
  700. }, 100)
  701. },
  702. onPageFinish: function(e) {
  703. console.log("onPageFinish==", e);
  704. },
  705. onError: function(e) {
  706. // 监听页面加载错误
  707. // this.error = this.url;
  708. console.error(e);
  709. },
  710. gWatchAcceleration: function(a) {
  711. this.sendMessage("onWatchAccelerometer", a);
  712. return;
  713. if (this.ConnectBindingDevice && this.ConnectBindingDevice.deviceType == 1) {
  714. this.sendMessage("onWatchAccelerometer", a);
  715. } else if (this.BLEConnectDevice && this.cIndex != -1) {
  716. this.sendMessage("onWatchAccelerometer", a);
  717. }
  718. },
  719. gWatchOrientation: function(o) {
  720. this.sendMessage("onWatchOrientation", o);
  721. return;
  722. if (this.ConnectBindingDevice && this.ConnectBindingDevice.deviceType == 1) {
  723. this.sendMessage("onWatchOrientation", o);
  724. } else if (this.BLEConnectDevice && this.cIndex != -1) {
  725. this.sendMessage("onWatchOrientation", o);
  726. }
  727. },
  728. //监听返回计算好的puch
  729. gWatchBoxingAcc: function(a) {
  730. if (this.ConnectBindingDevice && this.ConnectBindingDevice.deviceType == 1) {
  731. //计算返回 puch leftPunch rightPunch
  732. this.updateHitData(a);
  733. } else if (this.BLEConnectDevice && this.cIndex != -1) {
  734. this.updateHitData(a);
  735. }
  736. },
  737. //只返回一个hit状态
  738. gWatchHitBoxingAcc: function(a) {
  739. if (this.ConnectBindingDevice && this.ConnectBindingDevice.deviceType == 1) {
  740. //计算返回 puch leftPunch rightPunch
  741. this.EquipmentActionObj.updateAcc({
  742. xA: a.xAxis,
  743. zA: a.yAxis,
  744. yA: a.zAxis
  745. })
  746. } else if (this.cIndex != -1 && this.BLEConnectDevice != null) {
  747. if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode == "general") {
  748. this.EquipmentActionObj.updateAcc({
  749. xA: a.xAxis,
  750. zA: a.yAxis,
  751. yA: a.zAxis,
  752. bLimitRebound: false
  753. })
  754. } else if (this.BLEConnectDevice.usageMode == "hotman") {
  755. //hotman 沙袋情景 todo
  756. //后面处理手机加速计的数据
  757. }
  758. }
  759. },
  760. gWatchBLEUpdate: function(data) {
  761. //如果是模块外面触发,需要离线打包
  762. if (this.bMyAttitudeListen) {
  763. this.sendMessage("updateAccAndGyro", data);
  764. return;
  765. }
  766. if (this.ConnectBindingDevice) {
  767. //hotman 沙袋情景 todo
  768. this.gUpdateSandbagAlgorithm({
  769. data: data,
  770. callback: (res) => {
  771. // console.log(res);
  772. if (res.type == 'hit') {
  773. // console.log('gUpdateFilter callback:',res)
  774. //记录打击次数
  775. this.addSandbagHitCount({
  776. count: 1
  777. });
  778. let temp = {
  779. direction: res.direction,
  780. angle: res.angle,
  781. name: res.name,
  782. ename: res.ename,
  783. value: res.hit,
  784. mass: 10, //质量
  785. hitPower: res.hit, //计算的力
  786. //新增类型
  787. sendType: "ConnectBindingDevice",
  788. type: "none"
  789. }
  790. this.sendMessage("onBoxingPostHit", temp);
  791. }
  792. }
  793. });
  794. return;
  795. }
  796. if (this.BLEConnectDevice.usageMode == "phone" || this.BLEConnectDevice.usageMode == "general") {
  797. //手机情景或者自由模式
  798. let {
  799. ax,
  800. ay,
  801. az
  802. } = data.acc;
  803. //this.BLEConnectDevice.limitType == "rebound"
  804. //这里是监听 _createEquipmentBasedOnBoxingPostHit 回调
  805. this.EquipmentActionObj.updateTriaxialAcc({
  806. xA: ax * 9.80665,
  807. zA: ay * 9.80665,
  808. yA: az * 9.80665,
  809. bLimitRebound: false
  810. })
  811. } else if (this.BLEConnectDevice.usageMode == "hotman") {
  812. if(this.BLEConnectDevice.deviceType == "BLEIntelligent"){
  813. //智能hotman 沙袋情景
  814. this.gIntelligentUpdateSandbagAlgorithm({
  815. data: data,
  816. callback: (res) => {
  817. // console.log(res);
  818. if (res.type == 'hit') {
  819. // console.log('gUpdateFilter callback:',res)
  820. //记录打击次数
  821. this.addSandbagHitCount({
  822. count: 1
  823. });
  824. let temp = {
  825. direction: res.direction,
  826. angle: res.angle,
  827. name: res.name,
  828. ename: res.ename,
  829. value: res.hit,
  830. mass: 10, //质量
  831. hitPower: res.hit, //计算的力
  832. //新增类型
  833. sendType: "hotman",
  834. type: "none"
  835. }
  836. this.sendMessage("onBoxingPostHit", temp);
  837. }
  838. }
  839. });
  840. }else{
  841. //hotman 沙袋情景 todo
  842. this.gUpdateSandbagAlgorithm({
  843. data: data,
  844. callback: (res) => {
  845. // console.log(res);
  846. if (res.type == 'hit') {
  847. // console.log('gUpdateFilter callback:',res)
  848. //记录打击次数
  849. this.addSandbagHitCount({
  850. count: 1
  851. });
  852. let temp = {
  853. direction: res.direction,
  854. angle: res.angle,
  855. name: res.name,
  856. ename: res.ename,
  857. value: res.hit,
  858. mass: 10, //质量
  859. hitPower: res.hit, //计算的力
  860. //新增类型
  861. sendType: "hotman",
  862. type: "none"
  863. }
  864. this.sendMessage("onBoxingPostHit", temp);
  865. }
  866. }
  867. });
  868. }
  869. } else if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  870. //跳绳蓝牙反馈
  871. this.onBLERopeUpdate(data);
  872. }
  873. },
  874. updateHitData(a) {
  875. this.xA = a.xAxis;
  876. this.yA = a.yAxis;
  877. this.zA = a.zAxis;
  878. if (Math.abs(this.xA) > 8 && this.oldxA != this.xA && !this.bCalculation) {
  879. this.xAccArray.push(this.xA);
  880. this.oldxA = this.xA;
  881. if (this.calTimeout == null) {
  882. this.calTimeout = setTimeout(() => {
  883. this.bCalculation = true;
  884. for (let i = 0; i < this.xAccArray.length; i++) {
  885. if (this.xAccArray[i] < 0 && this.xAccArray[i] < this.xAccArray[this.xMin]) {
  886. this.xMin = i;
  887. } else if (this.xAccArray[i] > 0 && this.xAccArray[i] > this.xAccArray[this
  888. .xMax]) {
  889. this.xMax = i;
  890. }
  891. }
  892. console.log(this.xAccArray, "==", this.xMin, "==", this.xMax);
  893. if (this.xAccArray[this.xMin] < 0 && this.xAccArray[this.xMax] > 0) {
  894. if (this.xMin > this.xMax)
  895. this.onHit("xRCount", "左勾拳", "leftPunch", this.xAccArray[this.xMin], Math.ceil(
  896. Math.abs(this.xAccArray[this.xMin]) *
  897. puchConfig.BOXING_MASS));
  898. else if (this.xMin < this.xMax)
  899. this.onHit("xLCount", "右勾拳", "rightPunch", this.xAccArray[this.xMax], Math
  900. .ceil(Math.abs(this.xAccArray[this
  901. .xMax]) * puchConfig.BOXING_MASS));
  902. } else if (this.xAccArray[this.xMin] < 0) {
  903. this.onHit("xLCount", "右勾拳", "rightPunch", this.xAccArray[this.xMin], Math.ceil(
  904. Math.abs(this.xAccArray[this.xMin]) *
  905. puchConfig.BOXING_MASS));
  906. } else if (this.xAccArray[this.xMax] > 0) {
  907. this.onHit("xRCount", "左勾拳", "leftPunch", this.xAccArray[this.xMax], Math.ceil(Math
  908. .abs(this.xAccArray[this.xMax]) *
  909. puchConfig.BOXING_MASS));
  910. }
  911. setTimeout(() => {
  912. this.onResetCal();
  913. }, 100);
  914. this.calTimeout = null;
  915. }, 200);
  916. }
  917. } else if (this.zA < -10 && this.oldzA != this.zA && this.xAccArray.length == 0) {
  918. console.log("this.zA:", this.zA);
  919. this.oldzA = this.zA;
  920. setTimeout(() => {
  921. this.onResetCal();
  922. }, 200);
  923. this.onHit("zLCount", "直拳", "punch", this.zA, Math.ceil(Math.abs(this.zA) * puchConfig.BOXING_MASS));
  924. }
  925. },
  926. onHit(direction, name, ename, direValue, power) {
  927. // console.log(direction, direValue, power);
  928. let temp = {
  929. direction: direction,
  930. angle: 0,
  931. name: name,
  932. ename: ename,
  933. value: direValue,
  934. mass: this.mass, //质量
  935. hitPower: power, //计算的力
  936. //新增类型
  937. sendType: "BindBoxingPost",
  938. type: "none"
  939. }
  940. this.sendMessage("onBoxingPostHit", temp);
  941. },
  942. onResetCal() {
  943. this.xAccArray = [];
  944. this.xMax = 0;
  945. this.xMin = 0;
  946. this.bCalculation = false;
  947. this.oldxA = 0;
  948. this.oldzA = 0;
  949. this.calTimeout = null;
  950. },
  951. //创建一个 打击对象
  952. _createEquipmentBasedOnBoxingPostHit() {
  953. this.EquipmentActionObj = new EquipmentAction();
  954. this.EquipmentActionObj.addEventListener("resultantHit", (e) => {
  955. console.log(e);
  956. let temp = {
  957. direction: "allCount",
  958. angle: 0,
  959. name: "击中",
  960. ename: "hit",
  961. value: e.acc,
  962. mass: e.mass, //质量
  963. hitPower: e.power, //计算的力
  964. //新增类型
  965. sendType: "EquipmentActionObj",
  966. type: "none"
  967. }
  968. this.sendMessage("onBoxingPostHit", temp);
  969. })
  970. },
  971. /**
  972. * 创建一个 跳识别对象
  973. * @deprecated 此方法废弃,将使用c语音识别算法。
  974. */
  975. _createActionJumpOnBoxingPostHit() {
  976. this.actionJumpObj = new ActionJump();
  977. this.actionJumpObj.addEventListener('resultant', (e) => {
  978. let temp = {
  979. direction: "all",
  980. angle: 0,
  981. name: "击中", // this.BLEConnectDevice.name,
  982. ename: "hit", //this.BLEConnectDevice.ename,
  983. value: 10,
  984. mass: 10, //质量
  985. hitPower: 10, //计算的力
  986. //新增类型
  987. sendType: "ActionJumpObj",
  988. type: "none"
  989. }
  990. if (e.type == 'stateDataOfJump') {
  991. // console.log("game stateDataOfJump");
  992. this.sendMessage("onBoxingPostHit", temp);
  993. } else if (e.type == 'stop') {
  994. // console.log("game stop");
  995. this.onClearData();
  996. }
  997. })
  998. },
  999. /**
  1000. * @param {Object} gameData
  1001. * 识别跳部分数据处理
  1002. */
  1003. onBLERopeUpdate(gameData) {
  1004. //调用识别算法
  1005. this.jumpIdenModule_onJump6AxisDataUpdate({
  1006. data: {
  1007. hex: gameData.hex
  1008. },
  1009. callback: (res) => {
  1010. if (res.code == 0) {
  1011. if (res.tag != -1) {
  1012. // this.jumpIdenModule_listenStateDataOfJump(res);
  1013. /**
  1014. * @deprecated
  1015. */
  1016. let temp = {
  1017. direction: "all",
  1018. angle: 0,
  1019. name: "跳", // this.BLEConnectDevice.name,
  1020. ename: "hit", //this.BLEConnectDevice.ename,
  1021. value: 0, //
  1022. mass: 0, //质量
  1023. hitPower: 0, //计算的力
  1024. //新增类型
  1025. sendType: "RopeSkipping",
  1026. type: "none",
  1027. angle: res.tag, //返回一个 tag方向
  1028. }
  1029. switch (res.tag) {
  1030. case 0:
  1031. //JumpType.NORMAL = 0
  1032. temp.type = "normal";
  1033. break;
  1034. case 1:
  1035. //right jump
  1036. temp.type = "right";
  1037. break;
  1038. case 2:
  1039. //left jump
  1040. temp.type = "left";
  1041. break;
  1042. case 3:
  1043. //right rotate jump
  1044. temp.type = "right_rotate";
  1045. break;
  1046. case 4:
  1047. //left rotate jump
  1048. temp.type = "left_rotate";
  1049. break;
  1050. default:
  1051. break;
  1052. }
  1053. this.sendMessage("onBoxingPostHit", temp);
  1054. // uni.showToast({
  1055. // title: res.tag + ',' + res.msg,
  1056. // icon: 'none',
  1057. // duration: 1000,
  1058. // mask: true
  1059. // })
  1060. }
  1061. }
  1062. }
  1063. });
  1064. //********陀螺仪角速度********
  1065. let {
  1066. gx,
  1067. gy,
  1068. gz
  1069. } = gameData.gyro;
  1070. let {
  1071. min,
  1072. s,
  1073. ms
  1074. } = gameData;
  1075. //-gameData.acc.ax * 10;
  1076. let _ax = gameData.acc.ax * 10;
  1077. let _ay = gameData.acc.ay * 10;
  1078. let _az = gameData.acc.az * 10;
  1079. //低通滤波分离重力
  1080. let alpha = 0.8;
  1081. this.xA = alpha * this.xA + (1 - alpha) * _ax;
  1082. this.yA = alpha * this.yA + (1 - alpha) * _ay;
  1083. this.zA = alpha * this.zA + (1 - alpha) * _az;
  1084. //高通滤波获取线性速度
  1085. let linear_acceleration_x = _ax - this.xA;
  1086. let linear_acceleration_y = _az - this.zA;
  1087. let linear_acceleration_z = _ay - this.yA;
  1088. // let _temp = {
  1089. // linearAcc: {
  1090. // lAccX: linear_acceleration_x,
  1091. // lAccY: linear_acceleration_y,
  1092. // lAccZ: linear_acceleration_z
  1093. // }, //gameData.acc,
  1094. // oriAcc: {
  1095. // oAccX: _ax,
  1096. // oAccY: _ay,
  1097. // oAccZ: _az
  1098. // },
  1099. // gravityAcc: {
  1100. // gravityX: this.xA,
  1101. // gravityY: this.yA,
  1102. // gravityZ: this.zA
  1103. // },
  1104. // bLimitRebound: false,
  1105. // resultant: Math.sqrt(_ax * _ax +
  1106. // _ay * _ay + _az * _az),
  1107. // runIndex: this.BLEAccIndex,
  1108. // //陀螺仪
  1109. // oriGyro: {
  1110. // oGyroX: gx,
  1111. // oGyroY: gy,
  1112. // oGyroZ: gz
  1113. // },
  1114. // //输入当前轴,旧设备使用Y轴,即为true
  1115. // bYAxis: this.bOldDeviceType ? true : false,
  1116. // };
  1117. // this.actionJumpObj.updateJump(_temp);
  1118. this.BLEAccIndex++;
  1119. },
  1120. onClearData() {
  1121. this.BLEAccIndex = 0;
  1122. },
  1123. }
  1124. }
  1125. </script>
  1126. <style>
  1127. /* #ifdef APP-PLUS */
  1128. .web-view {
  1129. flex: 1;
  1130. flex-direction: column;
  1131. /* background-color: #007AFF; */
  1132. }
  1133. .web-view-child {
  1134. width: 750rpx;
  1135. flex: 1;
  1136. }
  1137. /* #endif */
  1138. /* #ifdef H5 */
  1139. .web-view {
  1140. display: flex;
  1141. flex-direction: column;
  1142. position: absolute;
  1143. bottom: 0;
  1144. top: 0;
  1145. left: 0;
  1146. right: 0;
  1147. }
  1148. .web-view-child {
  1149. position: relative;
  1150. width: 100%;
  1151. height: 100%;
  1152. }
  1153. /* #endif */
  1154. .sendMessage {
  1155. width: 300rpx;
  1156. position: fixed;
  1157. bottom: 100rpx;
  1158. left: 50rpx;
  1159. }
  1160. .web-back {
  1161. position: fixed;
  1162. top: 40px;
  1163. right: 20px;
  1164. width: 160rpx;
  1165. height: 80rpx;
  1166. border-radius: 45px;
  1167. /* border: 1px solid #FFFFFF; */
  1168. /* box-shadow: 0px 0px 1px #FFFFFF; */
  1169. background-color: rgba(0, 0, 0, 1);
  1170. opacity: 0.5;
  1171. /* #ifndef APP-PLUS-NVUE */
  1172. /* z-Index: 999; */
  1173. display: flex;
  1174. /* #endif */
  1175. justify-content: center;
  1176. align-items: center;
  1177. }
  1178. </style>