Showing
3 changed files
with
200 additions
and
0 deletions
src/pages/apxUserInfo/index.config.js
0 → 100755
| 1 | +/* | ||
| 2 | + * @Date: 2022-10-21 11:21:05 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-10-21 11:37:46 | ||
| 5 | + * @FilePath: /swx/src/pages/apxUserInfo/index.config.js | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | + */ | ||
| 8 | +export default { | ||
| 9 | + navigationBarTitleText: '个人信息', | ||
| 10 | + usingComponents: { | ||
| 11 | + }, | ||
| 12 | +} |
src/pages/apxUserInfo/index.less
0 → 100644
| 1 | +.bg-gradient { | ||
| 2 | + background: linear-gradient(#B3DDC9, #B3DDC9) no-repeat; | ||
| 3 | + /*调整下划线的宽度占百分之百 高度是3px */ | ||
| 4 | + background-size: 100% 1vw; | ||
| 5 | + /* 调整下划线的起始位置 左侧是0 上边是1.15em */ | ||
| 6 | + background-position: 0 1.25rem; | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +.join-activity-page { | ||
| 10 | + background-color: #FFFFFF; | ||
| 11 | + .activity-title { | ||
| 12 | + background-color: #FFFFFF; | ||
| 13 | + .box { | ||
| 14 | + padding: 1rem 1rem 0.5rem 1rem; | ||
| 15 | + text-align: center; | ||
| 16 | + } | ||
| 17 | + } | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +.form-item { | ||
| 21 | + padding: 0.5rem 1rem; | ||
| 22 | + background-color: #FFFFFF; | ||
| 23 | + .form-item-title { | ||
| 24 | + font-size: 1rem; | ||
| 25 | + &.border { | ||
| 26 | + padding-bottom: 0.5rem; | ||
| 27 | + border-bottom: 1px solid #F2F2F2; | ||
| 28 | + } | ||
| 29 | + &.required::before { | ||
| 30 | + color: red; | ||
| 31 | + content: "*"; | ||
| 32 | + font-size: 0.9rem; | ||
| 33 | + left: 0.5rem; | ||
| 34 | + position: absolute; | ||
| 35 | + } | ||
| 36 | + .sub { | ||
| 37 | + color: #999; | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +.limit-wrapper { | ||
| 43 | + .border { | ||
| 44 | + overflow: auto; | ||
| 45 | + border-bottom: 1px solid #F2F2F2; | ||
| 46 | + .fix { | ||
| 47 | + float: left; | ||
| 48 | + padding-top: 0.6rem; | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | +.limit-button-wrapper { | ||
| 53 | + padding: 1rem 0; | ||
| 54 | + margin: 1rem; | ||
| 55 | + text-align: center; | ||
| 56 | + .button { | ||
| 57 | + padding: 0.5rem 1rem; border-radius: 1rem; | ||
| 58 | + } | ||
| 59 | + .cancel { | ||
| 60 | + color: #199A74; | ||
| 61 | + border: 1px solid #199A74; | ||
| 62 | + } | ||
| 63 | + .confirm { | ||
| 64 | + color: #FFFFFF; | ||
| 65 | + background-color: #199A74; | ||
| 66 | + } | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +.upload-box { | ||
| 70 | + position: relative; | ||
| 71 | + .upload-icon { | ||
| 72 | + position: absolute; | ||
| 73 | + left: 40%; | ||
| 74 | + transform: translateX(-40%); | ||
| 75 | + top: 50%; | ||
| 76 | + transform: translateY(-50%); | ||
| 77 | + } | ||
| 78 | + .upload-close { | ||
| 79 | + position: absolute; | ||
| 80 | + right: -0.5rem; | ||
| 81 | + top: -0.5rem; | ||
| 82 | + } | ||
| 83 | +} |
src/pages/apxUserInfo/index.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2022-09-19 14:11:06 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-10-21 13:36:39 | ||
| 5 | + * @FilePath: /swx/src/pages/apxUserInfo/index.vue | ||
| 6 | + * @Description: 补充资料 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <div class="join-activity-page"> | ||
| 10 | + <view class="activity-title"> | ||
| 11 | + <view class="box"> | ||
| 12 | + <text class="bg-gradient" style="font-size: 1.25rem;">请完善个人信息</text> | ||
| 13 | + </view> | ||
| 14 | + </view> | ||
| 15 | + <view class="at-input"> | ||
| 16 | + <view class="at-input__container"> | ||
| 17 | + <label class="h5-label at-input__title at-input__title--required">头像</label> | ||
| 18 | + <van-uploader v-if="!has_image" @after-read="afterRead"> | ||
| 19 | + <view class=""> | ||
| 20 | + <van-icon :name="icon_upload" size="5rem" color="" class="upload-icon" /> | ||
| 21 | + </view> | ||
| 22 | + </van-uploader> | ||
| 23 | + <view v-else class="upload-box"> | ||
| 24 | + <van-image :round="true" width="5rem" height="5rem" :src="uploader_image" /> | ||
| 25 | + <van-icon name="clear" size="1.5rem" color="#000" class="upload-close" @tap="removeUploadImage" /> | ||
| 26 | + </view> | ||
| 27 | + </view> | ||
| 28 | + </view> | ||
| 29 | + <AtInput required :border="true" title="昵称" type='text' placeholder='请输入昵称' v-model:value="nickname" /> | ||
| 30 | + <bottom-button @on-submit="onSubmit">提交</bottom-button> | ||
| 31 | + </div> | ||
| 32 | + <van-toast id="van-toast" /> | ||
| 33 | + | ||
| 34 | +</template> | ||
| 35 | + | ||
| 36 | +<script setup> | ||
| 37 | +import Taro from '@tarojs/taro' | ||
| 38 | +import { ref } from "vue"; | ||
| 39 | +import { AtInput } from 'taro-ui-vue3' | ||
| 40 | +import "taro-ui-vue3/dist/style/components/input.scss"; | ||
| 41 | +import bottomButton from "@/components/bottom-button"; | ||
| 42 | +import icon_upload from '@/images/icon/qiandao@2x.png' | ||
| 43 | +import BASE_URL from '@/utils/config'; | ||
| 44 | +import Toast from '@/components/vant-weapp/toast/toast'; | ||
| 45 | + | ||
| 46 | +const nickname = ref(''); | ||
| 47 | +const has_image = ref(false) | ||
| 48 | +const uploader_image = ref('') | ||
| 49 | +const afterRead = (event) => { | ||
| 50 | + wx.showLoading({ | ||
| 51 | + title: '上传中', | ||
| 52 | + mask: true | ||
| 53 | + }); | ||
| 54 | + const { file } = event.detail; | ||
| 55 | + // 获取上传URL | ||
| 56 | + wx.uploadFile({ | ||
| 57 | + url: BASE_URL + '/admin/?m=srv&a=upload', | ||
| 58 | + filePath: file.url, | ||
| 59 | + name: 'file', | ||
| 60 | + header: { | ||
| 61 | + 'content-type': 'multipart/form-data', | ||
| 62 | + }, | ||
| 63 | + success: function (res) { | ||
| 64 | + let upload_data = JSON.parse(res.data); | ||
| 65 | + wx.hideLoading({ | ||
| 66 | + success: () => { | ||
| 67 | + if (res.statusCode === 200) { | ||
| 68 | + has_image.value = true; | ||
| 69 | + uploader_image.value = upload_data.data.src; | ||
| 70 | + } else { | ||
| 71 | + wx.showToast({ | ||
| 72 | + icon: 'error', | ||
| 73 | + title: '服务器错误,稍后重试!', | ||
| 74 | + mask: true | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | + }, | ||
| 78 | + }); | ||
| 79 | + } | ||
| 80 | + }); | ||
| 81 | +} | ||
| 82 | +const removeUploadImage = () => { | ||
| 83 | + has_image.value = false; | ||
| 84 | + uploader_image.value = '' | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +const onSubmit = () => { | ||
| 88 | + if (!uploader_image.value) { | ||
| 89 | + Toast('头像不能为空'); | ||
| 90 | + return false; | ||
| 91 | + } | ||
| 92 | + if (!nickname.value) { | ||
| 93 | + Toast('昵称不能为空'); | ||
| 94 | + return false; | ||
| 95 | + } | ||
| 96 | +} | ||
| 97 | +</script> | ||
| 98 | + | ||
| 99 | +<script> | ||
| 100 | +import "./index.less"; | ||
| 101 | + | ||
| 102 | +export default { | ||
| 103 | + name: "apxUserInfoPage", | ||
| 104 | +}; | ||
| 105 | +</script> |
-
Please register or login to post a comment