| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <template>
- <view class="container"></view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { myRequest } from '@/utils/api.js'
- onLoad(() => {
- uni.login({
- success: (res) => {
- vertify(res.code)
- }
- })
- })
- const vertify = async (code) => {
- const res = await myRequest({
- url: '/wanzai/api/wechat/vertify',
- data: {
- code
- }
- })
- // console.log(res)
- if (res.code == 200) {
- uni.setStorageSync('token', JSON.parse(res.message).token)
- uni.setStorageSync('userInfo', JSON.parse(res.message).user[0])
- uni.redirectTo({
- url: '/pages/home/home'
- })
- } else {
- uni.redirectTo({
- url: '/pages/login/login'
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- min-height: 100vh;
- background-color: #f8f8fa;
- }
- </style>
|