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
+14 -6
View File
@@ -1,12 +1,17 @@
<template>
<view class="content">
<u-navbar title="选择背景图" :background="{ background: '#ffffff'}"
:border-bottom="false">
<view class="slot-wrap" slot="right">
<uni-nav-bar
left-icon="back"
@clickLeft="uni.$u.route({type:'back'})"
statusBar
backgroundColor="#ffffff"
:border="false"
title="选择背景图">
<template v-slot:footer>
<u-button :custom-style="customBtnStyle" size="mini" :disabled="submitFlag"
:type="submitFlag?'info ':'success'" @click="handleLink()">设置</u-button>
</view>
</u-navbar>
</template>
</uni-nav-bar>
<u-grid @click="clickGrid">
<u-grid-item v-for="(item, index) in bgList" :key="index" :index="index" :custom-style="item.isCheck?girdItemCustomStyle:{}">
<u-image :src="item.src" width="200rpx" height="200rpx" mode="aspectFill"></u-image>
@@ -46,7 +51,10 @@ export default {
handleLink(){
const item = this.bgList.find(it=>it.isCheck);
if(item){
this.$u.vuex('circleBgImg', item.src);
this.$store.commit('circle/SET_SETTINGS',{
...this.$store.storeCircleSettings,
bg:item.src
});
uni.navigateBack({
delta:2
})
+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);
});
},
@@ -39,14 +39,9 @@
<!-- 视频 -->
<view class="u-m-b-30 u-m-t-30 u-flex u-row-left u-col-center"
<view class="u-m-b-30 u-m-t-30 u-flex u-row-left u-col-center"
v-if="item.files.length > 0&&item.releaseType==2" @tap="previewImg(0, item)">
<view v-if="vuex_OSPlat=='ios'">
<u-image width="280rpx" :src="getVideoPoster(item.files[0])" mode="widthFix">
<u-loading-icon slot="loading"></u-loading-icon>
</u-image>
</view>
<view v-else class="u-flex u-row-center u-col-center"
<view class="u-flex u-row-center u-col-center"
style="border: 1rpx solid #36648b;width:280rpx;height:120rpx;border-radius: 16rpx;">
<u-icon name="play-circle" size="48" color="#36648b"
label="点击查看视频" label-pos="bottom"></u-icon>
@@ -55,9 +50,9 @@
</view>
<!-- 地点 -->
<view v-if="(item.address&&item.address.chooseFlag)==true" class="u-line-2 u-m-t-10 u-m-b-10" style="font-size: 30rpx;color: #36648b;">
<u-icon name="map" color="#36648b" size="30" :custom-style="{marginLeft:'-4rpx'}"></u-icon>
<text> {{ item.address.name}}</text>
<view v-if="(item.address&&item.address.chooseFlag)==true" @click="gotomap(item)" class="content-address">
<u-icon name="map" color="#36648b"></u-icon>
<u-text class="name" :lines="1" :text="item.address.name"></u-text>
</view>
<!-- 相对时间 点赞按钮等 -->
@@ -182,6 +177,12 @@
return "http://192.168.31.125:9090/we-chat/images/friendCircle/1715421601709.mp4";
//return videoSrc;
},
gotomap(item){
const addr = item.address;
uni.navigateTo({
url:`/pages/common/map?type=viewlocation&lng=${addr.longitude}&lat=${addr.latitude}&address=${addr.address}`
})
},
cdn:util.cdn
}
}
@@ -254,7 +255,18 @@
}
}
}
&-address{
font-size: 26rpx;
color: #36648b;
display: flex;
align-items: center;
margin-top: 10rpx;
.u-icon{
}
.name{
}
}
.msg-box {
width: 100%;
background-color: #FFF;
+7 -4
View File
@@ -16,7 +16,7 @@
</u-navbar>
<!-- 我的朋友圈基本信息 -->
<view class="content-imgbox" :class="{top:scrollTop>bannarHeight}">
<image class="bgimg" v-if="storeCircleSettings.bg" :src="storeCircleSettings.bg" mode="scaleToFill" @tap="showSheet"></image>
<image class="bgimg" v-if="storeCircleSettings.bg" :src="cdn(storeCircleSettings.bg)" mode="scaleToFill" @tap="showSheet"></image>
<view class="bgimg" v-else @tap="showSheet"></view>
<MyAvatar class="headimg" :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname || storeSelfInfo.remark"
@@ -90,9 +90,9 @@
import {getFriendCircle} from "@/api/login.js"
import UserBase from "@/components/User.vue"
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util/index.js";
import CircleItem from "./components/circleItem.vue"
import { mapGetters } from "vuex";
import util from "@/util";
export default {
name: 'firendCircle',
mixins:[UserBase],
@@ -185,6 +185,7 @@
methods: {
goto:util.goto,
cdn:util.cdn,
clearUnReadCount(){
this.$store.dispatch('circle/updateUnreadCount',0-this.unreadCount);
},
@@ -244,11 +245,13 @@
showTypeSheet() {
const _this = this;
uni.showActionSheet({
itemList:['选择照片','选择视频'],
itemList:['文字','照片'/*,'视频'*/],
success: function (res) {
//toChooseRelease
if(res.tapIndex<2){
if([1,2].includes(res.tapIndex)){
_this.toChooseRelease(res.tapIndex);
}else{
_this.linkToRelease({releaseType:0})
}
},
fail: function (res) {
@@ -22,7 +22,7 @@
:adjust-position="true" :auto-blur="true" @linechange="inputLineChange" @input="inputing"
:confirm-hold="true" :show-confirm-bar="false"
:focus="inputFocusFlag" :disable-default-padding="true"
v-model="content" :cursor="content.length" :maxlength="-1" />
v-model="content" :cursor="content.length" :maxlength="1500" />
</scroll-view>
<!-- 文件选择区 -->
<view v-if="releaseType!=0" class="uploadBox">
@@ -49,29 +49,33 @@
</view>
<!-- 选项 -->
<view class="tips">
<u-cell-group>
<!-- :value="address.name" :value-style="customValueStyle" :label="address.address" -->
<u-cell bg-color="#ffffff"
:title="address.chooseFlag?(address.name):'所在位置'" :title-style="customTitleStyle"
:value="address.chooseFlag?(address.address):'请选择'" isLink
@click="toChooseLocation()">
<view slot="icon" class="u-flex u-row-center u-col-center">
<u-icon name="map" size="32" :color="address.chooseFlag?'#19be6b':'#606266'"></u-icon>
</view>
</u-cell>
<u-cell bg-color="#ffffff" title="提醒谁看" :title-style="customTitleStyle" @click="toRemind">
<view slot="icon" class="u-flex u-row-center u-col-center">
<u-icon name="/static/images/friendCircle/at.png" width="24" height="24" color="#606266"></u-icon>
</view>
</u-cell>
<u-cell bg-color="#ffffff" @click="toSetPromission()"
title="谁可以看" :title-style="customTitleStyle"
:value="'公开'" :value-style="customValueStyle">
<view slot="icon" class="u-flex u-row-center u-col-center">
<u-icon name="account" size="32" color="#606266"></u-icon>
</view>
</u-cell>
</u-cell-group>
<uni-list>
<uni-list-item
title="所在位置"
:rightText="address.chooseFlag?(address.name):'请选择'"
:show-extra-icon="true"
:extra-icon="{color: '#666',size: '22',type: 'location-filled'}"
clickable
showArrow
@click="toChooseLocation">
</uni-list-item>
<uni-list-item v-if="1==2"
title="提醒谁看"
:rightText="address.chooseFlag?(address.address):'请选择'"
clickable
showArrow
@click="toRemind">
</uni-list-item>
<uni-list-item
title="谁可以看"
rightText="公开"
:show-extra-icon="true"
:extra-icon="{color: '#666',size: '22',type: 'notification-filled'}"
clickable
showArrow
@click="toSetPromission">
</uni-list-item>
</uni-list>
</view>
</view>
@@ -273,21 +277,23 @@
//去选择所在位置
toChooseLocation:function(){
let that=this;
uni.chooseLocation({
success: function (res) {
// console.log('位置名称' + res.name);
// console.log('详细地址' + res.address);
// console.log('纬度' + res.latitude);
//console.log('经度' + res.longitude);
that.address=res;
that.address.chooseFlag=true;
//console.log("that.address",that.address);
},
fail:function(){
that.address={};
that.address.chooseFlag=false;
uni.navigateTo({
url:"/pages/common/map",
events:{
onConfirm(res) {
//_this.sendLocationMessage(res);
that.address={
address:res.address,
name:`${res.addressComponent.city}${res.addressComponent.town}`,
latitude:res.lat,
longitude:res.lng,
};
that.address.chooseFlag=true;
console.log(res);
}
}
});
})
return ;
},
//设置发布朋友圈的查看权限
toSetPromission:function(){
@@ -422,28 +428,16 @@
let that=this;
console.error('submitPublish');
uni.$u.http.post('/friendcircle/create',param).then(res => {
let newCircle=res;
if(newCircle.address!=null&&newCircle.address.length>0){
newCircle.address=JSON.parse(newCircle.address);
}else{
newCircle.address={"chooseFlag":false};
}
if(newCircle.fileList!=null&&newCircle.fileList.length>0){
newCircle.fileList=JSON.parse(newCircle.fileList);
}else{
newCircle.fileList=[];
}
if(newCircle.praise!=null){
newCircle.praise=JSON.parse(newCircle.praise);
}else{
newCircle.praise=[];
}
if(newCircle.comment!=null){
newCircle.comment=JSON.parse(newCircle.comment);
}
else{
newCircle.comment=[];
}
console.log("发布成功",res);
let newCircle=res.data;
newCircle['user'] = {
"id": this.$store.getters.storeSelfInfo.userID,
"nickname": this.$store.getters.storeSelfInfo.nickname,
"avatar": this.$store.getters.storeSelfInfo.faceURL,
};
newCircle['likes'] = [];
newCircle['comments'] = [];
newCircle['is_liked'] = false;
let circleDataList=[...this.circleData];
circleDataList.unshift(newCircle);
that.$store.commit('circle/SET_LIST',circleDataList);