login.vue 7.5 KB

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