123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <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 { 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({ 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 {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- 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;
- button {
- width: 80vw;
- font-size: var(--font16Size);
- }
- }
- }
- }
- </style>
|