login.vue 6.7 KB

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