index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <scroll-view scroll-y="true" class="scroll-view">
  5. <view class="list-scroll-view">
  6. <view class="one_1"></view>
  7. <uni-segmented-control :current="current" :values="list" @clickItem="onClickItem" styleType="text"
  8. activeColor="#dd524d"></uni-segmented-control>
  9. <view class="one_2">
  10. <view v-show="current === 0">
  11. <match :typeList="typeList" :numberList="numberList" :durationList='durationList' :openList="openList"></match>
  12. </view>
  13. <view v-show="current === 1">
  14. <activity :typeList="matchList" :durationList='durationList' :openList="openList" type="0"></activity>
  15. </view>
  16. <view v-show="current === 2">
  17. <activity :activityList="activityList" :durationList='durationList' :openList="openList" type="1"></activity>
  18. </view>
  19. </view>
  20. </view>
  21. </scroll-view>
  22. </view>
  23. <view class="two">
  24. <view class="left">
  25. <view class="left_1">
  26. <uni-icons @tap="toAdd" custom-prefix="iconfont" type="icon-caogao04" size="20"
  27. color="#696969"></uni-icons>
  28. <text>保存草稿</text>
  29. </view>
  30. <view class="left_1">
  31. <uni-icons @tap="toCopy" custom-prefix="iconfont" type="icon-icon_cz" size="20"
  32. color="#696969"></uni-icons>
  33. <text>复用</text>
  34. </view>
  35. </view>
  36. <view class="right">
  37. <button type="warn" size="mini" form-type="submit">完成</button>
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import { getCurrentInstance, ref } from 'vue';
  44. //该依赖已内置不需要单独安装
  45. import { onLoad } from "@dcloudio/uni-app";
  46. import activity from './components/activity.vue';
  47. import match from './components/match.vue';
  48. // 请求接口
  49. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  50. // 基本信息
  51. const config = ref({});
  52. // 详情信息id
  53. const id = ref('');
  54. const list = ref(['友谊赛', '训练', '活动']);
  55. const current = ref(0);
  56. // 字典表
  57. const typeList = ref([]);
  58. const numberList = ref([]);
  59. const matchList = ref([]);
  60. const activityList = ref([]);
  61. const durationList = ref([]);
  62. const openList = ref([]);
  63. onLoad(async (options) => {
  64. // 球队id
  65. id.value = options && options.id
  66. await searchConfig();
  67. await searchOther();
  68. await search();
  69. })
  70. // config信息
  71. const searchConfig = async () => {
  72. config.value = uni.getStorageSync('config');
  73. };
  74. // 查询其他信息
  75. const searchOther = async () => {
  76. let res;
  77. // 比赛类型
  78. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_type', status: '0' });
  79. if (res.code === 200 && res.total > 0) typeList.value = res.rows
  80. // 比赛人数
  81. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_match_number', status: '0' });
  82. if (res.code === 200 && res.total > 0) numberList.value = res.rows
  83. // 训练类型
  84. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_train_type', status: '0' });
  85. if (res.code === 200 && res.total > 0) matchList.value = res.rows
  86. // 活动类型
  87. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_activity_type', status: '0' });
  88. if (res.code === 200 && res.total > 0) activityList.value = res.rows
  89. // 时长
  90. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_match_duration' , status: '0'});
  91. if (res.code === 200 && res.total > 0) durationList.value = res.rows
  92. // 是否公开
  93. res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_yes_no' , status: '0'});
  94. if (res.code === 200 && res.total > 0) openList.value = res.rows
  95. };
  96. // 查询
  97. const search = async () => {
  98. if (id.value) { }
  99. };
  100. // 点击分页器
  101. const onClickItem = (e) => {
  102. if (current.value !== e.currentIndex) current.value = e.currentIndex
  103. };
  104. // 保存草稿
  105. const toAdd = async () => {
  106. console.log('保存草稿');
  107. };
  108. // 复用
  109. const toCopy = async () => {
  110. console.log('复用');
  111. };
  112. // 创建
  113. const formSubmit = (e) => {
  114. console.log(e.deatil.value);
  115. };
  116. </script>
  117. <style lang="scss" scoped>
  118. .content {
  119. display: flex;
  120. flex-direction: column;
  121. width: 100vw;
  122. height: 100vh;
  123. .one {
  124. position: relative;
  125. flex-grow: 1;
  126. .one_1 {
  127. height: 20vw;
  128. background-color: var(--f12Color);
  129. }
  130. }
  131. .two {
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. padding: 2vw;
  136. .left {
  137. display: flex;
  138. .left_1 {
  139. display: flex;
  140. flex-direction: column;
  141. align-items: center;
  142. padding: 0 2vw;
  143. font-size: var(--font14Size);
  144. color: var(--f69Color);
  145. text {
  146. margin: 2px 0 0 0;
  147. }
  148. }
  149. }
  150. .right {
  151. button {
  152. width: 60vw;
  153. font-size: var(--font16Size);
  154. }
  155. }
  156. }
  157. }
  158. .scroll-view {
  159. position: absolute;
  160. top: 0;
  161. left: 0;
  162. right: 0;
  163. bottom: 0;
  164. .list-scroll-view {
  165. display: flex;
  166. flex-direction: column;
  167. }
  168. }
  169. </style>