CustomNavbar.vue 5.9 KB

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