|
@@ -5,6 +5,11 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+ import {
|
|
|
|
|
+ getConfigByType,
|
|
|
|
|
+ systemSubjectCheckIsAdminOrSafeUser,
|
|
|
|
|
+ securityDataStatisticsGetUserIdentity
|
|
|
|
|
+ } from '@/api/index.js'
|
|
|
import wx from "weixin-webview-jssdk";
|
|
import wx from "weixin-webview-jssdk";
|
|
|
export default {
|
|
export default {
|
|
|
name: 'index',
|
|
name: 'index',
|
|
@@ -12,6 +17,7 @@
|
|
|
return {}
|
|
return {}
|
|
|
},
|
|
},
|
|
|
created () {
|
|
created () {
|
|
|
|
|
+ let self = this;
|
|
|
let url = decodeURIComponent(window.location.href);
|
|
let url = decodeURIComponent(window.location.href);
|
|
|
if (url.indexOf('token') != -1) {
|
|
if (url.indexOf('token') != -1) {
|
|
|
let list = url.split("?")[1].split("&");
|
|
let list = url.split("?")[1].split("&");
|
|
@@ -19,21 +25,54 @@
|
|
|
list.forEach((item) => {
|
|
list.forEach((item) => {
|
|
|
codeData[item.split("=")[0]] = item.split("=")[1];
|
|
codeData[item.split("=")[0]] = item.split("=")[1];
|
|
|
});
|
|
});
|
|
|
- wx.miniProgram.navigateTo({
|
|
|
|
|
- url: '/pages/views/login/ssoCertification?token='+codeData.token
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if(localStorage.getItem('loginH5')){
|
|
|
|
|
+ localStorage.setItem('touken',codeData.token);
|
|
|
|
|
+ localStorage.removeItem('loginH5');
|
|
|
|
|
+ setTimeout(function(){
|
|
|
|
|
+ //等待配置与字段获取到后跳转
|
|
|
|
|
+ Promise.all([
|
|
|
|
|
+ //获取开发配置
|
|
|
|
|
+ self.getConfigByType(),
|
|
|
|
|
+ ]).then((result) => {
|
|
|
|
|
+ //查询是否是管理员/安全员
|
|
|
|
|
+ self.systemSubjectCheckIsAdminOrSafeUser()
|
|
|
|
|
+ }).catch((error) => {
|
|
|
|
|
+ Toast.fail('数据异常,请稍候再试!');
|
|
|
|
|
+ })
|
|
|
|
|
+ },500);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
|
|
+ url: '/pages/views/login/ssoCertification?token='+codeData.token
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
} else if (url.indexOf('code') != -1) {
|
|
} else if (url.indexOf('code') != -1) {
|
|
|
//code 异常状态处理
|
|
//code 异常状态处理
|
|
|
if(url.split('=')[1] == '10100'){
|
|
if(url.split('=')[1] == '10100'){
|
|
|
- //当前用户不存在,请联系管理员!
|
|
|
|
|
- wx.miniProgram.navigateTo({
|
|
|
|
|
- url: '/pages/views/login/ssoCertification?code=10100'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if(localStorage.getItem('loginH5')){
|
|
|
|
|
+ localStorage.removeItem('loginH5');
|
|
|
|
|
+ Toast.fail('当前用户不存在,请联系管理员!');
|
|
|
|
|
+ setTimeout(function(){
|
|
|
|
|
+ self.$router.push({ path: '/login' });
|
|
|
|
|
+ },2000);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //当前用户不存在,请联系管理员!
|
|
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
|
|
+ url: '/pages/views/login/ssoCertification?code=10100'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}else if(url.split('=')[1] == '500'){
|
|
}else if(url.split('=')[1] == '500'){
|
|
|
- //服务异常,请稍候再试!
|
|
|
|
|
- wx.miniProgram.navigateTo({
|
|
|
|
|
- url: '/pages/views/login/ssoCertification?code=500'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if(localStorage.getItem('loginH5')){
|
|
|
|
|
+ localStorage.removeItem('loginH5')
|
|
|
|
|
+ Toast.fail('服务异常,请稍候再试!');
|
|
|
|
|
+ setTimeout(function(){
|
|
|
|
|
+ self.$router.push({ path: '/login' });
|
|
|
|
|
+ },2000);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //服务异常,请稍候再试!
|
|
|
|
|
+ wx.miniProgram.navigateTo({
|
|
|
|
|
+ url: '/pages/views/login/ssoCertification?code=500'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
//跳转至认证页面
|
|
//跳转至认证页面
|
|
@@ -45,6 +84,51 @@
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
+ //获取开发配置
|
|
|
|
|
+ getConfigByType() {
|
|
|
|
|
+ getConfigByType({category: 2, configType: 5}).then(response => {
|
|
|
|
|
+ let obj = JSON.parse(response.data.configValue)
|
|
|
|
|
+ //文件预览地址
|
|
|
|
|
+ localStorage.setItem('filePreviewUrl', 'https://' + obj.fileExtranetUrl)
|
|
|
|
|
+ //小程序视频地址
|
|
|
|
|
+ localStorage.setItem('cameraExtranetAgent', 'https://' + obj.cameraExtranetAgent)
|
|
|
|
|
+ //MQTT地址
|
|
|
|
|
+ localStorage.setItem('mqttUrl', Decrypt(obj.mqttExtranetUrl))
|
|
|
|
|
+ //MQTT地址-内网
|
|
|
|
|
+ localStorage.setItem('mqttIntranetUrl', Decrypt(obj.mqttIntranetUrl))
|
|
|
|
|
+ //MQTT账号
|
|
|
|
|
+ localStorage.setItem('mqttUser', Decrypt(obj.mqttExtranetUser))
|
|
|
|
|
+ //MQTT密码
|
|
|
|
|
+ localStorage.setItem('mqttPassword', Decrypt(obj.mqttExtranetPassword))
|
|
|
|
|
+ //文件浏览环境
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironment', 'http://' + Decrypt(obj.fileBrowseEnvironment))
|
|
|
|
|
+ localStorage.setItem('fileBrowseEnvironmentExtranet', 'http://' + Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ //查询是否是管理员/安全员
|
|
|
|
|
+ systemSubjectCheckIsAdminOrSafeUser(){
|
|
|
|
|
+ systemSubjectCheckIsAdminOrSafeUser({}).then(response => {
|
|
|
|
|
+ if (response.data.isSafe || response.data.isAdmin) {
|
|
|
|
|
+ window.location.href = localStorage.getItem('alarmUrl');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.securityDataStatisticsGetUserIdentity();
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ //查询是否是校级管理员/院级管理员
|
|
|
|
|
+ securityDataStatisticsGetUserIdentity(){
|
|
|
|
|
+ let self = this;
|
|
|
|
|
+ securityDataStatisticsGetUserIdentity({}).then(response => {
|
|
|
|
|
+ if(response.data.schoolAdmin || response.data.collegeAdmin){
|
|
|
|
|
+ window.location.href = localStorage.getItem('alarmUrl');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ Toast.fail('您无权查看报警信息,请联系管理员.');
|
|
|
|
|
+ setTimeout(function(){
|
|
|
|
|
+ self.$router.push({ path: '/login' });
|
|
|
|
|
+ },2000);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|