index.vue 5.8 KB

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