index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view class="window">
  3. <!-- #ifndef H5 -->
  4. <view class="topLine" :style="{ height: topBar + 'px' }"></view>
  5. <!-- #endif -->
  6. <view class="nav row_align_center" id="nav">
  7. <li class="li_5" :class="['iconfont icon-zuojiantou back']" @click="gotoBack()"></li>
  8. <text class="title li_5">{{ title ? title : '' }}</text>
  9. <li class="iconfont icon-zuojiantou back hidden"></li>
  10. </view>
  11. <view class="row_align_center head" id="head">
  12. <!-- 日期下拉列表 -->
  13. <drop-down ref="caleDrop" @tap="changDrop(1)" @changeItem="changeTime" :list="timeArray" :contentTop="top"
  14. selectWidth="260rpx" contentLeft="0"></drop-down>
  15. <!-- 日历选择日期 -->
  16. <view v-if="showCalendar"
  17. :class="['dropdown-item__selected', listWidth != '150rpx' ? 'dropdown-item__right' : 'dropdown-item__left']"
  18. @click="openCalendar" class="calendar_drag">
  19. <view class="selected__name">{{ nowDate }}</view>
  20. <li class="iconfont icon-calendar" style="margin-left: 10rpx;"></li>
  21. </view>
  22. <!-- 公司区域下拉列表 -->
  23. <drop-down ref="companyDrop" @tap="changDrop(2)" @changeItem="changeLocation" :list="locationArray"
  24. :contentTop="top" contentRight="10" :selectWidth="showCalendar ? '200rpx' : '300rpx'" listWidth="75%">
  25. </drop-down>
  26. </view>
  27. <uni-calendar ref="calendar" :insert="false" :start-date="startDate" :end-date="endDate" :clearDate="false"
  28. @confirm="confirm">
  29. </uni-calendar>
  30. <!--滑动列表头-->
  31. <wuc-tab id="wuctab" :tab-list="tabList" :tabCur.sync="tabCur" tab-class="text-center text-white bg-blue"
  32. select-class="text-white"></wuc-tab>
  33. <!--主体内容-->
  34. <view class="data_body" :style="{ height: scrollHeight }">
  35. <view v-if="tabCur == 0">
  36. <wechat :scrollHeight="scrollHeight" />
  37. </view>
  38. <view v-else-if="tabCur == 1">
  39. <user-operate :scrollHeight="scrollHeight" />
  40. </view>
  41. <view v-else-if="tabCur == 2">
  42. <user-healthy :scrollHeight="scrollHeight" />
  43. </view>
  44. <view v-else-if="tabCur == 3">
  45. <user-server :scrollHeight="scrollHeight"></user-server>
  46. </view>
  47. </view>
  48. <!--水印-->
  49. <view class="water-mark-mask row_wrap" :style="{ height: scrollHeight }">
  50. <text class="container" v-for="(count, index) in 10" :key="index">{{ info.name }}</text>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import Wechat from "../../components/data-center/wechat.vue"
  56. import UserOperate from "../../components/data-center/user-operate.vue"
  57. import UserHealthy from "../../components/data-center/user-healthy.vue"
  58. import UserServer from "../../components/data-center/user-server.vue"
  59. import WucTab from '../../components/wuc-tab/wuc-tab.vue'
  60. import DropDown from '../../components/drop-down/drop-down.vue'
  61. import UniCalendar from '../../components/uni-calendar/uni-calendar.vue'
  62. import Config from '../../static/js/config'
  63. import Common from "../../static/js/common"
  64. export default {
  65. components: {
  66. WucTab,
  67. DropDown,
  68. UniCalendar,
  69. Wechat,
  70. UserOperate,
  71. UserHealthy,
  72. UserServer,
  73. },
  74. data() {
  75. return {
  76. tabList: Config.TABLIST, //标签头
  77. timeArray: Config.TIMEARRAY, //时间数组
  78. info: '大便超人', //用户数据
  79. title: "数据报表中心", //标题
  80. showDataTime: "today", //选中的时间
  81. tabCur: 0, //标签头下标
  82. topBar: 17, //导航高
  83. top: '180', //下拉栏位置
  84. scrollHeight: "100%", //数据展示体高度
  85. nowDate: Common.getNowDate(), //现在日期
  86. endDate: Common.getNowDate(), //日历可选日期范围的结束时间
  87. startDate: Common.getPreMonth(Common.getNowDate()), //日历可选日期范围的开始时间,
  88. showCalendar: false,
  89. };
  90. },
  91. computed: {
  92. locationArray() {
  93. return [{
  94. value: "GDBJ-ENTRY-1",
  95. text: "天猫"
  96. }, {
  97. value: "GDBJ-ENTRY-201",
  98. text: "京东"
  99. }];
  100. }
  101. },
  102. methods: {
  103. gotoBack() {
  104. Common.navigateBack("/index/index");
  105. },
  106. changDrop(index) {
  107. if (index == 1 && this.$refs.companyDrop.showList) {
  108. this.$refs.companyDrop.closePopup()
  109. } else if (index == 2 && this.$refs.caleDrop.showList) {
  110. this.$refs.caleDrop.closePopup()
  111. }
  112. },
  113. // 打开日历
  114. openCalendar() {
  115. this.$refs.calendar.open();
  116. },
  117. // 日历选择日期
  118. confirm(e) {
  119. if (this.nowDate != e.fulldate || !this.showCalendar) {
  120. this.showCalendar = true;
  121. this.$refs.caleDrop.selectAuto();
  122. this.nowDate = e.fulldate;
  123. this.showDataTime = e.fulldate.replace(/-/g, "");
  124. Common.tipMsg("当前时间:" + this.showDataTime)
  125. }
  126. },
  127. //下拉选择时间
  128. changeTime(e) {
  129. if (e.value == "auto") {
  130. this.openCalendar();
  131. } else if (this.showDataTime != e.value) {
  132. this.showDataTime = e.value;
  133. this.showCalendar = false;
  134. Common.tipMsg("当前时间:" + this.showDataTime)
  135. }
  136. },
  137. changeLocation(e) {
  138. Common.tipMsg("当前选中平台:" + e.text)
  139. },
  140. //获取设备信息
  141. async getTelephoneInfo() {
  142. var telephoneInfo = await Common.getTelephoneInfo();
  143. let hasHeight = 0;
  144. if (telephoneInfo.top >= 40) {
  145. this.top = telephoneInfo.statusBarHeight * 2 + 150;
  146. this.topBar = telephoneInfo.statusBarHeight;
  147. }
  148. // 设置滚动高度
  149. const query = wx.createSelectorQuery();
  150. query.select('#nav').boundingClientRect();
  151. query.select('#head').boundingClientRect();
  152. query.select('#wuctab').boundingClientRect();
  153. query.exec(res => {
  154. res.map((item, index) => {
  155. hasHeight += item.height;
  156. })
  157. this.scrollHeight = (telephoneInfo.screenHeight - hasHeight - this.topBar) + 'px';
  158. })
  159. },
  160. getH5Info() {
  161. uni.getSystemInfo({
  162. success: e => {
  163. let hasHeight = 0;
  164. let element = wx.createSelectorQuery().in(this);
  165. element.select('#nav').boundingClientRect();
  166. element.select('#head').boundingClientRect();
  167. element.select('#wuctab').boundingClientRect();
  168. element.exec(res => {
  169. res.map((item, index) => {
  170. hasHeight += item.height;
  171. })
  172. this.scrollHeight = (e.screenHeight - hasHeight) + 'px';
  173. })
  174. },
  175. fail: (err) => {
  176. reject(err);
  177. }
  178. })
  179. }
  180. },
  181. onReady() {
  182. //#ifndef H5
  183. uni.showShareMenu();
  184. this.getTelephoneInfo();
  185. //#endif
  186. //#ifdef H5
  187. this.getH5Info();
  188. //#endif
  189. }
  190. };
  191. </script>
  192. <style lang="scss">
  193. page,
  194. body {
  195. margin: 0;
  196. padding: 0;
  197. width: 100%;
  198. height: 100%;
  199. }
  200. .li_5 {
  201. list-style-type: none;
  202. }
  203. .window {
  204. height: 100vh;
  205. overflow: hidden;
  206. .topLine {
  207. background-color: #40A2ED;
  208. width: 100%;
  209. }
  210. scroll-view {
  211. box-sizing: border-box;
  212. }
  213. .swiper {
  214. box-sizing: border-box;
  215. }
  216. .nav {
  217. background-image: url(http://photo.gdbjyy.cn/image/BCAI/top_bg.jpg);
  218. background-size: 100% 100%;
  219. .back {
  220. font-size: 54rpx;
  221. padding: 20rpx 14rpx 15rpx 14rpx;
  222. color: #fff;
  223. }
  224. .title {
  225. color: #fff;
  226. font-size: 30rpx;
  227. flex: 1;
  228. text-align: center;
  229. }
  230. .hidden {
  231. visibility: hidden;
  232. }
  233. }
  234. .head {
  235. padding: 0 16rpx 14rpx 16rpx;
  236. color: #fff;
  237. background-color: #40A2ED;
  238. justify-content: space-between;
  239. font-size: 26rpx !important;
  240. .calendar_drag {
  241. width: 340rpx;
  242. display: flex;
  243. justify-content: center;
  244. align-items: center;
  245. .calendar_name {
  246. margin-right: 10rpx;
  247. }
  248. .icon-calendar {
  249. font-size: 26rpx;
  250. margin-top: 4rpx;
  251. }
  252. }
  253. }
  254. .data_body {
  255. overflow: auto;
  256. text-align: center;
  257. color: #333333;
  258. background-repeat: repeat;
  259. background-color: #ffffff;
  260. position: relative;
  261. .item {
  262. padding: 0 20rpx;
  263. margin-bottom: 20rpx;
  264. .name {
  265. font-weight: 600;
  266. font-size: 36rpx;
  267. }
  268. .operate {
  269. view {
  270. padding: 5rpx 12rpx;
  271. color: #fff;
  272. }
  273. .bg-blue {
  274. background-color: #40A2ED;
  275. }
  276. .bg-yellow {
  277. background-color: #FFC300;
  278. }
  279. }
  280. .tip {
  281. margin-bottom: 30rpx;
  282. .update {
  283. color: #C4100A;
  284. margin-left: auto;
  285. font-size: 30rpx;
  286. }
  287. }
  288. }
  289. .cry {
  290. font-size: 96rpx;
  291. margin-bottom: 10rpx;
  292. }
  293. }
  294. }
  295. .water-mark-mask {
  296. width: 100%;
  297. position: fixed;
  298. left: 0;
  299. bottom: 0;
  300. z-index: 1000;
  301. justify-content: space-between;
  302. pointer-events: none; //无视鼠标事件,相当于鼠标事件透传下去一样
  303. flex: 1;
  304. overflow: hidden;
  305. text {
  306. width: 50%;
  307. color: #909399;
  308. opacity: 0.25;
  309. transform: rotate(-15deg);
  310. }
  311. }
  312. .histogram {
  313. height: 100%;
  314. width: 100%;
  315. canvas {
  316. margin-top: 40rpx;
  317. }
  318. }
  319. </style>