From 0560eed4a389f806dc3254a526e929e8476c868a Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期日, 29 九月 2024 18:52:51 +0800 Subject: [PATCH] 完成地址管理新增、删除、编辑、设置默认地址,修改navbar组件 --- App.vue | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/App.vue b/App.vue index 4742f87..23ef92a 100644 --- a/App.vue +++ b/App.vue @@ -1,10 +1,21 @@ <script setup> import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; - // import {getToken} from './util/auth'; + import { wxLoginApi } from './api/index.js' onLaunch(() => { - console.log("App Launch"); - //判断是否登录 - // let token = getToken() + if(!uni.getStorageSync('openId')){ + wx.login({ + success:async (res1)=>{ + uni.setStorageSync('code',res1.code) + await wxLoginApi({code:res1.code}).then((res2) =>{ + uni.setStorageSync('openId',res2.data.userId) + uni.setStorageSync('token',res2.data.token) + }) + }, + fail:(e) =>{ + console.log(e) + } + }) + } }); onShow(() => { console.log("App Show"); @@ -14,6 +25,5 @@ }); </script> -<style> - /*每个页面公共css */ +<style lang='scss'> </style> -- Gitblit v1.9.3