guide.nvue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <view class="guide-wrapper">
  3. <view v-if="currentType == 'level-button-tip'" class="guide-container position-relative"
  4. @click="buttonMessage('confirm',$event)">
  5. <!-- top: 55px; 相当于 上间隔 -->
  6. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  7. <!-- 中心位置 225 -->
  8. <view style="width: 750rpx;height: 231px;">
  9. <view style="height: 200px;" class="mask-bg-07">
  10. <view class="position-absolute-center" style="top: 0;left:100rpx;">
  11. <image style="width: 488rpx;height: 366rpx;"
  12. src="../../../static/modal/level-tip/level-tip-box@2x.png">
  13. </image>
  14. </view>
  15. <view class="position-absolute-center">
  16. <text class="text-white text-14px text-lines2"
  17. style="top: -80rpx;left:70rpx; width: 300rpx;">点击此按钮选择关卡</text>
  18. <view v-if="hiddenType != 'firstInstallation' && hiddenType != 'normal'"
  19. class="flex flex-direction-row" style="top: -50rpx;left:50rpx;" @click="switchSelected()">
  20. <image v-if="!isSelected" style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  21. src="../../../static/common/subNVue/guide/check-box.png"></image>
  22. <image v-else style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  23. src="../../../static/common/subNVue/guide/check-box-selected.png"></image>
  24. <text class="text-15px text-white">不再提示</text>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- <view style="width: 750rpx;height: 82rpx;" class="flex flex-direction-row">
  29. <view class="flex-sub mask-bg-07"></view>
  30. <view class="position-relative justify-center align-center"
  31. style="width: 147px;height: 82rpx; background-color: rgba(0,0,0,0.7);">
  32. <image style="width: 147px;height: 31px;" class="position-absolute-center"
  33. src="../../../static/modal/level-tip/level-tip-bg@2x.png"></image>
  34. <image style="width: 30px;height: 23px; "
  35. src="../../../static/modal/level-tip/level-tip-logo@2x.png"></image>
  36. </view>
  37. <view class="flex-sub mask-bg-07"></view>
  38. </view> -->
  39. <view style="width: 750rpx;height: 82rpx;" class="flex flex-direction-row">
  40. <view class="flex-sub mask-bg-07"></view>
  41. <view class="position-relative align-center"
  42. style="width: 248rpx;height: 104rpx; background-color: rgba(0,0,0,0.7);">
  43. <image class="position-absolute-center" style="width: 248rpx;height: 104rpx; top: 18rpx;"
  44. src="../../../static/modal/level-tip/level-tip-bg-orange.png"></image>
  45. <view
  46. style="margin-top: 38rpx; width: 72rpx; height: 12rpx; background-color: #FFFFFF; border-radius: 18px;">
  47. </view>
  48. </view>
  49. <view class="flex-sub mask-bg-07"></view>
  50. </view>
  51. </view>
  52. <!-- 计算剩余空白 -->
  53. <view class="mask-bg-07 flex-sub"></view>
  54. </view>
  55. <view v-if="currentType == 'device-tip'"
  56. class="guide-container justify-center align-center position-relative mask-bg-07"
  57. @click="buttonMessage('confirm',$event)">
  58. <view class="mid">
  59. <image class="bind-tip-image" src="../../../static/modal/tip/bind-tip-bg.png"></image>
  60. <text class="text-16px text-center text-white"
  61. style="width: 500rpx;margin-bottom: 130rpx;">请将手柄十字键朝上插入绑带中,佩戴在右侧小腿侧面</text>
  62. <view v-if="hiddenType != 'firstInstallation'" class="flex flex-direction-row"
  63. @click="switchSelected()">
  64. <image v-if="!isSelected" style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  65. src="../../../static/common/subNVue/guide/check-box.png"></image>
  66. <image v-else style="width: 40rpx;height: 40rpx; margin-right: 20rpx;"
  67. src="../../../static/common/subNVue/guide/check-box-selected.png"></image>
  68. <text class="text-15px text-white">不再提示</text>
  69. </view>
  70. </view>
  71. </view>
  72. <view v-if="currentType == 'plan'" class="guide-container position-relative" @click="buttonMessage('confirm',$event)">
  73. <!-- top: 55px; 相当于 上间隔 -->
  74. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  75. <!-- 中心位置 225 -->
  76. <view style="width: 750rpx;height: 284px;">
  77. <view style="height: 220px;" class="mask-bg-07">
  78. <view class="position-absolute-center-bottom">
  79. <image style="width: 488rpx;height: 366rpx;"
  80. src="../../../static/common/subNVue/guide/guide-plan@3x.png">
  81. </image>
  82. </view>
  83. <view class="position-absolute-center">
  84. <!-- left:40rpx; -->
  85. <text class="text-white text-14px text-lines2"
  86. style="top: 20rpx; left:40rpx; width: 300rpx;">请先定制属于您的专属计划</text>
  87. </view>
  88. </view>
  89. <view style="width: 750rpx;height: 100px;" class="flex flex-direction-row">
  90. <!-- 32+ 60/2 原本长度62px,去除游戏和视频长度 + 72 左右,设置 134 px-->
  91. <view :style="{width: guideRectLeft+'px'}" class="mask-bg-07"></view>
  92. <image style="width: 90px;height: 100px; opacity: 0.7;"
  93. src="../../../static/common/subNVue/guide/guide-rect-mask.png"></image>
  94. <view class="mask-bg-07 flex-sub"></view>
  95. </view>
  96. </view>
  97. <!-- 计算剩余空白 -->
  98. <view class="mask-bg-07 flex-sub"></view>
  99. </view>
  100. <view v-if="currentType == 'actionJumpPlay'" class="guide-container position-relative"
  101. @click="buttonMessage('confirm',$event)">
  102. <!-- top: 55px; 相当于 上间隔 -->
  103. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  104. <!-- 中心位置 275 -->
  105. <view style="width: 750rpx;height: 350px;">
  106. <view style="height: 200px;" class="mask-bg-07">
  107. <view class="position-absolute-center" style="top: 0;left:100rpx;">
  108. <image style="width: 488rpx;height: 366rpx;"
  109. src="../../../static/common/subNVue/guide/guide-mid.png">
  110. </image>
  111. </view>
  112. <view class="position-absolute-center">
  113. <text class="text-white text-14px" style="top: -30rpx;left:80rpx;">点击播放体验关卡对应关卡</text>
  114. </view>
  115. </view>
  116. <view style="width: 750rpx;height: 150px;" class="flex flex-direction-row">
  117. <view style="width: 166rpx;" class="mask-bg-07"></view>
  118. <image style="width: 200px;height: 200px; opacity: 0.7;top: -63rpx;"
  119. src="../../../static/common/subNVue/guide/guide-circle-mask.png"></image>
  120. <view class="mask-bg-07 flex-sub"></view>
  121. </view>
  122. </view>
  123. <!-- 计算剩余空白 -->
  124. <view class="mask-bg-07 flex-sub"></view>
  125. </view>
  126. <view v-if="currentType == 'bluetoothConnect'" class="guide-container position-relative"
  127. @click="buttonMessage('confirm',$event)">
  128. <!-- top: 55px; 相当于 上间隔 -->
  129. <view class="mask-bg-07" :style="{height:guideHeight+'px'}"></view>
  130. <!-- 中心位置 225 -->
  131. <view style="width: 750rpx;height: 764rpx;">
  132. <view style="height: 596rpx;" class="mask-bg-07">
  133. <view class="position-absolute-center-bottom" style="left:31rpx;">
  134. <image style="width: 442rpx;height: 372rpx;"
  135. src="../../../static/common/subNVue/guide/guide-bluetooth@3x.png">
  136. </image>
  137. </view>
  138. <view class="position-absolute-center">
  139. <text class="text-white text-14px" style="left: 20px;top: 50px;">请先连接蓝牙设备</text>
  140. <!-- <text class="text-left text-white text-14px"
  141. style="width: 542rpx;">1、长按开关键3秒,绿灯连续闪烁为可连接状态.</text>
  142. <text class="text-left text-white text-14px" style="width: 542rpx;">2、选择设备类型进行连接.</text>
  143. <text class="text-left text-white text-14px"
  144. style="width: 542rpx;">3、手柄连接成功后,将手柄十字键朝上插入绑带中.</text>
  145. <text class="text-left text-white text-14px" style="width: 542rpx;">4、用绑带将手柄朝上绑在右脚脚踝上.</text>
  146. -->
  147. </view>
  148. </view>
  149. <view style="width: 750rpx;height: 168rpx;" class="flex flex-direction-row">
  150. <!-- 这里width 当做 left -->
  151. <view class="mask-bg-07" :style="{width:guideLeft+'px'}"></view>
  152. <image style="width: 100px;height: 100px; opacity: 0.7;top: -12px;"
  153. src="../../../static/common/subNVue/guide/guide-circle-mask.png"></image>
  154. <view class="mask-bg-07 flex-sub"></view>
  155. </view>
  156. </view>
  157. <!-- 计算剩余空白 -->
  158. <view class="mask-bg-07 flex-sub"></view>
  159. </view>
  160. <view v-if="currentType == 'level-game-tip'"
  161. class="guide-container justify-center align-center position-relative mask-bg-07"
  162. @click="buttonMessage('confirm',$event)">
  163. <view class="game-mid">
  164. <view style="height: 278rpx;width: 750rpx;" class="position-relative">
  165. <view class="position-absolute-center" style="top: 0;left:0rpx;">
  166. <image style="width: 442rpx;height: 278rpx;"
  167. src="../../../static/common/subNVue/guide/level-game-title@2x.png"></image>
  168. </view>
  169. <view class="position-absolute-center">
  170. <text class="text-white text-14px"
  171. style="top: 0rpx;left:20rpx;">{{unlockLevelInfo.title}}</text>
  172. </view>
  173. </view>
  174. <view class="flex flex-direction-row align-center justify-center margin-17px">
  175. <text class="game-number">1</text>
  176. <text class="text-16px text-left text-white "
  177. style="width:476rpx;">{{unlockLevelInfo.firstText}}</text>
  178. </view>
  179. <image
  180. :style="{ width: unlockLevelInfo.firstWidth + 'rpx', height: unlockLevelInfo.firstHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.firstDirection +')' }"
  181. :src="unlockLevelInfo.firstImage"></image>
  182. <view v-if="!unlockLevelInfo.secondHidden"
  183. class="flex flex-direction-row align-center justify-center margin-17px">
  184. <text class="game-number">2</text>
  185. <text class="text-16px text-left text-white "
  186. style="width:476rpx;">{{unlockLevelInfo.secondText}}</text>
  187. </view>
  188. <image v-if="!unlockLevelInfo.secondHidden"
  189. :style="{ width: unlockLevelInfo.secondWidth + 'rpx', height: unlockLevelInfo.secondHeight + 'rpx' ,transform:'scaleX('+unlockLevelInfo.secondDirection +')' }"
  190. :src="unlockLevelInfo.secondImage">
  191. </image>
  192. <!-- <image style="width: 232rpx;height: 78rpx;margin-top: 48rpx;"
  193. src="../../../static/common/subNVue/guide/level-game-next@2x.png"></image>
  194. -->
  195. </view>
  196. </view>
  197. </view>
  198. </template>
  199. <script>
  200. import {
  201. mapState,
  202. mapMutations
  203. } from 'vuex';
  204. export default {
  205. computed: mapState(['systemInfo', 'navHeight', 'tabbarHeight','versionCodeState']),
  206. data() {
  207. return {
  208. //防止点击
  209. bShowComplete:false,
  210. title: '',
  211. content: '',
  212. lists: [],
  213. isSelected: false,
  214. currentType: 'none',
  215. /**
  216. * 隐藏guide时候,随后的操作类型
  217. */
  218. hiddenType: 'none',
  219. operationItem: null,
  220. guideHeight: 55,
  221. guideLeft: 166,
  222. //三个关卡的对应信息
  223. unlockLevelInfo: {
  224. title: '',
  225. firstText: '',
  226. firstImage: '',
  227. firstWidth: 0,
  228. firstHeight: 0,
  229. secondText: '',
  230. secondImage: '',
  231. secondWidth: 0,
  232. secondHeight: 0,
  233. secondHidden: false
  234. },
  235. midJumpInfo: {
  236. title: '解锁向上跳',
  237. // firstText: '请先确保手柄已经连接成功。',
  238. // firstImage: '../../../static/common/subNVue/guide/level-game-fab@2x.png',
  239. firstText: '通过向上跳的方式消除标志块',
  240. firstImage: '../../../static/modal/action-jump/midJumpWhite.png',
  241. firstDirection: 1,
  242. firstWidth: 68, //102,
  243. firstHeight: 68, //108,
  244. secondText: '通过向上跳的方式消除标志块',
  245. secondImage: '../../../static/modal/action-jump/midJumpWhite.png',
  246. secondDirection: 1,
  247. secondWidth: 68,
  248. secondHeight: 68,
  249. secondHidden: true,
  250. },
  251. directionJumpInfo: {
  252. title: '解锁左右跳',
  253. firstText: '此为左跳图标,通过向左跳的方式消除标志块',
  254. firstImage: '../../../static/modal/action-jump/directionJumpWhite-left.png',
  255. firstDirection: 1,
  256. firstWidth: 68,
  257. firstHeight: 68,
  258. secondText: '此为右跳图标,通过向右跳的方式消除标志块',
  259. secondImage: '../../../static/modal/action-jump/directionJumpWhite-right.png',
  260. secondDirection: 1,
  261. secondWidth: 68,
  262. secondHeight: 68,
  263. secondHidden: false
  264. },
  265. rotationJumpInfo: {
  266. title: '解锁左右旋跳',
  267. firstText: '此为左旋跳图标,通过向左旋跳的方式消除标志块',
  268. firstImage: '../../../static/modal/action-jump/rotateJumpWhite-left.png',
  269. firstDirection: 1,
  270. firstWidth: 68,
  271. firstHeight: 68,
  272. secondText: '此为右旋跳图标,通过向右旋跳的方式消除标志块',
  273. secondImage: '../../../static/modal/action-jump/rotateJumpWhite-right.png',
  274. secondDirection: 1,
  275. secondWidth: 68,
  276. secondHeight: 68,
  277. secondHidden: false
  278. },
  279. guideRectLeft:62
  280. }
  281. },
  282. created() {
  283. console.error('*********一个guide created')
  284. const vm = this;
  285. uni.$on('guide-popup', (data) => {
  286. vm.bShowComplete = true;
  287. console.log("vm.bShowComplete 1=:",vm.bShowComplete);
  288. setTimeout(()=>{
  289. vm.bShowComplete = false;
  290. console.log("vm.bShowComplete 2=:",vm.bShowComplete);
  291. },300)
  292. vm.title = data.title;
  293. vm.content = data.content;
  294. vm.currentType = data.type || 'none';
  295. vm.operationItem = data.operationItem;
  296. let _viewData = data.item;
  297. if(vm.versionCodeState.showGame&&vm.versionCodeState.showVideo){
  298. vm.guideRectLeft = 62;
  299. }else if(vm.versionCodeState.showGame||vm.versionCodeState.showVideo){
  300. vm.guideRectLeft = 89;
  301. }else {
  302. vm.guideRectLeft = 134;
  303. }
  304. //获取类型
  305. vm.hiddenType = (_viewData && _viewData.hiddenType) || 'none';
  306. console.log("初始化时候hidden类型:", vm.hiddenType);
  307. if (vm.currentType == "actionJumpPlay") {
  308. // _viewData.height/4 = 27.5
  309. vm.guideHeight = _viewData.top + _viewData.height - _viewData.height / 4 - vm.systemInfo
  310. .statusBarHeight - 275;
  311. } else if (vm.currentType == "bluetoothConnect") {
  312. //+ _viewData.height - _viewData.height / 4 - vm.systemInfo.statusBarHeight
  313. vm.guideHeight = _viewData.top - 298;
  314. vm.guideLeft = _viewData.left - _viewData.width / 2 + 5;
  315. } else if (vm.currentType == "plan") {
  316. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32;
  317. // vm.guideLeft = 55;
  318. } else if (vm.currentType == "level-button-tip") {
  319. //首页提示选择关卡
  320. vm.guideHeight = vm.systemInfo.screenHeight - 284 - 32 + 3 + 6;
  321. const value = uni.getStorageSync('levelButtonPrompt');
  322. if (value) {
  323. vm.isSelected = value.isSelected;
  324. } else {
  325. vm.isSelected = false;
  326. }
  327. } else if (vm.currentType == "device-tip") {
  328. //提示绑带
  329. const value = uni.getStorageSync('deviceDirectionPrompt');
  330. if (value) {
  331. vm.isSelected = value.isSelected;
  332. } else {
  333. vm.isSelected = false;
  334. }
  335. } else if (vm.currentType == "level-game-tip") {
  336. if (_viewData.levelType == 'midJump') {
  337. vm.unlockLevelInfo = Object.assign({}, vm.midJumpInfo);
  338. } else if (_viewData.levelType == 'directionJump') {
  339. vm.unlockLevelInfo = Object.assign({}, vm.directionJumpInfo);
  340. } else if (_viewData.levelType == 'rotationJump') {
  341. vm.unlockLevelInfo = Object.assign({}, vm.rotationJumpInfo);
  342. }
  343. }
  344. })
  345. },
  346. beforeDestroy() {
  347. uni.$off('guide-popup')
  348. },
  349. methods: {
  350. switchSelected() {
  351. console.log('switchSelected', this.isSelected, !this.isSelected);
  352. this.isSelected = !this.isSelected;
  353. uni.$emit('guide-popup-page', {
  354. type: 'selected',
  355. messageType: this.currentType,
  356. isSelected: this.isSelected,
  357. operationItem: this.operationItem
  358. })
  359. // if (this.isSelected) {
  360. // uni.setStorage({
  361. // key: 'deviceDirectionPrompt',
  362. // data: {
  363. // isSelected: true
  364. // }
  365. // })
  366. // } else {
  367. // uni.setStorage({
  368. // key: 'deviceDirectionPrompt',
  369. // data: {
  370. // isSelected: false
  371. // }
  372. // })
  373. // }
  374. },
  375. buttonMessage(buttonEvent,e) {
  376. e.stopPropagation();
  377. if(this.bShowComplete)return;
  378. this.bShowComplete = true;
  379. console.log('关闭2')
  380. setTimeout(() => {
  381. const subNVue = uni.getCurrentSubNVue()
  382. uni.$emit('guide-popup-page', {
  383. type: 'button',
  384. messageType: this.currentType,
  385. hiddenType: this.hiddenType,
  386. confirm: buttonEvent == 'confirm' ? true : false,
  387. cancel: buttonEvent == 'cancel' ? true : false,
  388. info: buttonEvent + ' 该元素被点击了!',
  389. operationItem: this.operationItem
  390. })
  391. }, 260);
  392. this.hidePupup();
  393. },
  394. hidePupup() {
  395. uni.getCurrentSubNVue().hide('auto', 250);
  396. }
  397. }
  398. }
  399. </script>
  400. <style scoped lang="scss">
  401. .guide-wrapper {
  402. justify-content: center;
  403. align-items: center;
  404. }
  405. .guide-container {
  406. /* background-color: rgba(0, 0, 0, 0.3); */
  407. width: 750rpx;
  408. flex: 1;
  409. }
  410. .transparents-container {}
  411. .mid {
  412. justify-content: center;
  413. align-items: center;
  414. height: 700rpx;
  415. width: 300rpx;
  416. }
  417. .game-mid {
  418. justify-content: center;
  419. align-items: center;
  420. height: 850rpx;
  421. width: 750rpx;
  422. }
  423. .bind-tip-image {
  424. border-width: 14rpx;
  425. border-style: solid;
  426. border-color: #E5E5FF;
  427. background-color: #FFFFFF;
  428. width: 226rpx;
  429. height: 260rpx;
  430. margin-bottom: 50rpx;
  431. }
  432. .title {
  433. height: 100rpx;
  434. line-height: 100rpx;
  435. border-bottom-style: solid;
  436. border-bottom-width: 1rpx;
  437. border-bottom-color: #CBCBCB;
  438. flex: 0;
  439. font-size: 30rpx;
  440. }
  441. .scroller {
  442. height: 400rpx;
  443. padding: 8rpx 15rpx;
  444. }
  445. .content {
  446. color: #555555;
  447. font-size: 32rpx;
  448. }
  449. .message-wrapper {
  450. flex: 0;
  451. border-top-style: solid;
  452. border-top-width: 1rpx;
  453. border-top-color: #CBCBCB;
  454. height: 80rpx;
  455. align-items: flex-end;
  456. }
  457. .send-message {
  458. font-size: 30rpx;
  459. line-height: 80rpx;
  460. color: #00CE47;
  461. margin-left: 20rpx;
  462. }
  463. .cell {
  464. margin: 10rpx;
  465. padding: 20rpx 0;
  466. top: 10rpx;
  467. align-items: center;
  468. justify-content: center;
  469. border-radius: 10rpx;
  470. background-color: #5989B9;
  471. }
  472. .text {
  473. font-size: 30rpx;
  474. text-align: center;
  475. color: white;
  476. }
  477. .circle {
  478. width: 50px;
  479. height: 50px;
  480. border-width: 1rpx;
  481. border-color: #FF0000;
  482. border-style: solid;
  483. border-radius: 50%;
  484. position: absolute;
  485. top: 200rpx;
  486. left: 200rpx;
  487. background-color: rgba(255, 255, 255, 0);
  488. /* box-sizing: border-box; */
  489. }
  490. .su {
  491. position: relative;
  492. width: 750px;
  493. flex: 1;
  494. border-width: 1rpx;
  495. border-color: #FF0000;
  496. border-style: solid;
  497. }
  498. .lk {
  499. position: absolute;
  500. width: 100px;
  501. height: 200px;
  502. /* border-radius: 10px; */
  503. // border-width: 10px;
  504. // border-color: rgba(0, 0, 0, 0.4);
  505. // border-style: solid;
  506. border-top-color: #000000;
  507. border-top-width: 10px;
  508. border-bottom: 1rpx solid #000;
  509. top: 150px;
  510. /* margin-top: -250px; */
  511. left: 150px;
  512. /* margin-left: -250px; */
  513. }
  514. .game-number {
  515. border-radius: 18px;
  516. border-width: 1rpx;
  517. width: 22px;
  518. height: 22px;
  519. text-align: center;
  520. color: #FFFFFF;
  521. border-color: #FFFFFF;
  522. margin-right: 13px;
  523. }
  524. </style>