Browse Source

创建球队

zs 1 year ago
parent
commit
9bae7a2f8e

+ 11 - 3
pages/home/components/game.vue

@@ -16,13 +16,14 @@
 									{{item.name||'暂无名称'}}
 								</view>
 								<view class="other">
-									{{item.address||'暂无地点'}}
+									{{item.address||'暂无地点'}} | {{item.date||'暂无日期'}}
 								</view>
 								<view class="other">
-									{{item.address||'暂无赛制'}}
+									{{item.format||'暂无赛制'}}
 								</view>
 							</view>
 						</view>
+						<view class="list_2">{{item.ranking||'暂无排名'}}</view>
 					</view>
 					<view class="is_bottom" v-if="is_bottom">
 						<text>{{config.bottomTitle||'到底了!'}}</text>
@@ -43,7 +44,8 @@
 		type ?: string,
 		logo ?: string,
 		date ?: string,
-		user_type ?: string,
+		format ?: string,
+		ranking ?: string,
 	};
 	// 基本信息
 	const config = ref({ bottomTitle: '', logoUrl: '' });
@@ -170,6 +172,12 @@
 						}
 					}
 				}
+
+				.list_2 {
+					text-align: right;
+					font-size: var(--font14Size);
+					color: var(--fFFColor);
+				}
 			}
 		}
 	}

+ 173 - 9
pagesHome/team/index.vue

@@ -1,24 +1,135 @@
 <template>
 	<view class="content">
 		<view class="one">
-			球队
+		</view>
+		<view class="two">
+			<text>设置队徽</text>
+		</view>
+		<view class="thr">
+			<form @submit="formSubmit">
+				<view class="logo">
+					<image class="image" mode="aspectFill" :src="form.logo||'/static/qiudui.png'" @tap="Preview">
+					</image>
+				</view>
+				<view class="value other">
+					<view class="title">名称</view>
+					<view class="label">
+						<input class="input" :value="form.name" placeholder="请输入名称" />
+					</view>
+				</view>
+				<view class="value other">
+					<view class="title">昵称</view>
+					<view class="label">
+						<input class="input" :value="form.nickname" placeholder="请输入昵称" />
+					</view>
+				</view>
+				<view class="value other">
+					<view class="title">类型</view>
+					<view class="label">
+						<picker @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
+							<view class="picker">{{form.type||'请选择类型'}}</view>
+						</picker>
+					</view>
+				</view>
+				<view class="value other">
+					<view class="title">手机号</view>
+					<view class="label">
+						<input class="input" :value="form.phone" placeholder="请输入手机号" />
+					</view>
+				</view>
+				<view class="value other">
+					<view class="title">城市</view>
+					<view class="label">
+						<cityPicker :showSheetView="showSheetView" :defaultIndexs="[0,0,0]" @onSelected="onSelected">
+						</cityPicker>
+					</view>
+				</view>
+				<view class="remark">
+					<view class="title">简介</view>
+					<view class="label">
+						<textarea :value="form.brief" placeholder="请简单描述球队" />
+					</view>
+				</view>
+				<view class="button">
+					<button type="warn" size="mini" form-type="submit">创建</button>
+				</view>
+			</form>
 		</view>
 	</view>
 </template>
 
 <script setup lang="ts">
-	import { ref } from 'vue';
+	import { getCurrentInstance, computed, ref } from 'vue';
 	//该依赖已内置不需要单独安装
 	import { onShow } from "@dcloudio/uni-app";
+	import cityPicker from '../../components/cityPicker.vue';
+	// 请求接口
+	const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
+	const $config = getCurrentInstance()?.appContext.config.globalProperties.$config;
+	const $apifile = getCurrentInstance()?.appContext.config.globalProperties.$apifile;
 	// 基本信息
-	const config = ref({});
-	onShow(() => {
-		searchConfig();
+	const config = ref({ logoUrl: '' });
+	// openid
+	const openid = computed(() => {
+		return uni.getStorageSync('openid');
+	})
+	// 用户信息
+	const form = ref({ icon: '' });
+	// 城市选择器
+	const showSheetView = ref(true);
+	// 字典表
+	const typeList = ref([]);
+	onShow(async () => {
+		await searchConfig();
+		await searchOther();
+		await search()
 	})
 	// config信息
 	const searchConfig = async () => {
 		config.value = uni.getStorageSync('config');
 	};
+	// 查询其他信息
+	const searchOther = async () => {
+		let res;
+		// 类型
+		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_team_type' });
+		if (res.code === 200 && res.total > 0) typeList.value = res.rows
+	};
+	// 查询
+	const search = async () => {
+
+	};
+	// 选择市
+	const onSelected = (row) => {
+		console.log(row, '1');
+		showSheetView.value = false
+	};
+	// 类型选择
+	const typeChange = (e) => {
+		const data = typeList.value[e.detail.value]
+		if (data) form.value.type = data.dictLabel
+	};
+	// 上传图片
+	const Preview = () => {
+		uni.chooseImage({
+			count: 1,
+			sizeType: ['original', 'compressed'],
+			sourceType: ['album', 'camera'],
+			success: async function (res) {
+				let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
+				const arr = await $apifile(`/common/upload`, 'file', tempFile[0],
+					'file');
+				if (arr.code == 200) {
+					form.value.logo = arr.url
+				} else {
+					uni.showToast({
+						title: arr.msg,
+						icon: 'none'
+					});
+				}
+			}
+		});
+	};
 </script>
 <style lang="scss" scoped>
 	.content {
@@ -28,11 +139,64 @@
 		height: 100vh;
 
 		.one {
-			padding: 2vw;
+			height: 25vw;
+			background-color: var(--f00Color);
+		}
+
+		.two {
+			margin: 10vw 0 0 0;
+			text-align: center;
+			font-size: var(--font16Size);
+			font-weight: bold;
+		}
+
+		.thr {
+			.logo {
+				position: fixed;
+				top: 12vw;
+				right: 40vw;
+
+				.image {
+					width: 20vw;
+					height: 20vw;
+					border-radius: 20vw;
+					background-color: var(--mainColor);
+				}
+			}
+
+			.other {
+				padding: 3vw 2vw;
+				border-bottom: 1px solid var(--footColor);
+			}
+
+			.remark {
+				padding: 3vw 2vw 0 2vw;
+
+				.title {
+					padding: 0 0 3vw 0;
+				}
+			}
+
+			.value {
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				background-color: var(--mainColor);
+
+				.label {
+					.input {
+						text-align: right;
+					}
+				}
+			}
+
+			.button {
+				text-align: center;
 
-			.rich-img {
-				width: 100% !important;
-				display: block;
+				button {
+					width: 80vw;
+					font-size: var(--font16Size);
+				}
 			}
 		}
 	}

+ 2 - 4
pagesMy/basic/index.vue

@@ -6,7 +6,7 @@
 					<view class="title">头像</view>
 					<view class="label">
 						<image class="image" mode="aspectFill" :src="form.icon||config.logoUrl"
-							@tap="Preview(form.icon||config.logoUrl)"></image>
+							@tap="Preview"></image>
 					</view>
 				</view>
 				<view class="remark">
@@ -172,7 +172,7 @@
 		if (data) form.value.place = data.dictLabel
 	};
 	// 上传图片
-	const Preview = (file) => {
+	const Preview = () => {
 		uni.chooseImage({
 			count: 1,
 			sizeType: ['original', 'compressed'],
@@ -247,8 +247,6 @@
 
 				button {
 					font-size: var(--font14Size);
-					border-radius: 2vw;
-					background: linear-gradient(to right, #00BFFF, #3F94F1, #7B68EE);
 				}
 			}
 		}

+ 5 - 3
unpackage/dist/dev/mp-weixin/pages/home/components/game.js

@@ -67,9 +67,11 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
             a: item.logo || config.value.logoUrl,
             b: common_vendor.t(item.name || "暂无名称"),
             c: common_vendor.t(item.address || "暂无地点"),
-            d: common_vendor.t(item.address || "暂无赛制"),
-            e: index,
-            f: common_vendor.o(($event) => toInfo(item), index)
+            d: common_vendor.t(item.date || "暂无日期"),
+            e: common_vendor.t(item.format || "暂无赛制"),
+            f: common_vendor.t(item.ranking || "暂无排名"),
+            g: index,
+            h: common_vendor.o(($event) => toInfo(item), index)
           };
         }),
         d: is_bottom.value

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/home/components/game.wxml


+ 5 - 0
unpackage/dist/dev/mp-weixin/pages/home/components/game.wxss

@@ -52,6 +52,11 @@
   font-size: var(--font14Size);
   color: var(--f85Color);
 }
+.main .second .list .list_2.data-v-a6b1fabb {
+  text-align: right;
+  font-size: var(--font14Size);
+  color: var(--fFFColor);
+}
 .scroll-view.data-v-a6b1fabb {
   position: absolute;
   top: 0;

+ 81 - 4
unpackage/dist/dev/mp-weixin/pagesHome/team/index.js

@@ -1,17 +1,94 @@
 "use strict";
 const common_vendor = require("../../common/vendor.js");
+if (!Math) {
+  cityPicker();
+}
+const cityPicker = () => "../../components/cityPicker.js";
 const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "index",
   setup(__props) {
-    const config = common_vendor.ref({});
-    common_vendor.onShow(() => {
-      searchConfig();
+    var _a, _b, _c;
+    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
+    (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
+    const $apifile = (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$apifile;
+    const config = common_vendor.ref({ logoUrl: "" });
+    common_vendor.computed(() => {
+      return common_vendor.index.getStorageSync("openid");
+    });
+    const form = common_vendor.ref({ icon: "" });
+    const showSheetView = common_vendor.ref(true);
+    const typeList = common_vendor.ref([]);
+    common_vendor.onShow(async () => {
+      await searchConfig();
+      await searchOther();
+      await search();
     });
     const searchConfig = async () => {
       config.value = common_vendor.index.getStorageSync("config");
     };
+    const searchOther = async () => {
+      let res;
+      res = await $api(`dict/data/list`, "GET", { dictType: "sys_team_type" });
+      if (res.code === 200 && res.total > 0)
+        typeList.value = res.rows;
+    };
+    const search = async () => {
+    };
+    const onSelected = (row) => {
+      console.log(row, "1");
+      showSheetView.value = false;
+    };
+    const typeChange = (e) => {
+      const data = typeList.value[e.detail.value];
+      if (data)
+        form.value.type = data.dictLabel;
+    };
+    const Preview = () => {
+      common_vendor.index.chooseImage({
+        count: 1,
+        sizeType: ["original", "compressed"],
+        sourceType: ["album", "camera"],
+        success: async function(res) {
+          let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
+          const arr = await $apifile(
+            `/common/upload`,
+            "file",
+            tempFile[0],
+            "file"
+          );
+          if (arr.code == 200) {
+            form.value.logo = arr.url;
+          } else {
+            common_vendor.index.showToast({
+              title: arr.msg,
+              icon: "none"
+            });
+          }
+        }
+      });
+    };
     return (_ctx, _cache) => {
-      return {};
+      return {
+        a: form.value.logo || "/static/qiudui.png",
+        b: common_vendor.o(Preview),
+        c: form.value.name,
+        d: form.value.nickname,
+        e: common_vendor.t(form.value.type || "请选择类型"),
+        f: common_vendor.o(typeChange),
+        g: _ctx.index,
+        h: typeList.value,
+        i: form.value.phone,
+        j: common_vendor.o(onSelected),
+        k: common_vendor.p({
+          showSheetView: showSheetView.value,
+          defaultIndexs: [0, 0, 0]
+        }),
+        l: form.value.brief,
+        m: common_vendor.o(
+          //@ts-ignore
+          (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
+        )
+      };
     };
   }
 });

+ 3 - 1
unpackage/dist/dev/mp-weixin/pagesHome/team/index.json

@@ -1,4 +1,6 @@
 {
   "navigationBarTitleText": "创建球队",
-  "usingComponents": {}
+  "usingComponents": {
+    "city-picker": "../../components/cityPicker"
+  }
 }

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/team/index.wxml


+ 44 - 4
unpackage/dist/dev/mp-weixin/pagesHome/team/index.wxss

@@ -7,9 +7,49 @@
   height: 100vh;
 }
 .content .one.data-v-01c8185c {
-  padding: 2vw;
+  height: 25vw;
+  background-color: var(--f00Color);
 }
-.content .one .rich-img.data-v-01c8185c {
-  width: 100% !important;
-  display: block;
+.content .two.data-v-01c8185c {
+  margin: 10vw 0 0 0;
+  text-align: center;
+  font-size: var(--font16Size);
+  font-weight: bold;
+}
+.content .thr .logo.data-v-01c8185c {
+  position: fixed;
+  top: 12vw;
+  right: 40vw;
+}
+.content .thr .logo .image.data-v-01c8185c {
+  width: 20vw;
+  height: 20vw;
+  border-radius: 20vw;
+  background-color: var(--mainColor);
+}
+.content .thr .other.data-v-01c8185c {
+  padding: 3vw 2vw;
+  border-bottom: 1px solid var(--footColor);
+}
+.content .thr .remark.data-v-01c8185c {
+  padding: 3vw 2vw 0 2vw;
+}
+.content .thr .remark .title.data-v-01c8185c {
+  padding: 0 0 3vw 0;
+}
+.content .thr .value.data-v-01c8185c {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  background-color: var(--mainColor);
+}
+.content .thr .value .label .input.data-v-01c8185c {
+  text-align: right;
+}
+.content .thr .button.data-v-01c8185c {
+  text-align: center;
+}
+.content .thr .button button.data-v-01c8185c {
+  width: 80vw;
+  font-size: var(--font16Size);
 }

+ 2 - 2
unpackage/dist/dev/mp-weixin/pagesMy/basic/index.js

@@ -78,7 +78,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       if (data)
         form.value.place = data.dictLabel;
     };
-    const Preview = (file) => {
+    const Preview = () => {
       common_vendor.index.chooseImage({
         count: 1,
         sizeType: ["original", "compressed"],
@@ -105,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     return (_ctx, _cache) => {
       return {
         a: form.value.icon || config.value.logoUrl,
-        b: common_vendor.o(($event) => Preview(form.value.icon || config.value.logoUrl)),
+        b: common_vendor.o(Preview),
         c: form.value.name,
         d: form.value.nickname,
         e: common_vendor.t(form.value.sex || "请选择性别"),

+ 0 - 2
unpackage/dist/dev/mp-weixin/pagesMy/basic/index.wxss

@@ -43,6 +43,4 @@
 }
 .content .one .button button.data-v-bf1a7b85 {
   font-size: var(--font14Size);
-  border-radius: 2vw;
-  background: linear-gradient(to right, #00BFFF, #3F94F1, #7B68EE);
 }