This commit is contained in:
cansnow
2025-11-27 07:40:32 +08:00
parent 198c3dd4a5
commit ab625e6463
17 changed files with 1092 additions and 1135 deletions
@@ -0,0 +1,71 @@
<template>
<view class="content">
<u-navbar title="选择背景图" :background="{ background: '#ffffff'}"
:border-bottom="false">
<view class="slot-wrap" slot="right">
<u-button :custom-style="customBtnStyle" size="mini" :disabled="submitFlag"
:type="submitFlag?'info ':'success'" @click="handleLink()">设置</u-button>
</view>
</u-navbar>
<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>
</u-grid-item>
</u-grid>
</view>
</template>
<script>
export default {
data() {
return {
bgList:[],
customBtnStyle: {
fontSize: '30rpx',
padding: '28rpx',
width:'100rpx'
},
submitFlag:true,
girdItemCustomStyle:{
backgroundColor:'#71d5a1',
// maring:'0rpx',
padding:'20rpx'
}
};
},
methods: {
clickGrid(index){
this.bgList.forEach((item,i)=>{
if(index == i) item.isCheck = !item.isCheck;
else item.isCheck = false;
})
this.submitFlag=false;
},
//处理跳转逻辑
handleLink(){
const item = this.bgList.find(it=>it.isCheck);
if(item){
this.$u.vuex('circleBgImg', item.src);
uni.navigateBack({
delta:2
})
}
},
},
onShow() {
this.bgList = JSON.parse(JSON.stringify(this.circleBgList))
}
};
</script>
<style lang="scss" scoped>
.content {
.slot-wrap {
display: flex;
align-items: center;
padding: 0 30rpx;
}
}
</style>
@@ -0,0 +1,80 @@
<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" />
</view>
</template>
<script>
export default {
data() {
return {
titleStyle:{
marginLeft:"20rpx",
fontSize:"32rpx",
color:"#000000"
}
};
},
methods: {
chooseImg() {
let that=this;
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera','album'], //从相册选择
success: function(res) {
console.log("res",res);
let tempFilePaths = res.tempFilePaths;
that.myUpload(tempFilePaths[0]);
return;
}
});
return;
},
//上传返回图片
myUpload(filePath) {
let that=this;
let obj = {
filePath:filePath,
savePath: "friendCircle" //文件存放目录
}
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);
}
});
},
linkToBuiltinBgImg() {
this.$u.route('/pages/tabbar/find/friend-circle/builtinBgImg');
},
},
};
</script>
<style></style>
@@ -0,0 +1,24 @@
<template>
<view class="locationContainer">
<view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
};
}
}
</script>
<style lang="scss" scoped>
.locationContainer{
padding: 20rpx;
}
</style>
+34 -232
View File
@@ -1,177 +1,56 @@
<template>
<view class="content">
<u-navbar :is-back="false" title="发现" :background="{ background: '#f4f4f5' }" title-color="#404133"
:title-bold="true" title-size="34" :border-bottom="false" z-index="1001">
</u-navbar>
<view style="background-color: #FFFFFF;">
<view>
<u-cell-item title="" :title-style="titleStyle" :border-bottom="showBorder(0)" :border-top="false"
@tap="linkTo(cellList[0])">
<u-icon class="u-m-r-10" slot="icon" name="/static/image/workbench/01.png" color="inherit" :size="44"></u-icon>
<view slot="title" class="u-flex u-row-left u-col-center" style="min-width: 200rpx;">
<view class="u-m-r-20">
<text>朋友圈</text>
</view>
<view class="u-flex u-row-center u-col-center" v-if="vuex_friendCircleUnreadCount>0"
style="width:36rpx;height:36rpx;background-color:#fa3534;border-radius:18rpx;font-size:28rpx;color: #ffffff;">
<text>{{vuex_friendCircleUnreadCount}}</text>
</view>
</view>
<view slot="right-icon" v-if="newCircleInfo&&newCircleInfo.userHeadImg.length>0">
<u-avatar :src="newCircleInfo.userHeadImg" mode="square" :size="70"></u-avatar>
<u-badge :is-dot="true" type="error" :offset="[20,60]"></u-badge>
</view>
</u-cell-item>
<u-gap :height="16" bg-color="#f4f4f5" v-if="showGap(0)"></u-gap>
</view>
<view v-for="(item,index) in cellList" :key="index">
<template v-if="item.hidden==false&&index!=0">
<u-cell-item :title="item.title" :title-style="titleStyle"
:border-bottom="showBorder(index)" :border-top="false"
@tap="linkTo(item)">
<u-icon :class="item.title=='购物'?'u-m-l-6 u-m-r-10':'u-m-r-10'"
slot="icon" :name="item.icon" :color="item.color" :size="item.size"></u-icon>
</u-cell-item>
<u-gap :height="16" bg-color="#f4f4f5" v-if="showGap(index)"></u-gap>
</template>
</view>
</view>
<uni-nav-bar title="发现" background-color="transparent"></uni-nav-bar>
<uni-list>
<uni-list-item title="朋友圈"
thumb="/static/images/workbench/01.png"
:thumbSize="thumbSize"
showArrow
to="/pages/workbench/friend-circle/friend-circle">
<view slot="footer" v-if="newCircleInfo&&newCircleInfo.userHeadImg.length>0">
<u-avatar :src="newCircleInfo.userHeadImg" mode="square" :size="70"></u-avatar>
<u-badge :is-dot="true" type="error" :offset="[20,60]"></u-badge>
</view>
</uni-list-item>
</uni-list>
<u-gap :height="10"></u-gap>
<uni-list>
<uni-list-item title="扫一扫" thumb="/static/images/workbench/03.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item title="摇一摇" thumb="/static/images/workbench/05.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item title="看一看" thumb="/static/images/workbench/06.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item title="听一听" thumb="/static/images/workbench/06.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item title="附近" thumb="/static/images/workbench/08.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
<uni-list-item title="购物" thumb="/static/images/workbench/09.png" :thumbSize="thumbSize" to="/pages/workbench/friend-circle/friend-circle" showArrow></uni-list-item>
</uni-list>
</view>
</template>
<script>
import {getFriendCircleInfo } from "@/api/login";
export default {
data() {
return {
cellList: [
{
id: 1,
title: "朋友圈",
icon: "/static/image/workbench/01.png",
color: "inherit",
bind: "/pages/workbench/friend-circle/friend-circle",
hidden:false,
size:44,
},
{
id: 3,
title: "扫一扫",
//icon: "/static/image/wx/saoyisao.png",
icon: "/static/image/workbench/04.png",
color: "#409eff",
bind: "scan",
hidden:false,
size:44,
},
{
id: 4,
title: "摇一摇",
//icon: "/static/image/wx/yaoyiyao.png",
icon: "/static/image/workbench/05.png",
color: "#409eff",
bind: "/pages/tabbar/find/yaoyiyao/yyy-index",
hidden:false,
size:44,
},
{
id: 11,
title: "看一看",
icon: "/static/image/workbench/06.png",
color: "#f29100",
bind: "",
hidden:false,
size:44,
},
{
id: 13,
title: "附近",
icon: "/static/image/workbench/08.png",
color: "#fab6b6",
bind: "",
hidden:false,
size:44,
},
{
id: 14,
title: "购物",
icon: "/static/image/workbench/09.png",
color: "#fab6b6",
bind: "taobao",
hidden:false,
size:44,
},
{
id: 15,
title: "游戏",
icon: "/static/image/workbench/10.png",
color: "#fab6b6",
bind: "",
hidden:false,
size:44,
},
{
id: 6,
title: "小程序",
//icon: "/static/image/wx/xiaochengxu.png",
icon: "/static/image/workbench/11.png",
color: "#fab6b6",
bind: "",
hidden:false,
size:44,
},
{
id: 7,
title: "ChatGpt",
icon: "/static/image/find/chatgpt.png",
color: "#ff9900",
bind: "/pages/tabbar/group/chat/chat-gpt-conversion-wss",
hidden:true,
size:64,
},
{
id: 8,
title: "AI绘画",
icon: "http://open.yjai.art/assets/logo-9a019aa3.svg",
color: "#ff9900",
bind: "/pages/tabbar/find/AI/ai-text-to-create-img/ai-text-to-create-img",
hidden:true,
size:64,
},
{
id: 9,
title: "免费听歌",
icon: "/static/image/find/MP3.png",
color: "#19BE6B",
bind: "/pages/tabbar/find/music/free-music",
hidden:true,
size:64,
}
],
titleStyle: {
marginLeft: "20rpx",
fontSize: "34rpx",
color: "#000000"
},
thumbSize:"base",
newCircleInfo: {
userHeadImg:""
userHeadImg:"",
count:0
},
};
},
onShow: function() {
this.changeDefaultAvatar(1,10);
let unreadCount= 1;//this.vuex_friendCircleUnreadCount+"";
this.localGroupApi.setTabBarBadge(2,unreadCount);
let unreadCount= 1;
//this.vuex_friendCircleUnreadCount+"";
//this.localGroupApi.setTabBarBadge(2,unreadCount);
},
methods: {
changeDefaultAvatar:function(min,max){
let that=this;
that.$u.api.friendCircle.checkFriendCircleUpdate().then(res => {
getFriendCircleInfo().then(res => {
if(res.code==200){
console.log("查询朋友圈更新情况",res.data);
console.log("查询朋友圈更新情况",res.data);
if(res.data&&res.data.length>0){
that.newCircleInfo=res.data[0];
that.newCircleInfo=res.data;
}else{
that.newCircleInfo=null;
}
@@ -179,92 +58,15 @@
})
},
showBorder(index){
switch (index){
case 1:
return true;
case 3:
return true;
case 5:
return true;
case 8:
return true;
default:
return false;
}
},
showGap(index){
switch (index){
case 0:
return true;
case 2:
return true;
case 4:
return true;
case 6:
return true;
case 7:
return true;
case 9:
return true;
default:
return false;
}
},
linkTo(item) {
let that = this;
let url = item.bind;
console.log("跳转链接", url);
if (url != null && url.length > 0) {
if (url == 'taobao') {
if (plus.os.name == 'Android') {
plus.runtime.launchApplication({
pname: 'com.taobao.taobao'
},
function(e) {
console.log('Open system default browser failed: ' + e.message);
}
);
} else if (plus.os.name == 'iOS') {
//抖音 snssdk1128://
plus.runtime.launchApplication({
action: 'snssdk1128://'
}, function(e) {
console.log('Open system default browser failed: ' + e.message);
});
}
} else if (url == "scan") {
this.globalUtil.scanQRcode(that, {
complete: function(res) {
console.log("扫码结果", res);
if (res.resp_code == 1000) {
let respData = res.resp_result;
that.$u.route({
url: '/pages/chat/qr-info/qr-info',
params: {
qrInfo: respData
},
animationType: 'slide-in-bottom'
});
}
},
})
} else {
console.log("url", url);
this.$u.route(url);
return;
}
}
},
}
};
</script>
<style lang="scss" scoped>
.content {}
.content {padding-top: 36rpx;}
</style>
<style>
page {
background-color: #f4f4f5 !important;
background-color: #ececec !important;
}
</style>