diff --git a/pages/menu/collection/addCollection/index.vue b/pages/menu/collection/addCollection/index.vue
index 084c88c..f626aa4 100644
--- a/pages/menu/collection/addCollection/index.vue
+++ b/pages/menu/collection/addCollection/index.vue
@@ -1,42 +1,46 @@
-
-
- NFT collections
-
+
+
+ NFT collections
+
-
-
-
-
- {{wallet.coinList[0].name2}}
-
-
- {{wallet.address}}
-
-
-
-
-
- Contract address
-
-
-
-
-
- Token ID
-
-
-
-
- Confirm
-
-
+
+
+
+
+ {{wallet.coinList[0].name2}}
+
+
+ {{wallet.address}}
+
+
+
+
+
+ Contract address
+
+
+
+
+
+ Token ID
+
+
+
+
+ Confirm
+
+
-
+
@@ -46,80 +50,81 @@
export default {
data() {
return {
- caddress:'',
- tid:'',
- wallet:{},
- nftIndex:0,
- nftContrct:[[]],
- walletInfo:{},
- address:'',
- proid:'',
-
+ caddress: '',
+ tid: '',
+ wallet: {},
+ nftIndex: 0,
+ nftContrct: [
+ []
+ ],
+ walletInfo: {},
+ address: '',
+ proid: '',
+
}
},
-
+
onLoad() {
- if(uni.getStorageSync('wallet')){
- this.address=uni.getStorageSync('wallet').address
- this.wallet=uni.getStorageSync('wallet')
- this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
- .substring(25, this.wallet.address.length);
-
- }else{
- this.wallet=uni.getStorageSync('walletInfo').BTC[0]
- this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
- console.log(this.wallet,111)
- }
-
+ if (uni.getStorageSync('wallet')) {
+ this.address = uni.getStorageSync('wallet').address
+ this.wallet = uni.getStorageSync('wallet')
+ this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
+ .substring(25, this.wallet.address.length);
+
+ } else {
+ this.wallet = uni.getStorageSync('walletInfo').BTC[0]
+ this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
+ console.log(this.wallet, 111)
+ }
+
},
methods: {
- back(){
+ back() {
uni.reLaunch({
- url:'../collectionDetail/index'
+ url: '../collectionDetail/index'
})
},
- Add(){
- this.proid=uni.getStorageSync('proid')
- uni.request({
- header: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- },
- url: 'http://wallet-api.weirui0755.com/api/nft/addNftCollection', //仅为示例,并非真实接口地址。
- method: 'POST',
- data: {
- address:this.address,
- contract:this.caddress,
- tonkenId:this.tid,
- nftProjectId:this.proid
- },
- dataType:'json',
- success: (res) => {
- if(res.data.code==200){
- uni.showToast({
- title: 'Successfully',
- icon: 'success',
- duration: 1500
- })
- setTimeout(()=>{
- uni.navigateTo({
- url:'../collectionDetail/index'
- })
- },1500)
- }
-
- }
- });
- },
-
-
-
-
-
-
+ async Add() {
+ this.proid = uni.getStorageSync('proid')
+ let params = {
+ address: this.address,
+ contract: this.caddress,
+ tonkenId: this.tid,
+ nftProjectId: this.proid
+ };
+ const response = await this.$api.addNftCollection(params)
+
+ if (response.code == 200) {
+ uni.showToast({
+ title: 'Successfully',
+ icon: 'success',
+ duration: 1500
+ })
+ setTimeout(() => {
+ uni.navigateTo({
+ url: '../collectionDetail/index'
+ })
+ }, 1500)
+ }else{
+ uni.showToast({
+ title: response.msg,
+ icon: 'error',
+ duration: 1500
+ })
+ }
+
+
+ },
+
+
+
+
+
+
}
-
+
};
diff --git a/pages/menu/collection/collectionDetail/index.vue b/pages/menu/collection/collectionDetail/index.vue
index cf990de..27a6ab6 100644
--- a/pages/menu/collection/collectionDetail/index.vue
+++ b/pages/menu/collection/collectionDetail/index.vue
@@ -1,29 +1,31 @@
-
-
-
- {{item.projectName}}
-
+
+
+
+ {{item.projectName}}
+
-
-
-
- {{item.address}}
-
+
+
+
+ {{item.address}}
+
+
+
+ Contracts: {{item.contract}}
+
+
+ ID: {{item.id}}
+
+
-
- Contracts: {{item.contract}}
-
-
- ID: {{item.id}}
-
-
-
-
+
@@ -33,90 +35,90 @@
export default {
data() {
return {
- item:{},
- wallet:{},
- address:'',
- result:[],
- result2:[],
- pageSize:10,
- pageNum:1,
+ item: {},
+ wallet: {},
+ address: '',
+ result: [],
+ result2: [],
+ pageSize: 10,
+ pageNum: 1,
}
},
-
- onLoad(option) {
- if(uni.getStorageSync('wallet')){
- this.address=uni.getStorageSync('wallet').address
- this.wallet=uni.getStorageSync('wallet')
- this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
- .substring(25, this.wallet.address.length);
-
- }else{
- this.wallet=uni.getStorageSync('walletInfo').BTC[0]
- this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address.substring(25, this.wallet.address.length);
- console.log(this.wallet,111)
- }
-
-
- this.item=uni.getStorageSync('nftitem')
-
-
- this.getProject()
- this.getProject2()
+
+ onLoad(option) {
+ if (uni.getStorageSync('wallet')) {
+ this.address = uni.getStorageSync('wallet').address
+ this.wallet = uni.getStorageSync('wallet')
+ this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
+ .substring(25, this.wallet.address.length);
+
+ } else {
+ this.wallet = uni.getStorageSync('walletInfo').BTC[0]
+ this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address.substring(25, this
+ .wallet.address.length);
+ console.log(this.wallet, 111)
+ }
+
+
+ this.item = uni.getStorageSync('nftitem')
+
+
+ this.getProject()
+ this.getProject2()
},
onReachBottom() {
- this.pageSize+=5
+ this.pageSize += 5
this.getProject()
this.getProject2()
},
methods: {
- back(){
+ back() {
uni.reLaunch({
- url:'../index'
+ url: '../index'
})
},
- // http://wallet-api.weirui0755.com/api/nft/getNftCollectionList?nftProjectId=1&address=
- getProject(){
- uni.request({
- url: 'http://wallet-api.weirui0755.com/api/nft/getNftCollectionList?'+'nftProjectId='+this.item.id+'&'+'address='+this.address+'&'+'pageSize='+this.pageSize+'&'+'pageNum='+this.pageNum, //请求接口
- header: {
- 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
- },
- success: (res) => {
- this.result=res.data.data.rows
- for(var i =0;i {
- this.result2=res.data.data.rows
- console.log( this.result2,7878)
- }
- });
+ async getProject2() {
+ let params = {
+ nftProjectId: this.item.id,
+ address: this.address,
+ pageSize: this.pageSize,
+ pageNum: this.pageNum
+ }
+ const response = await this.$api.getNftCollectionList(params);
+ this.result2 = response.data.rows
+ console.log(this.result2, 7878)
+
},
- goAdd(){
- uni.navigateTo({
- url:'../addCollection/index'
- })
- },
- goDetail(index){
- console.log(this.result2[index])
- uni.setStorageSync('nftOneItem',this.result2[index])
- uni.navigateTo({
- url:'../collectionDetailtrue/index'
- })
-
- }
-
+ goAdd() {
+ uni.navigateTo({
+ url: '../addCollection/index'
+ })
+ },
+ goDetail(index) {
+ console.log(this.result2[index])
+ uni.setStorageSync('nftOneItem', this.result2[index])
+ uni.navigateTo({
+ url: '../collectionDetailtrue/index'
+ })
+
+ }
+
},
diff --git a/pages/menu/collection/index.vue b/pages/menu/collection/index.vue
index e202ce7..b1f4771 100644
--- a/pages/menu/collection/index.vue
+++ b/pages/menu/collection/index.vue
@@ -119,8 +119,8 @@
let params = {
address: this.address
}
- const post = await this.$api.getNftProjectList(params)
- this.collectinInfo=post.data
+ const response = await this.$api.getNftProjectList(params)
+ this.collectinInfo=response.data
},
goDetail2(itemm,index){
diff --git a/pages/menu/wallet/otherCoin/index.vue b/pages/menu/wallet/otherCoin/index.vue
index 1c2f135..6cb4f72 100644
--- a/pages/menu/wallet/otherCoin/index.vue
+++ b/pages/menu/wallet/otherCoin/index.vue
@@ -134,16 +134,13 @@
},
// 拿代币
- getCoin(){
- uni.request({
- url: 'http://wallet-api.weirui0755.com/api/contract/getContractInfoList?chainName='+this.coinType, //请求接口
- header: {
- 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
- },
- success: (res) => {
- this.coinInfo=res.data.data
- }
- });
+ async getCoin(){
+ let params = {
+ chainName: this.coinType
+ }
+ const response = await this.$api.getContractInfoList(params)
+ this.coinInfo=response.data
+
},
diff --git a/utils/SystemConfiguration.js b/utils/SystemConfiguration.js
index 56a91e2..aef66bf 100644
--- a/utils/SystemConfiguration.js
+++ b/utils/SystemConfiguration.js
@@ -2,11 +2,11 @@ let isTest = true;
const constant = isTest ? {
//服务端连接
- serverUrl: 'http://wallet-api.weirui0755.com/'
+ serverUrl: 'http://wallet-api.weirui0755.com'
} : {
//服务端连接
- serverUrl: 'http://wallet-api.weirui0755.com/'
+ serverUrl: 'http://wallet-api.weirui0755.com'
}
diff --git a/utils/api.js b/utils/api.js
index 8122dcc..b19a439 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -1,8 +1,14 @@
import Vue from 'vue';
import qs from 'qs'
const api = {
+ //获取NFT项目列表
getNftProjectList: (params) => Vue.prototype.$axios.get('/api/nft/getNftProjectList?' + qs.stringify(params)),
-
+ //添加NFT收藏品
+ addNftCollection: (params) => Vue.prototype.$axios.post('/api/nft/addNftCollection', qs.stringify(params)),
+ getNftCollectionList: (params) => Vue.prototype.$axios.get('/api/nft/getNftCollectionList?' + qs.stringify(
+ params)),
+ getContractInfoList: (params) => Vue.prototype.$axios.get('/api/contract/getContractInfoList?' + qs.stringify(
+ params)),
//--------------------------------- free ---------------------------------
}
diff --git a/utils/axios.js b/utils/axios.js
index 2e3e812..fec473a 100644
--- a/utils/axios.js
+++ b/utils/axios.js
@@ -69,35 +69,44 @@ service.interceptors.response.use(res => {
})
// 在main.js中放入这段自定义适配器的代码,就可以实现uniapp的app和小程序开发中能使用axios进行跨域网络请求,并支持携带cookie
-axios.defaults.adapter = function(config) {
- return new Promise((resolve, reject) => {
+
+axios.defaults.adapter = function(config) { //自己定义个适配器,用来适配uniapp的语法
+ return new Promise((resolve, reject) => {
if(config.baseURL){
config.url=config.baseURL+'/'+config.url
}
- var settle = require('axios/lib/core/settle');
- var buildURL = require('axios/lib/helpers/buildURL');
- uni.request({
- method: config.method.toUpperCase(),
- url: buildURL(config.url, config.params, config.paramsSerializer),
- header: config.headers,
- data: config.data,
- dataType: config.dataType,
- responseType: config.responseType,
- sslVerify: config.sslVerify,
- complete: function complete(response) {
- response = {
- data: response.data,
- status: response.statusCode,
- errMsg: response.errMsg,
- header: response.header,
- config: config
- };
- // console.log(response)
- settle(resolve, reject, response);
- }
- })
- })
-}
+ console.log(config)
+ var settle = require('axios/lib/core/settle');
+ var buildURL = require('axios/lib/helpers/buildURL');
+ uni.request({
+ method: config.method.toUpperCase(),
+ url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),
+ header: config.headers,
+ data: config.data,
+ dataType: config.dataType,
+ responseType: config.responseType,
+ sslVerify: config.sslVerify,
+ complete: function complete(response) {
+ console.log("执行完成:",config.baseURL + buildURL(config.url, config.params, config.paramsSerializer),response.data)
+ response = {
+ data: response.data,
+ status: response.statusCode,
+ errMsg: response.errMsg,
+ header: response.header,
+ config: config
+ };
+ settle(resolve, reject, response);
+ },
+ fail:res =>{
+ uni.showToast({
+ title: res,
+ icon:'none',
+ duration: 1500
+ })
+ }
+ })
+ })
+}
export default service