SignOn.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <div class="signOn">
  3. <div class="signOnContent">
  4. <div class="signOnContentHeader">
  5. <div class="signOnContentHeader_follt">
  6. <div class="signOnContentHeaderTitle">新课标试题网</div>
  7. <div class="signOnContentHeaderLine"></div>
  8. <div class="signOnContentHeaderDesc">
  9. 汇聚K12全学科教学资源,覆盖课前预习、课中互动、课后巩固全场景,地域专版,训练精准,赋能师生高效教与学。
  10. </div>
  11. </div>
  12. </div>
  13. <div class="signOnContentBody">
  14. <div v-for="(item, index) in sysInfo" :key="index" class="system-cards" @click="goToSystem(item)"
  15. :style="{ backgroundImage: 'url(' + item.image + ')' }">
  16. <div class="card-content">
  17. <div class="card-content-title">{{ item.appName }}</div>
  18. <p>{{ item.description }}</p>
  19. <button class="experience-btn">立即体验</button>
  20. </div>
  21. <div class="card-image">
  22. <!-- 图标占位区域 -->
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import { getInfo, getToken } from '@/api/sigon'
  31. export default {
  32. data() {
  33. return {
  34. sysInfo: [],
  35. };
  36. },
  37. created() {
  38. this.getInfo()
  39. },
  40. methods: {
  41. async getInfo() {
  42. let getUserInfo = await getInfo()
  43. if (getUserInfo.ret == 0) {
  44. this.sysInfo = getUserInfo.data
  45. this.sysInfo = this.sysInfo.map(item => {
  46. if (item.appId == "C0001") {
  47. return {
  48. ...item,
  49. image: require("../assets/singleSignOn/resMgrSysBkg.png")
  50. }
  51. }
  52. else if (item.appId == "C0002") {
  53. return {
  54. ...item,
  55. image: require("../assets/singleSignOn/examMgmtSBgk.png")
  56. }
  57. }
  58. else if (item.appId == "C0003") {
  59. return {
  60. ...item,
  61. image: require("../assets/singleSignOn/onlineMarkingBgk.png")
  62. }
  63. }
  64. return item
  65. })
  66. sessionStorage.setItem("getInfo", JSON.stringify(this.sysInfo));
  67. }
  68. },
  69. async goToSystem(row) {
  70. console.log(`即将进入===============》`, row)
  71. let dataParmas = {
  72. // sunhj627
  73. account: sessionStorage.getItem("getInfoName"),
  74. "appId": row.appId
  75. }
  76. let goToken = await getToken(dataParmas)
  77. if (goToken.ret == 0) {
  78. // 从goToken中获取accessToken
  79. const accessToken = goToken && goToken.accessToken ? goToken.accessToken : '';
  80. if (row.platformUrl) {
  81. try {
  82. let targetUrl = row.platformUrl.trim();
  83. // 检查URL是否包含协议,如果没有则添加
  84. if (!targetUrl.startsWith('http://') && !targetUrl.startsWith('https://')) {
  85. // 如果URL本身就是完整域名,添加https协议
  86. if (targetUrl.includes('.')) {
  87. targetUrl = 'https://' + targetUrl;
  88. } else {
  89. // 否则,可能是相对路径或不完整URL
  90. console.warn('URL格式可能不完整:', targetUrl);
  91. }
  92. }
  93. // 构建带accessToken的URL
  94. if (accessToken) {
  95. // 检查URL是否已有查询参数
  96. const hasQueryParams = targetUrl.includes('?');
  97. targetUrl += hasQueryParams ? '&' : '?';
  98. targetUrl += 'accessToken=' + encodeURIComponent(accessToken);
  99. }
  100. console.log(targetUrl, 'targetUrl')
  101. // 跳转到系统页面
  102. window.location.href = targetUrl;
  103. } catch (error) {
  104. console.error('URL构建失败:', error);
  105. this.$message.error('无法跳转到目标系统,请联系管理员');
  106. }
  107. } else {
  108. console.error('平台URL不存在');
  109. this.$message.error('平台URL不存在');
  110. }
  111. }
  112. }
  113. },
  114. };
  115. </script>
  116. <style scoped lang="scss">
  117. .signOn {
  118. width: 100%;
  119. height: 100%;
  120. background: url("../assets/singleSignOn/bj.png");
  121. background-size: cover;
  122. .signOnContent {
  123. width: 100%;
  124. height: 100%;
  125. .signOnContentHeader {
  126. width: 100%;
  127. height: 50%;
  128. text-align: center;
  129. // border-bottom: 1px solid #326eff;
  130. // 内容垂直居中
  131. display: flex;
  132. align-items: end;
  133. justify-content: center;
  134. .signOnContentHeader_follt {
  135. margin-bottom: 5%;
  136. width: 44%;
  137. .signOnContentHeaderTitle {
  138. color: #326eff;
  139. font-size: 55px;
  140. font-weight: bold;
  141. position: relative;
  142. }
  143. .signOnContentHeaderLine {
  144. width: 100px;
  145. height: 7px;
  146. background: #326eff;
  147. margin: 10px auto 40px;
  148. }
  149. .signOnContentHeaderDesc {
  150. font-size: 20px;
  151. color: #333333;
  152. margin-bottom: 20px;
  153. text-align: center;
  154. font-weight: 400;
  155. }
  156. }
  157. }
  158. .signOnContentBody {
  159. width: 100%;
  160. // height: 50%;
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. gap: 30px;
  165. // padding: 50px;
  166. .system-cards {
  167. display: flex;
  168. height: 240px;
  169. backdrop-filter: blur(10px);
  170. border-radius: 15px;
  171. padding: 30px;
  172. text-align: left;
  173. transition: transform 0.3s, box-shadow 0.3s;
  174. cursor: pointer;
  175. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  176. background-size: 100% 100%;
  177. background-repeat: no-repeat;
  178. width: 400px;
  179. position: relative;
  180. overflow: hidden;
  181. align-items: center;
  182. justify-content: space-between;
  183. .card-content {
  184. flex: 1;
  185. z-index: 1;
  186. padding-right: 20px;
  187. }
  188. .card-image {
  189. flex-shrink: 0;
  190. width: 120px;
  191. height: 120px;
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. }
  196. .card-content-title {
  197. font-size: 24px;
  198. margin-bottom: 15px;
  199. font-weight: 800;
  200. color: #333;
  201. }
  202. p {
  203. font-size: 16px;
  204. margin-bottom: 20px;
  205. color: #666;
  206. line-height: 1.5;
  207. }
  208. .experience-btn {
  209. background-color: #326eff;
  210. color: white;
  211. border: none;
  212. padding: 8px 24px;
  213. border-radius: 25px 4px;
  214. font-size: 16px;
  215. cursor: pointer;
  216. transition: background-color 0.3s;
  217. &:hover {
  218. background-color: #2558d1;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. }
  225. </style>