index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="phonelogin">
  3. <img src="./logobig.png" alt="" class="logobig" />
  4. <div class="logTit">
  5. <span class="titletxt">欢迎登陆</span>
  6. </div>
  7. <div class="loginBox">
  8. <button
  9. open-type="getPhoneNumber"
  10. class="login_button"
  11. style="padding: 30rpx; color: white; margin-top: 25vh"
  12. @getphonenumber="getPhoneNumber"
  13. >
  14. 授权手机号快捷登录
  15. </button>
  16. </div>
  17. <div class="bottomTips">
  18. <label class="radio">
  19. <radio value="r1" checked="true" color="#8a0554" />
  20. 已阅读并同意<span style="color: #8a0554"
  21. >《服务协议条款及隐私政策》</span
  22. >
  23. </label>
  24. </div>
  25. <!-- <van-dialog id="van-toast" />-->
  26. </div>
  27. </template>
  28. <script>
  29. import { loginByWeixin2 } from "@/js_sdk/http.js";
  30. export default {
  31. data() {
  32. return {
  33. loginForm: {
  34. userName: "",
  35. password: "",
  36. code: "",
  37. type: "FRAME",
  38. captchaId: "",
  39. captchaImage: "",
  40. rememberMe: true,
  41. },
  42. };
  43. },
  44. mounted() {
  45. // login()
  46. this.captchaImageRefresh(this.loginForm);
  47. },
  48. methods: {
  49. getPhoneNumber(e) {
  50. wx.login({
  51. success(res) {
  52. console.log(res);
  53. let data = {
  54. loginCode: res.code,
  55. phoneCode: e.detail.code,
  56. };
  57. loginByWeixin2(data).then((e) => {
  58. console.log(e.data.user);
  59. wx.setStorageSync("USERINFO", JSON.stringify(e.data.user));
  60. uni.switchTab({
  61. url: "/pages/index/index",
  62. });
  63. });
  64. },
  65. });
  66. },
  67. goqy() {
  68. uni.navigateTo({
  69. url: "/pages/subPackages/gocompnay/index",
  70. });
  71. },
  72. gozhfw() {
  73. wx.navigateToMiniProgram({
  74. appId: "wx15404cced62d7b37",
  75. success(res) {
  76. // 打开成功
  77. },
  78. fail(e) {
  79. console.log(e);
  80. },
  81. });
  82. },
  83. captchaImageRefresh: function (_form) {
  84. _form.captchaId = this.$common.uuid(8);
  85. _form.captchaImage =
  86. this.$constant.BASE_URI +
  87. "/captcha/captchaImage?type=math&captchaId=" +
  88. _form.captchaId +
  89. "&s=" +
  90. Math.random();
  91. },
  92. forgetPsw() {
  93. wx.showModal({
  94. title: "提示!",
  95. content: "管理端修改密码需要拨打客服电话咨询,是否拨打?",
  96. success: function (res) {
  97. if (res.confirm) {
  98. uni.makePhoneCall({
  99. phoneNumber: "13921516068", //电话号码
  100. success: function (e) {},
  101. fail: function (e) {},
  102. });
  103. }
  104. },
  105. });
  106. },
  107. login() {
  108. const _this = this;
  109. if (!this.loginForm.userName || !this.loginForm.password) {
  110. uni.showModal({
  111. title: "提示",
  112. content: "请输入账号和密码",
  113. icon: "error",
  114. showCancel: false,
  115. });
  116. return;
  117. }
  118. login(this.loginForm).then((res) => {
  119. if (res.errmsg == "成功") {
  120. uni.showToast({
  121. title: "登录成功",
  122. icon: "none",
  123. mask: true,
  124. duration: 2000,
  125. });
  126. this.$auth.setUser(res.data.token);
  127. this.$auth.setUserInfo(res.data);
  128. uni.switchTab({
  129. url: "/pages/index/index",
  130. });
  131. } else {
  132. this.captchaImageRefresh(this.loginForm);
  133. }
  134. });
  135. // this.$auth.setUserType(this.$auth.TYPE_FRAME);
  136. },
  137. onShareAppMessage: function () {},
  138. },
  139. };
  140. </script>
  141. <style lang="scss">
  142. .phonelogin {
  143. background: white;
  144. height: 100%;
  145. overflow: hidden;
  146. .login_button {
  147. height: 96rpx;
  148. background: #8a0554;
  149. border-radius: 48rpx 48rpx 48rpx 48rpx;
  150. color: white;
  151. &:after {
  152. border: none;
  153. }
  154. }
  155. .logTit {
  156. width: 80vw;
  157. left: 10vw;
  158. top: 280rpx;
  159. display: flex;
  160. flex-direction: column;
  161. justify-content: center;
  162. align-items: center;
  163. position: absolute;
  164. z-index: 1;
  165. color: rgba(51, 51, 51, 1);
  166. font-size: 4vw;
  167. p {
  168. color: rgba(102, 102, 102, 1);
  169. font-size: 4vw;
  170. margin-top: 0.5vw;
  171. }
  172. .titletxt {
  173. font-size: 62rpx;
  174. font-family: Taipei Sans TC Beta-Bold, Taipei Sans TC Beta;
  175. font-weight: bold;
  176. color: rgba(52, 19, 39, 1);
  177. }
  178. }
  179. .logobig {
  180. width: 100vw;
  181. height: 100vh;
  182. position: absolute;
  183. left: 0;
  184. z-index: 0;
  185. }
  186. .loginBox {
  187. width: 70vw;
  188. left: 15vw;
  189. padding-top: 75vw;
  190. position: absolute;
  191. }
  192. .inputBox {
  193. position: relative;
  194. display: flex;
  195. align-items: center;
  196. img {
  197. position: absolute;
  198. width: 7vw;
  199. // padding-top: 40px;
  200. }
  201. .yanzhengImg {
  202. right: 0;
  203. width: 20vw;
  204. height: 10vw;
  205. }
  206. .yanzhengImgBox {
  207. height: 50px;
  208. display: flex;
  209. align-items: center;
  210. }
  211. input {
  212. background: black;
  213. width: 100%;
  214. height: 76rpx;
  215. padding: 5rpx 0 5rpx 70rpx;
  216. background-color: rgba(255, 255, 255, 1);
  217. border: 1rpx solid rgba(29, 24, 188, 0.05);
  218. margin: 5rpx 0;
  219. font-size: 4vw;
  220. }
  221. input::-webkit-input-placeholder {
  222. color: rgba(153, 153, 153, 1);
  223. }
  224. .yanzhengma {
  225. width: 60%;
  226. }
  227. }
  228. .pswBox {
  229. width: 100%;
  230. display: flex;
  231. justify-content: flex-end;
  232. margin: 20px 0;
  233. color: #8a0554;
  234. }
  235. .van-button {
  236. margin-top: 15rpx;
  237. border-radius: 60px;
  238. }
  239. .loginbtn {
  240. margin-top: 50rpx;
  241. }
  242. .bottomTips {
  243. width: 100vw;
  244. position: fixed;
  245. bottom: 100rpx;
  246. text-align: center;
  247. color: #999999;
  248. font-size: 28rpx;
  249. }
  250. @media screen and (max-height: 454px) {
  251. .bottomTips {
  252. display: none;
  253. }
  254. }
  255. }
  256. </style>