guide.nvue 18 KB

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