index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="mainBox">
  3. <view class="container">
  4. <image src="../../static/images/login_bg.png"></image>
  5. <button
  6. class="myBtn"
  7. open-type="getPhoneNumber"
  8. @getphonenumber="getPhoneNumber"
  9. >
  10. 获取手机号
  11. </button>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import httpAjax from '@/utils/https.js';
  17. /**
  18. * @description 待签收
  19. **/
  20. export default {
  21. name: 'login',
  22. data() {
  23. return {};
  24. },
  25. mounted() {
  26. const a = uni.getStorageSync('userInfo');
  27. if (a) {
  28. uni.navigateTo({
  29. url: '/pages/main/index',
  30. });
  31. }
  32. },
  33. methods: {
  34. getPhoneNumber(e) {
  35. if (e.detail.code) {
  36. let params = {
  37. code: e.detail.code,
  38. };
  39. uni
  40. .request({
  41. url: 'https://zlzd.zrzyt.zj.gov.cn/ysybz/api/app/xc/getXcryByMobile',
  42. // url: 'http://10.10.9.71:7089/ysgzybz/app/xc/getXcryByMobile',
  43. method: 'GET',
  44. data: params,
  45. })
  46. .then((result) => {
  47. console.log(result);
  48. if (result[1].data.data) {
  49. uni.setStorageSync('userInfo', result[1].data.data);
  50. uni.navigateTo({
  51. url: '/pages/main/index',
  52. });
  53. } else {
  54. uni.showToast({
  55. title: '该用户无权访问此系统',
  56. icon: 'none',
  57. duration: 4000,
  58. });
  59. }
  60. });
  61. } else {
  62. }
  63. },
  64. },
  65. };
  66. </script>
  67. <style lang="scss">
  68. @import './index.scss';
  69. </style>