|
|
@@ -1,46 +1,264 @@
|
|
|
-<!--登录页面-->
|
|
|
+<!--认证页面-->
|
|
|
<template>
|
|
|
- <view id="ssoLoginH5">
|
|
|
- <web-view @message="handleMessage"
|
|
|
- src="https://labcontrol.nwafu.edu.cn/api/auth/cas/logout/applet">
|
|
|
- <!-- src="http://192.168.1.10:80/#/miniProgramAuthentication?token=41cd8b02-f612-4dd5-abbd-efb5c45d69ad"> -->
|
|
|
- </web-view>
|
|
|
+ <view id="ssoCertification">
|
|
|
+ 登录中请稍后
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import {
|
|
|
+ config
|
|
|
+ } from '@/api/request/config.js'
|
|
|
+ import {
|
|
|
+ authGetAppletUser,
|
|
|
+ configInfo,
|
|
|
+ getConfigByType,
|
|
|
+ systemAppletRolePermission,
|
|
|
+ systemSubjectCheckIsAdminOrSafeUser,
|
|
|
+ securityDataStatisticsGetUserIdentity
|
|
|
+ } from '@/pages/api/index.js'
|
|
|
+ import {
|
|
|
+ Encrypt,
|
|
|
+ Decrypt
|
|
|
+ } from '@/utils/secret.js'
|
|
|
export default {
|
|
|
- name: "ssoLoginH5",
|
|
|
+ name: "ssoCertification",
|
|
|
data() {
|
|
|
return {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
-
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- const pages = getCurrentPages();
|
|
|
- const currentPage = pages[pages.length - 1];
|
|
|
- const prevPage = pages[pages.length - 2];
|
|
|
- if (prevPage && prevPage.route === 'pages/views/login/ssoCertification') {
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/views/login/login',
|
|
|
+ console.log('option',option)
|
|
|
+ if(option.token){
|
|
|
+ uni.setStorageSync('token', option.token);
|
|
|
+ //获取登录人信息接口
|
|
|
+ this.authGetAppletUser();
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ mask: true,
|
|
|
+ icon: "none",
|
|
|
+ position: "center",
|
|
|
+ title: '数据异常,请稍候再试!',
|
|
|
+ duration: 2000
|
|
|
});
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/views/login/login',
|
|
|
+ });
|
|
|
+ }, 2000);
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+
|
|
|
+ },
|
|
|
methods: {
|
|
|
- handleMessage(e) {
|
|
|
- const receivedData = e.detail.data; // 接收到的数据
|
|
|
- }
|
|
|
+ async authGetAppletUser(){
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await authGetAppletUser();
|
|
|
+ if (data.code == 200) {
|
|
|
+ uni.setStorageSync('dataBoardType', false);
|
|
|
+ uni.setStorageSync('userId', data.data.userId);
|
|
|
+ uni.setStorageSync('isInitPwd', true);
|
|
|
+ // userType 0-系统 1-教职工 2-学生 3-大屏
|
|
|
+ uni.setStorageSync('userType', data.data.userType == 0 || data.data.userType == 1 ? '1' :
|
|
|
+ (data.data.userType == 2 ? '2' : (data.data.userType == 3 ? '3' : 'none')));
|
|
|
+ //等待配置与字段获取到后跳转
|
|
|
+ Promise.all([
|
|
|
+ //查询公共配置
|
|
|
+ this.getConfigInfo(),
|
|
|
+ //获取开发配置
|
|
|
+ this.getConfigByType(),
|
|
|
+ //获取权限字段
|
|
|
+ this.systemAppletRolePermission(),
|
|
|
+ //查询身份
|
|
|
+ this.securityDataStatisticsGetUserIdentity(),
|
|
|
+ //查询是否是管理员/安全员
|
|
|
+ this.systemSubjectCheckIsAdminOrSafeUser(),
|
|
|
+ ]).then((result) => {
|
|
|
+ if (uni.getStorageSync('codeData')) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/views/saoCode/saoCode',
|
|
|
+ });
|
|
|
+ } else if (uni.getStorageSync('warningId')) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail',
|
|
|
+ });
|
|
|
+ } else if (uni.getStorageSync('manageCation')) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages_manage/views/accessQualification/accessQualificationInfo?item=' + uni.getStorageSync('manageCation')
|
|
|
+ })
|
|
|
+ } else if (uni.getStorageSync('studentCation')) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages_student/views/accessApplication/applicationDetails?item=' + uni.getStorageSync('studentCation')
|
|
|
+ })
|
|
|
+ } else if(uni.getStorageSync('recyclingReportRecord')){
|
|
|
+ //短信跳转-危废回收-报备
|
|
|
+ uni.removeStorageSync('recyclingReportRecord')
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages_hazardousWasteRecycling/views/recyclingReportRecord/index",
|
|
|
+ });
|
|
|
+ } else if(uni.getStorageSync('permissionApply')){
|
|
|
+ //短信跳转-危废回收-申请列表
|
|
|
+ uni.removeStorageSync('permissionApply')
|
|
|
+ uni.reLaunch({
|
|
|
+ url: "/pages_hazardousWasteRecycling/views/permissionApply/listPage",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/views/home/home',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ uni.showToast({
|
|
|
+ mask: true,
|
|
|
+ icon: "none",
|
|
|
+ position: "center",
|
|
|
+ title: '数据异常,请稍候再试!',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ setTimeout(function() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/views/login/login',
|
|
|
+ });
|
|
|
+ }, 2000);
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/views/home/home',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查询是否是管理员/安全员
|
|
|
+ async systemSubjectCheckIsAdminOrSafeUser(){
|
|
|
+ let self = this;
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await systemSubjectCheckIsAdminOrSafeUser();
|
|
|
+ if (data.code == 200) {
|
|
|
+ if(data.data.isSafe || data.data.isAdmin){
|
|
|
+ uni.setStorageSync('subAdmin','1');
|
|
|
+ }else{
|
|
|
+ uni.setStorageSync('subAdmin','0');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查询公共配置
|
|
|
+ async getConfigInfo() {
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await configInfo({
|
|
|
+ type: '1,2,4'
|
|
|
+ });
|
|
|
+ if (data.code == 200) {
|
|
|
+ let list = JSON.parse(data.data)
|
|
|
+ let newData = {};
|
|
|
+ list.forEach((item) => {
|
|
|
+ let obj = JSON.parse(item.configValue)
|
|
|
+ newData = {
|
|
|
+ ...newData,
|
|
|
+ ...obj
|
|
|
+ }
|
|
|
+ })
|
|
|
+ uni.setStorageSync('circularLogo', config.base_url + newData.circularLogo)
|
|
|
+ uni.setStorageSync('rectangleLogo', config.base_url + newData.rectangleLogo)
|
|
|
+ uni.setStorageSync('videoCover', config.base_url + newData.videoCover)
|
|
|
+ this.$set(this, 'loginBanner', config.base_url + newData.loginBanner);
|
|
|
+ uni.setStorageSync('loginBanner', config.base_url + newData.loginBanner)
|
|
|
+ this.$set(this, 'supplierType', newData.supplier);
|
|
|
+ uni.setStorageSync('supplierType', newData.supplier)
|
|
|
+ uni.setStorageSync('homepageBanner', config.base_url + newData.homepageBanner)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取开发配置
|
|
|
+ async getConfigByType() {
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await getConfigByType({
|
|
|
+ category: 2,
|
|
|
+ configType: 5
|
|
|
+ });
|
|
|
+ if (data.code == 200) {
|
|
|
+ let obj = JSON.parse(data.data.configValue)
|
|
|
+ //文件预览地址
|
|
|
+ uni.setStorageSync('filePreviewUrl', 'https://' + obj.fileExtranetUrl)
|
|
|
+ //小程序视频地址
|
|
|
+ uni.setStorageSync('cameraExtranetAgent', 'https://' + obj.cameraExtranetAgent)
|
|
|
+ //MQTT地址
|
|
|
+ uni.setStorageSync('mqttUrl', Decrypt(obj.mqttExtranetUrl))
|
|
|
+ //MQTT地址-内网
|
|
|
+ uni.setStorageSync('mqttIntranetUrl', Decrypt(obj.mqttIntranetUrl))
|
|
|
+ //MQTT账号
|
|
|
+ uni.setStorageSync('mqttUser', Decrypt(obj.mqttExtranetUser))
|
|
|
+ //MQTT密码
|
|
|
+ uni.setStorageSync('mqttPassword', Decrypt(obj.mqttExtranetPassword))
|
|
|
+ //版本号
|
|
|
+ if(config.weChatProgramVersion === obj.weChatProgramVersion){
|
|
|
+ uni.setStorageSync('weChatProgramVersion', true)
|
|
|
+ }else{
|
|
|
+ uni.setStorageSync('weChatProgramVersion', false)
|
|
|
+ }
|
|
|
+ //文件浏览环境
|
|
|
+ uni.setStorageSync('fileBrowseEnvironment','http://'+Decrypt(obj.fileBrowseEnvironment))
|
|
|
+ uni.setStorageSync('fileBrowseEnvironmentExtranet','https://'+Decrypt(obj.fileBrowseEnvironmentExtranet))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取权限字段
|
|
|
+ async systemAppletRolePermission() {
|
|
|
+ let self = this;
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await systemAppletRolePermission();
|
|
|
+ if (data.code == 200) {
|
|
|
+ uni.setStorageSync('permissions', data.data.data)
|
|
|
+ uni.setStorageSync('controlsRestrict', data.data.roleKeys ? data.data.roleKeys : [])
|
|
|
+ uni.setStorageSync('user', data.data.userInfo)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查询身份
|
|
|
+ async securityDataStatisticsGetUserIdentity(routeUrl) {
|
|
|
+ let self = this;
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await securityDataStatisticsGetUserIdentity();
|
|
|
+ if(data.schoolAdmin){
|
|
|
+ //校级管理员
|
|
|
+ uni.setStorageSync('identityData',{
|
|
|
+ type:'schoolAdmin'
|
|
|
+ });
|
|
|
+ }else if(data.collegeAdmin){
|
|
|
+ //院级管理员
|
|
|
+ uni.setStorageSync('identityData',{
|
|
|
+ type:'collegeAdmin'
|
|
|
+ });
|
|
|
+ }else if(data.schoolGroup){
|
|
|
+ //校级督导组
|
|
|
+ uni.setStorageSync('identityData',{
|
|
|
+ type:'schoolGroup',
|
|
|
+ groupIds:data.groupIds
|
|
|
+ });
|
|
|
+ }else if(data.collegeGroup){
|
|
|
+ //院级督导组
|
|
|
+ uni.setStorageSync('identityData',{
|
|
|
+ type:'collegeGroup',
|
|
|
+ groupIds:data.groupIds
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ uni.removeStorageSync('identityData');
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
- #ssoLoginH5 {
|
|
|
+ #ssoCertification {
|
|
|
width:100%;
|
|
|
height:100%;
|
|
|
overflow:scroll;
|
|
|
+ text-align: center;
|
|
|
+ line-height:200rpx;
|
|
|
}
|
|
|
</style>
|