Browse Source

修改

master
vee 4 years ago
parent
commit
d263be9901
  1. 173
      pages/menu/collection/addCollection/index.vue
  2. 168
      pages/menu/collection/collectionDetail/index.vue
  3. 4
      pages/menu/collection/index.vue
  4. 17
      pages/menu/wallet/otherCoin/index.vue
  5. 4
      utils/SystemConfiguration.js
  6. 8
      utils/api.js
  7. 61
      utils/axios.js

173
pages/menu/collection/addCollection/index.vue

@ -1,39 +1,43 @@
<template>
<view class="maintoP">
<navigation :showBack="false" :bgnum="true" class="aaa">
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()" ></image>
<text class="big_title">
NFT collections
</text>
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
<text class="big_title">
NFT collections
</text>
</navigation>
<view class="main">
<view class="main_con">
<view class="flex item">
<view class="imgcon flex2">
<image :src="wallet.coinList[0].icon" mode="aspectFit" class="img"></image>
<text class="tex1">{{wallet.coinList[0].name2}}</text>
</view>
<view class="text1">
{{wallet.address}}
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="lfetimg"></image>
</view>
</view>
<view class="item2">
<view class="title">
Contract address
</view>
<input type="text" v-model="caddress" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter the contract address"/>
</view>
<view class="item2">
<view class="title">
Token ID
</view>
<input type="text" v-model="tid" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID"/>
</view>
<view class="btn" @click="Add">
Confirm
</view>
</view>
<view class="main_con">
<view class="flex item">
<view class="imgcon flex2">
<image :src="wallet.coinList[0].icon" mode="aspectFit" class="img"></image>
<text class="tex1">{{wallet.coinList[0].name2}}</text>
</view>
<view class="text1">
{{wallet.address}}
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit"
class="lfetimg"></image>
</view>
</view>
<view class="item2">
<view class="title">
Contract address
</view>
<input type="text" v-model="caddress" value="" class="input"
placeholder-style="color:#BEBEBE;fontSize:14px"
placeholder="Please enter the contract address" />
</view>
<view class="item2">
<view class="title">
Token ID
</view>
<input type="text" v-model="tid" value="" class="input"
placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID" />
</view>
<view class="btn" @click="Add">
Confirm
</view>
</view>
</view>
@ -46,71 +50,72 @@
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
})
}
},

168
pages/menu/collection/collectionDetail/index.vue

@ -1,27 +1,29 @@
<template>
<view class="maintoP">
<navigation :showBack="false" :bgnum="true" class="aaa">
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()" ></image>
<image src="../../../../static/tongyonh/IconGroup.png" mode="aspectFit" @click="goAdd" class="renYou2" slot="logo"></image>
<text class="big_title">
{{item.projectName}}
</text>
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
<image src="../../../../static/tongyonh/IconGroup.png" mode="aspectFit" @click="goAdd" class="renYou2"
slot="logo"></image>
<text class="big_title">
{{item.projectName}}
</text>
</navigation>
<view class="main">
<view class="item" v-for="item,index in result" :key="index">
<view class="top">
<image :src="item.chainIconUrl" mode="aspectFit" class="img"></image>
{{item.address}}
<image src="../../../../static/tongyonh/[email protected]" mode="aspectFit" class="img lfet" @click="goDetail(index)"></image>
</view>
<view class="top">
<text class="textleft">Contracts: </text>{{item.contract}}
</view>
<view class="top">
<text class="textleft texttt">ID: </text>{{item.id}}
</view>
</view>
<view class="item" v-for="item,index in result" :key="index">
<view class="top">
<image :src="item.chainIconUrl" mode="aspectFit" class="img"></image>
{{item.address}}
<image src="../../../../static/tongyonh/[email protected]" mode="aspectFit" class="img lfet"
@click="goDetail(index)"></image>
</view>
<view class="top">
<text class="textleft">Contracts: </text>{{item.contract}}
</view>
<view class="top">
<text class="textleft texttt">ID: </text>{{item.id}}
</view>
</view>
</view>
</view>
@ -33,89 +35,89 @@
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)
}
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.item = uni.getStorageSync('nftitem')
this.getProject()
this.getProject2()
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.result.length;i++){
this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address
.substring(25, this.result[i].address.length);
}
}
});
async getProject() {
let params = {
nftProjectId: this.item.id,
address: this.address,
pageSize: this.pageSize,
pageNum: this.pageNum
}
const response = await this.$api.getNftCollectionList(params)
this.result = response.data.rows
for (var i = 0; i < this.result.length; i++) {
this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address
.substring(25, this.result[i].address.length);
}
},
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)
},
getProject2(){
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.result2=res.data.data.rows
console.log( this.result2,7878)
}
});
goAdd() {
uni.navigateTo({
url: '../addCollection/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'
})
}
goDetail(index) {
console.log(this.result2[index])
uni.setStorageSync('nftOneItem', this.result2[index])
uni.navigateTo({
url: '../collectionDetailtrue/index'
})
}
},

4
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){

17
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
},

4
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'
}

8
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 ---------------------------------
}

61
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

Loading…
Cancel
Save