|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
- <view style="background:#f1f1f1;" class="padding-sm">
|
|
|
+ <view style="background:#f1f1f1;" class="padding-sm">
|
|
|
+ <!-- 下拉选择 -->
|
|
|
<view class="searchSelect shadow" v-if="flag">
|
|
|
<view class="cu-bar search bg-white">
|
|
|
<view class="search-form round">
|
|
@@ -11,7 +12,10 @@
|
|
|
<view class="select-items">
|
|
|
<view class="select-item" v-for="(item,index) in searchList" @click="clickSelectItem(item,index)" :key="index">{{item}}</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
+ <!-- 下拉选择 end -->
|
|
|
+
|
|
|
+ <!-- 图表 -->
|
|
|
<view class="section1 section bg-white padding-xs">
|
|
|
<view class=" static-tabs grid margin-bottom text-center col-3 margin-top-sm margin-bottom-sm">
|
|
|
<view :class="['padding-sm ',Inv==0?'active':'']" @click="Inv=0">报警信息统计</view>
|
|
@@ -28,7 +32,7 @@
|
|
|
|
|
|
<chart2 :bindData="staticData"></chart2>
|
|
|
</view>
|
|
|
- <view v-if="Inv == 2" class="chart3-box" @tap="goDeviceList()">
|
|
|
+ <view v-if="Inv == 2" class="chart3-box" @tap="goOfflineList()">
|
|
|
<ul class="chart3-icon">
|
|
|
<li>
|
|
|
<image src="../../static/chart3-1.png" style="width:64rpx;height:64rpx"></image>
|
|
@@ -50,10 +54,10 @@
|
|
|
</chart3>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
+ <!-- 图表 end-->
|
|
|
|
|
|
<!-- 宫格列表 -->
|
|
|
- <!-- <square :cuIconList="cuIconList"></square> -->
|
|
|
<view class="section2 section bg-white margin-top-sm margin-bottom-sm">
|
|
|
<view class="cu-list grid col-3 no-border">
|
|
|
<view class="cu-item justify-center align-center" @tap=navItemClick(index) v-for="(item,index) in cuIconList" :key="index">
|
|
@@ -64,7 +68,8 @@
|
|
|
<text>{{item.name}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
+ <!-- 宫格列表 end -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -86,175 +91,80 @@
|
|
|
componentKey: 0,
|
|
|
arr: [],
|
|
|
searchInput: '',
|
|
|
- alarmCount:'',
|
|
|
+
|
|
|
flag: false,
|
|
|
- cuIconList: json.cuIconList,
|
|
|
+ cuIconList: json.cuIconList,
|
|
|
Inv: 0,
|
|
|
- searchList: [],
|
|
|
+
|
|
|
+
|
|
|
+ staticData: json.staticData.data[0],
|
|
|
+ alarmCount: json.staticData.data[0].alarmCount,
|
|
|
+
|
|
|
+ searchList: [],
|
|
|
searchList2: [],
|
|
|
- staticData: {}
|
|
|
+
|
|
|
};
|
|
|
- },
|
|
|
+ },
|
|
|
+
|
|
|
+ // 自定义导航事件
|
|
|
onNavigationBarButtonTap(e) {
|
|
|
if (e.float == 'right') {
|
|
|
console.log("你点击了扫一扫")
|
|
|
- uni.scanCode({
|
|
|
- // success: function(res) {
|
|
|
- // console.log('条码类型:' + res.scanType);
|
|
|
- // console.log('条码内容:' + res.result);
|
|
|
- // }
|
|
|
- success: function(res) {
|
|
|
- let result = res.result;
|
|
|
- if (result.indexOf('http://') == 0 || result.indexOf('https://') == 0) {
|
|
|
- //是网址,直接跳转
|
|
|
- plus.runtime.openURL(result); //调用手机浏览器
|
|
|
- //怎么在APP内跳转网址?
|
|
|
- } else {
|
|
|
- //不是网址,打印出结果
|
|
|
- uni.showToast({
|
|
|
- title: res.result
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function(err) {
|
|
|
- console.log('扫码失败', err)
|
|
|
- }
|
|
|
- });
|
|
|
} else {
|
|
|
this.showTag()
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onLoad(option) {
|
|
|
-
|
|
|
- let ua = navigator.userAgent.toLowerCase();
|
|
|
- if (ua.match(/MicroMessenger/i) == "micromessenger"){
|
|
|
- //是
|
|
|
- this.init();
|
|
|
- }else{
|
|
|
- //不是
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // });
|
|
|
- // setTimeout(function() {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/login/login',
|
|
|
- // });
|
|
|
- // }, 2000);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- this.hackReset = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.hackReset = true;
|
|
|
- })
|
|
|
- this.getData();
|
|
|
- this.getSearchList();
|
|
|
- },
|
|
|
- methods: {
|
|
|
-
|
|
|
- // start
|
|
|
- getUrlCode() {
|
|
|
- var url = location.search
|
|
|
- this.winUrl = url
|
|
|
- var theRequest = new Object()
|
|
|
- if (url.indexOf("?") != -1) {
|
|
|
- var str = url.substr(1)
|
|
|
- var strs = str.split("&")
|
|
|
- for (var i = 0; i < strs.length; i++) {
|
|
|
- theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1])
|
|
|
- }
|
|
|
- }
|
|
|
- return theRequest
|
|
|
- },
|
|
|
- async getUrlPrams(key) {
|
|
|
- var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i");
|
|
|
- var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
|
|
|
- var context = "";
|
|
|
- if (r != null) {
|
|
|
- context = r[2];
|
|
|
- }
|
|
|
- return context;
|
|
|
- },
|
|
|
- async init() {
|
|
|
- var appId = "wx4eab2e3b5531d58b";
|
|
|
- var params = {};
|
|
|
- var CODE = this.getUrlCode();
|
|
|
- var code = CODE['code'];
|
|
|
- if (code) {
|
|
|
-
|
|
|
- params.code = code;
|
|
|
|
|
|
-
|
|
|
- //使用code请求服务器接口,换取用户用户openID
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Com/getPageAuthorization',
|
|
|
- data: params
|
|
|
- })
|
|
|
- if (res.data.flag == 3000) {
|
|
|
- // alert("授权失败,请重新登录");
|
|
|
- window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
- }
|
|
|
+ // 图表切换渲染
|
|
|
+ this.hackReset = true;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.hackReset = true;
|
|
|
+ // })
|
|
|
|
|
|
- if (res.data.flag == 3003) {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/authority/authority',
|
|
|
- });
|
|
|
- }
|
|
|
- if (res.data.flag == 3002) {
|
|
|
- // alert("授权失败,请重新登录");
|
|
|
- window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
- }
|
|
|
- return "ok";
|
|
|
- }
|
|
|
-
|
|
|
- var cs = {};
|
|
|
- var curl = window.location.href;
|
|
|
- cs.curl = curl;
|
|
|
-
|
|
|
- const res1 = await this.$myRequest({
|
|
|
- url: 'Com/getAuthorizationUrl',
|
|
|
- data: cs
|
|
|
- })
|
|
|
-
|
|
|
- var turl = res1.data.turl;
|
|
|
- window.location.href =
|
|
|
- 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + turl +
|
|
|
- '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect';
|
|
|
- },
|
|
|
- // end
|
|
|
-
|
|
|
- //首页初始化授权
|
|
|
- async getPageAuthorization(ming = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Com/getPageAuthorization',
|
|
|
- data: ming
|
|
|
- })
|
|
|
-
|
|
|
- if (res.data.flag == 3000) {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- });
|
|
|
- }
|
|
|
- if (res.data.flag == 3002) {
|
|
|
- uni.navigateTo({
|
|
|
- url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx4eab2e3b5531d58b&redirect_uri=' + res.data
|
|
|
- .tourl + '&response_type=code&scope=snsapi_base&state=abc123#wechat_redirect',
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- async getData() {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Index/getDataStatistics',
|
|
|
- showLoading: true
|
|
|
- })
|
|
|
- this.staticData = res.data.data[0]
|
|
|
- this.alarmCount=this.staticData.alarmCount
|
|
|
+ // 数据渲染
|
|
|
+ this.getSearchList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 九宫格页面跳转
|
|
|
+ navItemClick(index) {
|
|
|
+ let url = "";
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ url = "/pages/alarmingList/alarmingList"
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ url = "/pages/deviceType/deviceType"
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ url = "/pages/inspectList/inspectList"
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ url = "/pages/xunJian/xunJian"
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (url) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ title: 'Tips',
|
|
|
+ content: '此模块开发中~',
|
|
|
+ showCancel: false,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ } else if (res.cancel) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ //请求
|
|
|
async getSearchList(ming = {}) {
|
|
|
const res = await this.$myRequest({
|
|
|
url: 'Index/getSiteDropDownBox',
|
|
@@ -264,53 +174,21 @@
|
|
|
this.searchList.push(item.siteName)
|
|
|
this.searchList2.push(item.siteName)
|
|
|
});
|
|
|
- },
|
|
|
-
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 下拉选择
|
|
|
clickSelectItem(item, index) {
|
|
|
this.getSearchList({
|
|
|
"siteName": item
|
|
|
});
|
|
|
this.flag = false
|
|
|
},
|
|
|
-
|
|
|
handleInput() {
|
|
|
var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
|
|
|
this.searchList = newlist
|
|
|
},
|
|
|
|
|
|
- navItemClick(index) {
|
|
|
- let url = "";
|
|
|
- switch (index) {
|
|
|
- case 0:
|
|
|
- url = "/pages/alarmingList/alarmingList"
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- url = "/pages/deviceType/deviceType"
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- url = "/pages/inspectList/inspectList"
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- if (url) {
|
|
|
- uni.navigateTo({
|
|
|
- url: url
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showModal({
|
|
|
- title: 'Tips',
|
|
|
- content: '此模块开发中~',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- } else if (res.cancel) {
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
showTag() {
|
|
|
this.flag = !this.flag;
|
|
|
},
|
|
@@ -329,7 +207,7 @@
|
|
|
|
|
|
|
|
|
// 页面跳转
|
|
|
- goDeviceList() {
|
|
|
+ goOfflineList() {
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/deviceOffLine/deviceOffLine',
|
|
|
success: res => {},
|