index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view style="background:#f1f1f1;" class="padding-sm">
  3. <view class="searchSelect shadow" v-if="flag">
  4. <view class="cu-bar search bg-white">
  5. <view class="search-form round">
  6. <input @focus="InputFocus" @blur="InputBlur" :adjust-position="false" type="text" placeholder="" confirm-type="search"></input>
  7. <text class="cuIcon-search "></text>
  8. </view>
  9. </view>
  10. <view>
  11. <view class="select-item">虹泾总部园</view>
  12. <view class="select-item">上海永天科技</view>
  13. <view class="select-item">AAAAA</view>
  14. <view class="select-item">BBBBBBB</view>
  15. </view>
  16. </view>
  17. <view class="section1 section bg-white padding-xs">
  18. <view class=" static-tabs grid margin-bottom text-center col-3 margin-top-sm margin-bottom-sm">
  19. <view :class="['padding-sm ',Inv==0?'active':'']" @click="Inv=0">报警信息统计</view>
  20. <view :class="['padding-sm ',Inv==1?'active':'']" @click="Inv=1">数据等级统计</view>
  21. <view :class="['padding-sm ',Inv==2?'active':'']" @click="Inv=2">设备运行状态</view>
  22. </view>
  23. <view class="time text-center">统计时段:2020年09月12日~2020年11月11日
  24. </view>
  25. <view>
  26. <view v-if="Inv == 0">
  27. <!-- <chart></chart> -->
  28. <chart4></chart4>
  29. </view>
  30. <view v-if="Inv == 1">
  31. <chart2></chart2>
  32. </view>
  33. <view v-if="Inv == 2" class="chart3-box">
  34. <ul class="chart3-icon">
  35. <li>
  36. <image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
  37. </li>
  38. <li>
  39. <image src="../../static/chart3-2.png" style="width:64rpx;height:64rpx"></image>
  40. </li>
  41. <li>
  42. <image src="../../static/chart3-3.png" style="width:64rpx;height:64rpx"></image>
  43. </li>
  44. <li>
  45. <image src="../../static/chart3-4.png" style="width:64rpx;height:64rpx"></image>
  46. </li>
  47. <li>
  48. <image src="../../static/chart3-5.png" style="width:64rpx;height:64rpx"></image>
  49. </li>
  50. </ul>
  51. <chart3>
  52. </chart3>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 宫格列表 -->
  57. <!-- <square :cuIconList="cuIconList"></square> -->
  58. <view class="section2 section bg-white margin-top-sm margin-bottom-sm">
  59. <view class="cu-list grid col-3 no-border">
  60. <view class="cu-item justify-center align-center" @tap=navItemClick(index) v-for="(item,index) in cuIconList" :key="index">
  61. <image :src="item.imgUrl" style="width:100rpx;height:100rpx"></image>
  62. <view class="cu-tag badge" v-if="item.badge!=0">
  63. <block v-if="item.badge!=1">{{item.badge>99?'99+':item.badge}}</block>
  64. </view>
  65. <text>{{item.name}}</text>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import chart from './components/chart/chart.vue';
  73. import chart2 from './components/chart2/chart2.vue';
  74. import chart3 from './components/chart3/chart3.vue';
  75. import chart4 from './components/chart4/chart4.vue';
  76. import json from '../../data/json.js';
  77. export default {
  78. components: {
  79. chart,
  80. chart2,
  81. chart3,
  82. chart4
  83. },
  84. data() {
  85. return {
  86. flag: false,
  87. // 宫格列表数据
  88. cuIconList: json.cuIconList,
  89. Inv: 0,
  90. };
  91. },
  92. onNavigationBarButtonTap(e) {
  93. if (e.float == 'right') {
  94. console.log("你点击了扫一扫")
  95. uni.scanCode({
  96. // success: function(res) {
  97. // console.log('条码类型:' + res.scanType);
  98. // console.log('条码内容:' + res.result);
  99. // }
  100. success: function(res) {
  101. let result = res.result;
  102. if (result.indexOf('http://') == 0 || result.indexOf('https://') == 0) {
  103. //是网址,直接跳转
  104. plus.runtime.openURL(result); //调用手机浏览器
  105. //怎么在APP内跳转网址?
  106. } else {
  107. //不是网址,打印出结果
  108. uni.showToast({
  109. title: res.result
  110. })
  111. }
  112. },
  113. fail: function(err) {
  114. console.log('扫码失败', err)
  115. }
  116. });
  117. } else {
  118. // alert("你点击了下拉");
  119. this.showTag()
  120. }
  121. },
  122. onLoad() {},
  123. methods: {
  124. navItemClick(index) {
  125. // log(index)
  126. let url = "";
  127. switch (index) {
  128. case 0:
  129. url = "/pages/siteList/siteList?type=1"
  130. break;
  131. case 1:
  132. url = "/pages/siteList/siteList?type=2"
  133. break;
  134. default:
  135. break;
  136. }
  137. if (url) {
  138. uni.navigateTo({
  139. url: url
  140. })
  141. } else {
  142. // uni.showToast({
  143. // title: '此模块开发中~',
  144. // icon: 'none'
  145. // });
  146. uni.showModal({
  147. title: 'Tips',
  148. content: '此模块开发中~',
  149. showCancel: false,
  150. success: function(res) {
  151. if (res.confirm) {
  152. console.log('用户点击确定');
  153. } else if (res.cancel) {
  154. console.log('用户点击取消');
  155. }
  156. }
  157. });
  158. }
  159. },
  160. showTag() {
  161. this.flag = !this.flag;
  162. },
  163. InputFocus(e) {
  164. this.InputBottom = e.detail.height
  165. },
  166. InputBlur(e) {
  167. this.InputBottom = 0
  168. },
  169. changeTab(Inv) {
  170. that.navIdx = Inv;
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. body {
  177. background: #f1f1f1 !important;
  178. }
  179. .static-tabs {
  180. border-radius: 50rpx;
  181. border: 1rpx solid #4074E7;
  182. }
  183. .static-tabs>view {
  184. color: #4074E7;
  185. font-size: 30rpx;
  186. }
  187. .static-tabs>view.active {
  188. color: #fff;
  189. background: #4074E7
  190. }
  191. .static-tabs>view:first-child {
  192. border-top-left-radius: 50rpx;
  193. border-bottom-left-radius: 50rpx;
  194. }
  195. .static-tabs>view:nth-child(2) {
  196. border-left: 1px solid #4074E7;
  197. border-right: 1px solid #4074E7
  198. }
  199. .static-tabs>view:last-child {
  200. border-top-right-radius: 50rpx;
  201. border-bottom-right-radius: 50rpx;
  202. }
  203. /* 检测时间 */
  204. .time {
  205. border-radius: 50rpx;
  206. background: #FAFCFF;
  207. border: 1px solid #E8F1FF;
  208. padding: 20rpx;
  209. color: #666666;
  210. font-size: 28rpx;
  211. }
  212. .chart3-box {
  213. position: relative
  214. }
  215. .chart3-icon {
  216. position: absolute;
  217. top: 60rpx;
  218. left: 30rpx
  219. }
  220. .chart3-icon li {
  221. padding-top: 25rpx
  222. }
  223. ul,
  224. li {
  225. padding: 0;
  226. margin: 0;
  227. list-style: none
  228. }
  229. </style>
  230. <style>
  231. .shadow {
  232. box-shadow: 1px 1px 4px rgb(26 26 26 / 10%);
  233. }
  234. </style>