index.vue 5.8 KB

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