guide.nvue 18 KB

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