兑换结果、兑换记录
This commit is contained in:
parent
e778b96292
commit
b916c1dc51
@ -49,11 +49,26 @@
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"id": -1,
|
||||
"id": 2,
|
||||
"name": "exchange-result",
|
||||
"pathName": "pages/exchange-result",
|
||||
"query": "",
|
||||
"scene": null
|
||||
"scene": 1037,
|
||||
"referrerInfo": {
|
||||
"appId": "4562388888889",
|
||||
"extraData": "{ \t\"accountId\": \"6001_1004_oQmL74u7TBo94aGpKIGNCZD9rKew\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5fa7ea6f8cb82bc0195750\" }"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "pages/exchange-record",
|
||||
"pathName": "pages/exchange-record",
|
||||
"query": "",
|
||||
"scene": 1037,
|
||||
"referrerInfo": {
|
||||
"appId": "12344",
|
||||
"extraData": "{ \t\"accountId\": \"6007_1004_D1A9357FB5975B61CDCB43B1AEE6C5D0\", \t\"sessionId\": \"1566525470_1563178315_f37bcfd5c3b82fd28d00d18273e7f1a5_53c8e916459a621c1e5021fba99c9212\", \t\"gameId\": \"8002\", \t\"channelId\": \"6001\", \"recordId\": \"5d5e81eedfd349387cace22c\" }"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
102
src/app.wpy
102
src/app.wpy
@ -1,28 +1,28 @@
|
||||
<style lang="less">
|
||||
@import "style/zanui/index.wxss";
|
||||
@import "style/font.wxss";
|
||||
@import "style/btn.wxss";
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
width: 749rpx;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.hidden{
|
||||
display: none!important;
|
||||
}
|
||||
@import 'style/zanui/index.wxss';
|
||||
@import 'style/font.wxss';
|
||||
@import 'style/btn.wxss';
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
width: 749rpx;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import wepy from 'wepy'
|
||||
import 'wepy-async-function'
|
||||
import jcEvent from './common/jc-event';
|
||||
import jcEvent from './common/jc-event'
|
||||
|
||||
let sdkManage = require('./jcfw/SDKManage');
|
||||
let sdkManage = require('./jcfw/SDKManage')
|
||||
|
||||
export default class extends wepy.app {
|
||||
config = {
|
||||
@ -31,72 +31,72 @@ export default class extends wepy.app {
|
||||
'pages/product',
|
||||
'pages/buyvip',
|
||||
'pages/detail',
|
||||
'pages/exchange-result'
|
||||
'pages/exchange-result',
|
||||
'pages/exchange-record',
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#fff',
|
||||
navigationBarTitleText: 'WeChat',
|
||||
navigationBarTextStyle: 'black'
|
||||
}
|
||||
navigationBarTextStyle: 'black',
|
||||
},
|
||||
}
|
||||
|
||||
globalData = {
|
||||
userInfo: null,
|
||||
gameToken: null,
|
||||
dataType: 'game'
|
||||
dataType: 'game',
|
||||
}
|
||||
|
||||
constructor () {
|
||||
constructor() {
|
||||
super()
|
||||
this.use('requestfix');
|
||||
this.use('promisify');
|
||||
sdkManage.init();
|
||||
this.use('requestfix')
|
||||
this.use('promisify')
|
||||
sdkManage.init()
|
||||
sdkManage.Login(() => {
|
||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
|
||||
console.log('finish parse jcfw');
|
||||
});
|
||||
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {})
|
||||
console.log('finish parse jcfw')
|
||||
})
|
||||
//全局拦截器
|
||||
this.intercept('request', {
|
||||
config(p) {
|
||||
let token = this.globalData.gameToken;
|
||||
let token = this.globalData.gameToken
|
||||
if (token) {
|
||||
p.header['Authorization'] = `JWT ${token}`;
|
||||
p.header['Authorization'] = `JWT ${token}`
|
||||
}
|
||||
(p.data) || (p.data = {});
|
||||
(p.data.data_type) || (p.data.data_type = this.globalData.dataType);
|
||||
return p;
|
||||
p.data || (p.data = {})
|
||||
p.data.data_type || (p.data.data_type = this.globalData.dataType)
|
||||
return p
|
||||
},
|
||||
success(response) {
|
||||
if (response.data.errcode === 0) {
|
||||
return response.data;
|
||||
return response.data
|
||||
} else if (response.statusCode === '404') {
|
||||
wepy.showToast({ title: '404 请求接口不存在' });
|
||||
wepy.showToast({title: '404 请求接口不存在'})
|
||||
}
|
||||
return response;
|
||||
return response
|
||||
},
|
||||
fail(response) {
|
||||
wepy.showModal({
|
||||
title: '提示',
|
||||
content: `服务器错误,请稍候再试! ${response.errMsg}`
|
||||
});
|
||||
return response;
|
||||
}
|
||||
});
|
||||
content: `服务器错误,请稍候再试! ${response.errMsg}`,
|
||||
})
|
||||
return response
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
onLaunch() {
|
||||
}
|
||||
onLaunch() {}
|
||||
onShow(options) {
|
||||
console.log('app.onShow');
|
||||
console.log(options);
|
||||
console.log('app.onShow')
|
||||
console.log(options)
|
||||
if (options.scene === 1037) {
|
||||
let params = options.query;
|
||||
this.globalData.gameToken = params.token;
|
||||
this.globalData.dataType = params.dataType;
|
||||
let params = options.query
|
||||
let extraData = options.referrerInfo.extraData
|
||||
this.globalData.gameToken = params.token
|
||||
this.globalData.dataType = params.dataType
|
||||
this.globalData.extraData = extraData
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -1,37 +1,131 @@
|
||||
<style lang="less">
|
||||
.container {
|
||||
.records {
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
.record {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 180rpx;
|
||||
margin: 24rpx;
|
||||
border: 1px solid #f0f0f0;
|
||||
|
||||
.item-img-wrap {
|
||||
height: 100%;
|
||||
width: 180rpx;
|
||||
.item-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.item-desc {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
margin-left: 36rpx;
|
||||
padding-top: 24rpx;
|
||||
.item-title,
|
||||
.code {
|
||||
display: block;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.code {
|
||||
margin-top: 36rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
max-width: 240rpx;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-copy {
|
||||
width: 180rpx;
|
||||
height: 100%;
|
||||
border-left: 1px solid #f0f0f0;
|
||||
line-height: 180rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view class="container">
|
||||
|
||||
<view class="container">
|
||||
<view class="records">
|
||||
<repeat
|
||||
for="{{records}}"
|
||||
key="index"
|
||||
index="index"
|
||||
item="item"
|
||||
>
|
||||
<view class="record">
|
||||
<view class="item-img-wrap">
|
||||
<image
|
||||
mode="cover"
|
||||
src="{{item.gift_info.gift_url}}"
|
||||
class="item-img"
|
||||
></image>
|
||||
</view>
|
||||
<view class="item-desc">
|
||||
<text class="item-title">{{item.gift_info.gift_name}}</text>
|
||||
<text class="code">{{item.code}}</text>
|
||||
</view>
|
||||
<view
|
||||
class="btn-copy"
|
||||
@tap="copy"
|
||||
data-index="{{index}}"
|
||||
>复制</view>
|
||||
</view>
|
||||
</repeat>
|
||||
</view>
|
||||
<view class="tip" wx:if="{{records.length === 0}}">暂无兑换记录</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import wepy from 'wepy'
|
||||
import http from '../utils/http'
|
||||
|
||||
export default class ExchangeResult extends wepy.page {
|
||||
export default class ExchangeRecord extends wepy.page {
|
||||
config = {
|
||||
navigationBarTitleText: '兑换结果',
|
||||
navigationBarTitleText: '兑换记录',
|
||||
}
|
||||
|
||||
data = {
|
||||
status: 1,
|
||||
records: [],
|
||||
}
|
||||
|
||||
methods = {
|
||||
|
||||
copy(e) {
|
||||
var self = this
|
||||
wx.setClipboardData({
|
||||
data: self.records[e.target.dataset.index].code,
|
||||
success: function(res) {
|
||||
wx.showToast({
|
||||
title: '复制成功!',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
onShow() {
|
||||
|
||||
async onShow() {
|
||||
const extraData = wepy.$instance.globalData.extraData
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!!')
|
||||
console.log(extraData)
|
||||
// TODO: 链接替换
|
||||
const res = await http.get(
|
||||
`/api/gift/records?accountId=${
|
||||
extraData.accountId
|
||||
}&gameId=${extraData.gameId}&channelId=${extraData.channelId}`
|
||||
)
|
||||
this.records = res.result
|
||||
this.$apply()
|
||||
console.log(this.records)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
@ -1,94 +1,85 @@
|
||||
<style lang="less">
|
||||
.container {
|
||||
padding: 200rpx 100rpx 0;
|
||||
.result {
|
||||
font-size: 64rpx;
|
||||
margin-bottom: 32rpx;
|
||||
.txt {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-bottom: 48rpx;
|
||||
text-align: center;
|
||||
padding-top: 100rpx;
|
||||
.title {
|
||||
font-size: 72rpx;
|
||||
}
|
||||
.item {
|
||||
margin: 50rpx 0 0;
|
||||
border: 1px solid #f0f0f0;
|
||||
text-align: center;
|
||||
font-size: 0;
|
||||
.item-img {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
&.success {
|
||||
.txt {
|
||||
color: #f44;
|
||||
}
|
||||
.item {
|
||||
border: 1px solid #f0f0f0;
|
||||
height: 200rpx;
|
||||
margin: 32rpx 0;
|
||||
.item-desc {
|
||||
font-size: 32rpx;
|
||||
margin: 12rpx 0;
|
||||
.item-title {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
.item-img {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
margin-right: 32rpx;
|
||||
float: left;
|
||||
}
|
||||
.item-desc {
|
||||
font-size: 36rpx;
|
||||
.text {
|
||||
display: block;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.item-info {
|
||||
color: #f44;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.code-wrap {
|
||||
box-sizing: border-box;
|
||||
width: 500rpx;
|
||||
padding: 20rpx 32rpx;
|
||||
margin: 64rpx;
|
||||
border: 1px solid #f0f0f0;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
&.fail {
|
||||
.txt {
|
||||
color: #666;
|
||||
}
|
||||
.fail-img {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.code-wrap {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 50rpx;
|
||||
|
||||
.code,
|
||||
.tip {
|
||||
display: block;
|
||||
font-size: 48rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.code {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tip {
|
||||
margin-top: 24rpx;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
.btn-view {
|
||||
color: #1989fa;
|
||||
margin-top: 100rpx;
|
||||
font-size: 28rpx;
|
||||
text-decoration: underline;
|
||||
color: #1989fa;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<view class="container">
|
||||
|
||||
<view class="result success">
|
||||
<text class="txt">兑换成功</text>
|
||||
<view class="item">
|
||||
<image
|
||||
mode="cover"
|
||||
src="http://iph.href.lu/300x300"
|
||||
class="item-img"
|
||||
></image>
|
||||
<view class="item-desc">
|
||||
<text class="text item-title">5元话费券</text>
|
||||
<text class="text item-info">¥5.00</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="code-wrap">
|
||||
<text class="code">xde23dacaf2</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<text class="btn-view">兑换记录</text>
|
||||
<view class="container">
|
||||
<text class="title">兑换成功</text>
|
||||
<view class="item">
|
||||
<image
|
||||
mode="cover"
|
||||
src="{{gift_record.gift_info.gift_url}}"
|
||||
class="item-img"
|
||||
></image>
|
||||
<view class="item-desc">
|
||||
<text class="item-title">{{gift_record.gift_info.gift_name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="code-wrap"
|
||||
@longtap="copy"
|
||||
>
|
||||
<text class="code">{{gift_record.code}}</text>
|
||||
<text class="tip">长按复制兑换券</text>
|
||||
</view>
|
||||
<text
|
||||
class="btn-view"
|
||||
@tap="viewRecords"
|
||||
>兑换记录</text>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -101,13 +92,49 @@ export default class ExchangeResult extends wepy.page {
|
||||
}
|
||||
|
||||
data = {
|
||||
|
||||
status: 0,
|
||||
gift_record: {
|
||||
gift_info: {
|
||||
gift_id: '',
|
||||
gift_name: '',
|
||||
gift_url: '',
|
||||
},
|
||||
_id: '',
|
||||
user_id: '',
|
||||
game_id: '',
|
||||
platform_id: '',
|
||||
gift_id: '',
|
||||
code: '',
|
||||
},
|
||||
}
|
||||
|
||||
methods = {}
|
||||
|
||||
onShow(options) {
|
||||
console.log(options.refrence)
|
||||
methods = {
|
||||
copy(e) {
|
||||
var self = this
|
||||
wx.setClipboardData({
|
||||
data: self.gift_record.code,
|
||||
success: function(res) {
|
||||
wx.showToast({
|
||||
title: '复制成功!',
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
viewRecords() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/exchange-record',
|
||||
})
|
||||
},
|
||||
}
|
||||
async onShow() {
|
||||
const extraData = wepy.$instance.globalData.extraData
|
||||
const res = await http.get(
|
||||
'/api/gift/record?recordId=' + extraData.recordId
|
||||
)
|
||||
if (res.errcode === 0) {
|
||||
this.gift_record = res.result
|
||||
this.$apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user