Skip to content

Instantly share code, notes, and snippets.

@zencodex
Created September 17, 2023 02:04
Show Gist options
  • Save zencodex/277e4ec8995ee65de9917437b50259e8 to your computer and use it in GitHub Desktop.
Save zencodex/277e4ec8995ee65de9917437b50259e8 to your computer and use it in GitHub Desktop.
激活页面
<template>
<view class="page">
<cu-custom :is-back="true"></cu-custom>
<view class="card">
<image class="card-bg" src="/static/activate/card-bg.png" mode="aspectFill"></image>
<view class="header">
<view class="left">
<image class="card-white" src="/static/activate/card-white.png" mode="widthFix"></image>
<text class="txt">兑换码</text>
</view>
</view>
</view>
<view class="form">
<view class="form-item">
<image class="form-icon" src="/static/activate/card-icon.png" mode="widthFix"></image>
<u--input placeholder="请输入兑换码" border="none" maxlength="30" v-model="activateCode" type="number" focus="true"></u--input>
</view>
<tik-button text="立即兑换" styleType="styleType2" @click="submit" style="margin: 0 20rpx"></tik-button>
</view>
</view>
</template>
<script>
import cuCustom from '@/components/cu-custom.nvue'
import TikButton from '@/components/TikButton.nvue'
import {
toast,
navigateBack
} from '@/common/utils/func.js'
import Api from '@/common/api/index.js'
export default {
components: {
cuCustom,
TikButton
},
data() {
return {
activateCode: ''
}
},
methods: {
submit() {
if (!this.activateCode) {
toast('请输入兑换码')
return
}
Api.activate({
active_codes: this.activateCode
}).then(res => {
if (res.error_code === 0) {
toast(res.message)
setTimeout(() => {
navigateBack()
}, 2000)
} else {
toast(res.message)
}
})
}
}
}
</script>
<style scoped lang="less">
.page>.card {
height: 448rpx;
padding: 60rpx 70rpx;
>.card-bg {
width: 750rpx;
position: absolute;
height: 443rpx;
left: 0;
top: 0;
}
>.header {
>.left {
flex-direction: row;
align-items: center;
.card-white {
width: 56rpx;
margin-right: 24rpx;
}
.txt {
color: #fff;
font-size: 14px;
}
}
}
}
.page>.form {
margin-top: 0rpx;
padding: 0 22rpx;
.form-item {
flex-direction: row;
align-items: center;
border-bottom: 1rpx solid #ccc;
border-top: 1rpx solid #ccc;
height: 120rpx;
margin-bottom: 40rpx;
.form-icon {
margin-right: 14rpx;
margin-top: 3px;
width: 48rpx;
}
}
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment