index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <image class="logo" :src="logoUrl"></image>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. logoUrl: ''
  13. };
  14. },
  15. onLoad: async function() {
  16. const that = this;
  17. await that.searchConfig();
  18. await that.searchOpenid();
  19. },
  20. methods: {
  21. // 查询基本设置
  22. async searchConfig() {
  23. const that = this;
  24. let res = await that.$api(`/config`, 'GET', {});
  25. if (res.errcode == '0') {
  26. that.$set(that, `logoUrl`, res.data.logo_url[0].url);
  27. uni.setStorage({
  28. key: 'config',
  29. data: res.data,
  30. success: function(res) {},
  31. fail: function(err) {
  32. console.log(err);
  33. }
  34. })
  35. }
  36. },
  37. async searchOpenid() {
  38. const that = this;
  39. try {
  40. const res = uni.getStorageSync('openid');
  41. const aee = await that.$api(`/login/app/${res}`, 'POST', {})
  42. if (aee.errcode == '0') {
  43. uni.reLaunch({
  44. url: `/pages/home/index`
  45. })
  46. } else {
  47. uni.showToast({
  48. title: aee.errmsg,
  49. icon: 'none'
  50. })
  51. }
  52. } catch (e) {
  53. uni.showToast({
  54. title: err.errmsg,
  55. icon: 'error',
  56. duration: 2000
  57. });
  58. }
  59. uni.reLaunch({
  60. url: `/pages/home/index`
  61. })
  62. }
  63. },
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .main {
  68. display: flex;
  69. align-items: center;
  70. justify-content: center;
  71. width: 100vw;
  72. height: 100vh;
  73. .one {
  74. .logo {
  75. width: 50vw;
  76. height: 50vw;
  77. border-radius: 90px;
  78. box-shadow: 0 0 5px var(--f1Color);
  79. }
  80. }
  81. }
  82. </style>