liudan 1 year ago
parent 3d9d7968c4
commit 05aadb3a95
  1. 19
      pages/user/info.vue
  2. 2
      sheep/api/app.js
  3. 14
      sheep/components/s-user-card/s-user-card.vue
  4. 19
      sheep/ui/su-image/su-image.vue

@ -9,7 +9,7 @@
>
<view class="ss-flex ss-row-center ss-col-center ss-p-t-60 ss-p-b-0 bg-white">
<view class="header-box-content">
<su-image
<!-- <su-image
class="content-img"
isPreview
:current="0"
@ -18,7 +18,15 @@
:width="160"
:radius="80"
mode="scaleToFill"
></su-image>
></su-image> -->
<image
:src="baseUrl+state.model.avatar"
:height="160"
:width="160"
:radius="80"
mode="scaleToFill"
></image>
<view class="avatar-action">
<!-- #ifdef MP -->
<button
@ -220,7 +228,7 @@ import { mobile, password, username } from '@/sheep/validate/form';
import sheep from '@/sheep';
import { clone } from 'lodash';
import { showAuthModal } from '@/sheep/hooks/useModal';
import { baseUrl } from '@/sheep/config';
const state = reactive({
model: {},
rules: {},
@ -278,7 +286,10 @@ function onChangeAvatar() {
async function uploadAvatar(tempUrl) {
if (!tempUrl) return;
let { url } = await sheep.$api.app.upload(tempUrl, 'ugc');
state.model.avatar = url;
console.log(url,",,,mmm")
// state.model.avatar = baseUrl+url.slice(1);
// console.log(state.model.avatar)
state.model.avatar =url;
}
// /

@ -102,7 +102,7 @@ export default {
});
return new Promise((resolve, reject) => {
uni.uploadFile({
url: baseUrl + '/api/common/upload',
url: baseUrl + 'api/common/upload',
filePath: file,
name: 'file',
formData: {

@ -4,7 +4,7 @@
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
<view class="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24">
<image
<!-- <image
class="avatar-img"
:src="
isLogin
@ -13,6 +13,16 @@
"
mode="aspectFill"
@tap="sheep.$router.go('/pages/user/info')"
></image> -->
<image
class="avatar-img"
:src="
isLogin
? baseUrl+userInfo.avatar
: sheep.$url.static('/assets/addons/shopro/uniapp/default_avatar.png')
"
mode="aspectFill"
@tap="sheep.$router.go('/pages/user/info')"
></image>
</view>
<view>
@ -59,7 +69,7 @@
import { computed, reactive } from 'vue';
import sheep from '@/sheep';
import { showShareModal, showAuthModal } from '@/sheep/hooks/useModal';
import { baseUrl } from '@/sheep/config';
//
const userInfo = computed(() => sheep.$store('user').userInfo);

@ -1,15 +1,30 @@
<template>
<!-- <image
v-if="!state.isError"
class="su-img"
:style="customStyle"
:draggable="false"
:mode="mode"
:src="sheep.$url.cdn(props.src)"
@tap="onImgPreview"
@load="onImgLoad"
@error="onImgError"
></image> -->
<view class="">
<image
v-if="!state.isError"
class="su-img"
:style="customStyle"
:draggable="false"
:mode="mode"
:src="sheep.$url.cdn(src)"
:src="baseUrl+props.src"
@tap="onImgPreview"
@load="onImgLoad"
@error="onImgError"
></image>
</view>
</template>
<script setup>
@ -29,7 +44,7 @@
import { reactive, computed } from 'vue';
import sheep from '@/sheep';
import { baseUrl } from '@/sheep/config';
//
const state = reactive({
isError: false,

Loading…
Cancel
Save