index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. // 店铺id
  15. shop: '6350f909a4d1c1253468bdb2',
  16. logoUrl: '',
  17. };
  18. },
  19. onLoad: async function() {
  20. const that = this;
  21. await that.searchConfig();
  22. },
  23. methods: {
  24. // 查询基本设置
  25. async searchConfig() {
  26. const that = this;
  27. let res = await that.$api(`/config`, 'GET', {
  28. shop: that.shop
  29. });
  30. if (res.errcode == '0') {
  31. uni.getStorage({
  32. key: 'token',
  33. success: async (res) => {
  34. let arr = await that.$api(`/user/cct`, 'POST');
  35. if (arr.errcode == '0') {
  36. uni.setStorage({
  37. key: 'token',
  38. data: arr.data,
  39. success: function() {}
  40. });
  41. }
  42. }
  43. })
  44. let config = res.data;
  45. that.$set(that, `logoUrl`, config.config.logo[0].url);
  46. uni.setStorage({
  47. key: 'config',
  48. data: config,
  49. success: function(res) {
  50. // 赋值默认值
  51. that.$config.share = {
  52. title: config.title,
  53. path: '/pages/index/index',
  54. imageUrl: config.config.share[0].url
  55. }
  56. let url = `/pages/home/index`; ///pagesHome/order/detail /pages/home/index
  57. uni.redirectTo({
  58. url
  59. })
  60. },
  61. fail: function(err) {
  62. console.log(err);
  63. }
  64. })
  65. uni.setStorage({
  66. key: 'shop',
  67. data: that.shop || '6350f909a4d1c1253468bdb2',
  68. success: function() {}
  69. });
  70. }
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. .main {
  77. display: flex;
  78. flex-direction: column;
  79. width: 100vw;
  80. height: 100vh;
  81. .one {
  82. text-align: center;
  83. margin: 40vw 0 0 0;
  84. .logo {
  85. width: 50vw;
  86. height: 50vw;
  87. border-radius: 90px;
  88. box-shadow: 0 0 5px #f1f1f1;
  89. }
  90. }
  91. }
  92. </style>