login.vue 8.0 KB

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