|
|
@@ -190,6 +190,7 @@
|
|
|
uni.hideLoading()
|
|
|
},
|
|
|
getgameInfo() {
|
|
|
+ console.log('111111');
|
|
|
this.$Service.send('/game/info', {}, (res) => {
|
|
|
console.log('res', res);
|
|
|
this.ucard = res.ucard
|
|
|
@@ -202,47 +203,78 @@
|
|
|
let res = this.ucard<this.tcard ? this.ucard : this.tcard
|
|
|
this.allNumber = Math.floor(res / this.synthesisNumber )
|
|
|
console.log(this.allNumber);
|
|
|
- },changesynthesisquantity(){
|
|
|
+ },
|
|
|
+ changesynthesisquantity(){
|
|
|
this.synthesisquantity = this.allNumber
|
|
|
- },syntheticUsdt(){
|
|
|
- this.Tdialog = true
|
|
|
+ },
|
|
|
+ syntheticUsdt(){
|
|
|
+ this.$Service.send('/game/issynthesis', {
|
|
|
+ amount:this.synthesisquantity
|
|
|
+ }, (res) => {
|
|
|
+ this.Tdialog = true
|
|
|
+ contracts.contract.methods
|
|
|
+ .syntheticUsdt(this.synthesisquantity)
|
|
|
+ .send({
|
|
|
+ from: this.$store.state.address
|
|
|
+ })
|
|
|
+ .on('receipt', async res => {
|
|
|
+ console.log(res);
|
|
|
+ this.likai()
|
|
|
+ this.$Service.send('/game/synthesis', {
|
|
|
+ amount:this.synthesisquantity
|
|
|
+ }, (res) => {
|
|
|
+ console.log('res', res);
|
|
|
+
|
|
|
+ this.synthesis = false
|
|
|
+ this.Insynthesis= true
|
|
|
+ this.getgameInfo()
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.opensuccess()
|
|
|
+ },3000)
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+ .on('error', error => {
|
|
|
+ this.likai()
|
|
|
+ console.log(error)
|
|
|
+ if(error.message == 'The requested account and/or method has not been authorized by the user.') {
|
|
|
+ uni.showToast({
|
|
|
+ title: this.$t('indexMSG0004'),
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },async getUserCode() {
|
|
|
contracts.contract.methods
|
|
|
- .syntheticUsdt(this.synthesisquantity)
|
|
|
- .send({
|
|
|
+ .getUserCode()
|
|
|
+ .call({
|
|
|
from: this.$store.state.address
|
|
|
- })
|
|
|
- .on('receipt', async res => {
|
|
|
- console.log(res);
|
|
|
- this.likai()
|
|
|
- this.$Service.send('/game/synthesis', {
|
|
|
- amount:this.synthesisquantity
|
|
|
- }, (res) => {
|
|
|
+ }, (err, res) => {
|
|
|
+ if (res) {
|
|
|
+ this.$store.commit('changeuser', res)
|
|
|
console.log('res', res);
|
|
|
-
|
|
|
- this.synthesis = false
|
|
|
- this.Insynthesis= true
|
|
|
- this.getgameInfo()
|
|
|
- setTimeout(()=>{
|
|
|
- this.opensuccess()
|
|
|
- },3000)
|
|
|
- })
|
|
|
-
|
|
|
- })
|
|
|
- .on('error', error => {
|
|
|
- this.likai()
|
|
|
- console.log(error)
|
|
|
- if(error.message == 'The requested account and/or method has not been authorized by the user.') {
|
|
|
- uni.showToast({
|
|
|
- title: this.$t('indexMSG0004'),
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
+ this.$Service.send('/user/login', {
|
|
|
+ username: this.$store.state.address,
|
|
|
+ code: res,
|
|
|
+ }, (res) => {
|
|
|
+ console.log(1);
|
|
|
+ this.$store.commit('changetoken', res.userinfo.token)
|
|
|
+ this.getgameInfo()
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.getgameInfo()
|
|
|
+ this.getUserCode()
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.getUserCode()
|
|
|
+ },1000)
|
|
|
}
|
|
|
}
|
|
|
</script>
|