john 8 mesiacov pred
rodič
commit
54b1b6d2eb
2 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 1 1
      deployment.sh
  2. 2 2
      node_expores/router/record/index.js

+ 1 - 1
deployment.sh

@@ -10,7 +10,7 @@ save_file_name="new_cash_book_node_$version-$current_git_branch_latest_short_id.
 
 # 执行命令
 cd ./frontEndMobile
-yarn install --registry=https://registry.npmmirror.com && npm run build
+yarn install --registry=https://registry.npmmirror.com && yarn build
 rm -rf ../node_expores/public
 cp -rf ./dist ../node_expores/public
 cd ../node_expores

+ 2 - 2
node_expores/router/record/index.js

@@ -104,7 +104,7 @@ router.get("/:record_id", async function (req, res) {
   const files = await getFileByRecordId(record_id);
   // 获取请求的来源域名
   // const host = req.headers['host']; // 主机名 + 端口
-  const origin = req.headers["origin"]; // 请求的来源域(适用于跨域)
+  const origin = req.headers["host"]; // 请求的来源域(适用于跨域)
 
   const typesRes = await getTypesById({
     typeId: recordInfo.type_id,
@@ -127,7 +127,7 @@ router.get("/:record_id", async function (req, res) {
       files: files.map(
         (elm) =>
           `${
-            origin.indexOf("3032") > -1 ? "http://localhost:3000" : origin
+            `${origin}`.indexOf("3032") > -1 ? "http://localhost:3000" : origin
           }/api/v1/files/${elm.file_id}`
       ),
     },