result json change

This commit is contained in:
yuexin 2019-12-03 21:18:08 +08:00
parent 3b88a7daba
commit c1300780ef
2 changed files with 34 additions and 12 deletions

View File

@ -13,7 +13,7 @@
<div class="card-bd"> <div class="card-bd">
<div class="card-cont">{{maker.desc}}</div> <div class="card-cont">{{maker.desc}}</div>
<div class="card-ipt-wrap"> <div class="card-ipt-wrap">
<input class="card-ipt" placeholder="点击输入你的名字" type="text" v-model="users" /> <input class="card-ipt" placeholder="点击输入你的名字" type="text" v-model="users" maxlength="12"/>
</div> </div>
<div @click="getResult" class="card-btn">GO</div> <div @click="getResult" class="card-btn">GO</div>
</div> </div>

View File

@ -106,6 +106,10 @@ export default {
async mounted() { async mounted() {
await this.getResult() await this.getResult()
await this.getHot() await this.getHot()
let str = this.result.join('\n');
console.log('[result]');
console.log(this.result);
console.log(str);
const palette = { const palette = {
background: '#eee', background: '#eee',
width: '750rpx', width: '750rpx',
@ -125,37 +129,50 @@ export default {
type: 'text', type: 'text',
text: this.users, text: this.users,
css: { css: {
top: '20rpx', top: '100rpx',
left: '40rpx', left: '100rpx',
width: '750rpx', width: '650rpx',
color: '#000000', color: '#000000',
textAlign: 'left', textAlign: 'left',
fontSize: '40rpx' fontSize: '40rpx',
fontWeight: 'bold',
}
},
{
type: 'text',
text: '--------------------------------',
css: {
top: '150rpx',
left: '100rpx',
width: '650rpx',
color: '#000000',
textAlign: 'left',
fontSize: '40rpx',
} }
}, },
{ {
type: 'text', type: 'text',
text: this.title, text: this.title,
css: { css: {
top: '100rpx', top: '210rpx',
left: '0rpx', left: '100rpx',
width: '750rpx', width: '650rpx',
color: '#000000', color: '#000000',
textAlign: 'center', textAlign: 'left',
fontSize: '52rpx', fontSize: '52rpx',
fontWeight: 'bold', fontWeight: 'bold',
lineHeight: '64rpx' lineHeight: '60rpx'
} }
}, },
{ {
type: 'text', type: 'text',
text: this.result.join('\n'), text: this.result.join('\n'),
css: { css: {
top: '220rpx', top: '310rpx',
left: '100rpx', left: '100rpx',
width: '550rpx', width: '550rpx',
color: '#000000', color: '#000000',
lineHeight: '72rpx', lineHeight: '80rpx',
fontSize: '48rpx' fontSize: '48rpx'
} }
}, },
@ -224,6 +241,11 @@ export default {
users: this.users users: this.users
}) })
this.result = data.result this.result = data.result
if(this.result instanceof Array){
if(this.result.length > 0 && this.result[0] == ''){
this.result.splice(0,1);
}
}
this.title = data.title this.title = data.title
} catch (err) { } catch (err) {
console.log(err) console.log(err)