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

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

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

Loading…
Cancel
Save