|
@@ -88,8 +88,8 @@
|
|
|
return {
|
|
|
componentKey: 0,
|
|
|
arr: [],
|
|
|
- searchInput: '',
|
|
|
- alarmCount:'',
|
|
|
+ searchInput: '',
|
|
|
+ alarmCount: '',
|
|
|
flag: false,
|
|
|
// 宫格列表数据
|
|
|
cuIconList: [{
|
|
@@ -166,13 +166,93 @@
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- onLoad(option) {
|
|
|
|
|
|
- let ua = navigator.userAgent.toLowerCase();
|
|
|
- if (ua.match(/MicroMessenger/i) == "micromessenger"){
|
|
|
- //是
|
|
|
- this.init();
|
|
|
- }else{
|
|
|
+
|
|
|
+ created: function() {
|
|
|
+ // alert('created')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeCreate: function() {
|
|
|
+ // alert('beforeCreate')
|
|
|
+ let ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
|
|
+ // alert('是')
|
|
|
+ //是
|
|
|
+ // alert('init')
|
|
|
+ var appId = "wx4eab2e3b5531d58b";
|
|
|
+ var params = {};
|
|
|
+
|
|
|
+ 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])
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var CODE = theRequest;
|
|
|
+ var code = CODE['code'];
|
|
|
+ // alert(code)
|
|
|
+ if (code) {
|
|
|
+
|
|
|
+ params.code = code;
|
|
|
+
|
|
|
+ // alert('code')
|
|
|
+ //使用code请求服务器接口,换取用户用户openID
|
|
|
+
|
|
|
+ uni.request({
|
|
|
+ url: 'https://qhome.usky.cn/USKYOF/USKYOF.php/Home/Com/getPageAuthorization', //仅为示例,并非真实接口地址。
|
|
|
+ // data: {
|
|
|
+ // text: 'uni.request'
|
|
|
+ // },
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ // alert(res.data.flag)
|
|
|
+ if (res.data.flag == 3000) {
|
|
|
+ // alert("3000授权失败,请重新登录");
|
|
|
+ window.location.href = 'https://qhome.usky.cn/index.html#/';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.data.flag == 3003) {
|
|
|
+ // alert("3003");
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/authority/authority',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (res.data.flag == 3002) {
|
|
|
+ // alert("3002授权失败,请重新登录");
|
|
|
+ window.location.href = 'https://qhome.usky.cn/index.html#/';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ var cs = {};
|
|
|
+ var curl = window.location.href;
|
|
|
+ cs.curl = curl;
|
|
|
+
|
|
|
+ const res1 = 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';
|
|
|
+ } else {
|
|
|
+ // alert('不是')
|
|
|
//不是
|
|
|
// uni.navigateTo({
|
|
|
// url: '/pages/login/login',
|
|
@@ -181,16 +261,58 @@
|
|
|
// uni.navigateTo({
|
|
|
// url: '/pages/login/login',
|
|
|
// });
|
|
|
- // }, 2000);
|
|
|
- }
|
|
|
+ // }, 2000);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ onLaunch: function() {
|
|
|
+ // alert('onLaunch')
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
|
|
|
- this.hackReset = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.hackReset = true;
|
|
|
- })
|
|
|
- this.getData();
|
|
|
- this.getSearchList();
|
|
|
+ onLoad: function(option) {
|
|
|
+ // alert('onload')
|
|
|
+
|
|
|
+ let ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
|
|
+ // alert('是')
|
|
|
+
|
|
|
+ var init=this.init();
|
|
|
+ if(init="3001"){
|
|
|
+ this.getData();
|
|
|
+ this.getSearchList();
|
|
|
+ }
|
|
|
+
|
|
|
+ //是
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.getData();
|
|
|
+ this.getSearchList();
|
|
|
+ // alert('不是')
|
|
|
+ //不是
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/login/login',
|
|
|
+ // });
|
|
|
+ // setTimeout(function() {
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pages/login/login',
|
|
|
+ // });
|
|
|
+ // }, 2000);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.hackReset = false;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.hackReset = true;
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
@@ -225,7 +347,7 @@
|
|
|
if (code) {
|
|
|
|
|
|
params.code = code;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//使用code请求服务器接口,换取用户用户openID
|
|
|
const res = await this.$myRequest({
|
|
@@ -233,20 +355,18 @@
|
|
|
data: params
|
|
|
})
|
|
|
if (res.data.flag == 3000) {
|
|
|
- // alert("授权失败,请重新登录");
|
|
|
- window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
- }
|
|
|
-
|
|
|
- if (res.data.flag == 3003) {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/authority/authority',
|
|
|
- });
|
|
|
+ // alert("3000授权失败,");
|
|
|
+ window.location.href = 'https://qhome.usky.cn/index.html#/';
|
|
|
}
|
|
|
- if (res.data.flag == 3002) {
|
|
|
- // alert("授权失败,请重新登录");
|
|
|
- window.location.href ='https://qhome.usky.cn/index.html#/';
|
|
|
+
|
|
|
+ if (res.data.flag == 3003) {
|
|
|
+ // alert("3003授权失败");
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/authority/authority',
|
|
|
+ });
|
|
|
}
|
|
|
- return "ok";
|
|
|
+
|
|
|
+ return res.data.flag;
|
|
|
}
|
|
|
|
|
|
var cs = {};
|
|
@@ -291,8 +411,8 @@
|
|
|
url: 'Index/getDataStatistics',
|
|
|
showLoading: true
|
|
|
})
|
|
|
- this.staticData = res.data.data[0]
|
|
|
- this.alarmCount=this.staticData.alarmCount
|
|
|
+ this.staticData = res.data.data[0]
|
|
|
+ this.alarmCount = this.staticData.alarmCount
|
|
|
},
|
|
|
|
|
|
|
|
@@ -341,9 +461,7 @@
|
|
|
content: '此模块开发中~',
|
|
|
showCancel: false,
|
|
|
success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- } else if (res.cancel) {
|
|
|
- }
|
|
|
+ if (res.confirm) {} else if (res.cancel) {}
|
|
|
}
|
|
|
});
|
|
|
}
|