{"id":21162357,"url":"https://github.com/webankblockchain/truora-web","last_synced_at":"2025-07-09T14:32:36.050Z","repository":{"id":53461895,"uuid":"319561038","full_name":"WeBankBlockchain/Truora-Web","owner":"WeBankBlockchain","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-03T03:18:08.000Z","size":633,"stargazers_count":20,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-24T03:16:29.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WeBankBlockchain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-08T07:32:30.000Z","updated_at":"2024-04-24T03:16:29.639Z","dependencies_parsed_at":"2023-01-20T22:17:46.292Z","dependency_job_id":null,"html_url":"https://github.com/WeBankBlockchain/Truora-Web","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeBankBlockchain%2FTruora-Web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeBankBlockchain%2FTruora-Web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeBankBlockchain%2FTruora-Web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeBankBlockchain%2FTruora-Web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeBankBlockchain","download_url":"https://codeload.github.com/WeBankBlockchain/Truora-Web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225564107,"owners_count":17488958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T13:25:45.768Z","updated_at":"2024-11-20T13:25:49.147Z","avatar_url":"https://github.com/WeBankBlockchain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Truora-Web\n开发文档\n\n\n## 1、开发环境搭建\n\n1.1 依赖环境\n\n| 环境     | 版本              |\n| ------   | ---------------  |\n| nodejs   | 1.8及以上         |\n\nnodejs下载地址：https://nodejs.org/en/download/\n\n### 1.2 安装依赖包\n\n1.2.1 拉取代码\n\n\u003e 执行命令：\n\n    git clone https://github.com/WeBankBlockchain/Truora-Web.git\n\n将代码放在你的工作目录，例如：D：\\project\n\n\u003e 切换到项目目录：\n\n    cd D:\\project\\Truora-Web\n\n\u003e 使用命令：\n\n    npm install\n\n下载依赖包\n\n1.3 启动项目\n\n\u003e 在项目根目录使用命令：\n\n    npm run dev\n\n\u003e 控制台出现：\n\n```\nListening at http ://localhost:3006\n```\n\n\u003e 在浏览器输入\"http ://localhost:3006\"。\n\n\u003e 默认端口是3006，可在config文件夹index.js中修改。\n\n\u003e 修改跨域配置，在config文件夹index.js中，在dev中的proxyTable修改，修改地址即可,请求的url路径必须加上前缀。\n\n```js\ndev: {\n        host: 'localhost', // can be overwritten by process.env.HOST\n        port: 3006, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined\n        autoOpenBrowser: false,\n        errorOverlay: true,\n        notifyOnErrors: true,\n        poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-\n        assetsSubDirectory: 'static',\n        assetsPublicPath: '/',\n        proxyTable: {\n        '/oracle':{\n            target:'http://127.0.0.1:5021/',  //在此修改跨域地址，这里是服务ip和端口，且可以访问\n            changeOrigin:true,\n            pathRewrite:{\n                '^/oracle':''\n                }\n            },\n        },\n    },\n```\n\n1.4 模拟数据\n\n模拟数据在mock.js中，在开发联调前使用，使用中注意mock.js的url和axios请求的url要保持一致。`包括get拼接在url上面的参数`\n\n注意：开发时将mian.js中加上mock.js引用，打包时需要注释mock.js的引用。\n\n\u003e axios请求地址：\n\n    overview请求url： /Oracle-Service/xx/xx/\n\n\u003e mock.js地址：\n\n```js\nMock.mock('/Oracle-Service/xx/xx/',function (req,res) {     //url和上面axios相同\n    return {\n        \"code\":0,\n        \"message\":\"success\",\n        \"data\":{\n\n        }\n    }\n});\n```\n\n\u003e main.js引用mock.js：\n\n```js.github\nVue.use(ElementUI);\n// require('./mock')    //直接require引入，开发时放开注释，打包时注释\n/* eslint-disable no-new */\nnew Vue({\n  el: '#app',\n  router,\n  template: '\u003cApp/\u003e',\n  components: { App }\n})\n```\n\n\n## 2、项目打包部署\n\n2.1 项目打包\n\n\u003e 切换到项目根目录，执行命令：\n\n    npm run build\n\n\u003e 进行打包，生成打包文件dist，在项目根目录下。\n\n2.2 部署\n\nnginx配置\n\n```Nginx\n    upstream oracle_server{\n        server 10.0.0.1:5021; # 服务ip和端口\n    }\n    server {\n        listen       5020 default_server; # 前端端口（端口需要开通策略且不能被占用）\n        server_name  0.0.0.0;           # 服务器ip，也可配置为域名\n        location / {\n                root   /data/Oracle-Web/dist;   # 前端文件路径(文件需要有权限访问)\n                index  index.html index.htm;\n                try_files $uri $uri/ /index.html =404;\n        }\n\n        include /etc/nginx/default.d/*.conf;\n\n        location /oracle {\n                    proxy_pass    http://oracle_server/;\n                    proxy_set_header                Host                         $host;\n                    proxy_set_header                X-Real-IP                 $remote_addr;\n                    proxy_set_header                X-Forwarded-For         $proxy_add_x_forwarded_for;\n        }\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebankblockchain%2Ftruora-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebankblockchain%2Ftruora-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebankblockchain%2Ftruora-web/lists"}