This commit is contained in:
cansnow
2026-02-09 07:29:02 +08:00
parent 2860c46ec1
commit 6720c15e30
19 changed files with 996 additions and 207 deletions
+23 -29
View File
@@ -1,22 +1,21 @@
<template>
<view>
<u-cell-group>
<u-cell-item title="选择内置背景图" :title-style="titleStyle"
:border-bottom="false" :border-top="false"
@click="linkToBuiltinBgImg"></u-cell-item>
</u-cell-group>
<u-gap :height="16" bg-color="#f4f4f5"></u-gap>
<u-cell-group>
<u-cell-item title="通过手机选择" :title-style="titleStyle"
:border-bottom="false" :border-top="false"
@click="chooseImg"></u-cell-item>
</u-cell-group>
<u-toast ref="uToast" />
<uni-nav-bar
left-icon="back"
@clickLeft="uni.$u.route({type:'back'})"
statusBar
backgroundColor="#ffffff"
title="选择背景图">
</uni-nav-bar>
<uni-list>
<uni-list-item disabled="true" title="选择内置背景图" @click="linkToBuiltinBgImg" clickable showArrow></uni-list-item>
<uni-list-item title="通过手机选择" @click="chooseImg" clickable showArrow></uni-list-item>
</uni-list>
</view>
</template>
<script>
import {upload} from "@/api/login"
export default {
data() {
return {
@@ -46,26 +45,21 @@ export default {
//上传返回图片
myUpload(filePath) {
let that=this;
let _this=this;
let obj = {
filePath:filePath,
savePath: "friendCircle" //文件存放目录
'url':"/friendcircle/upload_bg",
savePath: "circle" //文件存放目录
}
console.log("通过手机选择",obj);
this.globalUtil.globalUpload(that,{
param:obj,
success: (res1) => {
console.log("上传成功",res1);
let avatar= res1.result.url;
that.$u.vuex('circleBgImg',avatar);
uni.navigateBack();
},
fail:(res1) => {
console.log("上传失败",res1);
},
complete: (res1) => {
console.log("上传完成",res1);
}
upload(filePath,obj).then((res1) => {
_this.$store.commit('circle/SET_SETTINGS',{
..._this.$store.storeCircleSettings,
bg:res1.data.url
});
uni.navigateBack();
}).catch((res1) => {
console.log("上传失败",res1);
});
},