|
@@ -88,10 +88,48 @@
|
|
|
return {
|
|
|
componentKey: 0,
|
|
|
arr: [],
|
|
|
- searchInput: '',
|
|
|
+ searchInput: '',
|
|
|
+ alarmCount:'',
|
|
|
flag: false,
|
|
|
// 宫格列表数据
|
|
|
- cuIconList: json.cuIconList,
|
|
|
+ cuIconList: [{
|
|
|
+ imgUrl: '../../static/square1.png',
|
|
|
+ badge: 111,
|
|
|
+ name: '综合报警',
|
|
|
+ redirectUrl: '/pages/siteList/siteList?type=1'
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square2.png',
|
|
|
+ badge: 100,
|
|
|
+ name: '运行监测',
|
|
|
+ redirectUrl: '/pages/siteList/siteList?type=2'
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square-wb.png',
|
|
|
+ badge: 0,
|
|
|
+ name: '维保',
|
|
|
+ redirectUrl: ''
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square-bx.png',
|
|
|
+ badge: 0,
|
|
|
+ name: '报修',
|
|
|
+ redirectUrl: ''
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square-rl.png',
|
|
|
+ badge: 0,
|
|
|
+ name: '人脸识别',
|
|
|
+ redirectUrl: ''
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square-xj.png',
|
|
|
+ badge: 0,
|
|
|
+ badge: 0,
|
|
|
+ name: '巡检',
|
|
|
+ redirectUrl: ''
|
|
|
+ }, {
|
|
|
+ imgUrl: '../../static/square-bz.png',
|
|
|
+ badge: 0,
|
|
|
+ badge: 0,
|
|
|
+ name: '风险保障',
|
|
|
+ redirectUrl: ''
|
|
|
+ }],
|
|
|
Inv: 0,
|
|
|
searchList: [],
|
|
|
searchList2: [],
|
|
@@ -129,20 +167,26 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- onLoad(option) {
|
|
|
- let ua = navigator.userAgent.toLowerCase();
|
|
|
-
|
|
|
- if (ua.match(/MicroMessenger/i) == "micromessenger"){
|
|
|
- //是
|
|
|
- this.init();
|
|
|
- }else{
|
|
|
+ onLoad(option) {
|
|
|
+
|
|
|
+ let ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.match(/MicroMessenger/i) == "micromessenger"){
|
|
|
+ //是
|
|
|
+ this.init();
|
|
|
+ }else{
|
|
|
//不是
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/login/login',
|
|
|
+ // });
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login',
|
|
|
+ });
|
|
|
+ }, 2000);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
this.hackReset = false;
|
|
|
this.$nextTick(() => {
|
|
@@ -154,7 +198,6 @@
|
|
|
methods: {
|
|
|
|
|
|
// start
|
|
|
-
|
|
|
getUrlCode() {
|
|
|
var url = location.search
|
|
|
this.winUrl = url
|
|
@@ -177,176 +220,179 @@
|
|
|
}
|
|
|
return context;
|
|
|
},
|
|
|
- async init() {
|
|
|
- var appId = "wx4eab2e3b5531d58b";
|
|
|
- var params = {};
|
|
|
- var CODE = this.getUrlCode();
|
|
|
- var code = CODE['code'];
|
|
|
- // alert("CODE="+code);
|
|
|
- if (code) {
|
|
|
- // console.log("打印参数",JSON.stringify(params));
|
|
|
- params.code=code;
|
|
|
- // alert(code);
|
|
|
- // alert(JSON.stringify(params));
|
|
|
-
|
|
|
- //使用code请求服务器接口,换取用户用户openID
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Com/getPageAuthorization',
|
|
|
- data:params
|
|
|
- })
|
|
|
- // alert(res.data.flag);
|
|
|
- if(res.data.flag==3000){
|
|
|
- alert("授权失败,请重新登录");
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- });
|
|
|
- }
|
|
|
- if(res.data.flag==3002){
|
|
|
- alert("授权失败,请重新登录");
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login',
|
|
|
- });
|
|
|
- }
|
|
|
- return "ok";
|
|
|
- }
|
|
|
- // alert("授权开始");
|
|
|
- var cs = {};
|
|
|
- var curl=window.location.href;
|
|
|
- cs.curl=curl;
|
|
|
- // alert("当前页面路径"+curl);
|
|
|
- const res1 = await this.$myRequest({
|
|
|
- url: 'Com/getAuthorizationUrl',
|
|
|
- data:cs
|
|
|
- })
|
|
|
- // alert(res1.data);
|
|
|
- var turl=res1.data.turl;
|
|
|
- // alert(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
|
|
|
- })
|
|
|
- alert(res.data.flag)
|
|
|
-
|
|
|
- console.log('res.data');
|
|
|
- console.log(res.data);
|
|
|
-
|
|
|
- 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 init() {
|
|
|
+ var appId = "wx4eab2e3b5531d58b";
|
|
|
+ var params = {};
|
|
|
+ var CODE = this.getUrlCode();
|
|
|
+ var code = CODE['code'];
|
|
|
+ // alert("CODE="+code);
|
|
|
+ if (code) {
|
|
|
+ // console.log("打印参数",JSON.stringify(params));
|
|
|
+ params.code = code;
|
|
|
+ // alert(code);
|
|
|
+ // alert(JSON.stringify(params));
|
|
|
+
|
|
|
+ //使用code请求服务器接口,换取用户用户openID
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'Com/getPageAuthorization',
|
|
|
+ data: params
|
|
|
+ })
|
|
|
+ // alert(res.data.flag);
|
|
|
+ if (res.data.flag == 3000) {
|
|
|
+ alert("授权失败,请重新登录");
|
|
|
+
|
|
|
+ window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/login/login',
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ if (res.data.flag == 3002) {
|
|
|
+ alert("授权失败,请重新登录");
|
|
|
+ window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/login/login',
|
|
|
+ // });
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+ // alert("授权开始");
|
|
|
+ var cs = {};
|
|
|
+ var curl = window.location.href;
|
|
|
+ cs.curl = curl;
|
|
|
+ // alert("当前页面路径"+curl);
|
|
|
+ const res1 = await this.$myRequest({
|
|
|
+ url: 'Com/getAuthorizationUrl',
|
|
|
+ data: cs
|
|
|
+ })
|
|
|
+ // alert(res1.data);
|
|
|
+ var turl = res1.data.turl;
|
|
|
+ // alert(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
|
|
|
+ })
|
|
|
+ alert(res.data.flag)
|
|
|
+
|
|
|
+ console.log('res.data');
|
|
|
+ console.log(res.data);
|
|
|
+
|
|
|
+ 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
|
|
|
+ // console.log(this.staticData.alarmCount)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ async getSearchList(ming = {}) {
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: 'Index/getSiteDropDownBox',
|
|
|
+ data: ming
|
|
|
+ })
|
|
|
+ res.data.data.forEach(item => {
|
|
|
+ this.searchList.push(item.siteName)
|
|
|
+ this.searchList2.push(item.siteName)
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ clickSelectItem(item, index) {
|
|
|
+ // alert(index);
|
|
|
+ alert(item);
|
|
|
+ this.getSearchList({
|
|
|
+ "siteName": item
|
|
|
+ });
|
|
|
+ this.flag = false
|
|
|
+ },
|
|
|
+
|
|
|
+ handleInput() {
|
|
|
+ // this.searchList = this.searchList.filter(item => item.indexOf(this.searchInput) > -1);
|
|
|
+
|
|
|
+ var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
|
|
|
+ this.searchList = newlist
|
|
|
+ },
|
|
|
+
|
|
|
+ navItemClick(index) {
|
|
|
+ // log(index)
|
|
|
+ let url = "";
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ url = "/pages/siteListAlarming/siteListAlarming"
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ url = "/pages/siteList/siteList"
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (url) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '此模块开发中~',
|
|
|
+ // icon: 'none'
|
|
|
+ // });
|
|
|
+ uni.showModal({
|
|
|
+ title: 'Tips',
|
|
|
+ content: '此模块开发中~',
|
|
|
+ showCancel: false,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定');
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- },
|
|
|
+ showTag() {
|
|
|
+ this.flag = !this.flag;
|
|
|
+ },
|
|
|
|
|
|
- async getData() {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Index/getDataStatistics',
|
|
|
- showLoading: true
|
|
|
- })
|
|
|
+ InputFocus(e) {
|
|
|
+ this.InputBottom = e.detail.height
|
|
|
+ },
|
|
|
+ InputBlur(e) {
|
|
|
+ this.InputBottom = 0
|
|
|
+ },
|
|
|
|
|
|
- // alert(res.data.flag);
|
|
|
-
|
|
|
- this.staticData = res.data.data[0]
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- async getSearchList(ming = {}) {
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: 'Index/getSiteDropDownBox',
|
|
|
- data: ming
|
|
|
- })
|
|
|
- res.data.data.forEach(item => {
|
|
|
- this.searchList.push(item.siteName)
|
|
|
- this.searchList2.push(item.siteName)
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- clickSelectItem(item, index) {
|
|
|
- // alert(index);
|
|
|
- alert(item);
|
|
|
- this.getSearchList({
|
|
|
- "siteName": item
|
|
|
- });
|
|
|
- this.flag = false
|
|
|
- },
|
|
|
-
|
|
|
- handleInput() {
|
|
|
- // this.searchList = this.searchList.filter(item => item.indexOf(this.searchInput) > -1);
|
|
|
-
|
|
|
- var newlist = this.searchList2.filter(item => item.indexOf(this.searchInput) > -1)
|
|
|
- this.searchList = newlist
|
|
|
- },
|
|
|
-
|
|
|
- navItemClick(index) {
|
|
|
- // log(index)
|
|
|
- let url = "";
|
|
|
- switch (index) {
|
|
|
- case 0:
|
|
|
- url = "/pages/siteListAlarming/siteListAlarming"
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- url = "/pages/siteList/siteList"
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- if (url) {
|
|
|
- uni.navigateTo({
|
|
|
- url: url
|
|
|
- })
|
|
|
- } else {
|
|
|
- // uni.showToast({
|
|
|
- // title: '此模块开发中~',
|
|
|
- // icon: 'none'
|
|
|
- // });
|
|
|
- uni.showModal({
|
|
|
- title: 'Tips',
|
|
|
- content: '此模块开发中~',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
- } else if (res.cancel) {
|
|
|
- console.log('用户点击取消');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- showTag() {
|
|
|
- this.flag = !this.flag;
|
|
|
- },
|
|
|
-
|
|
|
- InputFocus(e) {
|
|
|
- this.InputBottom = e.detail.height
|
|
|
- },
|
|
|
- InputBlur(e) {
|
|
|
- this.InputBottom = 0
|
|
|
- },
|
|
|
-
|
|
|
- changeTab(Inv) {
|
|
|
- that.navIdx = Inv;
|
|
|
-
|
|
|
- },
|
|
|
+ changeTab(Inv) {
|
|
|
+ that.navIdx = Inv;
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|