123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <view class="container main">
- <view class="one">
- <view class="title">
- <span>决赛时间:</span>
- <span>{{info.final_start_time}}</span>
- </view>
- <view class="button">
- <button class="button_1" type="primary" @tap="toSign('0')">确认参加</button>
- <button class="button_2" type="warn" @tap="toSign('1')">放弃参加</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import moment from 'moment';
- export default {
- components: {},
- data() {
- return {
- id: '',
- user: {},
- info: {},
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e && e.id || '');
- await that.searchToken();
- await that.search();
- },
- methods: {
- // 用户信息
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const user = that.$jwt(res);
- that.$set(that, `user`, user);
- }
- } catch (e) {}
- },
- // 查询
- async search() {
- const that = this;
- if (that.id) {
- let res;
- res = await that.$api(`/matchReg/${that.id}`, 'GET', {})
- if (res.errcode == '0') {
- that.$set(that, `info`, res.data)
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- }
- }
- },
- async toSign(type) {
- const that = this;
- let res;
- if (type == '0') {
- res = await that.$api(`/matchExt/step5/confirm/${that.info.match_id}`, 'POST', {
- user_id: that.user.id
- })
- } else {
- res = await that.$api(`/matchExt/step5/refuse/${that.info.match_id}`, 'POST', {
- user_id: that.user.id
- })
- }
- if (res.errcode == '0') {
- uni.showModal({
- content: "维护成功!",
- showCancel: false
- });
- uni.navigateBack({
- delta: 1
- })
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- .one {
- padding: 2vw;
- .title {
- padding: 2vw;
- text-align: center;
- }
- .button {
- display: flex;
- margin: 2vw 0 0 0;
- padding: 2vw;
- .button_1 {
- color: var(--mainColor);
- font-size: var(--font14Size);
- border-radius: 2vw;
- background-color: var(--f3CColor);
- }
- .button_2 {
- color: var(--mainColor);
- font-size: var(--font14Size);
- border-radius: 2vw;
- background-color: var(--fF0Color);
- }
- }
- }
- }
- </style>
|