guide.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view>
  3. <uni-nav-bar id="nav-bar" status-bar="true" @clickLeft="onBack()" :title="title" color="#000000" fixed="true"
  4. :border="false">
  5. <view slot="left">
  6. <view class=" flex align-center margin-left">
  7. <image class="p-left-arrow" src="../../../static/p-left-arrow.png"></image>
  8. </view>
  9. </view>
  10. </uni-nav-bar>
  11. <view class="card-view settings-item" v-for="(item,index) in list" :key="index">
  12. <view class="content position-relative" @tap="onNavTo(item)">
  13. <text class="text-black text-regular text-16px margin-left-xl">{{item.gameName}}</text>
  14. <view class="only-arrow"></view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import reqUtil from "@/util/util-js/requstUtil.js"
  21. import config from "@/common/config.js"
  22. import {
  23. mapState,
  24. mapMutations
  25. } from 'vuex';
  26. export default {
  27. computed: mapState(['guideUnlockState']),
  28. data() {
  29. return {
  30. list: [],
  31. title: "新手指导",
  32. type: '',
  33. }
  34. },
  35. onLoad(option) {
  36. if (uni.getSystemInfoSync().platform == "ios") {
  37. this.list = [{
  38. gameName: '新手指导',
  39. navType: 'personalGuide'
  40. }, {
  41. gameName: '蓝牙连接指导',
  42. navType: 'bluetoothConnect'
  43. }]
  44. } else {
  45. this.list = [{
  46. gameName: '新手指导',
  47. navType: 'personalGuide'
  48. }, {
  49. gameName: '蓝牙连接指导',
  50. navType: 'bluetoothConnect'
  51. },
  52. // {
  53. // gameName: '游戏手柄校准指导',
  54. // navType: 'feedback'
  55. // },
  56. {
  57. gameName: '关卡指导',
  58. navType: 'levelGuide'
  59. }
  60. ]
  61. }
  62. },
  63. methods: {
  64. ...mapMutations(['setGuideUnlockState']),
  65. onBack() {
  66. uni.navigateBack({
  67. delta: 1
  68. })
  69. },
  70. onNavTo(item) {
  71. // console.log(item);
  72. let url = '';
  73. switch (item.navType) {
  74. case 'personalGuide':
  75. //跳回首页时候,重置新手教程
  76. let guideUnlockState = Object.assign(this.guideUnlockState, {
  77. //是否首次安装
  78. firstInstallation: true,
  79. // firstDisconnectBluetooth: true,
  80. firstUnlockJumpUp: true,
  81. firstUnlockLeftAndRightJump: true,
  82. firstUnlockLeftAndRightRotationJump: true,
  83. firstPromptSelectLevel: true
  84. });
  85. this.setGuideUnlockState(guideUnlockState);
  86. uni.switchTab({
  87. url: '../../personal-page/personal/personal',
  88. success: res => {},
  89. fail: () => {},
  90. complete: () => {}
  91. });
  92. return;
  93. case 'bluetoothConnect':
  94. url = './guide-ble-scroll';
  95. break;
  96. case 'levelGuide':
  97. url = './guide-level-scroll';
  98. break;
  99. }
  100. uni.navigateTo({
  101. url: url,
  102. success: res => {},
  103. fail: () => {},
  104. complete: () => {}
  105. });
  106. }
  107. }
  108. }
  109. </script>
  110. <style>
  111. .content {
  112. display: flex;
  113. flex-direction: row;
  114. align-items: center;
  115. height: 50px;
  116. }
  117. .settings-item {
  118. position: relative;
  119. background-color: #FFFFFF;
  120. border-radius: 10px;
  121. }
  122. </style>