login.vue 7.0 KB

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