Skip to content

Commit

Permalink
✨ feat: 快完成了
Browse files Browse the repository at this point in the history
  • Loading branch information
Chadwuo committed Apr 16, 2024
1 parent 54314ce commit 7d926d7
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 45 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@dcloudio/uni-mp-xhs": "3.0.0-3090920231225001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3090920231225001",
"dayjs": "^1.11.10",
"nanoid": "^3.3.7",
"pinia": "^2.0.36",
"pinia-plugin-persistedstate": "^3.2.1",
"pinyin-pro": "^3.19.6",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
import mpserverless from "~/alicloud/index";
import { useUserStore } from '~/stores/user'
onLaunch(async () => {
onLaunch(async (arg) => {
console.log('App Launch')
try {
await mpserverless.init()
// 初始化用户信息
await useUserStore().initUserInfo()
router.push({
path: '/pages/book/index',
tabBar: true
})
if (arg.path == 'pages/index') {
router.push({
path: '/pages/book/index',
tabBar: true
})
}
} catch (error) {
console.log('mpserverless error :>>', error)
uni.showModal({
Expand Down
113 changes: 98 additions & 15 deletions src/pages/family/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
<div class="bg-white rounded-2xl p-4 space-y-2xl" v-if="!userInfo.familyMembers">
<div class="text-center">
<img src="/static/home.svg">
<div class="text-xl font-bold mt-5">家庭共享</div>
<div class="text-xl font-bold mt-5">家人共享</div>
</div>

<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-device-mobile-share text-3xl"></i></div>
<div>
<div class="font-bold">协同共享记账</div>
<div class="text-gray text-sm">安全共享你的数据,使亲友和你共同记录家庭人情往来</div>
<div class="space-y-xl">
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-device-mobile-share text-3xl"></i></div>
<div>
<div class="font-bold">协同共享记账</div>
<div class="text-gray text-sm">安全共享你的数据,使亲友和你共同记录家庭人情往来</div>
</div>
</div>
</div>
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-lock-heart text-3xl"></i></div>
<div>
<div class="font-bold">私密且安全</div>
<div class="text-gray text-sm">信息会加密,你可以随时停止共享</div>
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-lock-heart text-3xl"></i></div>
<div>
<div class="font-bold">私密且安全</div>
<div class="text-gray text-sm">信息会加密,你可以随时停止共享</div>
</div>
</div>
</div>

Expand All @@ -30,28 +32,109 @@
<div class="bg-white rounded-2xl p-1">
<div class="bg-white rounded-2xl py-3 space-y-3 px-1">
<template v-for="i in userInfo.familyMembers" :key="i._id">
<uv-cell :title="i.user.nickName" :label="i.relation" :border="false" isLink>
<uv-cell :title="i.user.nickName" :label="i.relation" :border="false" isLink @click="onClick(i)">
<template v-slot:icon>
<uv-avatar :src="i.user.avatarUrl"></uv-avatar>
<div class="mr-3"><uv-avatar :src="i.user.avatarUrl"></uv-avatar></div>
</template>
</uv-cell>
</template>
</div>
</div>
<div class="mt-3">
<button openType="share" icon="plus" class="uv-reset-button bg-white rounded-2xl p-2">
<div class="text-red flex items-center justify-center"><div class="i-carbon-add text-2xl"></div> 邀请家庭成员</div>
<div class="text-red flex items-center justify-center">
<div class="i-carbon-add text-2xl"></div> 邀请家庭成员
</div>
</button>
</div>
</div>
</div>
<uv-action-sheet ref="actionSheetRef" :actions="actionSheetList" @select="onSelectedAction" safeAreaInsetBottom
:closeOnClickAction="false" cancelText="取消" round="1rem">
</uv-action-sheet>
</template>

<script setup>
import { useUserStore } from '~/stores/user'
import { storeToRefs } from 'pinia'
const { userInfo } = storeToRefs(useUserStore())
import { add, del, delFamilyMember } from '@/alicloud/services/family'
const loading = ref(false)
const onCreate = async () => {
loading.value = true
await add().then(async res => {
if (res.success) {
await useUserStore().initUserInfo()
}
}).finally(() => {
loading.value = false
})
}
const onClick = (i) => {
if (i.relation == '组织者') {
actionSheetList.value = [
{
name: '解散',
subname: '移除全部家庭成员并解散家庭',
data: i
}
]
} else {
actionSheetList.value = [
{
name: '删除',
subname: '从你的家庭中移除此成员',
data: i
}
]
}
actionSheetRef.value.open()
}
const actionSheetRef = ref(null)
const actionSheetList = ref([])
const onSelectedAction = async (e) => {
const { data, name } = e
e.loading = true
if (name == '删除') {
delFamilyMember({ _id: data._id }).then(async res => {
if (res.success) {
await useUserStore().initUserInfo()
actionSheetRef.value.close()
} else {
}
}).finally(() => {
e.loading = false
})
}
if (name == '解散') {
del({ familyId: data.familyId }).then(async res => {
if (res.success) {
await useUserStore().initUserInfo()
actionSheetRef.value.close()
} else {
}
}).finally(() => {
e.loading = false
})
}
}
onShareAppMessage(() => {
const familyId = userInfo.value.familyMembers[0].familyId
const word = `${userInfo.value.nickName}邀请你加入家庭共享记账`
const avatarUrl = userInfo.value.avatarUrl
return {
title: "和我一起记录家里的人情往来",
path: `/pages/family/invite?familyId=${familyId}&word=${word}&avatarUrl=${avatarUrl}`,
imageUrl: "/static/share2.png",
};
})
</script>

<style lang="scss" scoped></style>
Expand Down
94 changes: 72 additions & 22 deletions src/pages/family/invite.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,88 @@
<template>
<div>
<div class="bg-white rounded-2xl p-4 mt-3 space-y-2xl">
<div class="text-center">
<img src="/static/invite_family.svg" alt="">
<div class="text-xl font-blod mt-5">微信用户</div>
<div class="mt-3">邀请您和TA一起记账</div>
<div class="bg-white rounded-2xl p-4 mt-3">
<div>
<div class="mt-5 flex justify-center items-center space-x-3xl">
<div class="i-iconoir-favourite-book text-red text-12"></div>
<div class="i-mingcute-transfer-3-fill text-green text-2xl"></div>
<uv-avatar :src="inviteData.avatarUrl" :size="55"></uv-avatar>
</div>
<div class="mt-3 text-xl font-bold">{{ inviteData.word }}</div>
</div>

<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-device-mobile-share text-3xl"></i></div>
<div>
<div class="font-bold">协同共享记账</div>
<div class="text-gray text-sm">安全共享你的数据,使亲友和你共同记录家庭人情往来</div>
<div class="space-y-xl mt-10">
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-device-mobile-share text-3xl"></i></div>
<div>
<div class="font-bold">协同共享记账</div>
<div class="text-gray text-sm">安全共享你的数据,使亲友和你共同记录家庭人情往来</div>
</div>
</div>
</div>
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-lock-heart text-3xl"></i></div>
<div>
<div class="font-bold">私密且安全</div>
<div class="text-gray text-sm">信息会加密,你可以随时停止共享</div>
<div class="flex items-center">
<div class="text-red m-3"><i class="i-tabler-lock-heart text-3xl"></i></div>
<div>
<div class="font-bold">私密且安全</div>
<div class="text-gray text-sm">信息会加密,你可以随时停止共享</div>
</div>
</div>
</div>

<uv-button type="primary" shape="circle" text="同意" @click="onCreate" :loading="loading"
loadingMode="circle">
</uv-button>
<uv-button shape="circle" text="拒绝" @click="onCreate" :loading="loading"
loadingMode="circle">
</uv-button>
<div class="space-y-xl mt-10">
<uv-button type="primary" shape="circle" text="同意" @click="onAgree" :loading="loading"
loadingMode="circle">
</uv-button>
<uv-button shape="circle" text="拒绝" @click="onReject" :loading="loading" loadingMode="circle">
</uv-button>
</div>
</div>
</div>
</template>

<script setup>
import { useUserStore } from '~/stores/user'
import { storeToRefs } from 'pinia'
const { userInfo } = storeToRefs(useUserStore())
import { join } from '@/alicloud/services/family'
onLoad((options) => {
inviteData.value = options
})
const inviteData = ref({})
const loading = ref(false)
const onAgree = () => {
if (userInfo.value.familyMembers) {
router.push({
path: '/pages/family/index'
})
return
}
loading.value = true
join({
familyId: inviteData.value.familyId
}).then(res => {
if (res.success) {
uni.showToast({
title: '加入成功',
icon: 'none'
})
router.push({
path: '/pages/family/index'
})
} else {
}
}).finally(() => {
loading.value = false
})
}
const onReject = () => {
router.push({
path: '/pages/book/index',
tabBar: true
})
}
</script>

Expand Down
11 changes: 9 additions & 2 deletions src/pages/mine/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
</div>
</div>
<div class="bg-white rounded-2xl p-1">
<uv-cell isLink :border="false" url="/pages/family/index" value="家人共享"
v-if="userInfo.familyMembers">
<uv-cell isLink :border="false" url="/pages/family/index" value="家人共享" v-if="userInfo.familyMembers">
<template v-slot:title>
<uv-avatar-group :urls="userInfo.familyMembers.map(i => i.user.avatarUrl)" size="35" gap="0.4">
</uv-avatar-group>
Expand Down Expand Up @@ -104,6 +103,14 @@ const statistics = async () => {
}
}
onShareAppMessage(() => {
return {
title: "可能是东半球最好用的人情记账工具",
path: `/pages/index`,
imageUrl: "/static/share.png",
};
})
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sponsor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ const rewardedSuccess = () => {

<route lang="json">{
"style": {
"navigationBarTitleText": "开发团队"
"navigationBarTitleText": "支持礼记"
}
}</route>
Binary file added src/static/share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/static/share2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d926d7

Please sign in to comment.