...
This commit is contained in:
@@ -10,6 +10,7 @@ enum URL {
|
|||||||
login = '/wc/wechat/LoginByMa',
|
login = '/wc/wechat/LoginByMa',
|
||||||
loginByCode = '/wc/wechat/LoginByMaCode',
|
loginByCode = '/wc/wechat/LoginByMaCode',
|
||||||
register = '/wc/wechat/register',
|
register = '/wc/wechat/register',
|
||||||
|
uploadAvatar = '/wc/wechat/uploadImage',
|
||||||
logout = '/user/logout',
|
logout = '/user/logout',
|
||||||
profile = '/user/profile',
|
profile = '/user/profile',
|
||||||
addressList = '/ext/addr/list',
|
addressList = '/ext/addr/list',
|
||||||
|
@@ -7,10 +7,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<scroll-view class='goods-list' :scroll-y='true' type='custom'>
|
<scroll-view class='goods-list'>
|
||||||
<grid-view type='masonry' :cross-axis-count='2'>
|
<grid-view :cross-axis-count='2'>
|
||||||
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
||||||
@click.stop='goPath(`/pages/mall/subs/goods/goods-detail?goodsId=${item.goodsId}`)'>
|
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
|
||||||
<image class='goods-image' :src='item.images' />
|
<image class='goods-image' :src='item.images' />
|
||||||
<text class='goods-name'>{{ item.goodsName }}</text>
|
<text class='goods-name'>{{ item.goodsName }}</text>
|
||||||
<text class='goods-price'>¥{{ item.price }}</text>
|
<text class='goods-price'>¥{{ item.price }}</text>
|
||||||
@@ -72,6 +72,7 @@ const goodsList = ref<GoodsBean[]>([1, 2, 3, 4, 1, 2, 2, 2]);
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 10rpx 10rpx;
|
padding: 10rpx 10rpx;
|
||||||
|
background: #333333;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
.goods-image {
|
.goods-image {
|
||||||
|
@@ -21,15 +21,7 @@ const addressList = ref<{
|
|||||||
mobile: string,
|
mobile: string,
|
||||||
address: string,
|
address: string,
|
||||||
status: number
|
status: number
|
||||||
}[]>([{
|
}[]>([]);
|
||||||
name: '黄先生',
|
|
||||||
mobile: '13xxxxxx8900',
|
|
||||||
status: 1
|
|
||||||
}, {
|
|
||||||
name: '李先生',
|
|
||||||
mobile: '13xxxxxx8900',
|
|
||||||
status: 0
|
|
||||||
}]);
|
|
||||||
|
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
fetchAddressList();
|
fetchAddressList();
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='top-card-view'>
|
<view class='top-card-view'>
|
||||||
<image class='bg-image' :src='assetsUrl("test_bg.png")' />
|
<image class='bg-image' :src='assetsUrl("test_bg.png")' />
|
||||||
<image class='avatar-image' :src='userInfo.image' />
|
<image class='avatar-image' :src='userInfo.image' />
|
||||||
<text>{{userInfo.nickName}}</text>
|
<text>{{ userInfo.nickName }}</text>
|
||||||
<text>会员卡</text>
|
<text>会员卡</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -12,19 +12,19 @@
|
|||||||
<text>头像</text>
|
<text>头像</text>
|
||||||
<view class='avatar-view'>
|
<view class='avatar-view'>
|
||||||
<image class='avatar-image' :src='userInfo.image' />
|
<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>
|
</view>
|
||||||
|
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='nickname'>姓名</text>
|
<text class='nickname'>姓名</text>
|
||||||
<input placeholder='请输入姓名' type='nickname' v-model='userInfo.nickName' />
|
<input placeholder='请输入姓名' type='nickname' v-model='userInfo.nickName' @input='bindNickname' />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='divider' />
|
<view class='divider' />
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text>手机号</text>
|
<text>手机号</text>
|
||||||
<input placeholder='15523653265' v-model='userInfo.telephone'/>
|
<input placeholder='请输入手机号' v-model='userInfo.telephone' @input='bindTelephone' />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='divider' />
|
<view class='divider' />
|
||||||
@@ -51,25 +51,75 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<button class='primary-button'>保存</button>
|
<button class='primary-button' @click.stop='save'>保存</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
|
import { showToast } from '@/utils';
|
||||||
|
|
||||||
const store= useUserStore()
|
const store = useUserStore();
|
||||||
const {userInfo} = storeToRefs(store)
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
const currentGender = ref<number>(0);
|
const currentGender = ref<number>(0);
|
||||||
|
|
||||||
const changeGender = (index: number) => {
|
const chooseAvatar = (e: any) => {
|
||||||
currentGender.value = index;
|
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) => {
|
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>
|
</script>
|
||||||
|
@@ -8,13 +8,17 @@ const useUserStore = defineStore('user', {
|
|||||||
state: (): UserState => <UserState>({
|
state: (): UserState => <UserState>({
|
||||||
id: '',
|
id: '',
|
||||||
unionId: '',
|
unionId: '',
|
||||||
|
openId: '',
|
||||||
|
maOpenId: '',
|
||||||
name: '未登录',
|
name: '未登录',
|
||||||
nickName: '未登录',
|
nickName: '未登录',
|
||||||
image: '',
|
image: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
|
gender: 0,
|
||||||
balance: 0,
|
balance: 0,
|
||||||
integration: 0,
|
integration: 0,
|
||||||
birthday: '',
|
birthday: '',
|
||||||
|
creatorId: '',
|
||||||
companyId: ''
|
companyId: ''
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ export function mpUpdate() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showToast(title: string, icon: 'none' | 'success' | 'loading' | 'error' | 'fail' | 'exception' | undefined, duration: number = 2000) {
|
export function showToast(title: string, icon: 'none' | 'success' | 'loading' | 'error' | 'fail' | 'exception' | undefined = 'none', duration: number = 2000) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
|
Reference in New Issue
Block a user