2023.11.1修改

This commit is contained in:
2023-11-01 00:33:57 +08:00
parent 11cecc737f
commit 22c039a8eb
18 changed files with 497 additions and 88 deletions

View File

@@ -21,6 +21,7 @@
// 函数
function getInfo(){
is_login.value = custom.checkLogin()
// store.checkLogin()
// console.log(is_login.value)
if(is_login.value) {
avatar.value = uni.getStorageSync('avatarUrl')
@@ -65,7 +66,7 @@
}
function getPhoneNumber (e) {
// tel_code.value = e.detail.code
// console.log(e)
console.log(e)
getAccess_token({code:e.detail.code})
// console.log(e.detail.code) // 动态令牌
// console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
@@ -99,7 +100,7 @@
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token单独缓存一次
let res2=await api.wx_login({code:res_p.code},userId);
if(res2.code === 0) {
store.checkLogin()
toLogin(encodeURIComponent(JSON.stringify(res.data)))
}
}
@@ -112,6 +113,13 @@
wx_login(userId)
}
}
else{
uni.showToast({
icon:"error",
title:res.msg,
duration:2000
})
}
}
async function wx_login(userId){
let res=await new Promise(resolve=>{
@@ -127,6 +135,7 @@
if(res2.code === 0) {
uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
// is_login.value = custom.checkLogin()
store.checkLogin()
getInfo()
// if(newUser.value) {
// toLogin()

View File

@@ -4,14 +4,23 @@
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
import api from "@/api/index.js"
const store = useStore()
// 生命周期
onPullDownRefresh(()=> { // 下拉刷新
onLoad((e) => {
let userinfo = JSON.parse(store.userInfo)
// console.log(userinfo)
queryParams.value.userId = userinfo.userId
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
getList()
})
onReachBottom(() => { // 上滑触底
getList()
})
// 变量
// const user_info = ref(null)
const list = ref([
{
id:1,
@@ -36,7 +45,16 @@
`
}
])
const queryParams = ref({
page:1,
pageSize:10,
userId:0
})
// 方法
async function getList() {
const res = await api.getStarList(queryParams.value)
}
function toDetail(item) {
let info = encodeURIComponent(JSON.stringify(item))
// console.log(info)