123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <view class="content">
- <image class="logo" :src="config.logoUrl||'/static/logo.png'"></image>
- </view>
- </template>
- <script setup lang="ts">
- import { getCurrentInstance, ref } from 'vue';
- //该依赖已内置不需要单独安装
- import { onLoad } from "@dcloudio/uni-app";
- // 请求接口
- const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
- const $app = getCurrentInstance()?.appContext.config.globalProperties.$app;
- const $config = getCurrentInstance()?.appContext.config.globalProperties.$config;
- // 基本信息
- const config = ref({ logoUrl: [] });
- onLoad(async () => {
- await searchConfig();
- await search();
- })
- // config信息
- const searchConfig = async () => {
- config.value = uni.getStorageSync('config');
- };
- // 查询
- const search = async () => {
- uni.getStorage({
- key: 'openid',
- success: function (res) {
- uni.reLaunch({
- url: `/pages/home/index`
- })
- },
- fail: function (err) {
- uni.login({
- success: async function (res) {
- if (res.code) {
- uni.reLaunch({
- url: `/pages/home/index`
- })
- // const aee = await $app('/wechat/api/login/app', 'GET', {
- // js_code: res.code,
- // config: $config.wx_projectkey
- // })
- // if (aee.errcode == '0') {
- // uni.setStorage({
- // key: "openid",
- // data: aee.data.openid
- // })
- // uni.reLaunch({
- // url: `/pages/home/index`
- // })
- // } else {
- // uni.showToast({
- // title: aee.errmsg,
- // icon: 'none'
- // })
- // }
- } else {
- uni.showToast({
- title: res.errMsg,
- icon: 'none'
- })
- }
- }
- });
- }
- })
- };
- </script>
- <style lang="scss" scoped>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- width: 100vw;
- height: 100vh;
- .logo {
- width: 50vw;
- height: 50vw;
- border-radius: 90px;
- box-shadow: 0 0 5px #f1f1f1;
- }
- }
- </style>
|