index.vue 2.64 KB
<!--
 * @Date: 2022-09-19 14:11:06
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-10-10 14:12:13
 * @FilePath: /swx/src/pages/projectManage/index.vue
 * @Description: 主办方管理页面
-->
<template>
  <view class="project-manage-page">
    <view class="activity-title">
      <view class="box">
        <text class="bg-gradient" style="font-size: 1rem;">我创建的主办方</text>
      </view>
    </view>
    <view class="create-box">
      <view class="create-item" v-for="(item, index) in create_list" :key="index">
        <van-row>
          <van-col span="20">
            <view>
              <van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" />
              <text class="name">&nbsp;{{ item.name }}</text>
            </view>
          </van-col>
          <van-col span="4">
            <view class="manage-btn" @tap="onManage(item)">管理</view>
          </van-col>
        </van-row>
      </view>
    </view>
    <view style="height: 1rem;"></view>
    <view class="activity-title">
      <view class="box">
        <text class="bg-gradient" style="font-size: 1rem;">我加入的主办方</text>
      </view>
    </view>
    <view class="join-box">
      <view class="join-item" v-for="(item, index) in join_list" :key="index">
        <van-row>
          <van-col span="24">
            <view>
              <van-icon :name="icon_p" size="2.25rem" color="" style="vertical-align: middle;" />
              <text class="name">&nbsp;{{ item.name }}</text>
            </view>
          </van-col>
        </van-row>
      </view>
    </view>
  </view>
  <bottom-button @on-submit="onSubmit">新建主办方</bottom-button>
</template>

<script setup>
import Taro from '@tarojs/taro'
import { ref } from "vue";
import icon_p from '@/images/icon/zhubanfang@2x.png'
import bottomButton from "@/components/bottom-button";

const onSubmit = () => {
  Taro.navigateTo({
    url: '../createProject/index'
  })
}

const onManage = (item) => {
  Taro.navigateTo({
    url: '../userManage/index?id=' + item.id + '&name=' + decodeURIComponent(item.name)
  })
}
</script>

<script>
import "./index.less";
import request from '../../utils/request';

export default {
  name: "projectManagePage",
  data () {
    return {
      create_list: [],
      join_list: [],
    }
  },
  onShow() {
    // 保存主办方信息
    request.get('/srv/?a=host_list')
    .then(res => {
      if (res.data.code) {
        this.create_list = res.data.data.my_hosts;
        this.join_list = res.data.data.join_hosts;
      } else {
        console.warn(res.data.msg);
      }
    })
    .catch(err => {
      console.error(err);
    });
  },
};
</script>