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
+6
View File
@@ -314,6 +314,12 @@
this.$store.dispatch("contact/getSentGroupApplications");
uni.switchTab({
url: "/pages/conversation/conversationList/index?isRedirect=true",
success() {
// uni.navigateTo({
// url:'/pages/workbench/friend-circle/friend-circle'
// })
}
});
};
getDbDir()
+37 -29
View File
@@ -1,4 +1,7 @@
import { reject } from "lodash";
import config from "@/common/config";
// 登录
export const businessConfig = (params) =>
uni.$u?.http.post("/common/init", JSON.stringify(params));
// 验证是否升级
@@ -78,40 +81,45 @@ export const businessSearchUser = (keyword,searchtype) =>
},
}
);
export const getArticle = (id,type) =>
uni.$u?.http.post(
"/article/detail",
JSON.stringify({
id,
type:(type? type : 'id')
}), {
header: {
token: uni.getStorageSync("BusinessToken"),
},
}
);
export const getArticle = (id,type) => uni.$u?.http.post("/article/detail",JSON.stringify({id,type:(type? type : 'id')}));
export const getFriendCircle = (page=1,limit=10) =>{
uni.$u?.http.get(
"/friend_circle/list",
JSON.stringify({
limit:limit,
page:page
}),
{
header: {
token: uni.getStorageSync("BusinessToken"),
},
}
);
return uni.$u?.http.get("/friendcircle/list",JSON.stringify({limit:limit,page:page}));
}
export const getFriendCircleNewcount = () =>{
uni.$u?.http.get(
"/friend_circle/newcount",
JSON.stringify({}),
{
return uni.$u?.http.get("/friendcircle/newcount");
}
export const getFriendCircleInfo = () =>{
return uni.$u?.http.get("/friendcircle/info");
}
export const upload = (url,onProgress) =>{
return new Promise((resolve,reject)=>{
var u = uni.uploadFile({
url: config.getRegisterUrl()+"/user/upload", // 仅为示例,非真实的接口地址
filePath: url,
name: "file",
header:{
token:uni.getStorageSync("BusinessToken"),
},
success({data,errMsg}){
console.log(data);
data = JSON.parse(data);
if(data.code == 0){
resolve(data);
}else{
reject(data.msg);
}
);
},
fail(res) {
console.log(e);
reject(e);
}
});
u.onProgressUpdate((e)=>{
var res = {
'code' : 99999,
'progress' : e.progress
}
onProgress && onProgress.call(this,res);
})
})
}
+1 -1
View File
@@ -18,7 +18,7 @@ const getApiUrl = () => uni.getStorageSync("IMApiUrl") || API_URL;
const getWsUrl = () => uni.getStorageSync("IMWsUrl") || WS_URL;
module.exports = {
cdnUrl:BASE_DOMAIN,
cdnUrl:"http://"+BASE_DOMAIN,
version,
getRegisterUrl,
getApiUrl,
+34 -3
View File
@@ -269,22 +269,53 @@
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/workbench/friend-circle/releaseFriendCircle",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/workbench/friend-circle/chooseLocation",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/workbench/friend-circle/chooseCircleBgImg",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/workbench/friend-circle/builtinBgImg",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/common/userOrGroupQrCode",
"style": {
"navigationBarTitleText": ""
}
}
],
"tabBar": {
"color": "#171717",
"selectedColor": "#07c160",
"borderStyle": "#f4f4f4",
"backgroundColor": "#f4f4f4",
"backgroundColor": "rgba(244,244,244,0.8)",
"height": "55px",
"list": [{
"list": [
{
"pagePath": "pages/conversation/conversationList/index",
"iconPath": "./static/images/tabbar/conversation.png",
"selectedIconPath": "static/images/tabbar/conversation_active.png",
"text": "消息"
},
{
"pagePath": "pages/contact/index/index",
"pagePath": "pages/contact/friendList/index",
"iconPath": "./static/images/tabbar/contacts.png",
"selectedIconPath": "static/images/tabbar/contacts_active.png",
"text": "通讯录"
-1
View File
@@ -159,7 +159,6 @@
...imData,
...res.data[0],
};
console.log(info)
}
} catch (e) {
info = {};
@@ -1,11 +1,7 @@
<template>
<view @click="clickItem" class="application_item">
<my-avatar
:src="getAvatarUrl"
:isGroup="isGroupApplication"
:desc="application[isRecv ? 'fromNickname' : 'toNickname']"
size="42"
/>
<my-avatar :src="getAvatarUrl" :isGroup="isGroupApplication"
:desc="application[isRecv ? 'fromNickname' : 'toNickname']" size="42" />
<view class="application_item_details">
<view class="content">
<text class="user_name">{{ getShowName }}</text>
@@ -19,18 +15,9 @@
<view class="application_action">
<text v-if="showStateStr" class="status_tip">{{ getStateStr }}</text>
<text v-if="showGreet" @tap.stop="greetToUser" class="status_tip greet"
>打招呼</text
>
<button
:loading="accessLoading"
v-if="showAccept"
class="access_btn"
@tap.stop="acceptApplication"
type="primary"
:plain="true"
size="mini"
>
<text v-if="showGreet" @tap.stop="greetToUser" class="status_tip greet">打招呼</text>
<button :loading="accessLoading" v-if="showAccept" class="access_btn" @tap.stop="acceptApplication"
type="primary" :plain="true" size="mini">
{{ isGroupApplication ? "同意" : "接受" }}
</button>
</view>
@@ -41,8 +28,12 @@
</template>
<script>
import { navigateToDesignatedConversation } from "@/util/imCommon";
import IMSDK, { SessionType } from "openim-uniapp-polyfill";
import {
navigateToDesignatedConversation
} from "@/util/imCommon";
import IMSDK, {
SessionType
} from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue";
export default {
name: "ApplicationItem",
@@ -114,9 +105,9 @@ export default {
} else {
let sourceID =
this.application.groupID ??
(this.isRecv
? this.application.fromUserID
: this.application.toUserID);
(this.isRecv ?
this.application.fromUserID :
this.application.toUserID);
let cardType = this.isGroupApplication ? "groupCard" : "userCard";
const url = `/pages/common/${cardType}/index?sourceID=${sourceID}`;
uni.navigateTo({
@@ -130,8 +121,7 @@ export default {
if (this.isGroupApplication) {
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptGroupApplication,
IMSDK.uuid(),
{
IMSDK.uuid(), {
groupID: this.application.groupID,
fromUserID: this.application.userID,
handleMsg: "",
@@ -140,8 +130,7 @@ export default {
} else {
func = IMSDK.asyncApi(
IMSDK.IMMethods.AcceptFriendApplication,
IMSDK.uuid(),
{
IMSDK.uuid(), {
toUserID: this.application.fromUserID,
handleMsg: "",
},
+59 -21
View File
@@ -1,36 +1,41 @@
<template>
<view class="friend_list_container">
<custom-nav-bar title="我的好友" />
<view class="search_bar_wrap">
<u-search
class="search_bar"
shape="square"
placeholder="搜索"
:showAction="false"
disabled
/>
<view class="header">
<uni-nav-bar
right-icon="plus"
@clickRight="contactAddClick"
:border="false"
title="通讯录"
backgroundColor="transparent"
>
</uni-nav-bar>
<SearchbarPlace>搜索</SearchbarPlace>
</view>
<uni-list class="contact_menus">
<uni-list-item title="新的好友" :showBadge="storeUnHandleFriendApplicationNum>0" :badgeText="storeUnHandleFriendApplicationNum+''" badgeType="error" thumbSize="lg" to="/pages/contact/applicationList/index?applicationType=NewFriend" thumb="/static/images/contact_new_friend.png"></uni-list-item>
<uni-list-item title="新的群组" thumbSize="lg" to="/pages/contact/applicationList/index?applicationType=NewGroup" thumb="/static/images/contact_new_group.png"></uni-list-item>
<uni-list-item title="群聊" thumbSize="lg" to="/pages/contact/groupList/index" thumb="/static/images/contact_my_group.png"></uni-list-item>
</uni-list>
<choose-index-list
v-if="getIndexData.dataList.length > 0"
@itemClick="userClick"
:height="`${listHeight}px`"
:indexList="getIndexData.indexList"
:itemArr="getIndexData.dataList"
/>
<choose-index-list v-if="getIndexData.dataList.length > 0" @itemClick="userClick" :height="`${listHeight}px`"
:indexList="getIndexData.indexList" :itemArr="getIndexData.dataList" />
<u-empty v-else mode="list" />
</view>
</template>
<script>
import { mapGetters } from "vuex";
import {mapGetters,mapActions} from "vuex";
import {formatChooseData} from "@/util/common";
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import SearchbarPlace from "@/components/searchbar_place.vue";
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
import ContactMenus from "../index/components/ContactMenus.vue";
export default {
components: {
CustomNavBar,
ChooseIndexList,
ContactMenus,
SearchbarPlace
},
data() {
return {
@@ -39,7 +44,7 @@ export default {
};
},
computed: {
...mapGetters(["storeFriendList"]),
...mapGetters(["storeFriendList",'storeUnHandleFriendApplicationNum']),
getIndexData() {
return formatChooseData(this.storeFriendList);
},
@@ -47,7 +52,25 @@ export default {
mounted() {
this.getListHeight();
},
async onShow() {
await this.getFriendList();
},
methods: {
...mapActions('contact',['getFriendList']),
clear(){},
cancel(){},
input(){},
search() {},
contactAddClick() {
uni.navigateTo({
url: "/pages/contact/contactAdd/index",
});
},
goto(url){
uni.navigateTo({
url: url,
});
},
userClick(friend) {
uni.navigateTo({
url: `/pages/common/userCard/index?sourceID=${friend.userID}`,
@@ -55,13 +78,19 @@ export default {
},
async getListHeight() {
const windowInfo = uni.getWindowInfo();
const data = await this.getEl(".search_bar_wrap");
const searchBarHeight = Number(data.height.toFixed());
//const data = await this.getEl(".search_bar_wrap");
const contact_menus = await this.getEl(".contact_menus");
const header = await this.getEl(".header");
//const searchBarHeight = Number(data.height.toFixed());
const contact_menusHeight = contact_menusHeight ? Number(contact_menus.height.toFixed()) : 0;
const headerBarHeight = header ? Number(header.height.toFixed()) : 0;
this.listHeight =
windowInfo.windowHeight -
windowInfo.statusBarHeight -
44 -
searchBarHeight;
contact_menusHeight -
headerBarHeight;
},
getEl(el) {
return new Promise((resolve) => {
@@ -81,6 +110,10 @@ export default {
<style lang="scss" scoped>
.friend_list_container {
padding-top: 36rpx;
.header{
background-color: #f4f4f4;
}
.search_bar_wrap {
height: 34px;
padding: 12px 22px;
@@ -89,5 +122,10 @@ export default {
.u-empty {
margin-top: 25vh !important;
}
.contact_menus{
::v-deep .uni-list-item__container{
padding: 24rpx 44rpx;
}
}
}
</style>
@@ -1,10 +1,61 @@
<template>
<view class="chat_header">
<view class="self_info">
<my-avatar :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname" size="46" />
<uni-nav-bar
right-icon="plus"
@clickRight="showMore"
:border="false"
title="标题"
backgroundColor="transparent"
>
<template #right>
<uni-icons type="plus" size="26" class="more_icon"></uni-icons>
</template>
</uni-nav-bar>
<view class="right_action">
<u-overlay :show="moreMenuVisible" @click="moreMenuVisible = false" opacity="0">
<view :style="{ top: popMenuPosition.top, right: popMenuPosition.right }" class="more_menu">
<view @click="clickMenu({name:'createGroup'})" class="menu_item">
<uni-icons size="24" color="#FFF" type="chat"></uni-icons>
<text>创建群聊</text>
</view>
<view @click="clickMenu({name:'addFriend'})" class="menu_item">
<uni-icons size="24" color="#FFF" type="personadd"></uni-icons>
<text>添加好友</text>
</view>
<view @click="clickMenu({name:'createGroup'})" class="menu_item">
<uni-icons size="24" color="#FFF" type="scan"></uni-icons>
<text>扫一扫</text>
</view>
</view>
</u-overlay>
</view>
<uni-search-bar @confirm="search" :focus="false" bgColor="#fff"
placeholder="请输入您要搜索的内容"
v-model="searchValue" @input="input"
@cancel="cancel" @clear="clear">
</uni-search-bar>
<view class="status_notice">
<view class="tag" v-if="storeIsSyncing">
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
alt="" />
<text class="status">同步中</text>
</view>
<view class="tag" v-if="connectStart == 0">
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
alt="" />
<text class="status">连接中</text>
</view>
<view class="err-tag" v-if="connectStart == -1">
<img style="height: 24rpx; width: 24rpx" src="static/images/sync_error.png" alt="" />
<text class="status">连接失败</text>
</view>
</view>
<view class="self_info" v-if="1==2">
<my-avatar :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname || storeSelfInfo.remark" size="46" />
<view class="self_info_desc">
<view class="user_state">
<text class="nickname">{{ storeSelfInfo.nickname }}</text>
<text class="nickname">{{ storeSelfInfo.nickname || storeSelfInfo.remark }}</text>
<view v-if="!storeReinstall">
<view class="tag" v-if="storeIsSyncing">
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
@@ -24,20 +75,7 @@
</view>
</view>
</view>
<view class="right_action">
<view class="call_icon"> </view>
<view @click="showMore" class="more_icon">
<image src="@/static/images/common_circle_add.png"></image>
</view>
<u-overlay :show="moreMenuVisible" @click="moreMenuVisible = false" opacity="0">
<view :style="{ top: popMenuPosition.top, right: popMenuPosition.right }" class="more_menu">
<view @click="clickMenu(item)" v-for="item in moreMenus" :key="item.idx" class="menu_item">
<image :src="item.icon" mode=""></image>
<text>{{ item.title }}</text>
</view>
</view>
</u-overlay>
</view>
</view>
</template>
@@ -47,6 +85,7 @@
} from "vuex";
import MyAvatar from "@/components/MyAvatar/index.vue";
import IMSDK from "openim-uniapp-polyfill";
import util from "@/util";
export default {
name: "ChatHeader",
components: {
@@ -55,28 +94,13 @@
props: {},
data() {
return {
searchValue:"",
connectStart: -2,
moreMenuVisible: false,
popMenuPosition: {
top: 0,
right: 0,
},
moreMenus: [{
idx: 1,
title: "添加好友",
icon: require("static/images/more_add_friend.png"),
},
{
idx: 2,
title: "添加群聊",
icon: require("static/images/more_add_group.png"),
},
{
idx: 3,
title: "创建群聊",
icon: require("static/images/more_create_group.png"),
},
],
}
};
},
computed: {
@@ -89,6 +113,12 @@
this.unsubscribeAll();
},
methods: {
search(){},
blur(){},
focus(){},
input(){},
cancel(){},
clear(){},
setStateStart() {
this.connectStart = 0;
},
@@ -108,18 +138,20 @@
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
},
clickMenu({idx}) {
switch (idx) {
case 1:
case 2:
clickMenu({name}) {
switch (name) {
case 'createGroup':
uni.navigateTo({
url: `/pages/common/createGroup/index`,
});
break;
case 'addFriend':
uni.navigateTo({
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${idx === 2}`,
});
break;
case 3:
uni.navigateTo({
url: `/pages/common/createGroup/index`,
});
case 'scan':
util.scan();
break;
default:
break;
@@ -160,9 +192,10 @@
}
.chat_header {
@include btwBox();
padding: 36rpx 44rpx;
margin-top: var(--status-bar-height);
@include colBox(true);
padding: 36rpx 24rpx 10rpx;
//margin-top: var(--status-bar-height);
background: #f4f4f4;
.self_info {
@include btwBox();
@@ -249,22 +282,6 @@
display: flex;
position: relative;
.call_icon {
margin-right: 24rpx;
image {
width: 56rpx;
height: 56rpx;
}
}
.more_icon {
image {
width: 56rpx;
height: 56rpx;
}
}
.more_menu {
position: absolute;
// bottom: 0;
@@ -274,7 +291,7 @@
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
width: max-content;
border-radius: 12rpx;
background-color: #fff;
background-color: rgba(76 ,76, 76, 0.9);
.menu_item {
display: flex;
@@ -282,13 +299,12 @@
align-items: center;
padding: 20rpx 24rpx;
font-size: 28rpx;
color: $uni-text-color;
border-bottom: 1px solid #f0f0f0;
color: #fff;
//border-bottom: 1px solid #f0f0f0;
image {
width: 24px;
height: 24px;
margin-right: 24rpx;
.uni-icons {
margin-right: 16rpx;
color: #FFF;
}
&:last-child {
+15 -37
View File
@@ -5,7 +5,7 @@
<img src="static/images/logo.png" alt="" />
<view class="title">欢迎使用{{ config.name }}</view>
</view>
<u-tabs :list="list" :current="active" @click="click"></u-tabs>
<u-tabs v-if="1 == 2" :list="list" :current="active" @click="click"></u-tabs>
<u-form class="loginForm" labelPosition="top" :model="loginInfo" :labelStyle="{
fontSize: '14px',
marginTop: '20rpx',
@@ -14,7 +14,7 @@
<u-form-item v-if="active === 0" label="" prop="phoneNumber">
<u-input v-model="loginInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
<text class="areacode_content">+{{ loginInfo.areaCode }}</text>
<text class="areacode_content">+{{ loginInfo.region }}</text>
<u-icon class="arrow_down" name="arrow-down"></u-icon>
</view>
</u-input>
@@ -85,7 +85,7 @@
email: "",
phoneNumber: "",
password: "",
areaCode: "86",
region: "86",
verificationCode: "",
},
appversion: 0,
@@ -93,7 +93,7 @@
loading: false,
count: 0,
isPwdLogin: true,
active: 1,
active: 0,
};
},
computed: {
@@ -133,7 +133,7 @@
});
},
init() {
this.loginInfo.areaCode = uni.getStorageSync("last_areaCode") || "86";
this.loginInfo.region = uni.getStorageSync("last_areaCode") || "86";
this.loginInfo.email = uni.getStorageSync("last_email") || "";
this.loginInfo.phoneNumber = uni.getStorageSync("last_phoneNumber") || "";
@@ -159,7 +159,7 @@
data = await businessLogin({
mobile: this.loginInfo.phoneNumber,
email: this.loginInfo.email,
areaCode: `+${this.loginInfo.areaCode}`,
region: `+${this.loginInfo.region}`,
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
platform: uni.$u.os(),
type: this.active === 0 ? 'mobile' : 'email',
@@ -194,43 +194,21 @@
// });
},
saveLoginProfile(data) {
const {
imToken,
token,
userID
} = data;
uni.setStorage({
key: "IMUserID",
data: userID,
});
uni.setStorage({
key: "IMToken",
data: imToken,
});
uni.setStorage({
key: "BusinessToken",
data: token,
});
const { imToken, token, userID } = data;
uni.setStorage({ key: "IMUserID", data: userID, });
uni.setStorage({ key: "IMToken", data: imToken, });
uni.setStorage({ key: "BusinessToken", data: token, });
},
saveLoginInfo() {
uni.setStorage({
key: "last_areaCode",
data: this.loginInfo.areaCode,
});
uni.setStorage({
key: "last_phoneNumber",
data: this.loginInfo.phoneNumber,
});
uni.setStorage({
key: "last_email",
data: this.loginInfo.email,
});
uni.setStorage({key: "last_areaCode",data: this.loginInfo.region,});
uni.setStorage({key: "last_phoneNumber",data: this.loginInfo.phoneNumber,});
uni.setStorage({key: "last_email",data: this.loginInfo.email,});
},
showPicker() {
this.$refs.AreaPicker.init();
},
chooseArea(areaCode) {
this.loginInfo.areaCode = areaCode;
this.loginInfo.region = areaCode;
},
toggleLoginMethod() {
this.isPwdLogin = !this.isPwdLogin;
@@ -247,7 +225,7 @@
const options = {
phoneNumber: this.loginInfo.phoneNumber,
areaCode: `+${this.loginInfo.areaCode}`,
region: `+${this.loginInfo.region}`,
usedFor: SmsUserFor.Login,
operationID: Date.now() + "",
};
+3 -1
View File
@@ -31,6 +31,7 @@
import MyAvatar from "@/components/MyAvatar/index.vue";
import dayjs from "dayjs";
import InfoItem from "./InfoItem.vue";
import util from "@/util";
import {
getPurePath
} from "@/util/common";
@@ -71,6 +72,7 @@
},
},
methods: {
...util,
updateNickname() {
uni.navigateTo({
url: `/pages/common/markOrIDPage/index?isSelfNickname=true&sourceInfo=${JSON.stringify(
@@ -124,7 +126,7 @@
},
toQrCode() {
uni.navigateTo({
url: `/pages/common/userOrGroupQrCode/index`,
url: `/pages/common/userOrGroupQrCode`,
});
},
copyID() {
@@ -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>
+30 -228
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">
<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>
</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-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);
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>
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

+23 -109
View File
@@ -40,21 +40,15 @@ const mutations = {
};
const actions = {
async getFriendList({
commit
}) {
async getFriendList({commit }) {
let offset = 0;
let friendInfoList = [];
let initialFetch = true;
while (true) {
try {
const count = initialFetch ? 10000 : 1000;
const {
data
} = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {
offset,
count,
});
const {data} = await IMSDK.asyncApi("getFriendListPage", uuidv4(), {offset,count,});
//console.log(data);
friendInfoList = [
...friendInfoList,
...data,
@@ -68,9 +62,7 @@ const actions = {
}
commit("SET_FRIEND_LIST", friendInfoList);
},
async getGrouplist({
commit
}) {
async getGrouplist({commit}) {
let offset = 0;
let groupList = [];
while (true) {
@@ -93,18 +85,14 @@ const actions = {
}
commit("SET_GROUP_LIST", groupList);
},
getBlacklist({
commit
}) {
getBlacklist({commit}) {
IMSDK.asyncApi(IMSDK.IMMethods.GetBlackList, uuidv4()).then(({
data
}) => {
commit("SET_BLACK_LIST", data);
});
},
getRecvFriendApplications({
commit
}) {
getRecvFriendApplications({commit}) {
IMSDK.asyncApi(
IMSDK.IMMethods.GetFriendApplicationListAsRecipient,
uuidv4(),
@@ -114,9 +102,7 @@ const actions = {
commit("SET_RECV_FRIEND_APPLICATIONS", data);
});
},
getSentFriendApplications({
commit
}) {
getSentFriendApplications({ commit }) {
IMSDK.asyncApi(
IMSDK.IMMethods.GetFriendApplicationListAsApplicant,
uuidv4(),
@@ -126,9 +112,7 @@ const actions = {
commit("SET_SENT_FRIEND_APPLICATIONS", data);
});
},
getRecvGroupApplications({
commit
}) {
getRecvGroupApplications({ commit }) {
IMSDK.asyncApi(
IMSDK.IMMethods.GetGroupApplicationListAsRecipient,
uuidv4(),
@@ -138,9 +122,7 @@ const actions = {
commit("SET_RECV_GROUP_APPLICATIONS", data);
});
},
getSentGroupApplications({
commit
}) {
getSentGroupApplications({ commit }) {
IMSDK.asyncApi(
IMSDK.IMMethods.GetGroupApplicationListAsApplicant,
uuidv4(),
@@ -150,23 +132,14 @@ const actions = {
commit("SET_SENT_GROUP_APPLICATIONS", data);
});
},
pushNewFriend({
commit,
state
}, friendInfo) {
pushNewFriend({ commit, state}, friendInfo) {
const tmpList = [...state.friendList];
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
if (idx === -1) {
commit("SET_FRIEND_LIST", [...tmpList, friendInfo]);
}
},
updateFriendInfo({
commit,
state
}, {
friendInfo,
isRemove = false
}) {
updateFriendInfo({commit,state}, { friendInfo,isRemove = false}) {
const tmpList = [...state.friendList];
const idx = tmpList.findIndex((item) => item.userID === friendInfo.userID);
@@ -181,23 +154,14 @@ const actions = {
commit("SET_FRIEND_LIST", tmpList);
}
},
pushNewBlack({
commit,
state
}, blackInfo) {
pushNewBlack({ commit, state}, blackInfo) {
const tmpList = [...state.blackList];
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
if (idx === -1) {
commit("SET_BLACK_LIST", [...tmpList, blackInfo]);
}
},
updateBlackInfo({
commit,
state
}, {
blackInfo,
isRemove = false
}) {
updateBlackInfo({commit,state}, {blackInfo,isRemove = false}) {
const tmpList = [...state.blackList];
const idx = tmpList.findIndex((item) => item.userID === blackInfo.userID);
@@ -212,24 +176,14 @@ const actions = {
commit("SET_BLACK_LIST", tmpList);
}
},
pushNewGroup({
commit,
state
}, groupInfo) {
pushNewGroup({commit,state}, groupInfo) {
const tmpList = [...state.groupList];
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
if (idx === -1) {
commit("SET_GROUP_LIST", [...tmpList, groupInfo]);
}
},
updateGroupInfo({
commit,
state,
rootState
}, {
groupInfo,
isRemove = false
}, ) {
updateGroupInfo({commit,state,rootState}, {groupInfo,isRemove = false}, ) {
const tmpList = [...state.groupList];
const idx = tmpList.findIndex((item) => item.groupID === groupInfo.groupID);
@@ -250,10 +204,7 @@ const actions = {
commit("SET_GROUP_LIST", tmpList);
}
},
pushNewRecvFriendApplition({
commit,
state
}, application) {
pushNewRecvFriendApplition({commit,state}, application) {
const tmpList = [...state.recvFriendApplications];
const idx = tmpList.findIndex(
(item) => item.fromUserID === application.fromUserID,
@@ -263,14 +214,7 @@ const actions = {
}
commit("SET_RECV_FRIEND_APPLICATIONS", [...tmpList, application]);
},
updateRecvFriendApplition({
commit,
state,
rootState
}, {
application,
isRemove = false
}, ) {
updateRecvFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) {
const tmpList = [...state.recvFriendApplications];
const idx = tmpList.findIndex(
(item) => item.fromUserID === application.fromUserID,
@@ -287,10 +231,7 @@ const actions = {
commit("SET_RECV_FRIEND_APPLICATIONS", tmpList);
}
},
pushNewSentFriendApplition({
commit,
state
}, application) {
pushNewSentFriendApplition({commit,state}, application) {
const tmpList = [...state.sentFriendApplications];
const idx = tmpList.findIndex(
(item) => item.toUserID === application.toUserID,
@@ -300,14 +241,7 @@ const actions = {
}
commit("SET_SENT_FRIEND_APPLICATIONS", [...tmpList, application]);
},
updateSentFriendApplition({
commit,
state,
rootState
}, {
application,
isRemove = false
}, ) {
updateSentFriendApplition({commit,state,rootState}, {application,isRemove = false}, ) {
const tmpList = [...state.sentFriendApplications];
const idx = tmpList.findIndex(
(item) => item.toUserID === application.toUserID,
@@ -324,10 +258,7 @@ const actions = {
commit("SET_SENT_FRIEND_APPLICATIONS", tmpList);
}
},
pushNewRecvGroupApplition({
commit,
state
}, application) {
pushNewRecvGroupApplition({commit,state}, application) {
const tmpList = [...state.recvGroupApplications];
const idx = tmpList.findIndex((item) => item.userID === application.userID);
if (idx !== -1) {
@@ -335,14 +266,7 @@ const actions = {
}
commit("SET_RECV_GROUP_APPLICATIONS", [...tmpList, application]);
},
updateRecvGroupApplition({
commit,
state,
rootState
}, {
application,
isRemove = false
}, ) {
updateRecvGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) {
const tmpList = [...state.recvGroupApplications];
const idx = tmpList.findIndex((item) => item.userID === application.userID);
@@ -357,10 +281,7 @@ const actions = {
commit("SET_RECV_GROUP_APPLICATIONS", tmpList);
}
},
pushNewSentGroupApplition({
commit,
state
}, application) {
pushNewSentGroupApplition({commit,state}, application) {
const tmpList = [...state.sentGroupApplications];
const idx = tmpList.findIndex(
(item) => item.groupID === application.groupID,
@@ -370,14 +291,7 @@ const actions = {
}
commit("SET_SENT_GROUP_APPLICATIONS", [...tmpList, application]);
},
updateSentGroupApplition({
commit,
state,
rootState
}, {
application,
isRemove = false
}, ) {
updateSentGroupApplition({commit,state,rootState}, {application,isRemove = false}, ) {
const tmpList = [...state.sentGroupApplications];
const idx = tmpList.findIndex(
(item) => item.groupID === application.groupID,
+6 -7
View File
@@ -16,15 +16,13 @@
/* 颜色变量 */
@import "@/uni_modules/uview-ui/theme.scss";
text {
// line-height: 1.5;
}
// text element line-height can be customized if needed
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
$uni-color-primary: #997aff;
$uni-color-success: #07c160;
$uni-color-warning: #fa9d3b;
$uni-color-error: #fa5151;
/* 文字基本颜色 */
$uni-text-color: #0c1c33; //基本色
@@ -80,3 +78,4 @@ $uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle: 26px;
$uni-color-paragraph: #3f536e; // 文章段落颜色
$uni-font-size-paragraph: 15px;
//@import "@/styles/weui-overrides.scss";