Browse Source

代码

master
Dread 4 years ago
parent
commit
301f174e02
  1. 195
      pages/menu/collection/addCollection/index.vue
  2. 182
      pages/menu/collection/collectionDetail/index.vue
  3. 4
      pages/menu/collection/index.vue
  4. 24
      pages/menu/wallet/index.vue
  5. 17
      pages/menu/wallet/otherCoin/index.vue
  6. 19
      unpackage/dist/dev/app-plus/app-service.js
  7. 14
      unpackage/dist/dev/app-plus/app-view.js
  8. 4
      utils/SystemConfiguration.js
  9. 8
      utils/api.js
  10. 65
      utils/axios.js

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

@ -1,42 +1,46 @@
<template> <template>
<view class="maintoP"> <view class="maintoP">
<navigation :showBack="false" :bgnum="true" class="aaa"> <navigation :showBack="false" :bgnum="true" class="aaa">
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()" ></image> <image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()"></image>
<text class="big_title"> <text class="big_title">
NFT collections NFT collections
</text> </text>
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<view class="flex item"> <view class="flex item">
<view class="imgcon flex2"> <view class="imgcon flex2">
<image :src="wallet.coinList[0].icon" mode="aspectFit" class="img"></image> <image :src="wallet.coinList[0].icon" mode="aspectFit" class="img"></image>
<text class="tex1">{{wallet.coinList[0].name2}}</text> <text class="tex1">{{wallet.coinList[0].name2}}</text>
</view> </view>
<view class="text1"> <view class="text1">
{{wallet.address}} {{wallet.address}}
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="lfetimg"></image> <image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit"
</view> class="lfetimg"></image>
</view> </view>
<view class="item2"> </view>
<view class="title"> <view class="item2">
Contract address <view class="title">
</view> Contract address
<input type="text" v-model="caddress" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter the contract address"/> </view>
</view> <input type="text" v-model="caddress" value="" class="input"
<view class="item2"> placeholder-style="color:#BEBEBE;fontSize:14px"
<view class="title"> placeholder="Please enter the contract address" />
Token ID </view>
</view> <view class="item2">
<input type="text" v-model="tid" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID"/> <view class="title">
</view> Token ID
<view class="btn" @click="Add"> </view>
Confirm <input type="text" v-model="tid" value="" class="input"
</view> placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID" />
</view> </view>
<view class="btn" @click="Add">
Confirm
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
@ -46,80 +50,81 @@
export default { export default {
data() { data() {
return { return {
caddress:'', caddress: '',
tid:'', tid: '',
wallet:{}, wallet: {},
nftIndex:0, nftIndex: 0,
nftContrct:[[]], nftContrct: [
walletInfo:{}, []
address:'', ],
proid:'', walletInfo: {},
address: '',
proid: '',
} }
}, },
onLoad() { onLoad() {
if(uni.getStorageSync('wallet')){ if (uni.getStorageSync('wallet')) {
this.address=uni.getStorageSync('wallet').address this.address = uni.getStorageSync('wallet').address
this.wallet=uni.getStorageSync('wallet') this.wallet = uni.getStorageSync('wallet')
this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
.substring(25, this.wallet.address.length); .substring(25, this.wallet.address.length);
}else{ } else {
this.wallet=uni.getStorageSync('walletInfo').BTC[0] this.wallet = uni.getStorageSync('walletInfo').BTC[0]
this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
console.log(this.wallet,111) console.log(this.wallet, 111)
} }
}, },
methods: { methods: {
back(){ back() {
uni.reLaunch({ uni.reLaunch({
url:'../collectionDetail/index' url: '../collectionDetail/index'
}) })
}, },
Add(){ async Add() {
this.proid=uni.getStorageSync('proid') this.proid = uni.getStorageSync('proid')
uni.request({ let params = {
header: { address: this.address,
'Content-Type': 'application/x-www-form-urlencoded' contract: this.caddress,
}, tonkenId: this.tid,
url: 'http://wallet-api.weirui0755.com/api/nft/addNftCollection', // nftProjectId: this.proid
method: 'POST', };
data: { const response = await this.$api.addNftCollection(params)
address:this.address,
contract:this.caddress, if (response.code == 200) {
tonkenId:this.tid, uni.showToast({
nftProjectId:this.proid title: 'Successfully',
}, icon: 'success',
dataType:'json', duration: 1500
success: (res) => { })
if(res.data.code==200){ setTimeout(() => {
uni.showToast({ uni.navigateTo({
title: 'Successfully', url: '../collectionDetail/index'
icon: 'success', })
duration: 1500 }, 1500)
}) }else{
setTimeout(()=>{ uni.showToast({
uni.navigateTo({ title: response.msg,
url:'../collectionDetail/index' icon: 'error',
}) duration: 1500
},1500) })
} }
}
}); },
},
} }
}; };
</script> </script>

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

@ -1,29 +1,31 @@
<template> <template>
<view class="maintoP"> <view class="maintoP">
<navigation :showBack="false" :bgnum="true" class="aaa"> <navigation :showBack="false" :bgnum="true" class="aaa">
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="back" @click="back()" ></image> <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> <image src="../../../../static/tongyonh/IconGroup.png" mode="aspectFit" @click="goAdd" class="renYou2"
<text class="big_title"> slot="logo"></image>
{{item.projectName}} <text class="big_title">
</text> {{item.projectName}}
</text>
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="item" v-for="item,index in result" :key="index"> <view class="item" v-for="item,index in result" :key="index">
<view class="top"> <view class="top">
<image :src="item.chainIconUrl" mode="aspectFit" class="img"></image> <image :src="item.chainIconUrl" mode="aspectFit" class="img"></image>
{{item.address}} {{item.address}}
<image src="../../../../static/tongyonh/[email protected]" mode="aspectFit" class="img lfet" @click="goDetail(index)"></image> <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>
<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> </view>
</template> </template>
@ -33,90 +35,90 @@
export default { export default {
data() { data() {
return { return {
item:{}, item: {},
wallet:{}, wallet: {},
address:'', address: '',
result:[], result: [],
result2:[], result2: [],
pageSize:10, pageSize: 10,
pageNum:1, pageNum: 1,
} }
}, },
onLoad(option) { onLoad(option) {
if(uni.getStorageSync('wallet')){ if (uni.getStorageSync('wallet')) {
this.address=uni.getStorageSync('wallet').address this.address = uni.getStorageSync('wallet').address
this.wallet=uni.getStorageSync('wallet') this.wallet = uni.getStorageSync('wallet')
this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address
.substring(25, this.wallet.address.length); .substring(25, this.wallet.address.length);
}else{ } else {
this.wallet=uni.getStorageSync('walletInfo').BTC[0] 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); this.wallet.address = this.wallet.address.substring(0, 6) + '...' + this.wallet.address.substring(25, this
console.log(this.wallet,111) .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() { onReachBottom() {
this.pageSize+=5 this.pageSize += 5
this.getProject() this.getProject()
this.getProject2() this.getProject2()
}, },
methods: { methods: {
back(){ back() {
uni.reLaunch({ uni.reLaunch({
url:'../index' url: '../index'
}) })
}, },
// http://wallet-api.weirui0755.com/api/nft/getNftCollectionList?nftProjectId=1&address= async getProject() {
getProject(){ let params = {
uni.request({ nftProjectId: this.item.id,
url: 'http://wallet-api.weirui0755.com/api/nft/getNftCollectionList?'+'nftProjectId='+this.item.id+'&'+'address='+this.address+'&'+'pageSize='+this.pageSize+'&'+'pageNum='+this.pageNum, // address: this.address,
header: { pageSize: this.pageSize,
'content-type': 'application/x-www-form-urlencoded', // pageNum: this.pageNum
}, }
success: (res) => { const response = await this.$api.getNftCollectionList(params)
this.result=res.data.data.rows
for(var i =0;i<this.result.length;i++){ this.result = response.data.rows
this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address for (var i = 0; i < this.result.length; i++) {
.substring(25, this.result[i].address.length); this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address
} .substring(25, this.result[i].address.length);
}
}
});
}, },
getProject2(){ async getProject2() {
uni.request({ let params = {
url: 'http://wallet-api.weirui0755.com/api/nft/getNftCollectionList?'+'nftProjectId='+this.item.id+'&'+'address='+this.address+'&'+'pageSize='+this.pageSize+'&'+'pageNum='+this.pageNum, // nftProjectId: this.item.id,
header: { address: this.address,
'content-type': 'application/x-www-form-urlencoded', // pageSize: this.pageSize,
}, pageNum: this.pageNum
success: (res) => { }
this.result2=res.data.data.rows const response = await this.$api.getNftCollectionList(params);
console.log( this.result2,7878) this.result2 = response.data.rows
} console.log(this.result2, 7878)
});
}, },
goAdd(){ goAdd() {
uni.navigateTo({ uni.navigateTo({
url:'../addCollection/index' url: '../addCollection/index'
}) })
}, },
goDetail(index){ goDetail(index) {
console.log(this.result2[index]) console.log(this.result2[index])
uni.setStorageSync('nftOneItem',this.result2[index]) uni.setStorageSync('nftOneItem', this.result2[index])
uni.navigateTo({ uni.navigateTo({
url:'../collectionDetailtrue/index' url: '../collectionDetailtrue/index'
}) })
} }
}, },

4
pages/menu/collection/index.vue

@ -119,8 +119,8 @@
let params = { let params = {
address: this.address address: this.address
} }
const post = await this.$api.getNftProjectList(params) const response = await this.$api.getNftProjectList(params)
this.collectinInfo=post.data this.collectinInfo=response.data
}, },
goDetail2(itemm,index){ goDetail2(itemm,index){

24
pages/menu/wallet/index.vue

@ -97,14 +97,17 @@
showMoney1: true, showMoney1: true,
showMoney2: false, showMoney2: false,
btcBalance: 0, btcBalance: 0,
isStop:false
} }
}, },
onUnload: function() {
this.isStop = true
},
onLoad() { onLoad() {
// //
this.userObj = uni.getStorageSync('wallet'); this.userObj = uni.getStorageSync('wallet');
// this.userObj2 = uni.getStorageSync('wallet'); // this.userObj2 = uni.getStorageSync('wallet');
this.updateData(); this.updateData();
}, },
// onPullDownRefresh() { // onPullDownRefresh() {
@ -122,11 +125,22 @@
thar.userObj = uni.getStorageSync('wallet'); thar.userObj = uni.getStorageSync('wallet');
thar.userObj2 = uni.getStorageSync('wallet'); thar.userObj2 = uni.getStorageSync('wallet');
// thar.userObj.address = thar.userObj.ellipsisAddress; // thar.userObj.address = thar.userObj.ellipsisAddress;
<<<<<<< HEAD
thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25, thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25,
thar.userObj.address.length); thar.userObj.address.length);
thar.$walletUtil.updateBalance(); thar.$walletUtil.updateBalance();
thar.updateData(); thar.updateData();
}, 100); }, 100);
=======
thar.userObj.address = thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address
.substring(25,
thar.userObj.address.length);
thar.$walletUtil.updateBalance();
if (!thar.isStop) {
thar.updateData()
}
}, 2000);
>>>>>>> ecf936884019d656c3291d2f722529a76c9bbfd5
}, },
goOther() { goOther() {
@ -145,7 +159,7 @@
this.showMoney2 = false this.showMoney2 = false
}, },
setStorage() { setStorage() {
}, },
goTrans(itemm, index) { goTrans(itemm, index) {
if (index == 0) { if (index == 0) {

17
pages/menu/wallet/otherCoin/index.vue

@ -134,16 +134,13 @@
}, },
// //
getCoin(){ async getCoin(){
uni.request({ let params = {
url: 'http://wallet-api.weirui0755.com/api/contract/getContractInfoList?chainName='+this.coinType, // chainName: this.coinType
header: { }
'content-type': 'application/x-www-form-urlencoded', // const response = await this.$api.getContractInfoList(params)
}, this.coinInfo=response.data
success: (res) => {
this.coinInfo=res.data.data
}
});
}, },

19
unpackage/dist/dev/app-plus/app-service.js

File diff suppressed because one or more lines are too long

14
unpackage/dist/dev/app-plus/app-view.js

@ -23498,19 +23498,9 @@ __webpack_require__.r(__webpack_exports__);
!*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/style.js!C:/Users/Administrator/Desktop/bitcoo/pages/menu/wallet/index.vue?vue&type=script&lang=js&mpType=page ***! !*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/using-components.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/style.js!C:/Users/Administrator/Desktop/bitcoo/pages/menu/wallet/index.vue?vue&type=script&lang=js&mpType=page ***!
\********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ \********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */ /*! no static exports found */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default =
{
data: function data() {
return {
wxsProps: {} };
}, throw new Error("Module build failed (from ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/view/script.js):\nSyntaxError: Unexpected token (128:0)\n at Object._raise (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:746:17)\n at Object.raiseWithData (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:739:17)\n at Object.raise (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:733:17)\n at Object.unexpected (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:8807:16)\n at Object.parseExprAtom (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:10130:20)\n at Object.parseExprSubscripts (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9656:23)\n at Object.parseMaybeUnary (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9636:21)\n at Object.parseMaybeUnary (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:6877:20)\n at Object.parseExprOps (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9506:23)\n at Object.parseMaybeConditional (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9479:23)\n at Object.parseMaybeAssign (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9434:21)\n at Object.parseMaybeAssign (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:6822:20)\n at Object.parseExpression (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:9386:23)\n at Object.parseStatementContent (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:11285:23)\n at Object.parseStatementContent (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:6575:18)\n at Object.parseStatement (C:\\Users\\Administrator\\Desktop\\HBuilderX\\plugins\\uniapp-cli\\node_modules\\@babel\\parser\\lib\\index.js:11156:17)");
components: {} };exports.default = _default;
/***/ }), /***/ }),
/* 550 */ /* 550 */

4
utils/SystemConfiguration.js

@ -2,11 +2,11 @@ let isTest = true;
const constant = isTest ? { 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 Vue from 'vue';
import qs from 'qs' import qs from 'qs'
const api = { const api = {
//获取NFT项目列表
getNftProjectList: (params) => Vue.prototype.$axios.get('/api/nft/getNftProjectList?' + qs.stringify(params)), 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 --------------------------------- //--------------------------------- free ---------------------------------
} }

65
utils/axios.js

@ -69,35 +69,42 @@ service.interceptors.response.use(res => {
}) })
// 在main.js中放入这段自定义适配器的代码,就可以实现uniapp的app和小程序开发中能使用axios进行跨域网络请求,并支持携带cookie // 在main.js中放入这段自定义适配器的代码,就可以实现uniapp的app和小程序开发中能使用axios进行跨域网络请求,并支持携带cookie
axios.defaults.adapter = function(config) {
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);
}
})
})
}
axios.defaults.adapter = function(config) { //自己定义个适配器,用来适配uniapp的语法
return new Promise((resolve, reject) => {
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 export default service

Loading…
Cancel
Save