index.vue 5.5 KB

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