login.vue 7.7 KB

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