index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. uni.getStorage({
  28. key: 'token',
  29. success: async (res) => {
  30. let arr = await that.$api(`/user/cct`, 'POST');
  31. if (arr.errcode == '0') {
  32. uni.setStorage({
  33. key: 'token',
  34. data: arr.data,
  35. success: function() {}
  36. });
  37. }
  38. }
  39. })
  40. let config = res.data;
  41. that.$set(that, `logoUrl`, config.config.logo[0].url);
  42. uni.setStorage({
  43. key: 'config',
  44. data: config,
  45. success: function(res) {
  46. // 赋值默认值
  47. that.$config.share = {
  48. title: config.title,
  49. path: '/pages/index/index',
  50. imageUrl: config.config.share[0].url
  51. }
  52. let url = `/pages/home/index`; ///pagesHome/order/detail /pages/home/index
  53. uni.redirectTo({
  54. url
  55. })
  56. },
  57. fail: function(err) {
  58. console.log(err);
  59. }
  60. })
  61. }
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. .main {
  68. display: flex;
  69. flex-direction: column;
  70. width: 100vw;
  71. height: 100vh;
  72. .one {
  73. text-align: center;
  74. margin: 40vw 0 0 0;
  75. .logo {
  76. width: 50vw;
  77. height: 50vw;
  78. border-radius: 90px;
  79. box-shadow: 0 0 5px #f1f1f1;
  80. }
  81. }
  82. }
  83. </style>