feat:bug修改
This commit is contained in:
1 parent
afd84e06e7
commit
67d558d6a6
12 files changed
+281
-179
No files matched your search
@@ -257,6 +257,13 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "userinfo-simple",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的账号",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "userinfo",
|
||||
"style": {
|
||||
|
||||
Whitespace-only changes.
@@ -75,11 +75,17 @@
|
||||
</view>
|
||||
|
||||
<view class="m-4">
|
||||
<view class="my-2 text-base">
|
||||
<text>评价</text>
|
||||
<text class="text-sm ml-1">{{ userDetail.operationTotal?.recentShieldTotal || 0 }}</text>
|
||||
<view class="flex items-center justify-between my-2 text-base">
|
||||
<view class="flex items-center">
|
||||
<text class="text-size-base">评价</text>
|
||||
<text class="text-sm ml-1">{{ userDetail.operationTotal?.recentShieldTotal || 0 }}</text>
|
||||
<text class="ml-50rpx text-size-xs color-#D29E52">综合评分:3.2</text>
|
||||
</view>
|
||||
<view class="bg-#D29E52 rounded-full px-2 py-0.5">
|
||||
<text class="text-size-sm">评价Ta</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-around flex-wrap text-color-theme text-base">
|
||||
<view class="mt-3 flex justify-around flex-wrap text-color-theme text-base">
|
||||
<view class="bg-color-dark flex items-center px-2 py-1 mb-2 rounded-2 gap-2">
|
||||
<text>身材</text>
|
||||
<uni-rate v-model="rating.scoreSc" size="18" readonly />
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="send-bar">
|
||||
<view v-if="!isMessageUser" class="send-bar">
|
||||
<view v-if="!showRecord" class="iconfont icon-voice-circle" @click="onRecorderInput()"></view>
|
||||
<view v-else class="iconfont icon-keyboard" @click="onKeyboardInput()"></view>
|
||||
<chat-record v-if="showRecord" class="chat-record" @send="onSendRecord"></chat-record>
|
||||
|
||||
@@ -14,45 +14,43 @@
|
||||
</view>
|
||||
<view class="text-base mx-4 my-2">图片</view>
|
||||
<view class="px-4">
|
||||
<s-uploader
|
||||
v-model:url="params.pic"
|
||||
fileMediatype="image"
|
||||
limit="1"
|
||||
mode="grid"
|
||||
:imageStyles="{
|
||||
border: { width: '6rpx', color: '#D29E52' },
|
||||
}"
|
||||
/>
|
||||
<s-uploader v-model:url="params.pic" fileMediatype="image" limit="1" mode="grid" :imageStyles="{
|
||||
border: { width: '6rpx', color: '#D29E52' },
|
||||
}" />
|
||||
</view>
|
||||
<view
|
||||
v-if="!isSubmit"
|
||||
<view v-if="!isSubmit"
|
||||
class="mt-80rpx w-1/3 mx-auto rounded-full bg-color-theme-dark text-base text-center py-2 active:bg-color-theme"
|
||||
@click="submitFeedback"
|
||||
>
|
||||
@click="submitFeedback">
|
||||
提交反馈
|
||||
</view>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { reactive, ref } from 'vue';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { reactive, ref } from 'vue';
|
||||
|
||||
const themeVars = reactive({
|
||||
darkBackground2: '#333',
|
||||
});
|
||||
const themeVars = reactive({
|
||||
darkBackground2: '#333',
|
||||
});
|
||||
|
||||
const params = reactive({
|
||||
content: '',
|
||||
pic: '',
|
||||
});
|
||||
const isSubmit = ref(false);
|
||||
const params = reactive({
|
||||
content: '',
|
||||
pic: '',
|
||||
});
|
||||
const isSubmit = ref(false);
|
||||
|
||||
const submitFeedback = async () => {
|
||||
if (!params.content || !params.pic)
|
||||
return uni.showToast({ title: '请填写内容', icon: 'error' });
|
||||
await RecentApi.feedback(params);
|
||||
uni.showToast({ title: '提交成功', icon: 'success' });
|
||||
isSubmit.value = true;
|
||||
};
|
||||
const submitFeedback = async () => {
|
||||
if (!params.content) {
|
||||
uni.showToast({ title: '请填写问题描述', icon: 'none' });
|
||||
return
|
||||
}
|
||||
if (!params.pic) {
|
||||
uni.showToast({ title: '请上传图片', icon: 'none' });
|
||||
return
|
||||
}
|
||||
await RecentApi.feedback(params);
|
||||
uni.showToast({ title: '提交成功', icon: 'success' });
|
||||
isSubmit.value = true;
|
||||
};
|
||||
</script>
|
||||
+50
-64
@@ -11,31 +11,17 @@
|
||||
</template>
|
||||
</wd-navbar>
|
||||
|
||||
<swiper
|
||||
:current="current"
|
||||
style="height: calc(100vh - 44rpx - 100rpx)"
|
||||
@change="(e) => (current = e.detail.current)"
|
||||
:duration="200"
|
||||
>
|
||||
<swiper :current="current" style="height: calc(100vh - 44rpx - 100rpx)"
|
||||
@change="(e) => (current = e.detail.current)" :duration="200">
|
||||
<swiper-item>
|
||||
<scroll-list
|
||||
:loadMoreStatus="loadMoreStatus0"
|
||||
@refresh="refreshList0"
|
||||
@loadMore="listLoadMore0"
|
||||
:show-scrollbar="false"
|
||||
:refresherEnabled="false"
|
||||
>
|
||||
<scroll-list :loadMoreStatus="loadMoreStatus0" @refresh="refreshList0" @loadMore="listLoadMore0"
|
||||
:show-scrollbar="false" :refresherEnabled="false">
|
||||
<user-card v-for="user in listData0" :key="user.id" :data="user" @click="detail(user)" />
|
||||
</scroll-list>
|
||||
</swiper-item>
|
||||
<swiper-item>
|
||||
<scroll-list
|
||||
:loadMoreStatus="loadMoreStatus1"
|
||||
@refresh="refreshList1"
|
||||
@loadMore="listLoadMore1"
|
||||
:show-scrollbar="false"
|
||||
:refresherEnabled="false"
|
||||
>
|
||||
<scroll-list :loadMoreStatus="loadMoreStatus1" @refresh="refreshList1" @loadMore="listLoadMore1"
|
||||
:show-scrollbar="false" :refresherEnabled="false">
|
||||
<user-card v-for="user in listData1" :key="user.id" :data="user" @click="detail(user)" />
|
||||
</scroll-list>
|
||||
</swiper-item>
|
||||
@@ -44,52 +30,52 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import segmented from '@/sheep/components/segmented/segmented.vue';
|
||||
import UserCard from '@/sheep/components/user-card/user-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';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import segmented from '@/sheep/components/segmented/segmented.vue';
|
||||
import UserCard from '@/sheep/components/user-card/user-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';
|
||||
|
||||
const current = ref<0 | 1 | number>(0);
|
||||
const segmentedItems = [
|
||||
{ code: 0, label: '我喜欢' },
|
||||
{ code: 1, label: '喜欢我' },
|
||||
];
|
||||
const {
|
||||
listData: listData0,
|
||||
loadMoreStatus: loadMoreStatus0,
|
||||
refreshList: refreshList0,
|
||||
listLoadMore: listLoadMore0,
|
||||
} = useScroll(RecentApi.likeIt);
|
||||
const {
|
||||
listData: listData1,
|
||||
loadMoreStatus: loadMoreStatus1,
|
||||
refreshList: refreshList1,
|
||||
listLoadMore: listLoadMore1,
|
||||
} = useScroll(RecentApi.likeMe);
|
||||
const current = ref<0 | 1 | number>(0);
|
||||
const segmentedItems = [
|
||||
{ code: 0, label: '我的关注' },
|
||||
{ code: 1, label: '我的粉丝' },
|
||||
];
|
||||
const {
|
||||
listData: listData0,
|
||||
loadMoreStatus: loadMoreStatus0,
|
||||
refreshList: refreshList0,
|
||||
listLoadMore: listLoadMore0,
|
||||
} = useScroll(RecentApi.likeIt);
|
||||
const {
|
||||
listData: listData1,
|
||||
loadMoreStatus: loadMoreStatus1,
|
||||
refreshList: refreshList1,
|
||||
listLoadMore: listLoadMore1,
|
||||
} = useScroll(RecentApi.likeMe);
|
||||
|
||||
onLoad((options: any) => {
|
||||
const { type = 0 } = options;
|
||||
current.value = type;
|
||||
onLoad((options: any) => {
|
||||
const { type = 0 } = options;
|
||||
current.value = type;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
refreshList0();
|
||||
refreshList1();
|
||||
});
|
||||
|
||||
const detail = (user: any) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/home/detail?memberId=${user.memberId}`,
|
||||
success: function (res) {
|
||||
res.eventChannel.emit('recentDetail', user);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
refreshList0();
|
||||
refreshList1();
|
||||
});
|
||||
|
||||
const detail = (user: any) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/home/detail?memberId=${user.memberId}`,
|
||||
success: function (res) {
|
||||
res.eventChannel.emit('recentDetail', user);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
function back() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
function back() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
</script>
|
||||
@@ -9,8 +9,9 @@
|
||||
</wd-navbar>
|
||||
|
||||
<wd-cell-group v-if="!loading">
|
||||
<wd-cell title="手机号" :value="userInfo?.mobile" />
|
||||
<wd-cell title="设置微信" :value="userInfo?.wechatNum" is-link ellipsis to="/pages/profile/set-wechat" />
|
||||
<wd-cell v-if="false" title="手机号" :value="userInfo?.mobile" />
|
||||
<wd-cell title="我的账号" is-link to="/pages/profile/userinfo-simple" />
|
||||
<wd-cell v-if="false" title="设置微信" :value="userInfo?.wechatNum" is-link ellipsis to="/pages/profile/set-wechat" />
|
||||
<wd-cell title="黑名单" is-link ellipsis to="/pages/profile/black-list" />
|
||||
<wd-cell title="客服邮箱" value="18917151569@163.com" is-link @tap="copyEmail('18917151569@163.com')" />
|
||||
<wd-cell title="消息推送" value="消息推送" ellipsis>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="我的账号" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#D29E52"></uni-icons>
|
||||
</navigator>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<wd-cell-group v-if="!loading">
|
||||
<wd-cell title="手机号" :value="userInfo?.mobile" />
|
||||
<wd-cell title="微信" :value="userInfo?.wechatNum" />
|
||||
<wd-cell title="注销账号" is-link @tap="writeoff" />
|
||||
</wd-cell-group>
|
||||
<wd-message-box selector="writeoff" />
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni';
|
||||
|
||||
const writeoffMessage = useMessage('writeoff')
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
onShow(() => {
|
||||
sheep.$store('user').updateUserData();
|
||||
})
|
||||
|
||||
// 注销
|
||||
const writeoff = () => {
|
||||
writeoffMessage.confirm({
|
||||
title: '提示',
|
||||
msg: '确定注销账号吗?,注销请求发送后,十五天后会自动生效,期间重新登录会自动取消这一流程,是否继续?'
|
||||
})
|
||||
.then(() => {
|
||||
uni.showToast({ title: '注销成功', icon: 'success' });
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -3,10 +3,10 @@
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="我的" safeAreaInsetTop :bordered="false">
|
||||
<template #right>
|
||||
<navigator url="/pages/profile/userinfo" open-type="navigate" hover-class="navigator-hover">
|
||||
<navigator url="/pages/profile/setting" open-type="navigate" hover-class="navigator-hover">
|
||||
<view class="flex items-center rounded-full h-44rpx bg-color-theme py-1 px-2 text-black">
|
||||
<uni-icons type="auth" size="20" color="#333"></uni-icons>
|
||||
<text class="text-sm">编辑资料</text>
|
||||
<wd-icon name="setting" size="18" color="#333" />
|
||||
<text class="text-sm m-l-6rpx">设置</text>
|
||||
</view>
|
||||
</navigator>
|
||||
</template>
|
||||
@@ -14,41 +14,43 @@
|
||||
|
||||
<scroll-view class="h-[calc(100vh-144rpx)]" scroll-y>
|
||||
<!-- 个人信息 -->
|
||||
<view class="flex items-center p-6">
|
||||
<image :src="userInfo.avatar" class="mr-4 size-100px rounded-full bg-#333 border border-amber border-solid"
|
||||
mode="aspectFill" />
|
||||
<view class="flex-1">
|
||||
<view class="mb-1 text-base">
|
||||
<text>{{ userInfo.nickname }}</text>
|
||||
<image class="size-26rpx ml-2" :src="userGenderImageSrc" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="mb-2 text-xs text-#ffffff80 flex items-center">
|
||||
<text>ID: {{ userInfo.id }}</text>
|
||||
<view v-if="userInfo.memberVip?.vip"
|
||||
class="text-20rpx ml-2 flex-row-center bg-color-theme-dark px-1 rounded-1">
|
||||
<uni-icons type="vip-filled" size="14" />
|
||||
<text class="text-color-dark ml-1">VIP</text>
|
||||
<navigator url="/pages/profile/userinfo" open-type="navigate" hover-class="navigator-hover">
|
||||
<view class="flex items-center p-6">
|
||||
<image :src="userInfo.avatar" class="mr-4 size-100px rounded-full bg-#333 border border-amber border-solid"
|
||||
mode="aspectFill" />
|
||||
<view class="flex-1">
|
||||
<view class="mb-1 text-base">
|
||||
<text>{{ userInfo.nickname }}</text>
|
||||
<image class="size-26rpx ml-2" :src="userGenderImageSrc" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="mb-2 text-xs text-#ffffff80 flex items-center">
|
||||
<text>ID: {{ userInfo.id }}</text>
|
||||
<view v-if="userInfo.memberVip?.vip"
|
||||
class="text-20rpx ml-2 flex-row-center bg-color-theme-dark px-1 rounded-1">
|
||||
<uni-icons type="vip-filled" size="14" />
|
||||
<text class="text-color-dark ml-1">VIP</text>
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="userCity?.t" class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1 truncate">
|
||||
{{ userCity?.t || '' }}
|
||||
</text>
|
||||
</view>
|
||||
<text v-if="userCity?.t" class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1 truncate">
|
||||
{{ userCity?.t || '' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
|
||||
<!-- 我喜欢和钱包 -->
|
||||
<view class="flex my-4">
|
||||
<view class="flex m-b-4">
|
||||
<view class="flex-1 flex-col-center" @click="goLike(0)">
|
||||
<text class="text-color-theme font-600 text-lg">
|
||||
{{ recentTotal.userLikeItTotal || 0 }}
|
||||
</text>
|
||||
<text class="text-color-theme text-sm">我喜欢</text>
|
||||
<text class="text-color-theme text-sm">我的关注</text>
|
||||
</view>
|
||||
<view class="flex-1 flex-col-center" @click="goLike(1)">
|
||||
<text class="text-color-theme font-600 text-lg">
|
||||
{{ recentTotal.userLikeMeTotal || 0 }}
|
||||
</text>
|
||||
<text class="text-color-theme text-sm">喜欢我</text>
|
||||
<text class="text-color-theme text-sm">我的粉丝</text>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<navigator url="/pages/profile/recharge" open-type="navigate" hover-class="navigator-hover">
|
||||
@@ -103,8 +105,13 @@
|
||||
<!-- 菜单 -->
|
||||
<view class="mt-2 mx-1">
|
||||
<wd-cell-group>
|
||||
<wd-cell v-for="(item, index) in MenuCellList" :key="index" :title="item.title" :value="item.value"
|
||||
icon-size="24" :icon="item.icon" is-link ellipsis :to="item.to" @click="item.onClick" />
|
||||
<wd-cell v-for="(item, index) in MenuCellList" :key="index" :title="item.title" title-width="110px"
|
||||
:value="item.value" icon-size="24" :icon="item.icon" is-link :to="item.to" @click="item.onClick">
|
||||
<view class="h-full flex items-center">
|
||||
<view v-if="item.icon == 'service'" class="size-10rpx rounded-full bg-red"></view>
|
||||
<text class="m-l-6rpx text-xs">{{ item.value }}</text>
|
||||
</view>
|
||||
</wd-cell>
|
||||
</wd-cell-group>
|
||||
</view>
|
||||
<view class="h-100rpx"></view>
|
||||
@@ -141,9 +148,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
<wd-curtain v-model="curtainShow"
|
||||
src="https://img20.360buyimg.com/da/jfs/t1/141592/25/8861/261559/5f68d8c1E33ed78ab/698ad655bfcfbaed.png"
|
||||
close-position="top-right" :width="300" close-on-click-modal show-menu-by-longpress />
|
||||
<wd-message-box selector="gzh">
|
||||
<view>
|
||||
<view class="text-sm m-t-20rpx">使用微信扫码,第一时间获取活动信息。</view>
|
||||
<image class="w-80% m-t-20rpx" src="/src/static/gzh/gzh.jpg" mode="widthFix" />
|
||||
</view>
|
||||
</wd-message-box>
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
@@ -159,9 +169,13 @@ import { onShow } from '@dcloudio/uni-app';
|
||||
import { formatDate } from '@/sheep/helper/utils';
|
||||
// @ts-ignore
|
||||
import { fen2yuanSimple } from '@/sheep/hooks/useGoods';
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni';
|
||||
import { gotoAppPermissionSetting, requestPermission } from '@/sheep/util/permission';
|
||||
|
||||
const { ablumList } = useAblum();
|
||||
|
||||
const gzhMessage = useMessage('gzh')
|
||||
|
||||
// 统计信息
|
||||
const recentTotal = ref({
|
||||
memberRecentId: null,
|
||||
@@ -186,7 +200,6 @@ const myEvaluation = reactive({
|
||||
evaluateCount: 0,
|
||||
});
|
||||
const myEvaluationShow = ref(false); // 我的评价弹窗
|
||||
const curtainShow = ref(false); // 关注公众号弹窗
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
const userCity = computed(() => sheep.$store('user').userCity);
|
||||
@@ -224,7 +237,32 @@ const lookMyEvaluation = async () => {
|
||||
|
||||
// 关注公众号
|
||||
const subOfficial = () => {
|
||||
curtainShow.value = true;
|
||||
gzhMessage
|
||||
.alert({
|
||||
title: '领取福利',
|
||||
msg: "使用微信扫码,第一时间获取活动信息。",
|
||||
confirmButtonText: "保存图片",
|
||||
})
|
||||
.then(async () => {
|
||||
// 首先请求存储权限
|
||||
// #ifdef APP-PLUS || MP-WEIXIN
|
||||
const permissionStatus = await requestPermission("location")
|
||||
// 已拒绝|受限
|
||||
if (permissionStatus === 'denied') {
|
||||
gotoAppPermissionSetting()
|
||||
}
|
||||
// #endif
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: "/src/static/gzh/gzh.jpg",
|
||||
success: () => {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' });
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({ title: '保存失败', icon: 'none' });
|
||||
console.error('|保存海报|,意外的错误:', err);
|
||||
},
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
// 问题反馈
|
||||
@@ -239,11 +277,12 @@ const MenuCellList = [
|
||||
{ title: '我的收益', value: '', icon: 'wallet', to: '/pages/wechat-tabbar/index' },
|
||||
{ title: '访客记录', value: '', icon: 'browse', to: '/pages/profile/view-record' },
|
||||
{ title: '认证中心', value: '', icon: 'user', to: '/pages/profile/verify-status' },
|
||||
{ title: '联系方式', value: '修改微信需客服核实', icon: 'user', to: '/pages/profile/set-wechat' },
|
||||
{ title: '我的动态', value: '', icon: 'star', to: '/pages/profile/my-moment' },
|
||||
{ title: '我的评价', value: '', icon: 'view-module', to: '', onClick: lookMyEvaluation },
|
||||
{ title: '问题反馈', value: '', icon: 'backtop-rectangle', to: '', onClick: goFeedback },
|
||||
// { title: '客服助手', value: '', icon: 'service', to: '' },
|
||||
// { title: '关注公众号', value: '获取最新消息', icon: 'qrcode', to: '', onClick: subOfficial },
|
||||
{ title: '设置', value: '', icon: 'setting1', to: '/pages/profile/setting' },
|
||||
{ title: '客服助手', value: '遇到问题点击这里', icon: 'service', to: '' },
|
||||
{ title: '关注公众号', value: '领取福利、获取最新下载地址', icon: 'qrcode', to: '', onClick: subOfficial },
|
||||
// { title: '设置', value: '', icon: 'setting1', to: '/pages/profile/setting' },
|
||||
];
|
||||
</script>
|
||||
@@ -1,58 +1,50 @@
|
||||
<template>
|
||||
<view
|
||||
v-if="items.length"
|
||||
<view v-if="items.length"
|
||||
class="flex items-center relative mx-auto border-1 border-solid border-#666 bg-#333 rounded-full overflow-hidden p-1"
|
||||
:style="segmentedWidth"
|
||||
>
|
||||
:style="segmentedWidth">
|
||||
<view
|
||||
class="relative z-10 flex-1 h-40rpx line-height-40rpx text-center text-xs font-500 c-#fff active:text-color-theme"
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
:class="{ active: modelValue === index }"
|
||||
@click="segmentedItem(item, index)"
|
||||
>
|
||||
v-for="(item, index) in items" :key="index" :class="{ active: modelValue === index }"
|
||||
@click="segmentedItem(item, index)">
|
||||
<text>{{ item.label }}</text>
|
||||
</view>
|
||||
<div
|
||||
class="absolute h-2/3 bg-color-theme-dark rounded-full transform duration-100"
|
||||
:style="activeStyle"
|
||||
></div>
|
||||
<div class="absolute h-2/3 bg-color-theme-dark rounded-full transform duration-100" :style="activeStyle"></div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
items?: { label: string }[];
|
||||
modelValue?: number | string;
|
||||
}>(),
|
||||
{
|
||||
items: () => [],
|
||||
modelValue: 0,
|
||||
},
|
||||
);
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', index: number): void;
|
||||
(e: 'change', item: { label: string }, index: number): void;
|
||||
}>();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
items?: { label: string }[];
|
||||
modelValue?: number | string;
|
||||
}>(),
|
||||
{
|
||||
items: () => [],
|
||||
modelValue: 0,
|
||||
},
|
||||
);
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', index: number): void;
|
||||
(e: 'change', item: { label: string }, index: number): void;
|
||||
}>();
|
||||
|
||||
const activeStyle = computed(() => {
|
||||
const x = 50 * Number(props.modelValue);
|
||||
return {
|
||||
width: `${50}px`,
|
||||
transform: `translate3d(${x}px, 0, 0)`,
|
||||
};
|
||||
});
|
||||
const activeStyle = computed(() => {
|
||||
const x = 60 * Number(props.modelValue);
|
||||
return {
|
||||
width: `${60}px`,
|
||||
transform: `translate3d(${x}px, 0, 0)`,
|
||||
};
|
||||
});
|
||||
|
||||
const segmentedWidth = computed(() => {
|
||||
return { width: `${props.items.length * 50}px` };
|
||||
});
|
||||
const segmentedWidth = computed(() => {
|
||||
return { width: `${props.items.length * 60}px` };
|
||||
});
|
||||
|
||||
function segmentedItem(item: { label: string }, index: number) {
|
||||
if (props.modelValue === index) return;
|
||||
emit('update:modelValue', index);
|
||||
emit('change', item, index);
|
||||
}
|
||||
function segmentedItem(item: { label: string }, index: number) {
|
||||
if (props.modelValue === index) return;
|
||||
emit('update:modelValue', index);
|
||||
emit('change', item, index);
|
||||
}
|
||||
</script>
|
||||
@@ -1,4 +1,4 @@
|
||||
type PermissionId = 'location';
|
||||
type PermissionId = 'location' | 'storage';
|
||||
/**
|
||||
* 权限请求状态
|
||||
* - none: 未请求
|
||||
@@ -62,6 +62,9 @@ const requestIos = (permissionId: PermissionId): Promise<RequestStatus> => {
|
||||
case 'location':
|
||||
resolve(iosLocation());
|
||||
break;
|
||||
case 'storage':
|
||||
resolve(iosStorage());
|
||||
break;
|
||||
default:
|
||||
resolve('denied');
|
||||
break;
|
||||
@@ -92,6 +95,26 @@ const iosLocation = (): RequestStatus => {
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 请求ios存储权限
|
||||
* @returns 权限请求状态
|
||||
*/
|
||||
const iosStorage = (): RequestStatus => {
|
||||
let result: RequestStatus = 'denied';
|
||||
// @ts-ignore
|
||||
const NSPhotoLibraryUsageDescription = plus.ios.import('NSPhotoLibraryUsageDescription');
|
||||
const status = NSPhotoLibraryUsageDescription.authorizationStatus();
|
||||
if (status === 0) {
|
||||
result = 'prompt';
|
||||
} else if (status === 3 || status === 4) {
|
||||
result = 'granted';
|
||||
} else {
|
||||
result = 'denied';
|
||||
}
|
||||
plus.ios.deleteObject(NSPhotoLibraryUsageDescription);
|
||||
return result;
|
||||
};
|
||||
|
||||
/******************************** andorid相关 ********************************/
|
||||
|
||||
/**
|
||||
@@ -104,6 +127,9 @@ const requestAndroid = (permissionID: PermissionId): Promise<RequestStatus> => {
|
||||
case 'location':
|
||||
androidPermissionKey = 'android.permission.ACCESS_FINE_LOCATION';
|
||||
break;
|
||||
case 'storage':
|
||||
androidPermissionKey = 'android.permission.WRITE_EXTERNAL_STORAGE';
|
||||
break;
|
||||
}
|
||||
if (!androidPermissionKey) {
|
||||
resolve('denied');
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in new issue
Block a user