CustomNavbar.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view>
  3. <!-- 自定义导航栏 -->
  4. <view class="navBarBox">
  5. <!-- 状态栏占位 -->
  6. <view class="statusBar"></view>
  7. <!-- 真正的导航栏内容 -->
  8. <view class="navBar" :style="{ min_height: statusBarHeight + 'px'}">
  9. <view class="button" @click="getMore">更多设置</view>
  10. <view class="button" @click="toLogin">联机设置</view>
  11. <view class="button" @click="toOrder">画框预览</view>
  12. <view class="button" @click="resendData">补发数据</view>
  13. <view class="button" @click="resume">重新开始</view>
  14. </view>
  15. </view>
  16. <uni-popup ref="popup" background-color="#fff" type="bottom">
  17. <view class="popup-content">
  18. <scroll-view :scroll-top="0" scroll-y="true" class="scroll-Y">
  19. <view v-for="(item,index ) in featuresList" :id=" 'demo' + index + 1 " @click="item.click()"
  20. class="scroll-view-item" :class="index === featuresList.length - 1 ? 'last-item':'' ">{{
  21. item.name
  22. }}
  23. </view>
  24. </scroll-view>
  25. </view>
  26. </uni-popup>
  27. <uni-popup ref="WLANpopup" background-color="#fff" type="center">
  28. <uni-popup-dialog message="成功消息" :duration="2080" :before-close="true" @close="close"
  29. @confirm="dialogInputConfirm"
  30. title="wifi热点设置">
  31. <view style="display: flex; flex-direction: row; margin-bottom: 10px;">
  32. <span style="font-size:14px;">WIFI名称:</span>
  33. <input type="text" id="jichu" v-model="WlANname"
  34. style="width: calc(68% - 25px); border: 1px solid #c5c5c5; border-radius: 3px; padding: 0 8px; font-size: 12px; ">
  35. </view>
  36. <view style="display: flex; flex-direction: row;">
  37. <span style="font-size:14px;">WIFI密码:</span>
  38. <input type="text" id="jichu" v-model="WlANpower"
  39. style="width: calc(68% - 25px); border: 1px solid #c5c5c5; border-radius: 3px; padding: 0 8px; font-size: 12px; ">
  40. </view>
  41. </uni-popup-dialog>
  42. </uni-popup>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. // 状态栏高度
  50. statusBarHeight: 0,
  51. WlANname: '',
  52. WlANpower: '',
  53. // 导航栏高度
  54. navBarHeight: 82 + 11,
  55. featuresList: [
  56. {
  57. name: '关闭补光灯',
  58. click: () => {
  59. console.log('关闭补光灯')
  60. }
  61. },
  62. {
  63. name: '开启补光灯',
  64. click: () => {
  65. console.log('开启补光灯')
  66. }
  67. },
  68. {
  69. name: '调试模式',
  70. click: () => {
  71. console.log('调试模式')
  72. }
  73. },
  74. {
  75. name: '自动勾框',
  76. click: () => {
  77. console.log('自动勾框')
  78. }
  79. },
  80. {
  81. name: '远程WIFI设置',
  82. click: () => {
  83. console.log('远程WIFI设置')
  84. this.$refs.WLANpopup.open()
  85. }
  86. },
  87. {
  88. name: 'SL wifi设置',
  89. click: () => {
  90. console.log('SL wifi设置')
  91. }
  92. },
  93. {
  94. name: '通知公告',
  95. click: () => {
  96. console.log('通知公告')
  97. }
  98. },
  99. {
  100. name: '密码修改',
  101. click: () => {
  102. console.log('密码修改')
  103. }
  104. },
  105. {
  106. name: '清除缓存',
  107. click: () => {
  108. console.log('清除缓存')
  109. }
  110. },
  111. {
  112. name: '退出登录',
  113. click: () => {
  114. console.log('退出登录')
  115. }
  116. },
  117. ]
  118. };
  119. },
  120. props: {},
  121. //第一次加载时调用
  122. created() {
  123. //获取手机状态栏高度
  124. this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
  125. },
  126. methods: {
  127. toLogin() {
  128. //跳转传参示例
  129. this.$Router.push({
  130. path: '/pages/login/login',
  131. });
  132. },
  133. toOrder() {
  134. //跳转传参示例
  135. this.$Router.push({
  136. path: '/pages/order/order',
  137. });
  138. },
  139. getMore() {
  140. this.$refs.popup.open('left')
  141. },
  142. close() {
  143. this.$refs.WLANpopup.close()
  144. },
  145. resendData() {
  146. console.log('补发数据')
  147. },
  148. resume() {
  149. console.log('重新开始')
  150. },
  151. dialogInputConfirm(val) {
  152. uni.showLoading({
  153. title: '3秒后会关闭'
  154. })
  155. console.log(this.WlANname, this.WlANpower)
  156. setTimeout(() => {
  157. uni.hideLoading()
  158. console.log(val)
  159. this.value = val
  160. // 关闭窗口后,恢复默认内容
  161. this.$refs.WLANpopup.close()
  162. }, 3000)
  163. },
  164. }
  165. }
  166. </script>
  167. <style>
  168. .navBarBox {
  169. width: 100vw;
  170. }
  171. .navBarBox .navBar {
  172. padding: 10rpx 50rpx;
  173. padding-bottom: 8rpx;
  174. color: white;
  175. width: 100%;
  176. display: flex;
  177. background: black;
  178. flex-direction: row;
  179. align-items: center;
  180. }
  181. .navBarBox .navBar .logo-image {
  182. width: 16rpx;
  183. height: 16rpx;
  184. margin-right: 10rpx;
  185. }
  186. .button {
  187. padding: 4rpx 30rpx;
  188. border-radius: 5px;
  189. font-size: 16px;
  190. margin: 0 10px;
  191. background: #910eea;
  192. }
  193. .button:hover {
  194. background: #910eea;
  195. }
  196. .popup-content {
  197. align-items: center;
  198. justify-content: center;
  199. height: 50px;
  200. background-color: #fff;
  201. }
  202. .scroll-Y {
  203. height: 100vh;
  204. }
  205. .scroll-view-item {
  206. height: 50rpx;
  207. text-align: center;
  208. font-size: 15rpx;
  209. padding: 15px;
  210. }
  211. .scroll-view-item:active {
  212. height: 50rpx;
  213. color: white;
  214. background-color: rgba(43, 133, 228, 0.74);
  215. text-align: center;
  216. font-size: 15rpx;
  217. }
  218. .last-item {
  219. padding-top: 20rpx;
  220. border-top: 1px solid rgba(0, 0, 0, 0.2);
  221. }
  222. </style>