From cce9e3cb52708be6bd88b1b2730ce575604bfc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=99=BE=E5=A3=B3?= <121141103+disk5@users.noreply.github.com> Date: Sun, 23 Jun 2024 19:48:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B2=A1=E6=9C=89=E5=90=8D?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/user.js | 12 ++++++++++++ pages/newsInfo/newsInfo.vue | 4 +++- unpackage/dist/dev/mp-weixin/apis/user.js | 10 ++++++++++ .../dist/dev/mp-weixin/pages/newsInfo/newsInfo.js | 2 ++ .../dist/dev/mp-weixin/project.private.config.json | 3 ++- unpackage/dist/dev/mp-weixin/utils/http.js | 2 +- utils/http.js | 4 ++-- 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/apis/user.js b/apis/user.js index c464261..01f2975 100644 --- a/apis/user.js +++ b/apis/user.js @@ -54,4 +54,16 @@ export const updateUserName=(username)=>{ username, } }) +} +/** + * 获取用户昵称 + */ +export const getUserNameById=(id)=>{ + return http({ + url:"/api/getUserNameById", + method:"GET", + data:{ + id, + } + }) } \ No newline at end of file diff --git a/pages/newsInfo/newsInfo.vue b/pages/newsInfo/newsInfo.vue index 0a9f39c..99702a0 100644 --- a/pages/newsInfo/newsInfo.vue +++ b/pages/newsInfo/newsInfo.vue @@ -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; diff --git a/unpackage/dist/dev/mp-weixin/apis/user.js b/unpackage/dist/dev/mp-weixin/apis/user.js index 7d5127b..435ddb7 100644 --- a/unpackage/dist/dev/mp-weixin/apis/user.js +++ b/unpackage/dist/dev/mp-weixin/apis/user.js @@ -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; diff --git a/unpackage/dist/dev/mp-weixin/pages/newsInfo/newsInfo.js b/unpackage/dist/dev/mp-weixin/pages/newsInfo/newsInfo.js index d94f6ba..24c99dd 100644 --- a/unpackage/dist/dev/mp-weixin/pages/newsInfo/newsInfo.js +++ b/unpackage/dist/dev/mp-weixin/pages/newsInfo/newsInfo.js @@ -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; diff --git a/unpackage/dist/dev/mp-weixin/project.private.config.json b/unpackage/dist/dev/mp-weixin/project.private.config.json index 94d6f2f..15ede59 100644 --- a/unpackage/dist/dev/mp-weixin/project.private.config.json +++ b/unpackage/dist/dev/mp-weixin/project.private.config.json @@ -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 } } \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/utils/http.js b/unpackage/dist/dev/mp-weixin/utils/http.js index c5273e8..45b2612 100644 --- a/unpackage/dist/dev/mp-weixin/utils/http.js +++ b/unpackage/dist/dev/mp-weixin/utils/http.js @@ -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 "参数非法"; diff --git a/utils/http.js b/utils/http.js index ff44d39..13c1634 100644 --- a/utils/http.js +++ b/utils/http.js @@ -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) => {