ssoCertification.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!--认证页面-->
  2. <template>
  3. <view id="ssoCertification">
  4. 登录中请稍后
  5. </view>
  6. </template>
  7. <script>
  8. import {
  9. configInfo,
  10. getConfigByType,
  11. systemAppletRolePermission,
  12. securityDataStatisticsGetUserIdentity
  13. } from '@/pages/api/index.js'
  14. export default {
  15. name: "ssoCertification",
  16. data() {
  17. return {
  18. }
  19. },
  20. onLoad(option) {
  21. console.log('option=>',option);
  22. if(option.token){
  23. uni.setStorageSync('token', option.token);
  24. //获取登录人信息接口
  25. this.getUserInfo();
  26. }else{
  27. uni.redirectTo({
  28. url: '/pages/views/login/ssoLogin',
  29. });
  30. }
  31. },
  32. mounted() {
  33. },
  34. methods: {
  35. getUserInfo(){
  36. //等待配置与字段获取到后跳转
  37. Promise.all([
  38. //查询公共配置
  39. this.getConfigInfo(),
  40. //获取开发配置
  41. this.getConfigByType(),
  42. //获取权限字段
  43. this.systemAppletRolePermission(),
  44. //查询身份
  45. this.securityDataStatisticsGetUserIdentity()
  46. ]).then((result) => {
  47. if (uni.getStorageSync('codeData')) {
  48. uni.redirectTo({
  49. url: '/pages/views/saoCode/saoCode',
  50. });
  51. } else if (uni.getStorageSync('warningId')) {
  52. uni.redirectTo({
  53. url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail',
  54. });
  55. } else {
  56. uni.redirectTo({
  57. url: '/pages/views/home/home',
  58. });
  59. }
  60. }).catch((error) => {
  61. wx.showToast({
  62. title: '数据异常,请稍候再试!',
  63. icon: "none",
  64. duration: 3000
  65. });
  66. })
  67. },
  68. //查询公共配置
  69. async getConfigInfo() {
  70. const {
  71. data
  72. } = await configInfo({
  73. type: '1,2,4'
  74. });
  75. if (data.code == 200) {
  76. let list = JSON.parse(data.data)
  77. let newData = {};
  78. list.forEach((item) => {
  79. let obj = JSON.parse(item.configValue)
  80. newData = {
  81. ...newData,
  82. ...obj
  83. }
  84. })
  85. uni.setStorageSync('circularLogo', config.base_url + newData.circularLogo)
  86. uni.setStorageSync('rectangleLogo', config.base_url + newData.rectangleLogo)
  87. uni.setStorageSync('videoCover', config.base_url + newData.videoCover)
  88. this.$set(this, 'loginBanner', config.base_url + newData.loginBanner);
  89. uni.setStorageSync('loginBanner', config.base_url + newData.loginBanner)
  90. this.$set(this, 'supplierType', newData.supplier);
  91. uni.setStorageSync('supplierType', newData.supplier)
  92. uni.setStorageSync('homepageBanner', config.base_url + newData.homepageBanner)
  93. }
  94. },
  95. //获取开发配置
  96. async getConfigByType() {
  97. const {
  98. data
  99. } = await getConfigByType({
  100. category: 2,
  101. configType: 5
  102. });
  103. if (data.code == 200) {
  104. let obj = JSON.parse(data.data.configValue)
  105. //文件预览地址
  106. uni.setStorageSync('filePreviewUrl', 'https://' + obj.fileExtranetUrl)
  107. //小程序视频地址
  108. uni.setStorageSync('cameraExtranetAgent', 'https://' + obj.cameraExtranetAgent)
  109. //MQTT地址
  110. uni.setStorageSync('mqttUrl', Decrypt(obj.mqttExtranetUrl))
  111. //MQTT地址-内网
  112. uni.setStorageSync('mqttIntranetUrl', Decrypt(obj.mqttIntranetUrl))
  113. //MQTT账号
  114. uni.setStorageSync('mqttUser', Decrypt(obj.mqttExtranetUser))
  115. //MQTT密码
  116. uni.setStorageSync('mqttPassword', Decrypt(obj.mqttExtranetPassword))
  117. //文件浏览环境
  118. uni.setStorageSync('fileBrowseEnvironment','http://'+Decrypt(obj.fileBrowseEnvironment))
  119. uni.setStorageSync('fileBrowseEnvironmentExtranet','https://'+Decrypt(obj.fileBrowseEnvironmentExtranet))
  120. }
  121. },
  122. //查询身份
  123. async securityDataStatisticsGetUserIdentity(routeUrl) {
  124. let self = this;
  125. const {
  126. data
  127. } = await securityDataStatisticsGetUserIdentity();
  128. if(data.schoolAdmin){
  129. //校级管理员
  130. uni.setStorageSync('identityData',{
  131. type:'schoolAdmin'
  132. });
  133. }else if(data.collegeAdmin){
  134. //院级管理员
  135. uni.setStorageSync('identityData',{
  136. type:'collegeAdmin'
  137. });
  138. }else if(data.schoolGroup){
  139. //校级督导组
  140. uni.setStorageSync('identityData',{
  141. type:'schoolGroup',
  142. groupIds:data.groupIds
  143. });
  144. }else if(data.collegeGroup){
  145. //院级督导组
  146. uni.setStorageSync('identityData',{
  147. type:'collegeGroup',
  148. groupIds:data.groupIds
  149. });
  150. }else{
  151. uni.removeStorageSync('identityData');
  152. }
  153. },
  154. },
  155. }
  156. </script>
  157. <style lang="stylus" scoped>
  158. #ssoCertification {
  159. width:100%;
  160. height:100%;
  161. overflow:scroll;
  162. text-align: center;
  163. line-height:200rpx;
  164. }
  165. </style>