back.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="container">
  3. <view class="box"></view>
  4. <view class="ibox">
  5. <view class="logoBox">
  6. <image src="/static/img/logo.png" mode=""></image>
  7. <view>中南设计院教育建筑云平台</view>
  8. </view>
  9. <!-- <view class="item">
  10. <view>
  11. <image src="/static/img/zh.png" mode=""></image>
  12. 账号
  13. </view>
  14. <u--input placeholder="请输入账号" maxlength="11" border="none" inputAlign="right"
  15. v-model="value"></u--input>
  16. </view>
  17. <view class="item">
  18. <view>
  19. <image src="/static/img/mm.png" mode=""></image>
  20. 密码
  21. </view>
  22. <u--input password placeholder="请输入密码" maxlength="11" border="none" inputAlign="right"
  23. v-model="value"></u--input>
  24. </view>
  25. <view class="btn" @click="submit">
  26. 登录
  27. </view> -->
  28. <view class="loading">
  29. <image src="/static/img/loading.gif" mode=""></image>
  30. <view>登录中</view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getOauthUrl,
  38. corpLogin
  39. } from "@/api/index.js"
  40. export default {
  41. data() {
  42. return {
  43. deviceType: "phone",
  44. }
  45. },
  46. onLoad() {
  47. this.login()
  48. },
  49. methods: {
  50. submit() {
  51. uni.$u.route({
  52. type: "reLaunch",
  53. url: 'pages/tabbar/resultSquare',
  54. })
  55. },
  56. // 接收地址传参
  57. getQueryString(name) {
  58. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  59. var r = window.location.search.substr(1).match(reg);
  60. if (r != null) return unescape(r[2]);
  61. return null;
  62. },
  63. login() {
  64. let codeList = [9000003, 9000006, 9000004, 9000005]
  65. // let code = location.href.split("?")[1].split("&")[0].split("=")[1];
  66. let code=this.getQueryString('code');
  67. let state=this.getQueryString('state');
  68. corpLogin({
  69. code: code
  70. }).then(res => {
  71. if (res.code == 200) {
  72. uni.setStorageSync('TOKEN', res.data.token);
  73. if(state=='phone'){
  74. uni.reLaunch({
  75. url: '/pages/tabbar/resultSquare'
  76. });
  77. }else{
  78. // location.href='http://frp.songlanyun.com:8801/web/#/index'
  79. location.href='http://csadi.songlanyun.com/index'
  80. }
  81. } else if (codeList.indexOf(res.code) != -1) {
  82. uni.$u.toast(res.msg);
  83. setTimeout(()=>{
  84. if(state=='phone'){
  85. uni.reLaunch({
  86. url: '/pages/login?loginType=account'
  87. });
  88. }else{
  89. // location.href='http://frp.songlanyun.com:8801/web/#/index'
  90. location.href='http://csadi.songlanyun.com/index'
  91. }
  92. // http://frp.songlanyun.com:8801/web/#/index
  93. },3000)
  94. }
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .container {
  102. width: 100vw;
  103. height: 100vh;
  104. overflow: hidden;
  105. background: url('../static/img/loginBg.png');
  106. background-size: contain;
  107. position: relative;
  108. .box {
  109. width: 740rpx;
  110. height: 1600rpx;
  111. background-color: #fff;
  112. transform: rotateZ(75deg);
  113. margin: auto;
  114. }
  115. .ibox {
  116. width: 100vw;
  117. position: absolute;
  118. top: 530rpx;
  119. left: 0;
  120. text-align: center;
  121. .logoBox {
  122. margin: 0 auto 40rpx;
  123. image {
  124. width: 172rpx;
  125. height: 70rpx;
  126. margin-bottom: 5rpx;
  127. }
  128. >view {
  129. font-size: 36rpx;
  130. color: #E83A27;
  131. font-weight: 700;
  132. letter-spacing: 3rpx;
  133. }
  134. }
  135. .item {
  136. width: 600rpx;
  137. margin: auto;
  138. display: flex;
  139. align-items: center;
  140. font-size: 28rpx;
  141. padding: 30rpx 0;
  142. border-bottom: 1rpx solid rgba(204, 204, 204, 0.6);
  143. image {
  144. width: 30rpx;
  145. height: 30rpx;
  146. vertical-align: middle;
  147. margin-right: 5px;
  148. }
  149. }
  150. .btn {
  151. width: 630rpx;
  152. height: 80rpx;
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. margin: 55rpx auto;
  157. background: #e83a27;
  158. border-radius: 40rpx;
  159. box-shadow: 0rpx 10rpx 22rpx 0rpx rgba(232, 58, 39, 0.22);
  160. color: #fff;
  161. }
  162. }
  163. }
  164. .loading {
  165. // color: #e83a27;;
  166. font-size: 28rpx;
  167. image {
  168. width: 300rpx;
  169. height: 300rpx;
  170. }
  171. }
  172. </style>