get-system-info.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view>
  3. <page-head :title="title"></page-head>
  4. <view class="uni-common-mt">
  5. <view class="uni-list">
  6. <view class="uni-list-cell">
  7. <view class="uni-pd">
  8. <view class="uni-label" style="width:180px;">设备型号</view>
  9. </view>
  10. <view class="uni-list-cell-db">
  11. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.model"/>
  12. </view>
  13. </view>
  14. <view class="uni-list-cell">
  15. <view class="uni-pd">
  16. <view class="uni-label" style="width:180px;">客户端平台</view>
  17. </view>
  18. <view class="uni-list-cell-db">
  19. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.platform"/>
  20. </view>
  21. </view>
  22. <view class="uni-list-cell">
  23. <view class="uni-pd">
  24. <view class="uni-label" style="width:180px;">操作系统版本</view>
  25. </view>
  26. <view class="uni-list-cell-db">
  27. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.system"/>
  28. </view>
  29. </view>
  30. <view class="uni-list-cell">
  31. <view class="uni-pd">
  32. <view class="uni-label" style="width:180px;">语言</view>
  33. </view>
  34. <view class="uni-list-cell-db">
  35. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.language"/>
  36. </view>
  37. </view>
  38. <view class="uni-list-cell">
  39. <view class="uni-pd">
  40. <view class="uni-label" style="width:180px;">版本</view>
  41. </view>
  42. <view class="uni-list-cell-db">
  43. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.version"/>
  44. </view>
  45. </view>
  46. <view class="uni-list-cell">
  47. <view class="uni-pd">
  48. <view class="uni-label" style="width:180px;">屏幕宽度</view>
  49. </view>
  50. <view class="uni-list-cell-db">
  51. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.screenWidth"/>
  52. </view>
  53. </view>
  54. <view class="uni-list-cell">
  55. <view class="uni-pd">
  56. <view class="uni-label" style="width:180px;">屏幕高度</view>
  57. </view>
  58. <view class="uni-list-cell-db">
  59. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.screenHeight"/>
  60. </view>
  61. </view>
  62. <view class="uni-list-cell">
  63. <view class="uni-pd">
  64. <view class="uni-label" style="width:180px;">可使用窗口高度</view>
  65. </view>
  66. <view class="uni-list-cell-db">
  67. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.windowHeight"/>
  68. </view>
  69. </view>
  70. <view class="uni-list-cell">
  71. <view class="uni-pd">
  72. <view class="uni-label" style="width:180px;">可使用窗口的顶部位置</view>
  73. </view>
  74. <view class="uni-list-cell-db">
  75. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.windowTop"/>
  76. </view>
  77. </view>
  78. <view class="uni-list-cell">
  79. <view class="uni-pd">
  80. <view class="uni-label" style="width:180px;">可使用窗口的底部位置</view>
  81. </view>
  82. <view class="uni-list-cell-db">
  83. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.windowBottom"/>
  84. </view>
  85. </view>
  86. <view class="uni-list-cell">
  87. <view class="uni-pd">
  88. <view class="uni-label" style="width:180px;">状态栏的高度</view>
  89. </view>
  90. <view class="uni-list-cell-db">
  91. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.statusBarHeight"/>
  92. </view>
  93. </view>
  94. <view class="uni-list-cell">
  95. <view class="uni-pd">
  96. <view class="uni-label" style="width:180px;">DPI</view>
  97. </view>
  98. <view class="uni-list-cell-db">
  99. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.pixelRatio"/>
  100. </view>
  101. </view>
  102. <!-- #ifdef MP -->
  103. <view class="uni-list-cell">
  104. <view class="uni-pd">
  105. <view class="uni-label" style="width:180px;">基础库版本</view>
  106. </view>
  107. <view class="uni-list-cell-db">
  108. <input class="uni-input" type="text" :disabled="true" placeholder="未获取" :value="systemInfo.SDKVersion"/>
  109. </view>
  110. </view>
  111. <!-- #endif -->
  112. </view>
  113. <view class="uni-padding-wrap">
  114. <view class="uni-btn-v">
  115. <button type="primary" @tap="getSystemInfo">获取设备系统信息</button>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. <script>
  122. export default {
  123. data() {
  124. return {
  125. title: 'getSystemInfo',
  126. systemInfo: {}
  127. }
  128. },
  129. onUnload:function(){
  130. this.systemInfo = {};
  131. },
  132. methods: {
  133. getSystemInfo: function () {
  134. uni.getSystemInfo({
  135. success: (res) => {
  136. this.systemInfo = res
  137. }
  138. })
  139. }
  140. }
  141. }
  142. </script>
  143. <style>
  144. .uni-pd {
  145. padding-left: 30rpx;
  146. }
  147. </style>