feat:替换各个列表接口参数;登录注册合并;发布动态添加视频;分段控件修改
This commit is contained in:
1 parent
298bc6babe
commit
7267cf93c9
22 files changed
+288
-187
No files matched your search
+10
-13
@@ -328,7 +328,7 @@
|
||||
const groupId = msg.groupId;
|
||||
uni.navigateTo({
|
||||
url: `/pages/chat/chat-group-video?groupId=${groupId}&isHost=false
|
||||
&inviterId=${inviterId}&userInfos=${userInfos}`,
|
||||
&inviterId=${inviterId}&userInfos=${userInfos}`,
|
||||
});
|
||||
delayTime = 500;
|
||||
}
|
||||
@@ -388,7 +388,7 @@
|
||||
return group;
|
||||
},
|
||||
exit() {
|
||||
console.log('exit');
|
||||
console.log('1exit');
|
||||
this.isExit = true;
|
||||
wsApi.close(3099);
|
||||
uni.removeStorageSync('loginInfo');
|
||||
@@ -494,28 +494,25 @@
|
||||
ShoproInit();
|
||||
// app启动时更新用户位置
|
||||
uni.getLocation({
|
||||
geocode: true,
|
||||
success: (res) => {
|
||||
const params = {
|
||||
issueLat: String(res.latitude),
|
||||
issueLong: String(res.longitude),
|
||||
lat: String(res.latitude),
|
||||
lon: String(res.longitude),
|
||||
province: res.address?.province ?? '',
|
||||
city: res.address?.city ?? '',
|
||||
district: res.address?.district ?? '',
|
||||
address: res.address?.street ?? '',
|
||||
};
|
||||
RecentApi.updateUserLocation(params);
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({ title: '位置信息获取失败', icon: 'none' });
|
||||
uni.showToast({ title: '位置信息获取失败,请打开系统定位', icon: 'none' });
|
||||
},
|
||||
});
|
||||
|
||||
this.$mountStore();
|
||||
this.closeSplashscreen(1000); // 延迟1s,避免用户看到页面跳转
|
||||
uni.setStorageSync('loginInfo', {
|
||||
accessToken:
|
||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyIiwiZXhwIjoxNzY0MTQ1MDQyLCJpbmZvIjoie1wibmlja05hbWVcIjpcInd3d1wiLFwidGVybWluYWxcIjoxLFwidXNlcklkXCI6MixcInVzZXJOYW1lXCI6XCJ3d3dcIn0ifQ.yO8o-DM4mied_C5PFzqentfiETV38jmVjFzLVljouz4',
|
||||
accessTokenExpiresIn: 1800,
|
||||
refreshToken:
|
||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyIiwiZXhwIjoxNzY0NzQ4MDQyLCJpbmZvIjoie1wibmlja05hbWVcIjpcInd3d1wiLFwidGVybWluYWxcIjoxLFwidXNlcklkXCI6MixcInVzZXJOYW1lXCI6XCJ3d3dcIn0ifQ.O2Ge2P-n3JSjEqr7P5sH5jaSWZosopHycsuS-vk-WEU',
|
||||
refreshTokenExpiresIn: 604800,
|
||||
});
|
||||
// 登录状态校验
|
||||
let loginInfo = uni.getStorageSync('loginInfo');
|
||||
this.refreshToken(loginInfo)
|
||||
|
||||
@@ -22,6 +22,7 @@ const request = (options) => {
|
||||
if (res.data.code == 200) {
|
||||
return resolve(res.data.data);
|
||||
} else if (res.data.code == 400) {
|
||||
console.log('code 400');
|
||||
getApp().$vm.exit();
|
||||
} else if (res.data.code == 401) {
|
||||
console.log('token失效,尝试重新获取');
|
||||
|
||||
@@ -126,5 +126,3 @@
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -12,13 +12,13 @@
|
||||
<image
|
||||
v-show="friend.onlineWeb"
|
||||
class="online"
|
||||
src="/static/image/online_web.png"
|
||||
src="/static/online_web.png"
|
||||
title="电脑设备在线"
|
||||
/>
|
||||
<image
|
||||
v-show="friend.onlineApp"
|
||||
class="online"
|
||||
src="/static/image/online_app.png"
|
||||
src="/static/online_app.png"
|
||||
title="移动设备在线"
|
||||
/>
|
||||
</view>
|
||||
@@ -88,8 +88,8 @@
|
||||
|
||||
.online {
|
||||
padding-right: 4rpx;
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
position: fixed;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background-color: $im-bg-active;
|
||||
background-color: $im-bg-active-lighter;
|
||||
z-index: 1000;
|
||||
box-shadow: $im-box-shadow-dark;
|
||||
|
||||
|
||||
+3
-2
@@ -46,8 +46,8 @@ $im-box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
$im-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.12);
|
||||
$im-box-shadow-dark: 0px 1px 10px 2px
|
||||
rgba(
|
||||
$color: #444,
|
||||
$alpha: 0.01,
|
||||
$color: #666,
|
||||
$alpha: 0.05,
|
||||
);
|
||||
|
||||
// 背景
|
||||
@@ -55,6 +55,7 @@ $im-bg: #222;
|
||||
$im-bg-linear: linear-gradient(135deg, #222 0%, #333 100%);
|
||||
$im-bg-active: #333;
|
||||
$im-bg-active-light: #444;
|
||||
$im-bg-active-lighter: #555;
|
||||
$im-bg-input: #333;
|
||||
|
||||
// 标题
|
||||
|
||||
+40
-21
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<wd-config-provider class="h-full flex flex-col" theme="dark">
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="城市" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<uni-icons type="back" size="30" color="#ffcd32" @click="back"></uni-icons>
|
||||
@@ -7,7 +7,7 @@
|
||||
</wd-navbar>
|
||||
|
||||
<view class="px-3 text-sm">热门城市</view>
|
||||
<view class="flex flex-wrap gap-3 my-3 mx-4">
|
||||
<view class="flex flex-wrap gap-3 py-3 px-4">
|
||||
<text
|
||||
v-for="(item, index) in hotCity"
|
||||
:key="index"
|
||||
@@ -18,19 +18,21 @@
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<wd-index-bar sticky>
|
||||
<view v-for="(item, index) in useCityIndex()" :key="index">
|
||||
<wd-index-anchor :index="item.letter" />
|
||||
<wd-cell
|
||||
border
|
||||
clickable
|
||||
v-for="city in item.data"
|
||||
:key="city.v"
|
||||
:title="city.t"
|
||||
@click="select(city)"
|
||||
/>
|
||||
</view>
|
||||
</wd-index-bar>
|
||||
<view style="height: calc(100vh - 150px)">
|
||||
<wd-index-bar sticky>
|
||||
<view v-for="(item, index) in useCityIndex()" :key="index">
|
||||
<wd-index-anchor :index="item.letter" />
|
||||
<wd-cell
|
||||
border
|
||||
clickable
|
||||
v-for="city in item.data"
|
||||
:key="city.v"
|
||||
:title="city.t"
|
||||
@click="select(city)"
|
||||
/>
|
||||
</view>
|
||||
</wd-index-bar>
|
||||
</view>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
@@ -48,6 +50,7 @@
|
||||
import useCityIndex, { type cityItem } from '@/sheep/hooks/use-city-index';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
|
||||
const instance: any = getCurrentInstance()?.proxy;
|
||||
const eventChannel = instance.getOpenerEventChannel();
|
||||
@@ -61,6 +64,28 @@
|
||||
|
||||
const select = (v: cityItem) => {
|
||||
sheep.$store('user').setUserCity(v);
|
||||
uni.getLocation({
|
||||
geocode: true,
|
||||
success: (res) => {
|
||||
const params = {
|
||||
lat: String(res.latitude),
|
||||
lon: String(res.longitude),
|
||||
province: res.address?.province ?? '',
|
||||
city: v?.t ?? '',
|
||||
district: res.address?.district ?? '',
|
||||
address: res.address?.street ?? '',
|
||||
};
|
||||
RecentApi.updateUserLocation(params);
|
||||
},
|
||||
fail: (err) => {
|
||||
const params = {
|
||||
lat: '0',
|
||||
lon: '0',
|
||||
city: v?.t ?? '',
|
||||
};
|
||||
RecentApi.updateUserLocation(params);
|
||||
},
|
||||
});
|
||||
eventChannel.emit('changeCity');
|
||||
back();
|
||||
};
|
||||
@@ -69,9 +94,3 @@
|
||||
uni.navigateBack();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
+27
-10
@@ -2,7 +2,7 @@
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<view class="flex items-center w-200rpx" @click="selectAddress">
|
||||
<view class="flex items-center w-200rpx" @click="goSelectAddress">
|
||||
<uni-icons type="location" size="22" color="#ffcd32"></uni-icons>
|
||||
<text class="truncate text-xs">{{ userCity?.t || '未选择' }}</text>
|
||||
</view>
|
||||
@@ -19,6 +19,8 @@
|
||||
:loadMoreStatus="loadMoreStatus"
|
||||
@refresh="refreshList"
|
||||
@loadMore="listLoadMore"
|
||||
@scroll="(e) => (scrollTop = e.detail.scrollTop)"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<user-card
|
||||
v-if="listData.length"
|
||||
@@ -60,27 +62,41 @@
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const current = ref(0);
|
||||
const segmentedItems = ['广场', '最近', '新人'];
|
||||
const segmentedItems = ref([]);
|
||||
const userCity = computed(() => sheep.$store('user').userCity);
|
||||
const params = reactive({
|
||||
scene: 'DYNAMIC_RECOMMEND',
|
||||
scene: '',
|
||||
province: '',
|
||||
city: '',
|
||||
city: userCity.value.t,
|
||||
memberId: '',
|
||||
});
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
RecentApi.quickPage,
|
||||
params,
|
||||
);
|
||||
const scrollTop = ref(0);
|
||||
|
||||
const selectAddress = () => {
|
||||
onLoad(async () => {
|
||||
// 获取顶部导航栏tab菜单
|
||||
const { data } = await RecentApi.getSquareTabMenu();
|
||||
if (data && data.length > 0) {
|
||||
segmentedItems.value = data;
|
||||
params.scene = data[0]['search-action'];
|
||||
refreshList();
|
||||
}
|
||||
});
|
||||
|
||||
const goSelectAddress = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/city',
|
||||
events: {
|
||||
changeCity: () => {
|
||||
refreshList();
|
||||
changeCity: async () => {
|
||||
scrollTop.value = 0;
|
||||
params.city = userCity.value.t;
|
||||
await refreshList();
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -95,8 +111,9 @@
|
||||
});
|
||||
};
|
||||
|
||||
const segmentedChange = ({ currentIndex }: { currentIndex: number }) => {
|
||||
console.log(segmentedItems[currentIndex]);
|
||||
refreshList();
|
||||
const segmentedChange = async (item: any) => {
|
||||
params.scene = item['search-action'];
|
||||
scrollTop.value = 0;
|
||||
await refreshList();
|
||||
};
|
||||
</script>
|
||||
+45
-59
@@ -7,46 +7,40 @@
|
||||
<view class="text-16px tracking-4rpx text-amber/80">• 高端社交圈 •</view>
|
||||
</view>
|
||||
|
||||
<template v-if="scene === 'login'">
|
||||
<view class="flex w-full flex-col items-center gap-40rpx">
|
||||
<view class="relative flex w-full items-center">
|
||||
<input
|
||||
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="phone"
|
||||
/>
|
||||
</view>
|
||||
<view class="relative flex w-full items-center">
|
||||
<input
|
||||
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
|
||||
type="number"
|
||||
placeholder="验证码"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="smsCode"
|
||||
/>
|
||||
<view
|
||||
class="absolute right-20rpx rounded-16rpx bg-color-theme-dark px-20rpx py-16rpx text-12px"
|
||||
@click="handleGetCode"
|
||||
>
|
||||
获取验证码
|
||||
</view>
|
||||
<view class="flex w-full flex-col items-center gap-40rpx">
|
||||
<view class="relative flex w-full items-center">
|
||||
<input
|
||||
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="phone"
|
||||
/>
|
||||
</view>
|
||||
<view class="relative flex w-full items-center">
|
||||
<input
|
||||
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
|
||||
type="number"
|
||||
placeholder="验证码"
|
||||
placeholder-style="color: rgba(255, 255, 255, 0.6)"
|
||||
v-model="smsCode"
|
||||
/>
|
||||
<view
|
||||
class="absolute right-20rpx rounded-16rpx bg-color-theme-dark px-20rpx py-16rpx text-12px"
|
||||
@click="handleGetCode"
|
||||
>
|
||||
获取验证码
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="mt-40rpx w-full rounded-full bg-color-theme text-lg text-center py-2"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登 录
|
||||
</view>
|
||||
<button class="mt-40rpx border-none bg-transparent text-white" @click="goRegister">
|
||||
去注册
|
||||
</button>
|
||||
</template>
|
||||
</view>
|
||||
<view
|
||||
class="mt-40rpx w-full rounded-full bg-color-theme text-lg text-center py-2"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登 录 / 注 册
|
||||
</view>
|
||||
|
||||
<template v-else>
|
||||
<view class="flex w-full flex-col items-center gap-40rpx">
|
||||
<!-- <view class="flex w-full flex-col items-center gap-40rpx">
|
||||
<view class="relative flex w-full items-center">
|
||||
<input
|
||||
class="h-100rpx w-full rounded-50rpx bg-color-light px-40rpx text-32rpx text-white"
|
||||
@@ -80,8 +74,7 @@
|
||||
</view>
|
||||
<button class="mt-40rpx border-none bg-transparent text-white" @click="goLogin">
|
||||
去登录
|
||||
</button>
|
||||
</template>
|
||||
</button> -->
|
||||
</view>
|
||||
|
||||
<view class="absolute bottom-40rpx w-full text-center text-14px text-white">
|
||||
@@ -96,7 +89,6 @@
|
||||
|
||||
const phone = ref('');
|
||||
const smsCode = ref('');
|
||||
const scene = ref('login');
|
||||
|
||||
const handleGetCode = async () => {
|
||||
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
|
||||
@@ -116,30 +108,24 @@
|
||||
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
|
||||
if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' });
|
||||
|
||||
const { code } = await AuthUtil.smsLogin({ mobile: phone.value, code: smsCode.value });
|
||||
if (code === 0) {
|
||||
uni.reLaunch({ url: '/pages/home/home' });
|
||||
}
|
||||
};
|
||||
|
||||
// 注册
|
||||
const handleRegister = async () => {
|
||||
if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
|
||||
if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' });
|
||||
|
||||
const { code } = await AuthUtil.smsRegister({ mobile: phone.value, code: smsCode.value });
|
||||
if (code === 0) {
|
||||
uni.reLaunch({ url: '/pages/home/home' });
|
||||
getApp().$vm.init();
|
||||
return;
|
||||
}
|
||||
// 清理数据,防止缓存未失效
|
||||
getApp().$vm.unloadStore();
|
||||
};
|
||||
|
||||
const goLogin = () => {
|
||||
smsCode.value = '';
|
||||
scene.value = 'login';
|
||||
};
|
||||
// 注册
|
||||
// const handleRegister = async () => {
|
||||
// if (!phone.value) return uni.showToast({ title: '请填写手机号', icon: 'none' });
|
||||
// if (!smsCode.value) return uni.showToast({ title: '请填写验证码', icon: 'none' });
|
||||
|
||||
const goRegister = () => {
|
||||
smsCode.value = '';
|
||||
scene.value = 'register';
|
||||
};
|
||||
// const { code } = await AuthUtil.smsRegister({ mobile: phone.value, code: smsCode.value });
|
||||
// if (code === 0) {
|
||||
// uni.reLaunch({ url: '/pages/home/home' });
|
||||
// }
|
||||
// };
|
||||
</script>
|
||||
@@ -120,7 +120,7 @@
|
||||
>
|
||||
<view class="tool-icon iconfont icon-folder"></view>
|
||||
</file-upload>
|
||||
<view class="tool-name">文件</view>
|
||||
<view class="tool-name" style="margin-top: -10rpx">文件</view>
|
||||
</view>
|
||||
<view class="chat-tools-item">
|
||||
<image-upload
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="tab-page friend">
|
||||
<view class="page friend">
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="友友" fixed safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
@@ -29,7 +29,7 @@
|
||||
</view>
|
||||
<view class="tip-title">还没有好友</view>
|
||||
<view class="tip-content">添加好友,开始精彩的聊天之旅</view>
|
||||
<!-- <button type="primary" @click="onAddNewFriends">添加好友</button> -->
|
||||
<button type="primary" @click="onAddNewFriends">逛逛首页</button>
|
||||
</view>
|
||||
<view class="friend-items" v-else>
|
||||
<!-- <up-index-list :index-list="friendIdx" :sticky="false" :custom-nav-height="customNavHeight">
|
||||
@@ -67,9 +67,7 @@
|
||||
},
|
||||
methods: {
|
||||
onAddNewFriends() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/friend/friend-add',
|
||||
});
|
||||
uni.switchTab({ url: '/pages/home/home' });
|
||||
},
|
||||
firstLetter(strText) {
|
||||
// 使用pinyin-pro库将中文转换为拼音
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
});
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 0,
|
||||
index: 2,
|
||||
complete: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<wd-navbar title="" safeAreaInsetTop style="z-index: 999999 !important" :bordered="false">
|
||||
<template #left>
|
||||
<view class="flex items-center h-full">
|
||||
<segmented v-model="current" :items="segmentedItems" />
|
||||
<segmented v-model="current" :items="segmentedItems" @change="segmentedChange" />
|
||||
</view>
|
||||
</template>
|
||||
<template #right>
|
||||
@@ -18,6 +18,8 @@
|
||||
:loadMoreStatus="loadMoreStatus"
|
||||
@refresh="refreshList"
|
||||
@loadMore="listLoadMore"
|
||||
@scroll="(e) => (scrollTop = e.detail.scrollTop)"
|
||||
:scroll-top="scrollTop"
|
||||
>
|
||||
<swiper
|
||||
class="h-300rpx mx-4"
|
||||
@@ -61,17 +63,21 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import segmented from '@/sheep/components/segmented/segmented.vue';
|
||||
import MomentCard from '@/sheep/components/moment-card/moment-card.vue';
|
||||
import ScrollList from '@/sheep/components/scroll-list/scroll-list.vue';
|
||||
import useScroll from '@/sheep/hooks/use-scroll';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const userCity = computed(() => sheep.$store('user').userCity);
|
||||
const params = reactive({
|
||||
scene: 'DYNAMIC_RECOMMEND',
|
||||
scene: '',
|
||||
province: '',
|
||||
city: '',
|
||||
city: userCity.value.t,
|
||||
memberId: '',
|
||||
});
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
@@ -79,7 +85,25 @@
|
||||
params,
|
||||
);
|
||||
const current = ref(0);
|
||||
const segmentedItems = ['动态', '附近'];
|
||||
const segmentedItems = ref([]);
|
||||
const scrollTop = ref(0);
|
||||
|
||||
onLoad(async () => {
|
||||
// 获取顶部导航栏tab菜单
|
||||
const { data } = await RecentApi.getDynamicTabMenu();
|
||||
if (data && data.length > 0) {
|
||||
segmentedItems.value = data;
|
||||
params.scene = data[0]['search-action'];
|
||||
refreshList();
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
() => userCity.value,
|
||||
(val) => {
|
||||
params.city = val.value.t;
|
||||
},
|
||||
);
|
||||
|
||||
// 查看用户详情
|
||||
const goDetail = (user: any) => {
|
||||
@@ -90,4 +114,10 @@
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const segmentedChange = async (item: any) => {
|
||||
params.scene = item['search-action'];
|
||||
scrollTop.value = 0;
|
||||
await refreshList();
|
||||
};
|
||||
</script>
|
||||
@@ -16,50 +16,75 @@
|
||||
</template>
|
||||
</wd-navbar>
|
||||
|
||||
<wd-textarea v-model="params.description" :maxlength="1000" clearable show-word-limit />
|
||||
<wd-tabs v-model="activeTab">
|
||||
<wd-tab title="发图片">
|
||||
<view class="p-4">
|
||||
<s-uploader v-model:url="params.coverPic" fileMediatype="image" limit="1" mode="grid" />
|
||||
</view>
|
||||
</wd-tab>
|
||||
<wd-tab title="发视频">
|
||||
<view class="p-4">
|
||||
<s-uploader v-model:url="params.videos" fileMediatype="video" limit="1" mode="grid" />
|
||||
</view>
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
<scroll-view scroll-y style="height: calc(100dvh - 44px)">
|
||||
<wd-textarea v-model="params.description" :maxlength="1000" clearable show-word-limit />
|
||||
<wd-tabs v-model="activeTab">
|
||||
<wd-tab title="发图片">
|
||||
<view class="px-4 py-8">
|
||||
<wd-upload
|
||||
v-model:file-list="params.coverPic"
|
||||
:action="baseUrl + apiPath + '/infra/file/upload'"
|
||||
:header="header"
|
||||
image-mode="aspectFill"
|
||||
accept="image"
|
||||
multiple
|
||||
:limit="6"
|
||||
:max-size="500000"
|
||||
/>
|
||||
</view>
|
||||
</wd-tab>
|
||||
<wd-tab title="发视频">
|
||||
<view class="px-4 py-8">
|
||||
<wd-upload
|
||||
v-model:file-list="params.coverVideo"
|
||||
:action="baseUrl + apiPath + '/infra/file/upload'"
|
||||
:header="header"
|
||||
image-mode="aspectFill"
|
||||
accept="video"
|
||||
multiple
|
||||
:limit="6"
|
||||
:max-size="2000000"
|
||||
/>
|
||||
</view>
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
|
||||
<wd-col-picker
|
||||
label="选择地址"
|
||||
title="选择地址"
|
||||
align-right
|
||||
v-model="addressValue"
|
||||
:columns="area"
|
||||
:column-change="columnChange"
|
||||
@confirm="areaPickerConfirm"
|
||||
/>
|
||||
<wd-cell title="详细地址" vertical>
|
||||
<wd-input v-model.trim="params.issueAddress" :maxlength="20" show-word-limit />
|
||||
</wd-cell>
|
||||
<wd-col-picker
|
||||
label="选择地址"
|
||||
title="选择地址"
|
||||
align-right
|
||||
v-model="addressValue"
|
||||
:columns="area"
|
||||
:column-change="columnChange"
|
||||
@confirm="areaPickerConfirm"
|
||||
/>
|
||||
<wd-cell title="详细地址" vertical>
|
||||
<wd-input v-model.trim="params.issueAddress" :maxlength="20" show-word-limit />
|
||||
</wd-cell>
|
||||
<view class="h-100" />
|
||||
</scroll-view>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import sUploader from '@/sheep/components/s-uploader/s-uploader.vue';
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { useColPickerData } from '@/sheep/hooks/use-col-picker-data';
|
||||
import { type ColPickerColumnChange } from '@/uni_modules/wot-design-uni/components/wd-col-picker/types';
|
||||
// @ts-ignore
|
||||
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
|
||||
// @ts-ignore
|
||||
import { getAccessToken } from '@/sheep/request';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const { colPickerData, findChildrenByCode } = useColPickerData();
|
||||
|
||||
const activeTab = ref<0 | 1>(0);
|
||||
const addressValue = ref<string[]>([]);
|
||||
const params = reactive({
|
||||
description: '',
|
||||
coverPic: [],
|
||||
videos: [],
|
||||
coverVideo: [],
|
||||
description: '',
|
||||
issueLong: '0',
|
||||
issueLat: '0',
|
||||
issueProvince: '',
|
||||
@@ -67,6 +92,12 @@
|
||||
issueDistrict: '',
|
||||
issueAddress: '',
|
||||
});
|
||||
const coverPic = computed(() => {
|
||||
return params.coverPic.map((item: any) => JSON.parse(item.response).data);
|
||||
});
|
||||
const coverVideo = computed(() => {
|
||||
return params.coverVideo.map((item: any) => JSON.parse(item.response).data);
|
||||
});
|
||||
const area = ref<any[]>([
|
||||
colPickerData.map((item) => {
|
||||
return {
|
||||
@@ -113,30 +144,34 @@
|
||||
params.issueLong = String(res.longitude);
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({ title: '位置信息获取失败', icon: 'none' });
|
||||
uni.showToast({ title: '位置信息获取失败,请打开系统定位', icon: 'none' });
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const header = {
|
||||
Accept: '*/*',
|
||||
'tenant-id': tenantId,
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
};
|
||||
|
||||
onLoad(() => {
|
||||
getLocation();
|
||||
});
|
||||
|
||||
// 发布朋友圈
|
||||
const publishMoments = async () => {
|
||||
getLocation();
|
||||
|
||||
if (!params.description || !params.issueProvince || !params.issueAddress)
|
||||
return uni.showToast({ title: '请填写内容', icon: 'error' });
|
||||
if (!params.coverPic || !params.coverPic.length)
|
||||
return uni.showToast({ title: '请上传图片', icon: 'error' });
|
||||
getLocation();
|
||||
|
||||
if (activeTab.value === 0) {
|
||||
if (!params.coverPic || !params.coverPic.length)
|
||||
return uni.showToast({ title: '请上传图片', icon: 'error' });
|
||||
}
|
||||
|
||||
if (activeTab.value === 1) {
|
||||
if (!params.videos || !params.videos.length)
|
||||
return uni.showToast({ title: '请上传视频', icon: 'error' });
|
||||
params.coverPic = params.videos;
|
||||
}
|
||||
|
||||
await RecentApi.createMoment(params);
|
||||
await RecentApi.createMoment({
|
||||
...params,
|
||||
coverPic: coverPic.value.join(','),
|
||||
coverVideo: coverVideo.value.join(','),
|
||||
});
|
||||
back();
|
||||
};
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ const AuthUtil = {
|
||||
data: { ...data, socialType: 35 },
|
||||
custom: {
|
||||
showSuccess: true,
|
||||
loadingMsg: '注册中',
|
||||
successMsg: '注册成功',
|
||||
loadingMsg: '登录中',
|
||||
successMsg: '登录成功',
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -13,6 +13,26 @@ const RecentApi = {
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取首页顶部导航栏的tab菜单
|
||||
getSquareTabMenu: () => {
|
||||
return request({
|
||||
url: '/view/get-square-classify',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 获取动态页顶部导航栏的tab菜单
|
||||
getDynamicTabMenu: () => {
|
||||
return request({
|
||||
url: '/view/get-dynamic-classify',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: false,
|
||||
},
|
||||
});
|
||||
},
|
||||
// 查询附近/广场
|
||||
quickPage: (data: any) => {
|
||||
return request({
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
@refresherabort="onRefresherAbort"
|
||||
@refresherrefresh="onRefresherRefresh"
|
||||
@scrolltolower="onScrollToLower"
|
||||
@scroll="(e: any) => emit('scroll', e)"
|
||||
@scroll="scroll"
|
||||
v-bind="attrs"
|
||||
>
|
||||
<slot />
|
||||
@@ -23,7 +23,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, useAttrs } from 'vue';
|
||||
import { reactive, ref, useAttrs } from 'vue';
|
||||
|
||||
const attrs = useAttrs();
|
||||
const props = withDefaults(
|
||||
@@ -48,10 +48,6 @@
|
||||
contentnomore: '没有更多数据了',
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
onScrollToLower();
|
||||
});
|
||||
|
||||
// 下拉刷新中止
|
||||
const onRefresherAbort = () => {
|
||||
refresherTriggered.value = false;
|
||||
@@ -72,4 +68,8 @@
|
||||
}
|
||||
emit('loadMore');
|
||||
};
|
||||
|
||||
const scroll = (e: any) => {
|
||||
emit('scroll', e);
|
||||
};
|
||||
</script>
|
||||
@@ -6,11 +6,11 @@
|
||||
<view
|
||||
class="relative z-10 flex-1 h-40rpx line-height-40rpx text-center text-xs font-500 active:text-color-theme"
|
||||
v-for="(item, index) in items"
|
||||
:key="item"
|
||||
:key="index"
|
||||
:class="{ active: modelValue === index }"
|
||||
@click="segmentedItem(index)"
|
||||
@click="segmentedItem(item, index)"
|
||||
>
|
||||
<text>{{ item }}</text>
|
||||
<text>{{ item.label }}</text>
|
||||
</view>
|
||||
<div
|
||||
class="absolute h-2/3 bg-color-theme-dark rounded-full transform duration-100"
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
items?: string[];
|
||||
items?: { label: string }[];
|
||||
modelValue?: number | string;
|
||||
}>(),
|
||||
{
|
||||
@@ -34,7 +34,7 @@
|
||||
);
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', index: number): void;
|
||||
(e: 'change', target: { currentIndex: number }): void;
|
||||
(e: 'change', target: { label: string }): void;
|
||||
}>();
|
||||
|
||||
const activeStyle = computed(() => {
|
||||
@@ -49,11 +49,9 @@
|
||||
return { width: `${props.items.length * 50}px` };
|
||||
});
|
||||
|
||||
function segmentedItem(index: number) {
|
||||
function segmentedItem(item: { label: string }, index: number) {
|
||||
if (props.modelValue === index) return;
|
||||
emit('update:modelValue', index);
|
||||
emit('change', {
|
||||
currentIndex: index,
|
||||
});
|
||||
emit('change', item);
|
||||
}
|
||||
</script>
|
||||
@@ -115,6 +115,7 @@ http.interceptors.response.use(
|
||||
// 约定:如果是 /auth/ 下的 URL 地址,并且返回了 accessToken 说明是登录相关的接口,则自动设置登陆令牌
|
||||
if (response.config.url.indexOf('/member/auth/') >= 0 && response.data?.data?.accessToken) {
|
||||
$store('user').setToken(response.data.data.accessToken, response.data.data.refreshToken);
|
||||
uni.setStorageSync('loginInfo', response.data.data.chatToken); // 聊天相关token
|
||||
}
|
||||
|
||||
// 自定处理【loading 加载中】:如果需要显示 loading,则关闭 loading
|
||||
|
||||
@@ -141,8 +141,8 @@ const adaptTenant = async () => {
|
||||
|
||||
// 如果 URL 参数中没有,则通过 host 获取
|
||||
if (!newTenantId && window.location.host) {
|
||||
const { data } = await getTenantByWebsite(window.location.host);
|
||||
newTenantId = data?.id;
|
||||
// const { data } = await getTenantByWebsite(window.location.host);
|
||||
// newTenantId = data?.id;
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Reference in new issue
Block a user