修复没有名字

This commit is contained in:
虾壳 2024-06-23 19:48:33 +08:00
parent d0bca860a3
commit cce9e3cb52
7 changed files with 32 additions and 5 deletions

View File

@ -55,3 +55,15 @@ export const updateUserName=(username)=>{
}
})
}
/**
* 获取用户昵称
*/
export const getUserNameById=(id)=>{
return http({
url:"/api/getUserNameById",
method:"GET",
data:{
id,
}
})
}

View File

@ -53,7 +53,7 @@
import { reactive, ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import { getCastInfo } from '@/apis/cast.js';
import { getImageById } from '@/apis/user.js';
import { getImageById ,getUserNameById} from '@/apis/user.js';
import { getCommentsByRelatedPostId, addComments } from '@/apis/comments.js';
import { addLike } from '@/apis/likes.js';
import { addCollections } from "@/apis/collections.js";
@ -129,8 +129,10 @@ const getData = async () => {
com = com.data;
let list = await getCommentsByRelatedPostId(id.value);
let image = await getImageById(com.userId);
let userName=await getUserNameById(com.userId)
list = list.data;
commentList.value = list;
info.name=userName.msg;
info.iamge = image.msg;
info.caseId = com.caseId;
info.title = com.title;

View File

@ -36,7 +36,17 @@ const updateUserName = (username) => {
}
});
};
const getUserNameById = (id) => {
return utils_http.http({
url: "/api/getUserNameById",
method: "GET",
data: {
id
}
});
};
exports.getImageById = getImageById;
exports.getUserNameById = getUserNameById;
exports.mark = mark;
exports.updateUserImage = updateUserImage;
exports.updateUserName = updateUserName;

View File

@ -90,8 +90,10 @@ const _sfc_main = {
com = com.data;
let list = await apis_comments.getCommentsByRelatedPostId(id.value);
let image = await apis_user.getImageById(com.userId);
let userName = await apis_user.getUserNameById(com.userId);
list = list.data;
commentList.value = list;
info.name = userName.msg;
info.iamge = image.msg;
info.caseId = com.caseId;
info.title = com.title;

View File

@ -2,6 +2,7 @@
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "gree_leran",
"setting": {
"compileHotReLoad": true
"compileHotReLoad": true,
"urlCheck": false
}
}

View File

@ -1,7 +1,7 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_Auth = require("./Auth.js");
const baseUrl = "https://9miao.fun/prod-api";
const baseUrl = "http://127.0.0.1:8080";
const http = (option) => {
if (!option instanceof Object) {
throw "参数非法";

View File

@ -2,8 +2,8 @@
import {
getToken
} from "./Auth.js"
export const baseUrl = "https://9miao.fun/prod-api"
// export const baseUrl="http://127.0.0.1:8080"
// export const baseUrl = "https://9miao.fun/prod-api"
export const baseUrl="http://127.0.0.1:8080"
export const http = (option) => {