index.vue 1.9 KB

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