index.vue 1.8 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. logoUrl: '',
  15. };
  16. },
  17. onLoad: async function() {
  18. const that = this;
  19. if(process.env.NODE_ENV === 'development'){
  20. uni.showToast({
  21. title: '开发环境'
  22. });
  23. }else{
  24. uni.showToast({
  25. title: '开发环境'
  26. });
  27. await that.searchConfig();
  28. }
  29. },
  30. methods: {
  31. // 查询基本设置
  32. async searchConfig() {
  33. const that = this;
  34. let res = await that.$api(`/config`, 'GET', {});
  35. if (res.errcode == '0') {
  36. uni.getStorage({
  37. key: 'token',
  38. success: async (res) => {
  39. let arr = await that.$api(`/user/cct`, 'POST');
  40. if (arr.errcode == '0') {
  41. uni.setStorage({
  42. key: 'token',
  43. data: arr.data,
  44. success: function() {}
  45. });
  46. }
  47. }
  48. })
  49. let config = res.data;
  50. that.$set(that, `logoUrl`, config.config.logo[0].url);
  51. uni.setStorage({
  52. key: 'config',
  53. data: config,
  54. success: function(res) {
  55. // 赋值默认值
  56. that.$config.share = {
  57. title: config.title,
  58. path: '/pages/index/index',
  59. imageUrl: config.config.share[0].url
  60. }
  61. let url = `/pages/home/index`; ///pagesHome/order/detail /pages/home/index
  62. uni.redirectTo({
  63. url
  64. })
  65. },
  66. fail: function(err) {
  67. console.log(err);
  68. }
  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>