+
contractAddress
@@ -101,6 +102,11 @@
{{$t('text.register')}}
+
+ contractAddress
+
+ {{$t('text.addContractAddress')}}
+
contractName
@@ -138,6 +144,17 @@
+
+
+
+
+
+
+
+ {{$t('dialog.cancel')}}
+ {{$t('dialog.confirm')}}
+
+
@@ -197,6 +214,8 @@ export default {
code: "",
status: 0,
abiFile: "",
+ // abi is empty list
+ abiEmpty: true,
bin: "",
contractAddress: "",
contractName: "",
@@ -235,12 +254,38 @@ export default {
mgmtCnsVisible: false,
mgmtCnsItem: {},
activeNames: ['0'],
- isDeployedModifyEnable: false
+ isDeployedModifyEnable: false,
+ isFinishComplie: false,
+ addContractAddressVisible: false,
+ contractForm: {
+ contractAddress: ""
+ },
+ rules: {
+ contractAddress: [
+ {
+ required: true,
+ message: this.$t("rule.contractAddress"),
+ trigger: "blur",
+ },
+ {
+ pattern: /^[0x|0X]+[A-Fa-f0-9]+$/,
+ message: this.$t("rule.contractAddressHex"),
+ trigger: "blur",
+ },
+ {
+ min: 42,
+ max: 42,
+ message: this.$t("rule.contractAddressLong"),
+ trigger: "blur",
+ },
+ ]
+ }
};
},
beforeDestroy: function () {
Bus.$off("select")
Bus.$off("noData")
+ Bus.$off("javaProjectComplie")
},
beforeMount() {
@@ -260,6 +305,7 @@ export default {
this.version = "";
this.status = null;
this.abiFile = "";
+ this.abiEmpty = true;
this.contractAddress = "";
this.errorMessage = "";
this.contractName = "";
@@ -271,6 +317,9 @@ export default {
this.aceEditor.setValue(this.content);
this.status = data.contractStatus;
this.abiFile = data.contractAbi;
+ if (this.abiFile && this.abiFile != '[]') {
+ this.abiEmpty = false
+ }
this.contractAddress = data.contractAddress;
this.errorMessage = data.description || "";
this.contractName = data.contractName;
@@ -291,12 +340,31 @@ export default {
this.version = "";
this.status = null;
this.abiFile = "";
+ this.abiEmpty = true;
this.contractAddress = "";
this.errorMessage = "";
this.contractName = "";
this.content = "";
this.bin = "";
})
+ Bus.$on('javaProjectComplie', data=>{
+ this.contractName = data.contractName
+ this.content = Base64.decode(data.contractSource);
+ console.log(this.code)
+ this.abiFile = data.contractAbi;
+ this.bin = data.contractBin;
+ this.data.contractVersion = data.contractVersion;
+ this.data.contractAddress = data.contractAddress;
+ this.data.contractName = data.contractName;
+ this.data.contractAbi = data.contractAbi;
+ this.data.bytecodeBin = data.bytecodeBin;
+ this.data.contractBin = data.contractBin;
+ this.data.contractId = data.contractId;
+ this.data.contractPath = data.contractPath;
+ this.data.contractSource = data.contractSource;
+ localStorage.setItem("isFinishCompile", "no")
+ this.compile()
+ })
},
watch: {
content: function (val) {
@@ -549,11 +617,11 @@ export default {
}
}
},
- compile() {
+ compile() {
this.loading = true;
let version = this.$store.state.versionData;
if (version && version.net !== 0) {
- this.compileHighVersion()
+ this.compileHighVersion()
} else {
setTimeout(() => {
this.compileLowVersion()
@@ -561,7 +629,7 @@ export default {
}
},
- compileHighVersion() {
+ compileHighVersion(callback) {
let that = this
this.refreshMessage();
this.contractList = this.$store.state.contractDataList
@@ -605,7 +673,8 @@ export default {
that.errorMessage = output.errors;
that.errorInfo = that.$t("contracts.contractCompileFail");
that.loading = false;
- }
+ }
+
} else {
console.log(ev.data);
console.log(JSON.parse(ev.data.data))
@@ -616,7 +685,7 @@ export default {
that.errorMessage = ev;
that.compileShow = true;
that.loading = false;
- })
+ })
console.log('wwww:', w)
},
compileLowVersion: function () {
@@ -685,6 +754,9 @@ export default {
this.successInfo = this.$t("contracts.compileSuccess");
this.abiFile = compiledMap.abi;
this.abiFile = JSON.stringify(this.abiFile);
+ if (this.abiFile && this.abiFile != '[]') {
+ this.abiEmpty = false
+ }
this.bin = compiledMap.evm.deployedBytecode.object;
this.bytecodeBin = compiledMap.evm.bytecode.object;
this.data.contractAbi = this.abiFile;
@@ -694,6 +766,7 @@ export default {
this.loading = false;
Bus.$emit("compile", this.data);
this.setMethod();
+ localStorage.setItem("isFinishCompile", "yes")
} else {
this.$message({
type: "error",
@@ -713,6 +786,50 @@ export default {
exportJava() {
this.$store.dispatch('set_exportProject_show_action', true)
},
+ addContractAddress(){
+ this.contractForm.contractAddress = "";
+ this.addContractAddressVisible = true;
+ },
+ closeContractAddress() {
+ this.addContractAddressVisible = false;
+ this.contractForm.contractAddress = "";
+ },
+ sureContractAddress(formName) {
+ this.$refs[formName].validate(valid => {
+ if (valid) {
+ if (this.contractForm.contractAddress=='' || this.contractForm.contractAddress==null) {
+ this.$message({
+ type: "error",
+ message: this.$t('contracts.contractAddressInput')
+ });
+ } else {
+ this.addContractAddressVisible = false;
+ this.addContract()
+ }
+ } else {
+ return false;
+ }
+ });
+ },
+ // todo add contract address all hex string and start with 0x
+ // 正则判断
+ // todo 保存后加一个Close函数 刷新当前的ID数据
+ addContract: function () {
+ let reqData = {
+ groupId: localStorage.getItem("groupId"),
+ contractName: this.data.contractName,
+ contractPath: this.data.contractPath,
+ contractSource: this.data.contractSource,
+ contractAbi: this.data.contractAbi,
+ contractBin: this.data.contractBin,
+ bytecodeBin: this.data.bytecodeBin,
+ contractAddress : this.contractForm.contractAddress
+ };
+ if (this.data.contractId) {
+ reqData.contractId = this.data.contractId;
+ }
+ Bus.$emit("save", reqData);
+ },
refreshMessage: function () {
this.abiFileShow = false;
this.errorInfo = "";
@@ -721,10 +838,18 @@ export default {
this.contractAddress = "";
},
deploying: function () {
+ if (!this.bytecodeBin) {
+ this.$message({
+ type: 'warning',
+ message: this.$t('text.notHaveBin'),
+ duration: 2000
+ })
+ return;
+ }
if (JSON.parse(this.abiFile).length == 0 || !this.abiFile) {
this.$message({
type: 'error',
- message: this.$t('text.haveAbi')
+ message: this.$t('text.notHaveAbi')
})
} else {
if (this.data.contractStatus && this.data && this.data.contractStatus == 2) {
@@ -920,7 +1045,7 @@ export default {
if(JSON.parse(this.abiFile).length == 0 || !this.abiFile){
this.$message({
type: 'error',
- message: this.$t('text.haveAbi')
+ message: this.$t('text.notHaveAbi')
})
}else {
this.dialogVisible = true;
@@ -1037,7 +1162,7 @@ export default {
},
handleChange(val) {
console.log(val);
- }
+ }
}
};
diff --git a/src/views/chaincode/components/contractCatalog.vue b/src/views/chaincode/components/contractCatalog.vue
index 63652888..15cbd30f 100644
--- a/src/views/chaincode/components/contractCatalog.vue
+++ b/src/views/chaincode/components/contractCatalog.vue
@@ -87,7 +87,7 @@
-
+
diff --git a/src/views/chaincode/contract.vue b/src/views/chaincode/contract.vue
index b090badd..65eb364c 100755
--- a/src/views/chaincode/contract.vue
+++ b/src/views/chaincode/contract.vue
@@ -97,6 +97,13 @@ export default {
}
},
mounted: function () {
+ if(localStorage.getItem("dataFrom") === "transactionDetail"){
+ localStorage.setItem("dataFrom","")
+ this.$message({
+ type: "warning",
+ message: this.$t('text.importContractTip')
+ });
+ }
this.allVersion = [
{
solcName: "v0.4.25",
@@ -142,7 +149,7 @@ export default {
}
];
this.initWorker()
- this.getEncryption(this.querySolcList);
+ this.getEncryption(this.querySolcList);
},
methods: {
initWorker() {
diff --git a/src/views/chaincode/dialog/addFile.vue b/src/views/chaincode/dialog/addFile.vue
index 1f7f1cac..8d6fb4fb 100644
--- a/src/views/chaincode/dialog/addFile.vue
+++ b/src/views/chaincode/dialog/addFile.vue
@@ -26,6 +26,9 @@
+