login.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div class="login">
  3. <img
  4. src="https://www.idea-co-sf.com/gardenProduct/image/bj01.png"
  5. alt=""
  6. class="logobig2"
  7. />
  8. <div
  9. style="
  10. position: absolute;
  11. margin: 0 auto;
  12. width: 100%;
  13. text-align: center;
  14. color: #0365f9;
  15. top: 80rpx;
  16. font-size: 48rpx;
  17. font-weight: bold;
  18. "
  19. >
  20. 安居保障房交易管理系统
  21. </div>
  22. <!-- <div class="logintype" v-if="loginStatus">-->
  23. <!-- <div-->
  24. <!-- @click="changeLoginType('企业用户')"-->
  25. <!-- :class="loginType == '企业用户' ? 'checkbox ischecked' : 'checkbox'"-->
  26. <!-- >-->
  27. <!-- 企业用户-->
  28. <!-- </div>-->
  29. <!-- <div-->
  30. <!-- @click="changeLoginType('管理用户')"-->
  31. <!-- :class="loginType == '管理用户' ? 'checkbox ischecked' : 'checkbox'"-->
  32. <!-- >-->
  33. <!-- 管理用户-->
  34. <!-- </div>-->
  35. <!-- </div>-->
  36. <div class="loginBody">
  37. <!-- <div class="loginTypeBox">
  38. <div class="loginTypeItem" @click="changeLoginType('企业用户')">
  39. <span
  40. class="loginTypeName"
  41. :class="loginType === '企业用户' ? 'ischecked' : ''"
  42. >企业用户</span
  43. >
  44. <div class="bottomLine" v-show="loginType === '企业用户'"></div>
  45. </div>
  46. <div class="loginTypeItem" @click="changeLoginType('管理用户')">
  47. <span
  48. class="loginTypeName"
  49. :class="loginType === '管理用户' ? 'ischecked' : ''"
  50. >管理用户</span
  51. >
  52. <div class="bottomLine" v-show="loginType === '管理用户'"></div>
  53. </div>
  54. </div> -->
  55. <div class="loginBox">
  56. <div class="inputBox">
  57. <img
  58. src="https://www.idea-co-sf.com/gardenProduct/image/comicon.svg"
  59. alt=""
  60. style="height: 60rpx; left: 32rpx"
  61. />
  62. <input
  63. type="text"
  64. placeholder="请输入用户名"
  65. v-model="loginForm.userName"
  66. class="inputCont"
  67. placeholder-class="b-palceholder"
  68. />
  69. </div>
  70. <div class="inputBox">
  71. <img
  72. src="https://www.idea-co-sf.com/gardenProduct/image/pswicon.svg"
  73. alt=""
  74. style="height: 60rpx; left: 32rpx"
  75. />
  76. <input
  77. type="password"
  78. placeholder="请输入密码"
  79. v-model="loginForm.password"
  80. class="inputCont"
  81. placeholder-class="b-palceholder"
  82. />
  83. </div>
  84. <div class="inputBox">
  85. <img
  86. src="https://www.idea-co-sf.com/gardenProduct/image/yzmicon.svg"
  87. alt=""
  88. style="height: 60rpx; left: 32rpx"
  89. />
  90. <input
  91. type="text"
  92. placeholder="请输入验证码"
  93. class="yanzhengma"
  94. v-model="loginForm.code"
  95. placeholder-class="b-palceholder"
  96. />
  97. <img
  98. :src="loginForm.captchaImage"
  99. @click="captchaImageRefresh(loginForm)"
  100. class="yanzhengImg"
  101. />
  102. </div>
  103. <!-- <div class="pswBox" @click="forgetPsw()">-->
  104. <!-- <p>忘记密码?</p>-->
  105. <!-- </div>-->
  106. <div>
  107. <button class="loginbtn" @click="loginClick">提交</button>
  108. </div>
  109. </div>
  110. <div class="bottomTips">
  111. <label class="radio">
  112. <radio value="r1" checked="true" color="rgba(3, 101, 249, 1)" />
  113. 已阅读并同意<span style="color: rgba(3, 101, 249, 1)"
  114. >《服务协议条款及隐私政策》</span
  115. >
  116. </label>
  117. </div>
  118. <!-- <van-dialog id="van-toast" />-->
  119. </div>
  120. </div>
  121. </template>
  122. <script>
  123. import { login, loginByCompany } from "@/js_sdk/http.js";
  124. export default {
  125. data() {
  126. return {
  127. loginStatus: true,
  128. loginType: "企业用户",
  129. loginForm: {
  130. userName: "",
  131. password: "",
  132. code: "",
  133. type: "FRAME",
  134. captchaId: "",
  135. captchaImage: "",
  136. rememberMe: true,
  137. },
  138. };
  139. },
  140. mounted() {
  141. // login()
  142. this.captchaImageRefresh(this.loginForm);
  143. },
  144. onLoad(options) {
  145. if (options.loginType) {
  146. this.loginType = options.loginType;
  147. }
  148. },
  149. methods: {
  150. changeLoginType(e) {
  151. console.log(this.loginType);
  152. this.loginStatus = false;
  153. this.loginType = e;
  154. this.loginStatus = true;
  155. },
  156. getPhoneNumber(e) {
  157. wx.login({
  158. success(res) {
  159. // console.log(res);
  160. let data = {
  161. loginCode: res.code,
  162. phoneCode: e.detail.code,
  163. };
  164. loginByWeixin2(data).then((e) => {
  165. // console.log(e.data.user);
  166. wx.setStorageSync("USERINFO", JSON.stringify(e.data.user));
  167. uni.switchTab({
  168. url: "/pages/index/index",
  169. });
  170. });
  171. },
  172. });
  173. },
  174. goqy() {
  175. uni.navigateTo({
  176. url: "/pages/subPackages/gocompnay/index",
  177. });
  178. },
  179. gozhfw() {
  180. wx.navigateToMiniProgram({
  181. appId: "wx15404cced62d7b37",
  182. success(res) {
  183. // 打开成功
  184. },
  185. fail(e) {
  186. console.log(e);
  187. },
  188. });
  189. },
  190. captchaImageRefresh: function (_form) {
  191. _form.captchaId = this.$common.uuid(8);
  192. _form.captchaImage =
  193. this.$constant.BASE_URI +
  194. "/captcha/captchaImage?type=math&captchaId=" +
  195. _form.captchaId +
  196. "&s=" +
  197. Math.random();
  198. },
  199. forgetPsw() {
  200. wx.showModal({
  201. title: "提示!",
  202. content: "管理端修改密码需要拨打客服电话咨询,是否拨打?",
  203. success: function (res) {
  204. if (res.confirm) {
  205. uni.makePhoneCall({
  206. phoneNumber: "", //电话号码
  207. success: function (e) {},
  208. fail: function (e) {},
  209. });
  210. }
  211. },
  212. });
  213. },
  214. loginClick() {
  215. this.login();
  216. },
  217. UserLogin() {
  218. const _this = this;
  219. if (!this.loginForm.userName || !this.loginForm.password) {
  220. uni.showModal({
  221. title: "提示",
  222. content: "请输入账号和密码",
  223. icon: "error",
  224. showCancel: false,
  225. });
  226. return;
  227. }
  228. wx.login({
  229. success(e) {
  230. console.log(e);
  231. _this.loginForm.loginCode = e.code;
  232. loginByCompany(_this.loginForm).then((res) => {
  233. if (res.msg == "正常") {
  234. uni.showToast({
  235. title: "登录成功",
  236. icon: "none",
  237. mask: true,
  238. duration: 2000,
  239. });
  240. wx.setStorageSync("USERINFO", JSON.stringify(res.user_));
  241. uni.switchTab({
  242. url: "/pages/index/index",
  243. });
  244. } else {
  245. uni.showToast({
  246. title: res.errmsg,
  247. icon: "none",
  248. mask: true,
  249. duration: 2000,
  250. });
  251. _this.captchaImageRefresh(_this.loginForm);
  252. }
  253. });
  254. },
  255. });
  256. // this.$auth.setUserType(this.$auth.TYPE_FRAME);
  257. },
  258. login() {
  259. const _this = this;
  260. if (!this.loginForm.userName || !this.loginForm.password) {
  261. uni.showModal({
  262. title: "提示",
  263. content: "请输入账号和密码",
  264. icon: "error",
  265. showCancel: false,
  266. });
  267. return;
  268. }
  269. wx.login({
  270. success(e) {
  271. console.log(e);
  272. _this.loginForm.loginCode = e.code;
  273. login(_this.loginForm).then((res) => {
  274. console.log(res);
  275. if (res.errmsg == "成功") {
  276. uni.showToast({
  277. title: "登录成功",
  278. icon: "none",
  279. mask: true,
  280. duration: 2000,
  281. });
  282. console.log(res.data.user);
  283. wx.setStorageSync("USERINFO", JSON.stringify(res.data.user));
  284. uni.switchTab({
  285. url: "/pages/index/index",
  286. });
  287. } else {
  288. uni.showToast({
  289. title: res.errmsg,
  290. icon: "none",
  291. mask: true,
  292. duration: 2000,
  293. });
  294. _this.captchaImageRefresh(_this.loginForm);
  295. }
  296. });
  297. },
  298. });
  299. // this.$auth.setUserType(this.$auth.TYPE_FRAME);
  300. },
  301. onShareAppMessage: function () {},
  302. },
  303. };
  304. </script>
  305. <style lang="scss">
  306. .login {
  307. background: white;
  308. height: 100%;
  309. overflow: hidden;
  310. .logTit {
  311. width: 80vw;
  312. left: 10vw;
  313. top: 60vw;
  314. display: flex;
  315. flex-direction: column;
  316. justify-content: center;
  317. align-items: center;
  318. position: absolute;
  319. z-index: 1;
  320. color: rgba(51, 51, 51, 1);
  321. font-size: 4vw;
  322. p {
  323. color: rgba(102, 102, 102, 1);
  324. font-size: 4vw;
  325. margin-top: 0.5vw;
  326. }
  327. .titletxt {
  328. font-size: 48rpx;
  329. font-family: Taipei Sans TC Beta-Bold, Taipei Sans TC Beta;
  330. font-weight: bold;
  331. color: #333333;
  332. }
  333. .titletxt2 {
  334. font-size: 32rpx;
  335. font-family: PingFang SC-Regular, PingFang SC;
  336. font-weight: 400;
  337. color: #666666;
  338. }
  339. }
  340. .logobig2 {
  341. width: 100vw;
  342. height: 400rpx;
  343. position: absolute;
  344. left: 0;
  345. z-index: 0;
  346. }
  347. .loginBox {
  348. width: 86vw;
  349. left: 7vw;
  350. top: 156rpx;
  351. position: absolute;
  352. }
  353. .inputBox {
  354. position: relative;
  355. display: flex;
  356. align-items: center;
  357. margin-bottom: 30rpx;
  358. img {
  359. position: absolute;
  360. width: 7vw;
  361. // padding-top: 40px;
  362. }
  363. .yanzhengImg {
  364. right: 0 !important;
  365. width: 20vw;
  366. height: 10vw;
  367. z-index: 10;
  368. }
  369. .yanzhengImgBox {
  370. height: 50px;
  371. display: flex;
  372. align-items: center;
  373. }
  374. input {
  375. background: black;
  376. width: 100%;
  377. height: 76rpx;
  378. padding: 5rpx 0 5rpx 92rpx;
  379. border: 1rpx solid rgba(29, 24, 188, 0.05);
  380. margin: 5rpx 0;
  381. font-size: 32rpx;
  382. background: rgba(243, 245, 249, 1) !important;
  383. border-radius: 16rpx;
  384. }
  385. .b-palceholder {
  386. color: rgba(179, 179, 179, 1);
  387. }
  388. .yanzhengma {
  389. width: 100%;
  390. }
  391. }
  392. .pswBox {
  393. width: 100%;
  394. display: flex;
  395. justify-content: flex-end;
  396. margin: 20px 0;
  397. color: rgba(29, 24, 188, 1);
  398. }
  399. .van-button {
  400. margin-top: 15rpx;
  401. border-radius: 60px;
  402. }
  403. .loginbtn {
  404. margin-top: 50rpx;
  405. border-radius: 16rpx !important;
  406. padding: 24rpx;
  407. background: rgba(3, 101, 249, 1);
  408. color: white;
  409. font-size: 36rpx;
  410. }
  411. .bottomTips {
  412. width: 100vw;
  413. position: fixed;
  414. bottom: 100rpx;
  415. text-align: center;
  416. color: #999999;
  417. font-size: 28rpx;
  418. }
  419. @media screen and (max-height: 454px) {
  420. .bottomTips {
  421. display: none;
  422. }
  423. }
  424. .loginBody {
  425. background: white;
  426. border-radius: 16px 16px 0 0;
  427. position: relative;
  428. top: 336rpx;
  429. height: 1112rpx;
  430. .loginTypeBox {
  431. display: flex;
  432. justify-content: space-evenly;
  433. font-size: 40rpx;
  434. padding-top: 48rpx;
  435. color: rgba(86, 93, 106, 1);
  436. }
  437. .loginTypeItem {
  438. position: relative;
  439. .bottomLine {
  440. width: 40px;
  441. height: 6px;
  442. background: linear-gradient(90deg, #0365f9 0%, #85b5ff 100%);
  443. border-radius: 3px 3px 3px 3px;
  444. position: absolute;
  445. bottom: 0;
  446. z-index: 0;
  447. left: 40rpx;
  448. }
  449. .loginTypeName {
  450. position: relative;
  451. z-index: 1;
  452. }
  453. .ischecked {
  454. color: rgba(6, 35, 59, 1);
  455. font-weight: 600;
  456. }
  457. }
  458. }
  459. }
  460. </style>