index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="login_bg">
  3. <div class="login_adv" style="background-image: url(img/auth_banner.png)">
  4. <div class="login_adv__title">
  5. <h2>AIZUDA</h2>
  6. <h4>{{ $t('login.slogan') }}</h4>
  7. <p>{{ $t('login.describe') }}</p>
  8. </div>
  9. <div class="login_adv__mask"></div>
  10. <div class="login_adv__bottom">© {{ $CONFIG.APP_NAME }} {{ $CONFIG.APP_VER }}</div>
  11. </div>
  12. <div class="login_main">
  13. <div class="login_config">
  14. <el-button :icon="config.dark ? 'el-icon-sunny' : 'el-icon-moon'" circle type="info" @click="configDark"></el-button>
  15. <el-dropdown trigger="click" placement="bottom-end" @command="configLang">
  16. <el-button circle>
  17. <svg
  18. xmlns="http://www.w3.org/2000/svg"
  19. xmlns:xlink="http://www.w3.org/1999/xlink"
  20. aria-hidden="true"
  21. role="img"
  22. width="1em"
  23. height="1em"
  24. preserveAspectRatio="xMidYMid meet"
  25. viewBox="0 0 512 512"
  26. >
  27. <path
  28. d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z"
  29. fill="currentColor"
  30. ></path>
  31. <path
  32. d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z"
  33. fill="currentColor"
  34. ></path>
  35. </svg>
  36. </el-button>
  37. <template #dropdown>
  38. <el-dropdown-menu>
  39. <el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{ selected: config.lang == item.value }">{{
  40. item.name
  41. }}</el-dropdown-item>
  42. </el-dropdown-menu>
  43. </template>
  44. </el-dropdown>
  45. </div>
  46. <div class="login-form">
  47. <div class="login-header">
  48. <div class="logo">
  49. <img :alt="$CONFIG.APP_NAME" src="/logo.png" />
  50. <label>{{ $CONFIG.APP_NAME }}</label>
  51. </div>
  52. </div>
  53. <el-tabs>
  54. <el-tab-pane :label="$t('login.accountLogin')" lazy>
  55. <password-form></password-form>
  56. </el-tab-pane>
  57. <el-tab-pane :label="$t('login.mobileLogin')" lazy>
  58. <phone-form></phone-form>
  59. </el-tab-pane>
  60. </el-tabs>
  61. <template v-if="$CONFIG.MY_SHOW_LOGIN_OAUTH">
  62. <el-divider>{{ $t('login.signInOther') }}</el-divider>
  63. <div class="login-oauth">
  64. <el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button>
  65. </div>
  66. </template>
  67. </div>
  68. </div>
  69. </div>
  70. <el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
  71. <div class="qrCodeLogin">
  72. <!-- <sc-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></sc-qr-code> -->
  73. <p class="msg">{{ $tc('login.wechatLoginMsg', 1) }}<br />{{ $tc('login.wechatLoginMsg', 2) }}</p>
  74. <div v-if="isWechatLoginResult" class="qrCodeLogin-result">
  75. <el-result icon="success" :title="$tc('login.wechatLoginResult', 1)" :sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
  76. </div>
  77. </div>
  78. </el-dialog>
  79. </template>
  80. <script>
  81. import passwordForm from './components/passwordForm'
  82. import phoneForm from './components/phoneForm'
  83. export default {
  84. components: {
  85. passwordForm,
  86. phoneForm
  87. },
  88. data() {
  89. return {
  90. config: {
  91. lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
  92. dark: this.$TOOL.data.get('APP_DARK') || false
  93. },
  94. lang: [
  95. {
  96. name: '简体中文',
  97. value: 'zh-cn'
  98. },
  99. {
  100. name: 'English',
  101. value: 'en'
  102. }
  103. ],
  104. WechatLoginCode: '',
  105. showWechatLogin: false,
  106. isWechatLoginResult: false
  107. }
  108. },
  109. watch: {
  110. // 先不考虑 暗黑模式
  111. // 'config.dark'(val) {
  112. // if (val) {
  113. // document.documentElement.classList.add('dark')
  114. // this.$TOOL.data.set('APP_DARK', val)
  115. // } else {
  116. // document.documentElement.classList.remove('dark')
  117. // this.$TOOL.data.remove('APP_DARK')
  118. // }
  119. // },
  120. 'config.lang'(val) {
  121. this.$i18n.locale = val
  122. this.$TOOL.data.set('APP_LANG', val)
  123. }
  124. },
  125. created: function () {
  126. this.$TOOL.cookie.remove('TOKEN')
  127. this.$TOOL.data.remove('USER_INFO')
  128. this.$TOOL.data.remove('MENU')
  129. this.$TOOL.data.remove('PERMISSIONS')
  130. this.$TOOL.data.remove('DASHBOARDGRID')
  131. this.$TOOL.data.remove('grid')
  132. this.$store.commit('clearViewTags')
  133. this.$store.commit('clearKeepLive')
  134. this.$store.commit('clearIframeList')
  135. console.log('%c SCUI %c Gitee: https://gitee.com/lolicode/scui', 'background:#666;color:#fff;border-radius:3px;', '')
  136. },
  137. methods: {
  138. configDark() {
  139. this.config.dark = this.config.dark ? false : true
  140. },
  141. configLang(command) {
  142. this.config.lang = command.value
  143. },
  144. wechatLogin() {
  145. this.showWechatLogin = true
  146. this.WechatLoginCode = 'SCUI-823677237287236-' + new Date().getTime()
  147. this.isWechatLoginResult = false
  148. setTimeout(() => {
  149. this.isWechatLoginResult = true
  150. }, 3000)
  151. }
  152. }
  153. }
  154. </script>
  155. <style scoped>
  156. .login_bg {
  157. width: 100%;
  158. height: 100%;
  159. background: #fff;
  160. display: flex;
  161. }
  162. .login_adv {
  163. width: 33.33333%;
  164. background-color: #555;
  165. background-size: cover;
  166. background-position: center center;
  167. background-repeat: no-repeat;
  168. position: relative;
  169. }
  170. .login_adv__title {
  171. color: #fff;
  172. padding: 40px;
  173. position: absolute;
  174. top: 0px;
  175. left: 0px;
  176. right: 0px;
  177. z-index: 2;
  178. }
  179. .login_adv__title h2 {
  180. font-size: 40px;
  181. }
  182. .login_adv__title h4 {
  183. font-size: 18px;
  184. margin-top: 10px;
  185. font-weight: normal;
  186. }
  187. .login_adv__title p {
  188. font-size: 14px;
  189. margin-top: 10px;
  190. line-height: 1.8;
  191. color: rgba(255, 255, 255, 0.6);
  192. }
  193. .login_adv__title div {
  194. margin-top: 10px;
  195. display: flex;
  196. align-items: center;
  197. }
  198. .login_adv__title div span {
  199. margin-right: 15px;
  200. }
  201. .login_adv__title div i {
  202. font-size: 40px;
  203. }
  204. .login_adv__title div i.add {
  205. font-size: 20px;
  206. color: rgba(255, 255, 255, 0.6);
  207. }
  208. .login_adv__bottom {
  209. position: absolute;
  210. left: 0px;
  211. right: 0px;
  212. bottom: 0px;
  213. color: #fff;
  214. padding: 40px;
  215. background-image: linear-gradient(transparent, #000);
  216. z-index: 3;
  217. }
  218. .login_adv__mask {
  219. position: absolute;
  220. top: 0px;
  221. left: 0px;
  222. right: 0px;
  223. bottom: 0px;
  224. z-index: 1;
  225. }
  226. .login_main {
  227. flex: 1;
  228. overflow: auto;
  229. display: flex;
  230. }
  231. .login-form {
  232. width: 400px;
  233. margin: auto;
  234. padding: 20px 0;
  235. }
  236. .login-header {
  237. margin-bottom: 40px;
  238. }
  239. .login-header .logo {
  240. display: flex;
  241. align-items: center;
  242. }
  243. .login-header .logo img {
  244. width: 40px;
  245. height: 40px;
  246. vertical-align: bottom;
  247. margin-right: 10px;
  248. }
  249. .login-header .logo label {
  250. font-size: 26px;
  251. font-weight: bold;
  252. }
  253. .login-oauth {
  254. display: flex;
  255. justify-content: space-around;
  256. }
  257. .login-form .el-divider {
  258. margin-top: 40px;
  259. }
  260. .login-form {
  261. }
  262. .login-form:deep(.el-tabs) .el-tabs__header {
  263. margin-bottom: 25px;
  264. }
  265. .login-form:deep(.el-tabs) .el-tabs__header .el-tabs__item {
  266. font-size: 14px;
  267. }
  268. .login-form:deep(.login-forgot) {
  269. text-align: right;
  270. }
  271. .login-form:deep(.login-forgot) a {
  272. color: var(--el-color-primary);
  273. }
  274. .login-form:deep(.login-forgot) a:hover {
  275. color: var(--el-color-primary-light-3);
  276. }
  277. .login-form:deep(.login-reg) {
  278. font-size: 14px;
  279. color: var(--el-text-color-primary);
  280. }
  281. .login-form:deep(.login-reg) a {
  282. color: var(--el-color-primary);
  283. }
  284. .login-form:deep(.login-reg) a:hover {
  285. color: var(--el-color-primary-light-3);
  286. }
  287. .login_config {
  288. position: absolute;
  289. top: 20px;
  290. right: 20px;
  291. }
  292. .login-form:deep(.login-msg-yzm) {
  293. display: flex;
  294. width: 100%;
  295. }
  296. .login-form:deep(.login-msg-yzm) .el-button {
  297. margin-left: 10px;
  298. --el-button-size: 42px;
  299. }
  300. .qrCodeLogin {
  301. text-align: center;
  302. position: relative;
  303. padding: 20px 0;
  304. }
  305. .qrCodeLogin img.qrCode {
  306. background: #fff;
  307. padding: 20px;
  308. border-radius: 10px;
  309. }
  310. .qrCodeLogin p.msg {
  311. margin-top: 15px;
  312. }
  313. .qrCodeLogin .qrCodeLogin-result {
  314. position: absolute;
  315. top: 0;
  316. left: 0;
  317. right: 0;
  318. bottom: 0;
  319. text-align: center;
  320. background: var(--el-mask-color);
  321. }
  322. @media (max-width: 1200px) {
  323. .login-form {
  324. width: 340px;
  325. }
  326. }
  327. @media (max-width: 1000px) {
  328. .login_main {
  329. display: block;
  330. }
  331. .login_main .login_config {
  332. position: static;
  333. padding: 20px 20px 0 20px;
  334. text-align: right;
  335. }
  336. .login-form {
  337. width: 100%;
  338. padding: 20px 40px;
  339. }
  340. .login_adv {
  341. display: none;
  342. }
  343. }
  344. </style>