login.vue 7.0 KB

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