login.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="login">
  3. <img src="../../common/assets/image/logobig.png" alt="" class="logobig" />
  4. <div class="logTit">
  5. <span class="titletxt">微纳园蒲公英平台</span>
  6. <p class="titletxt2">(管理端)</p>
  7. </div>
  8. <div class="loginBox">
  9. <div class="inputBox">
  10. <img
  11. src="../../common/assets/image/comicon.png"
  12. alt=""
  13. style="height: 60rpx"
  14. />
  15. <input
  16. type="text"
  17. placeholder="请输入账号"
  18. v-model="loginForm.userName"
  19. />
  20. </div>
  21. <div class="inputBox">
  22. <img src="../../common/assets/image/pswicon.svg" alt="" />
  23. <input
  24. type="password"
  25. placeholder="请输入密码"
  26. v-model="loginForm.password"
  27. />
  28. </div>
  29. <div class="inputBox">
  30. <img src="../../common/assets/image/yzmicon.svg" alt="" />
  31. <input
  32. type="text"
  33. placeholder="验证码"
  34. class="yanzhengma"
  35. v-model="loginForm.code"
  36. />
  37. <img
  38. :src="loginForm.captchaImage"
  39. @click="captchaImageRefresh(loginForm)"
  40. class="yanzhengImg"
  41. />
  42. </div>
  43. <div class="pswBox" @click="forgetPsw()">
  44. <p>忘记密码?</p>
  45. </div>
  46. <div>
  47. <van-button type="default" size="large" color="#1f1fbe" @click="login"
  48. >登 录</van-button
  49. >
  50. </div>
  51. </div>
  52. <div class="bottomTips">
  53. 2022@copyrigtht IOT - Park-tech. supported by 中国移动
  54. </div>
  55. <van-dialog id="van-toast" />
  56. </div>
  57. </template>
  58. <script>
  59. import Dialog from "../..//wxcomponents/weapp/dist/dialog/dialog.js";
  60. import { login } from "@/js_sdk/http.js";
  61. export default {
  62. data() {
  63. return {
  64. loginForm: {
  65. userName: "",
  66. password: "",
  67. code: "",
  68. type: "FRAME",
  69. captchaId: "",
  70. captchaImage: "",
  71. rememberMe: true,
  72. },
  73. };
  74. },
  75. mounted() {
  76. // login()
  77. this.captchaImageRefresh(this.loginForm);
  78. },
  79. methods: {
  80. captchaImageRefresh: function (_form) {
  81. _form.captchaId = this.$common.uuid(8);
  82. _form.captchaImage =
  83. this.$constant.BASE_URI +
  84. "/captcha/captchaImage?type=math&captchaId=" +
  85. _form.captchaId +
  86. "&s=" +
  87. Math.random();
  88. },
  89. forgetPsw() {
  90. wx.showModal({
  91. title: "提示!",
  92. content: "管理端修改密码需要拨打客服电话咨询,是否拨打?",
  93. success: function (res) {
  94. if (res.confirm) {
  95. uni.makePhoneCall({
  96. phoneNumber: "13921516068", //电话号码
  97. success: function (e) {},
  98. fail: function (e) {},
  99. });
  100. }
  101. },
  102. });
  103. },
  104. login() {
  105. const _this = this;
  106. if (!this.loginForm.userName || !this.loginForm.password) {
  107. uni.showModal({
  108. title: "提示",
  109. content: "请输入账号和密码",
  110. icon: "error",
  111. showCancel: false,
  112. });
  113. return;
  114. }
  115. login(this.loginForm).then((res) => {
  116. if (res.errmsg == "成功") {
  117. uni.showToast({
  118. title: "登录成功",
  119. icon: "none",
  120. mask: true,
  121. duration: 2000,
  122. });
  123. this.$auth.setUser(res.data.token);
  124. this.$auth.setUserInfo(res.data);
  125. uni.switchTab({
  126. url: "/pages/companyreport/companyreport",
  127. });
  128. } else {
  129. this.captchaImageRefresh(this.loginForm);
  130. }
  131. });
  132. // this.$auth.setUserType(this.$auth.TYPE_FRAME);
  133. },
  134. onShareAppMessage: function () {},
  135. },
  136. };
  137. </script>
  138. <style lang="scss">
  139. .login {
  140. background: white;
  141. height: 100%;
  142. overflow: hidden;
  143. .logTit {
  144. width: 80vw;
  145. left: 10vw;
  146. top: 60vw;
  147. display: flex;
  148. flex-direction: column;
  149. justify-content: center;
  150. align-items: center;
  151. position: absolute;
  152. z-index: 1;
  153. color: rgba(51, 51, 51, 1);
  154. font-size: 4vw;
  155. p {
  156. color: rgba(102, 102, 102, 1);
  157. font-size: 4vw;
  158. margin-top: 0.5vw;
  159. }
  160. .titletxt {
  161. font-size: 48rpx;
  162. font-family: Taipei Sans TC Beta-Bold, Taipei Sans TC Beta;
  163. font-weight: bold;
  164. color: #333333;
  165. }
  166. .titletxt2 {
  167. font-size: 32rpx;
  168. font-family: PingFang SC-Regular, PingFang SC;
  169. font-weight: 400;
  170. color: #666666;
  171. }
  172. }
  173. .logobig {
  174. width: 100vw;
  175. height: 100vh;
  176. position: absolute;
  177. left: 0;
  178. z-index: 0;
  179. }
  180. .loginBox {
  181. width: 70vw;
  182. left: 15vw;
  183. padding-top: 75vw;
  184. position: absolute;
  185. }
  186. .inputBox {
  187. position: relative;
  188. display: flex;
  189. align-items: center;
  190. img {
  191. position: absolute;
  192. width: 7vw;
  193. // padding-top: 40px;
  194. }
  195. .yanzhengImg {
  196. right: 0;
  197. width: 20vw;
  198. height: 10vw;
  199. }
  200. .yanzhengImgBox {
  201. height: 50px;
  202. display: flex;
  203. align-items: center;
  204. }
  205. input {
  206. background: black;
  207. width: 100%;
  208. height: 76rpx;
  209. padding: 5rpx 0 5rpx 70rpx;
  210. background-color: rgba(255, 255, 255, 1);
  211. border: 1rpx solid rgba(29, 24, 188, 0.05);
  212. margin: 5rpx 0;
  213. font-size: 4vw;
  214. }
  215. input::-webkit-input-placeholder {
  216. color: rgba(153, 153, 153, 1);
  217. }
  218. .yanzhengma {
  219. width: 60%;
  220. }
  221. }
  222. .pswBox {
  223. width: 100%;
  224. display: flex;
  225. justify-content: flex-end;
  226. margin: 20px 0;
  227. color: rgba(29, 24, 188, 1);
  228. }
  229. .van-button {
  230. border-radius: 60px;
  231. margin-top: 50px;
  232. }
  233. .bottomTips {
  234. width: 100vw;
  235. position: fixed;
  236. bottom: 15px;
  237. text-align: center;
  238. color: #999999;
  239. font-size: 2vw;
  240. }
  241. @media screen and (max-height: 454px) {
  242. .bottomTips {
  243. display: none;
  244. }
  245. }
  246. }
  247. </style>