index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <image class="logo" :src="logoUrl"></image>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. logoUrl: ""
  13. };
  14. },
  15. onLoad: async function() {
  16. const that = this;
  17. await that.searchConfig();
  18. },
  19. methods: {
  20. // 查询基本设置
  21. async searchConfig() {
  22. const that = this;
  23. let res = await that.$api(`/Config`, 'GET', {});
  24. if (res.errcode == '0') {
  25. that.$set(that, `logoUrl`, res.data.logo_url[0].url || '../../static/login.jpeg');
  26. uni.setStorage({
  27. key: 'config',
  28. data: res.data,
  29. success: function(res) {
  30. uni.getStorage({
  31. key: 'token',
  32. success: function(res) {
  33. let url = `/pages/home/index`;
  34. uni.reLaunch({
  35. url
  36. })
  37. },
  38. fail: async function(err) {
  39. let url = `/pages/login/index`;
  40. uni.reLaunch({
  41. url
  42. })
  43. },
  44. })
  45. },
  46. fail: function(err) {
  47. console.log(err);
  48. }
  49. })
  50. }
  51. }
  52. },
  53. }
  54. </script>
  55. <style lang="scss">
  56. .main {
  57. display: flex;
  58. flex-direction: column;
  59. width: 100vw;
  60. height: 100vh;
  61. .one {
  62. text-align: center;
  63. margin: 40vw 0 0 0;
  64. .logo {
  65. width: 50vw;
  66. height: 50vw;
  67. border-radius: 90px;
  68. box-shadow: 0 0 5px var(--f1Color);
  69. }
  70. }
  71. }
  72. </style>