L1 20210518
讲义Reach 学习班 第一期.pptx
代码部分helloworld.zip
ES6 基础Demo
//#region template string
let basket = { count: 1, };
const TemplateString = () => {
let str = 'There are ' + basket.count + ' ' +
'items in your basket '
console.log('old method:', str);
str = `
There are ${basket.count + ('a' + 'b')} items in your basket
`;
console.log('new method:', str);
}
TemplateString()
//#endregion
//#region arrow function
function hellowWorld() {
console.log(`Hello World`)
}
const hellowWorldBeta = () => {
console.log(`Hello World`)
}
hellowWorld()
hellowWorldBeta()
let Person = () => {
return {
name: 'Alice',
playCard: () => {
console.log(`I can play card`)
}
}
}
console.log(Person())
console.log(Person().name)
Person = () => ({
name: 'Bob',
playCard: () => {
console.log(`I can play card`)
}
})//构造函数直接返回一个对象
console.log(Person())
//#endregion
//#region promise
// let success = false;
// const giveCFX = new Promise(function (resolve, reject) {
// reject('bad');
// resolve('ok');
// });
// giveCFX.then(function (v) {
// console.log(`resolved${v}`)
// }).catch((x) => {
// console.log(x)
// }).finally(()=>{
// console.log('finally')
// })
//#endregion
L4 20210529
在Firefox和Chrome下面安装meta mask
Firefox 选择扩展和主题,搜索metamask即可
Chrome
进入Web Store进行搜索 https://chrome.google.com/webstore/category/extensions
ReactJS
官方网站: https://reactjs.org/
入门教程:http://www.ruanyifeng.com/blog/2015/03/react.html
简单了解State,Props即可上手
剪刀石头布网页版
源码如下
tut-9.zip
运行命令是./reach react
主要熟悉页面的生命周期,跟着流程找出各个网页对应的视图和相关的组件方法,State
L520210605
视频
链接:https://pan.baidu.com/s/13eRJhdQfzoVH6Vcdr4Z4RQ 提取码:il56 复制这段内容后打开百度网盘手机App,操作更方便哦—来自百度网盘超级会员V5的分享
Vue入门
https://www.runoob.com/w3cnote/vue-js-quickstart.html
安装命令
sudo apt update
sudo apt install nodejs npm
cnpm install -g @vue/cli (请安装cnpm,命令是npm install -g cnpm —registry=https://registry.npm.taobao.org))
vue create vuecli-reach-tut
cnpm install @reach-sh/stdlib
仓库源代码
https://github.com/nicholasburka/reach-vue-tutorial/tree/vue/src
L620210610
视频
链接:https://pan.baidu.com/s/1Qk0qfbGcN5-5lsOBOzbi6w 提取码:5ht5
复制这段内容后打开百度网盘手机App,操作更方便哦—来自百度网盘超级会员V5的分享
安装命令
1.git clone https://github.com/uxk0587/reach-vue-tutorial.git
- cd reach-vue-tutorial
3.curl https://raw.githubusercontent.com/reach-sh/reach-lang/master/reach -o reach ; chmod +x reach
4.npm install @reach-sh/stdlib
REACH_CONNECTOR_MODE=ETH ./reach devnet 【后端】
执行这条命令前得改一下代码 ,把scr/App.vue的代码改成 import * as reach from ‘@reach-sh/stdlib/ETH.mjs’-
资料
VueX
https://vuex.vuejs.org/zh/
Vue
https://www.bilibili.com/video/BV12J411m7MG?p=4&spm_id_from=pageDriver
L7 20210615
Hashlock控制台代码
视频
链接:https://pan.baidu.com/s/1XpK7TehdaHBXz3VD0sjPbA 提取码:fk1e
复制这段内容后打开百度网盘手机App,操作更方便哦—来自百度网盘超级会员V5的分享
作业
用Vue/ReactJs 实现hashlock的网页版本。要求
- A打开网页,页面有两个文本框,输入金额和密码。然后点击提交。生成一个智能合约。
- B加入该智能合约,B 输入密码,点击提交。
- 如果B输入正确,B得到赏金,否则赏金退还给A。