Browse Source

代码

master
Dread 4 years ago
parent
commit
301f174e02
  1. 41
      pages/menu/collection/addCollection/index.vue
  2. 50
      pages/menu/collection/collectionDetail/index.vue
  3. 4
      pages/menu/collection/index.vue
  4. 16
      pages/menu/wallet/index.vue
  5. 15
      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. 21
      utils/axios.js

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

@ -15,20 +15,24 @@
</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"
class="lfetimg"></image>
</view> </view>
</view> </view>
<view class="item2"> <view class="item2">
<view class="title"> <view class="title">
Contract address Contract address
</view> </view>
<input type="text" v-model="caddress" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter the 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>
<view class="item2"> <view class="item2">
<view class="title"> <view class="title">
Token ID Token ID
</view> </view>
<input type="text" v-model="tid" value="" class="input" placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID"/> <input type="text" v-model="tid" value="" class="input"
placeholder-style="color:#BEBEBE;fontSize:14px" placeholder="Please enter token ID" />
</view> </view>
<view class="btn" @click="Add"> <view class="btn" @click="Add">
Confirm Confirm
@ -50,7 +54,9 @@
tid: '', tid: '',
wallet: {}, wallet: {},
nftIndex: 0, nftIndex: 0,
nftContrct:[[]], nftContrct: [
[]
],
walletInfo: {}, walletInfo: {},
address: '', address: '',
proid: '', proid: '',
@ -79,23 +85,17 @@
url: '../collectionDetail/index' url: '../collectionDetail/index'
}) })
}, },
Add(){ async Add() {
this.proid = uni.getStorageSync('proid') this.proid = uni.getStorageSync('proid')
uni.request({ let params = {
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
url: 'http://wallet-api.weirui0755.com/api/nft/addNftCollection', //
method: 'POST',
data: {
address: this.address, address: this.address,
contract: this.caddress, contract: this.caddress,
tonkenId: this.tid, tonkenId: this.tid,
nftProjectId: this.proid nftProjectId: this.proid
}, };
dataType:'json', const response = await this.$api.addNftCollection(params)
success: (res) => {
if(res.data.code==200){ if (response.code == 200) {
uni.showToast({ uni.showToast({
title: 'Successfully', title: 'Successfully',
icon: 'success', icon: 'success',
@ -106,10 +106,15 @@
url: '../collectionDetail/index' url: '../collectionDetail/index'
}) })
}, 1500) }, 1500)
}else{
uni.showToast({
title: response.msg,
icon: 'error',
duration: 1500
})
} }
}
});
}, },

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

@ -2,7 +2,8 @@
<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"
slot="logo"></image>
<text class="big_title"> <text class="big_title">
{{item.projectName}} {{item.projectName}}
</text> </text>
@ -13,7 +14,8 @@
<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>
<view class="top"> <view class="top">
<text class="textleft">Contracts: </text>{{item.contract}} <text class="textleft">Contracts: </text>{{item.contract}}
@ -52,7 +54,8 @@
} 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
.wallet.address.length);
console.log(this.wallet, 111) console.log(this.wallet, 111)
} }
@ -74,34 +77,33 @@
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
this.result = response.data.rows
for (var i = 0; i < this.result.length; i++) { for (var i = 0; i < this.result.length; i++) {
this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address this.result[i].address = this.result[i].address.substring(0, 6) + '...' + this.result[i].address
.substring(25, this.result[i].address.length); .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
console.log( this.result2,7878)
} }
}); const response = await this.$api.getNftCollectionList(params);
this.result2 = response.data.rows
console.log(this.result2, 7878)
}, },
goAdd() { goAdd() {
uni.navigateTo({ uni.navigateTo({

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

16
pages/menu/wallet/index.vue

@ -97,9 +97,12 @@
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');
@ -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() {

15
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', //
},
success: (res) => {
this.coinInfo=res.data.data
} }
}); const response = await this.$api.getContractInfoList(params)
this.coinInfo=response.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 ---------------------------------
} }

21
utils/axios.js

@ -69,22 +69,23 @@ service.interceptors.response.use(res => {
}) })
// 在main.js中放入这段自定义适配器的代码,就可以实现uniapp的app和小程序开发中能使用axios进行跨域网络请求,并支持携带cookie // 在main.js中放入这段自定义适配器的代码,就可以实现uniapp的app和小程序开发中能使用axios进行跨域网络请求,并支持携带cookie
axios.defaults.adapter = function(config) {
axios.defaults.adapter = function(config) { //自己定义个适配器,用来适配uniapp的语法
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(config.baseURL){
config.url=config.baseURL+'/'+config.url console.log(config)
}
var settle = require('axios/lib/core/settle'); var settle = require('axios/lib/core/settle');
var buildURL = require('axios/lib/helpers/buildURL'); var buildURL = require('axios/lib/helpers/buildURL');
uni.request({ uni.request({
method: config.method.toUpperCase(), method: config.method.toUpperCase(),
url: buildURL(config.url, config.params, config.paramsSerializer), url: config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),
header: config.headers, header: config.headers,
data: config.data, data: config.data,
dataType: config.dataType, dataType: config.dataType,
responseType: config.responseType, responseType: config.responseType,
sslVerify: config.sslVerify, sslVerify: config.sslVerify,
complete: function complete(response) { complete: function complete(response) {
console.log("执行完成:",config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),response.data)
response = { response = {
data: response.data, data: response.data,
status: response.statusCode, status: response.statusCode,
@ -92,12 +93,18 @@ axios.defaults.adapter = function(config) {
header: response.header, header: response.header,
config: config config: config
}; };
// console.log(response)
settle(resolve, reject, response); settle(resolve, reject, response);
},
fail:res =>{
uni.showToast({
title: res,
icon:'none',
duration: 1500
})
} }
}) })
}) })
} }
export default service export default service

Loading…
Cancel
Save