login.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. third,
  32. third_mobile
  33. } from "../../units/inquire.js"
  34. export default {
  35. data() {
  36. return {
  37. xieyi: false
  38. }
  39. },
  40. onLoad() {
  41. },
  42. methods: {
  43. toxieyi(type) {
  44. uni.navigateTo({
  45. url: "/pagesA/xieyi?type=" + type
  46. })
  47. },
  48. totel() {
  49. if (!this.xieyi) {
  50. this.$u.toast("请勾选协议")
  51. return
  52. }
  53. uni.navigateTo({
  54. url: "/pagesA/tel-login"
  55. })
  56. },
  57. tologin() {
  58. let that = this
  59. if (!this.xieyi) {
  60. this.$u.toast('请先阅读并同意用户协议')
  61. return
  62. }
  63. wx.login({
  64. success(res) {
  65. console.log(res.code);
  66. if (res.code) {
  67. third({
  68. code: res.code
  69. }).then(res => {
  70. that.$u.toast("登录成功")
  71. console.log(res);
  72. if (res.data.is_mobile == 1) {
  73. uni.setStorageSync("token", res.data.userinfo.token)
  74. uni.setStorageSync("user_id", res.data.userinfo.id)
  75. uni.setStorageSync("is_profile", res.data.userinfo.group_info
  76. .is_profile)
  77. setTimeout(() => {
  78. uni.switchTab({
  79. url: "/pages/index/index"
  80. })
  81. }, 800)
  82. } else {
  83. setTimeout(() => {
  84. uni.navigateTo({
  85. url: "/pagesA/tel-login?openid=" + res.data.openid
  86. })
  87. }, 800)
  88. }
  89. })
  90. } else {
  91. that.$u.toast(res.msg)
  92. }
  93. }
  94. })
  95. },
  96. // tologin(e) {
  97. // console.log(e);
  98. // if (e.detail.code) {
  99. // var phoneCode = e.detail.code
  100. // uni.login({
  101. // success: (code) => {
  102. // third({
  103. // code: code.code
  104. // }).then(res=>{
  105. // if (res.code == 1) {
  106. // uni.setStorageSync("token", res.data.userinfo.token)
  107. // if (!res.data.userinfo.mobile|| 1 ) {
  108. // third_mobile({
  109. // mobile:'',
  110. // captcha:"123456",
  111. // }).then(res => {
  112. // if (res.code == 1) {
  113. // this.$u.toast("登录成功")
  114. // this.$u.post('/api/Member/member_info').then(
  115. // res => {
  116. // uni.setStorageSync("hx_username",
  117. // res.data.hx_username)
  118. // this.$WebIM.conn.open({
  119. // user: res.data
  120. // .hx_username,
  121. // pwd: "888888",
  122. // }).then(() => {
  123. // console.log(
  124. // "login success"
  125. // );
  126. // }).catch((reason) => {
  127. // console.log(
  128. // "login fail",
  129. // reason);
  130. // });
  131. // })
  132. // setTimeout(() => {
  133. // uni.navigateBack()
  134. // }, 800)
  135. // } else {
  136. // this.$u.toast(res.msg)
  137. // uni.removeStorageSync('token')
  138. // }
  139. // })
  140. // } else {
  141. // this.$u.toast("登录成功")
  142. // setTimeout(() => {
  143. // // if()
  144. // }, 800)
  145. // }
  146. // } else {
  147. // this.$u.toast(res.msg)
  148. // }
  149. // })
  150. // }
  151. // })
  152. // }
  153. // },
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. .login {
  159. .other-login {
  160. width: 270rpx;
  161. height: 84rpx;
  162. background: rgba(1, 139, 141, 0.06);
  163. border-radius: 42rpx;
  164. margin: 106rpx auto;
  165. image {
  166. width: 39rpx;
  167. height: 39rpx;
  168. margin-right: 8rpx;
  169. }
  170. text {
  171. font-size: 26rpx;
  172. font-family: PingFangSC-Regular, PingFang SC;
  173. font-weight: 400;
  174. color: #018B8D;
  175. }
  176. }
  177. .xieyi-box {
  178. .text1 {
  179. font-size: 24rpx;
  180. font-family: PingFangSC-Regular, PingFang SC;
  181. font-weight: 400;
  182. color: #141414;
  183. }
  184. .text2 {
  185. font-size: 24rpx;
  186. font-family: PingFangSC-Regular, PingFang SC;
  187. font-weight: 400;
  188. color: #0C66C2;
  189. }
  190. }
  191. .login-btn2 {
  192. width: 650rpx;
  193. line-height: 96rpx;
  194. border-radius: 16rpx;
  195. border: 1rpx solid #0C66C2;
  196. margin: 44rpx auto;
  197. text-align: center;
  198. font-size: 32rpx;
  199. font-family: PingFangSC-Regular, PingFang SC;
  200. font-weight: 400;
  201. color: #0C66C2;
  202. }
  203. .login-btn1 {
  204. width: 650rpx;
  205. line-height: 96rpx;
  206. height: 96rpx;
  207. background: #0C66C2;
  208. border-radius: 16rpx;
  209. margin: 0 auto;
  210. font-size: 32rpx;
  211. font-family: PingFangSC-Regular, PingFang SC;
  212. font-weight: 400;
  213. color: #FFFFFF;
  214. }
  215. .login-top {
  216. height: 478rpx;
  217. image {
  218. width: 150rpx;
  219. height: 150rpx;
  220. margin-bottom: 20rpx;
  221. }
  222. text {
  223. font-size: 32rpx;
  224. font-family: PingFangSC-Medium, PingFang SC;
  225. font-weight: 500;
  226. color: #222222;
  227. }
  228. }
  229. }
  230. </style>