login.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="login">
  3. <!-- <u-navbar :is-back="false" :border-bottom="false" :background="{background:'rgba(0,0,0,0)'}"></u-navbar> -->
  4. <view class="login-top u-flex-col u-col-center u-row-center">
  5. <image src="../../static/images/logo.png" mode=""></image>
  6. <text>内核招聘</text>
  7. </view>
  8. <button class="login-btn1" @click="tologin">微信授权登录</button>
  9. <view class="login-btn2" @click="totel">
  10. 手机号登录/注册
  11. </view>
  12. <view class="xieyi-box u-flex u-row-center">
  13. <u-checkbox-group v-model="xieyi">
  14. <u-checkbox shape="circle" active-color="#0C66C2"></u-checkbox>
  15. </u-checkbox-group>
  16. <view class="u-flex">
  17. <text class="text1">登录代表您已同意</text>
  18. <text class="text2" @click.stop="toxieyi(1)">《用户协议》</text>
  19. <text class="text1">、</text>
  20. <text class="text2" @click.stop="toxieyi(2)">《隐私协议》</text>
  21. </view>
  22. </view>
  23. <view class="other-login u-flex u-row-center">
  24. <image src="../../static/images/jingli-img.png" mode=""></image>
  25. <text>项目经理登录</text>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. conn
  32. } from '@/utils/WebIM.js'
  33. import {
  34. third,
  35. third_mobile
  36. } from "../../units/inquire.js"
  37. export default {
  38. data() {
  39. return {
  40. xieyi: false
  41. }
  42. },
  43. onLoad() {
  44. },
  45. methods: {
  46. toxieyi(type) {
  47. uni.navigateTo({
  48. url: "/pagesA/xieyi?type=" + type
  49. })
  50. },
  51. totel() {
  52. if (!this.xieyi) {
  53. this.$u.toast("请勾选协议")
  54. return
  55. }
  56. uni.navigateTo({
  57. url: "/pagesA/tel-login"
  58. })
  59. },
  60. tologin() {
  61. let that = this
  62. if (!this.xieyi) {
  63. this.$u.toast('请先阅读并同意用户协议')
  64. return
  65. }
  66. wx.login({
  67. success(res) {
  68. console.log(res.code);
  69. if (res.code) {
  70. third({
  71. code: res.code
  72. }).then(res => {
  73. that.$u.toast("登录成功")
  74. var options = {
  75. user: res.data.userinfo.user_no,
  76. pwd: res.data.userinfo.emchat_password,
  77. appKey: conn.appkey,
  78. success: function(res2) {
  79. uni.setStorageSync('user_no', res.data.userinfo.user_no)
  80. uni.setStorageSync('pwd', res.data.userinfo
  81. .emchat_password)
  82. },
  83. error: function() {}
  84. };
  85. conn.open(options);
  86. console.log(res);
  87. if (res.data.is_mobile == 1) {
  88. uni.setStorageSync("token", res.data.userinfo.token)
  89. uni.setStorageSync("user_id", res.data.userinfo.id)
  90. uni.setStorageSync("is_profile", res.data.userinfo.group_info
  91. .is_profile)
  92. setTimeout(() => {
  93. uni.switchTab({
  94. url: "/pages/index/index"
  95. })
  96. }, 800)
  97. } else {
  98. setTimeout(() => {
  99. uni.navigateTo({
  100. url: "/pagesA/tel-login?openid=" + res.data
  101. .openid
  102. })
  103. }, 800)
  104. }
  105. })
  106. } else {
  107. that.$u.toast(res.msg)
  108. }
  109. }
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss">
  116. .login {
  117. .other-login {
  118. width: 270rpx;
  119. height: 84rpx;
  120. background: rgba(1, 139, 141, 0.06);
  121. border-radius: 42rpx;
  122. margin: 106rpx auto;
  123. image {
  124. width: 39rpx;
  125. height: 39rpx;
  126. margin-right: 8rpx;
  127. }
  128. text {
  129. font-size: 26rpx;
  130. font-family: PingFangSC-Regular, PingFang SC;
  131. font-weight: 400;
  132. color: #018B8D;
  133. }
  134. }
  135. .xieyi-box {
  136. .text1 {
  137. font-size: 24rpx;
  138. font-family: PingFangSC-Regular, PingFang SC;
  139. font-weight: 400;
  140. color: #141414;
  141. }
  142. .text2 {
  143. font-size: 24rpx;
  144. font-family: PingFangSC-Regular, PingFang SC;
  145. font-weight: 400;
  146. color: #0C66C2;
  147. }
  148. }
  149. .login-btn2 {
  150. width: 650rpx;
  151. line-height: 96rpx;
  152. border-radius: 16rpx;
  153. border: 1rpx solid #0C66C2;
  154. margin: 44rpx auto;
  155. text-align: center;
  156. font-size: 32rpx;
  157. font-family: PingFangSC-Regular, PingFang SC;
  158. font-weight: 400;
  159. color: #0C66C2;
  160. }
  161. .login-btn1 {
  162. width: 650rpx;
  163. line-height: 96rpx;
  164. height: 96rpx;
  165. background: #0C66C2;
  166. border-radius: 16rpx;
  167. margin: 0 auto;
  168. font-size: 32rpx;
  169. font-family: PingFangSC-Regular, PingFang SC;
  170. font-weight: 400;
  171. color: #FFFFFF;
  172. }
  173. .login-top {
  174. height: 478rpx;
  175. image {
  176. width: 150rpx;
  177. height: 150rpx;
  178. margin-bottom: 20rpx;
  179. }
  180. text {
  181. font-size: 32rpx;
  182. font-family: PingFangSC-Medium, PingFang SC;
  183. font-weight: 500;
  184. color: #222222;
  185. }
  186. }
  187. }
  188. </style>