index.vue 1.3 KB

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