login.vue 7.1 KB

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