...
This commit is contained in:
@@ -21,15 +21,7 @@ const addressList = ref<{
|
||||
mobile: string,
|
||||
address: string,
|
||||
status: number
|
||||
}[]>([{
|
||||
name: '黄先生',
|
||||
mobile: '13xxxxxx8900',
|
||||
status: 1
|
||||
}, {
|
||||
name: '李先生',
|
||||
mobile: '13xxxxxx8900',
|
||||
status: 0
|
||||
}]);
|
||||
}[]>([]);
|
||||
|
||||
onLoad((e) => {
|
||||
fetchAddressList();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<view class='top-card-view'>
|
||||
<image class='bg-image' :src='assetsUrl("test_bg.png")' />
|
||||
<image class='avatar-image' :src='userInfo.image' />
|
||||
<text>{{userInfo.nickName}}</text>
|
||||
<text>{{ userInfo.nickName }}</text>
|
||||
<text>会员卡</text>
|
||||
</view>
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
<text>头像</text>
|
||||
<view class='avatar-view'>
|
||||
<image class='avatar-image' :src='userInfo.image' />
|
||||
<button class='avatar-btn' open-type='chooseAvatar' />
|
||||
<button class='avatar-btn' open-type='chooseAvatar' @chooseavatar='chooseAvatar' />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class='c-flex-row'>
|
||||
<text class='nickname'>姓名</text>
|
||||
<input placeholder='请输入姓名' type='nickname' v-model='userInfo.nickName' />
|
||||
<input placeholder='请输入姓名' type='nickname' v-model='userInfo.nickName' @input='bindNickname' />
|
||||
</view>
|
||||
|
||||
<view class='divider' />
|
||||
<view class='c-flex-row'>
|
||||
<text>手机号</text>
|
||||
<input placeholder='15523653265' v-model='userInfo.telephone'/>
|
||||
<input placeholder='请输入手机号' v-model='userInfo.telephone' @input='bindTelephone' />
|
||||
</view>
|
||||
|
||||
<view class='divider' />
|
||||
@@ -51,25 +51,75 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button class='primary-button'>保存</button>
|
||||
<button class='primary-button' @click.stop='save'>保存</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang='ts' setup>
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { useUserStore } from '@/store';
|
||||
import { showToast } from '@/utils';
|
||||
|
||||
const store= useUserStore()
|
||||
const {userInfo} = storeToRefs(store)
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
|
||||
const currentGender = ref<number>(0);
|
||||
|
||||
const changeGender = (index: number) => {
|
||||
currentGender.value = index;
|
||||
const chooseAvatar = (e: any) => {
|
||||
uni.showLoading();
|
||||
uni.uploadFile({
|
||||
url: import.meta.env.VITE_APP_BASE_API + '/wc/wechat/uploadImage',
|
||||
filePath: e.detail.avatarUrl,
|
||||
name: 'fileName',
|
||||
header: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
success: (res: any) => {
|
||||
userInfo.value.image = JSON.parse(res.data).data;
|
||||
},
|
||||
error: (err: any) => {
|
||||
showToast('上传失败');
|
||||
},
|
||||
complete() {
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const bindNickname = (e: any) => {
|
||||
userInfo.value.nickName = e.detail.value;
|
||||
};
|
||||
|
||||
const bindTelephone = (e: any) => {
|
||||
userInfo.value.telephone = e.detail.value;
|
||||
};
|
||||
|
||||
const changeGender = (index: number) => {
|
||||
currentGender.value = index;
|
||||
userInfo.value.gender = index;
|
||||
};
|
||||
|
||||
|
||||
const changeDate = (e: any) => {
|
||||
console.log(e);
|
||||
userInfo.value.birthday = e.detail.value;
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
const registerForm = {
|
||||
unionId: userInfo.value.unionId,
|
||||
openId: userInfo.value.openId,
|
||||
maOpenId: userInfo.value.maOpenId,
|
||||
image: userInfo.value.image,
|
||||
nickName: userInfo.value.nickName,
|
||||
telephone: userInfo.value.telephone,
|
||||
birthday: userInfo.value.birthday,
|
||||
gender: userInfo.value.gender,
|
||||
companyId: userInfo.value.companyId,
|
||||
creatorId: userInfo.value.creatorId
|
||||
};
|
||||
console.log('--------_>>>userInfo.value ', userInfo.value);
|
||||
const result = await store.userRegister(registerForm);
|
||||
console.log('--------->>>', result);
|
||||
};
|
||||
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user