index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="content">
  3. <loginPassword :themeColor="themeColor" :logoUrl="logoUrl" @loginFun="loginFun"></loginPassword>
  4. </view>
  5. </template>
  6. <script>
  7. import loginPassword from '@/components/ay-login/login-password.vue';
  8. export default {
  9. components: {
  10. loginPassword
  11. },
  12. data() {
  13. return {
  14. themeColor: '#33CCCC',
  15. logoUrl: 'https://cdn.pixabay.com/photo/2016/11/23/17/55/beach-1854072__340.jpg',
  16. }
  17. },
  18. onLoad() {
  19. },
  20. methods: {
  21. loginFun(data) {
  22. this.$http('common.login', data, '登录中', true).then((res) => {
  23. if (res.success == true) {
  24. if (res.data) {
  25. uni.setStorageSync('token', res.data.token);
  26. }
  27. uni.showToast({
  28. title: '登录成功',
  29. icon: 'none',
  30. success: function() {
  31. uni.redirectTo({
  32. url: '/pages/home/home',
  33. success: function(res) {}
  34. });
  35. }
  36. }, );
  37. }
  38. })
  39. }
  40. }
  41. }
  42. </script>
  43. <style>
  44. .content {
  45. width: 100%;
  46. height: 100%;
  47. /* background: url('../../static/home.png');
  48. background-size: 100% 100%;
  49. overflow: auto; */
  50. }
  51. </style>