login.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. </div>
  11. <div class="loginBox">
  12. <button
  13. open-type="getPhoneNumber"
  14. class="login_button"
  15. style="
  16. padding: 30rpx;
  17. background: rgba(3, 101, 249, 1);
  18. color: white;
  19. margin-top: 25vh;
  20. border-radius: 10rpx;
  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. <label class="radio">
  94. <radio value="r1" checked="true" color="rgba(3, 101, 249, 1)"/>
  95. 已阅读并同意<span style="color: rgba(3, 101, 249, 1)">《服务协议条款及隐私政策》</span>
  96. </label>
  97. </div>
  98. <!-- <van-dialog id="van-toast" />-->
  99. </div>
  100. </template>
  101. <script>
  102. import Dialog from "../..//wxcomponents/weapp/dist/dialog/dialog.js";
  103. import { loginByWeixin2 } from "@/js_sdk/http.js";
  104. export default {
  105. data() {
  106. return {
  107. loginForm: {
  108. userName: "",
  109. password: "",
  110. code: "",
  111. type: "FRAME",
  112. captchaId: "",
  113. captchaImage: "",
  114. rememberMe: true,
  115. },
  116. };
  117. },
  118. mounted() {
  119. // login()
  120. this.captchaImageRefresh(this.loginForm);
  121. },
  122. methods: {
  123. getPhoneNumber(e) {
  124. wx.login({
  125. success(res) {
  126. console.log(res);
  127. let data = {
  128. loginCode: res.code,
  129. phoneCode: e.detail.code,
  130. };
  131. loginByWeixin2(data).then((e) => {
  132. console.log(e.data.user);
  133. wx.setStorageSync("USERINFO", JSON.stringify(e.data.user));
  134. uni.switchTab({
  135. url: "/pages/index/index",
  136. });
  137. });
  138. },
  139. });
  140. },
  141. goqy() {
  142. uni.navigateTo({
  143. url: "/pages/subPackages/gocompnay/index",
  144. });
  145. },
  146. gozhfw() {
  147. wx.navigateToMiniProgram({
  148. appId: "wx15404cced62d7b37",
  149. success(res) {
  150. // 打开成功
  151. },
  152. fail(e) {
  153. console.log(e);
  154. },
  155. });
  156. },
  157. captchaImageRefresh: function (_form) {
  158. _form.captchaId = this.$common.uuid(8);
  159. _form.captchaImage =
  160. this.$constant.BASE_URI +
  161. "/captcha/captchaImage?type=math&captchaId=" +
  162. _form.captchaId +
  163. "&s=" +
  164. Math.random();
  165. },
  166. forgetPsw() {
  167. wx.showModal({
  168. title: "提示!",
  169. content: "管理端修改密码需要拨打客服电话咨询,是否拨打?",
  170. success: function (res) {
  171. if (res.confirm) {
  172. uni.makePhoneCall({
  173. phoneNumber: "13921516068", //电话号码
  174. success: function (e) {},
  175. fail: function (e) {},
  176. });
  177. }
  178. },
  179. });
  180. },
  181. login() {
  182. const _this = this;
  183. if (!this.loginForm.userName || !this.loginForm.password) {
  184. uni.showModal({
  185. title: "提示",
  186. content: "请输入账号和密码",
  187. icon: "error",
  188. showCancel: false,
  189. });
  190. return;
  191. }
  192. login(this.loginForm).then((res) => {
  193. if (res.errmsg == "成功") {
  194. uni.showToast({
  195. title: "登录成功",
  196. icon: "none",
  197. mask: true,
  198. duration: 2000,
  199. });
  200. this.$auth.setUser(res.data.token);
  201. this.$auth.setUserInfo(res.data);
  202. uni.switchTab({
  203. url: "/pages/index/index",
  204. });
  205. } else {
  206. this.captchaImageRefresh(this.loginForm);
  207. }
  208. });
  209. // this.$auth.setUserType(this.$auth.TYPE_FRAME);
  210. },
  211. onShareAppMessage: function () {},
  212. },
  213. };
  214. </script>
  215. <style lang="scss">
  216. .login {
  217. background: white;
  218. height: 100%;
  219. overflow: hidden;
  220. .logTit {
  221. width: 80vw;
  222. left: 10vw;
  223. top: 280rpx;
  224. display: flex;
  225. flex-direction: column;
  226. justify-content: center;
  227. align-items: center;
  228. position: absolute;
  229. z-index: 1;
  230. color: rgba(51, 51, 51, 1);
  231. font-size: 4vw;
  232. p {
  233. color: rgba(102, 102, 102, 1);
  234. font-size: 4vw;
  235. margin-top: 0.5vw;
  236. }
  237. .titletxt {
  238. font-size: 62rpx;
  239. font-family: Taipei Sans TC Beta-Bold, Taipei Sans TC Beta;
  240. font-weight: bold;
  241. color: rgba(47, 59, 104, 1);
  242. }
  243. }
  244. .logobig {
  245. width: 100vw;
  246. height: 100vh;
  247. position: absolute;
  248. left: 0;
  249. z-index: 0;
  250. }
  251. .loginBox {
  252. width: 70vw;
  253. left: 15vw;
  254. padding-top: 75vw;
  255. position: absolute;
  256. }
  257. .inputBox {
  258. position: relative;
  259. display: flex;
  260. align-items: center;
  261. img {
  262. position: absolute;
  263. width: 7vw;
  264. // padding-top: 40px;
  265. }
  266. .yanzhengImg {
  267. right: 0;
  268. width: 20vw;
  269. height: 10vw;
  270. }
  271. .yanzhengImgBox {
  272. height: 50px;
  273. display: flex;
  274. align-items: center;
  275. }
  276. input {
  277. background: black;
  278. width: 100%;
  279. height: 76rpx;
  280. padding: 5rpx 0 5rpx 70rpx;
  281. background-color: rgba(255, 255, 255, 1);
  282. border: 1rpx solid rgba(29, 24, 188, 0.05);
  283. margin: 5rpx 0;
  284. font-size: 4vw;
  285. }
  286. input::-webkit-input-placeholder {
  287. color: rgba(153, 153, 153, 1);
  288. }
  289. .yanzhengma {
  290. width: 60%;
  291. }
  292. }
  293. .pswBox {
  294. width: 100%;
  295. display: flex;
  296. justify-content: flex-end;
  297. margin: 20px 0;
  298. color: rgba(29, 24, 188, 1);
  299. }
  300. .van-button {
  301. margin-top: 15rpx;
  302. border-radius: 60px;
  303. }
  304. .loginbtn {
  305. margin-top: 50rpx;
  306. }
  307. .bottomTips {
  308. width: 100vw;
  309. position: fixed;
  310. bottom: 100rpx;
  311. text-align: center;
  312. color: #999999;
  313. font-size: 28rpx;
  314. }
  315. @media screen and (max-height: 454px) {
  316. .bottomTips {
  317. display: none;
  318. }
  319. }
  320. }
  321. </style>