update front development guide

This commit is contained in:
CaiHQ
2023-03-18 21:57:34 +08:00
parent acc103e6a4
commit adcb9d40a5
18 changed files with 2400 additions and 151 deletions

4
front/vite/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
.husky
dist
package-lock.json
node_modules

13
front/vite/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>vite template</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/main.ts"></script>
</body>
</html>

29
front/vite/package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "example-front",
"version": "0.0.1",
"scripts": {
"dev": "vite --host",
"build": "vite build",
"prod": " vue-tsc --noEmit &&vite build",
"serve": "vite preview",
"lint": "eslint --ext .vue,.js,.ts ./",
"prepare": "cd ../../ && husky install front/vite/.husky"
},
"lint-staged": {
"*.{vue,js,ts}": "eslint --fix"
},
"dependencies": {
"@bdware/bdcontract-sdk": "^0.4.0-beta",
"husky": "^6.0.0",
"vite": "^3.0.0",
"@vitejs/plugin-vue": "3.2.0"
},
"devDependencies": {
"husky": "^6.0.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
}
}
}

13
front/vite/src/main.ts Normal file
View File

@@ -0,0 +1,13 @@
import {HttpClient} from '@bdware/bdcontract-sdk'
async function run(){
const url = 'http://127.0.0.1:21030/SCIDE';
var sm2Key = {"publicKey": "04180354fdb6507f8ab98ccfbe165ce11da74ba733f81af86ad6d32216b32cf4f797c559d50ceeefbf4c760c3483840471c67471b90acdffb388cd7d496d9a1610",
"privateKey": "1d4196947f59532db6f8f4055e58474a48db8f30b476ae3edc66406464521b3b"};
const client = new HttpClient(url, sm2Key);
const data = await client.executeContract(
'ContractExample',
'callHello',
'abc');
alert(data.data);
}
run();

13
front/vite/vite.config.ts Normal file
View File

@@ -0,0 +1,13 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
base: './', // 设开发或生产环境服务的 公共基础路径
define: { // 类型: Record<string, string> 定义全局变量替换方式。每项在开发时会被定义为全局变量,而在构建时则是静态替换。
'process.platform': null,
'process.version': null,
},
plugins: [ // 类型: (Plugin | Plugin[])[] 将要用到的插件数组
vue()
],
});