宠物详细页面、身份证识别页面更新

This commit is contained in:
aiShuiJiaoDeXioShou 2024-09-09 08:40:40 +08:00
parent 973f7c82f2
commit 76a3b19a06
10 changed files with 97 additions and 131 deletions

View File

@ -76,7 +76,7 @@ export default ({ command, mode }) => {
pagesJsonDir: path.resolve(__dirname, './src/pages.json'), pagesJsonDir: path.resolve(__dirname, './src/pages.json'),
includes: ['path', 'aliasPath', 'name', 'meta'], includes: ['path', 'aliasPath', 'name', 'meta'],
}), }),
mpliveMainfestPlugin(env.SHOPRO_MPLIVE_ON), // mpliveMainfestPlugin(env.SHOPRO_MPLIVE_ON),
UniLayouts(), UniLayouts(),
UniPlatform(), UniPlatform(),
UniManifest(), UniManifest(),

View File

@ -1,32 +0,0 @@
---
name: Bug report报告问题
about: Create a report to help us improve
---
<!--
注意:为更好的解决你的问题,请参考模板提供完整信息,准确描述问题,信息不全的 issue 将被关闭。
Note: In order to better solve your problem, please refer to the template to provide complete information, accurately describe the problem, and the incomplete information issue will be closed.
-->
# Bug report问题描述
please write your issue description here
## Steps to reproduce问题复现步骤
<!--
1. [xxx]
2. [xxx]
3. [xxxx]
-->
## Screenshot or Gif截图或动态图
## minimal reproduction最小可还原代码
## System Info
`npx envinfo --system --npmPackages vue --binaries --browsers`
执行上面命令,将结果贴下面

View File

@ -1,6 +0,0 @@
---
name: Feature Request新功能建议
about: Suggest an idea for this project
---
# Feature request新功能建议

View File

@ -1,52 +0,0 @@
name: Deploy Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --no-frozen-lockfile
- name: Build
run: pnpm build:h5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist/build/h5
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install commitlint --edit

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install -- lint-staged

View File

@ -12,44 +12,54 @@
<TopBar /> <TopBar />
<image <image
class="absolute w-full h-full" class="absolute w-full h-full"
:src="'@/static/certification/certification_bg.png'" src="/static/certification/certification_bg.png"
mode="aspectFill" mode="aspectFill"
></image> ></image>
<view> <view class="absolute w-full top-[75vw]">
<view v-if="!user.userInfo.isRealName"> <view v-if="!user.userInfo.isRealName">
<!-- 实名认证部分 --> <!-- 实名认证部分 -->
<view class="p-4"> <view class="p-4">
<text class="text-lg text-gray-800 mb-2">请进行身份证实名认证</text> <text class="text-lg text-gray-800 mb-2">请进行身份证实名认证</text>
<view class="bg-white p-4 rounded-lg shadow mb-4 flex items-center justify-between"> <view class="flex justify-center items-center flex-col gap-[10px]">
<view class="flex items-center"> <view class="text-center">
<image :src="frontImage" class="w-24 h-16 object-cover rounded"></image> <image
<text class="ml-4">身份证人像面</text> class="w-[60vw]"
mode="widthFix"
src="/static/permission/idcard.png"
@click="chooseFrontImage"
></image>
<view class="pt-1">身份证人像面</view>
</view> </view>
<button class="bg-[#ffc107] text-white rounded-full px-4 py-2" @click="chooseFrontImage"> <view class="text-center">
<wd-icon name="add" /> <image
</button> class="w-[60vw]"
mode="widthFix"
src="/static/permission/idcard_back.png"
@click="chooseBackImage"
></image>
<view class="pt-1">身份证国徽面</view>
</view> </view>
<view class="bg-white p-4 rounded-lg shadow mb-4 flex items-center justify-between">
<view class="flex items-center">
<image :src="backImage" class="w-24 h-16 object-cover rounded"></image>
<text class="ml-4">身份证国徽面</text>
</view>
<button class="bg-[#ffc107] text-white rounded-full px-4 py-2" @click="chooseBackImage">
<wd-icon name="add" />
</button>
</view> </view>
<button <button
class="w-full bg-pink-500 text-white text-center rounded-full py-4 mt-4" class="w-full bg-[#FCCB30] text-black text-center rounded-full py-1 mt-4"
@click="submitAuth" @click="submitAuth"
> >
提交认证材料 提交认证材料
</button> </button>
<button
class="w-full bg-[#ff7f50] text-black text-center rounded-full py-1 mt-4"
@click="toPath('/')"
>
返回首页
</button>
</view> </view>
</view> </view>
<view class="bg-[#F5F5F5] h-full" v-else>您已经完成了实名认证</view> <view class="w-full h-full text-center flex justify-center items-center content-center" v-else>
<view class="mt-[30vw]">您已经完成了实名认证</view>
</view>
</view> </view>
</template> </template>
@ -58,6 +68,7 @@ import { ref } from 'vue'
import { httpUploadFile } from '@/utils/http' import { httpUploadFile } from '@/utils/http'
import { useUserStore } from '@/store' import { useUserStore } from '@/store'
import TopBar from '@/components/TopBar.vue' import TopBar from '@/components/TopBar.vue'
import { toPath } from '@/utils/commUtils'
const frontImage = ref('https://via.placeholder.com/100') const frontImage = ref('https://via.placeholder.com/100')
const backImage = ref('https://via.placeholder.com/100') const backImage = ref('https://via.placeholder.com/100')

View File

@ -20,7 +20,7 @@
<view class="relative"> <view class="relative">
<view class="absolute left-4 bottom-[-20px] z-10"> <view class="absolute left-4 bottom-[-20px] z-10">
<image <image
:src="imgUrl('@/static/icons/cat.png')" :src="petInfo.profileUrl ? imgUrl(petInfo.profileUrl) : imgUrl('@/static/icons/cat.png')"
class="w-20 h-20 object-cover rounded-full border-4 border-white" class="w-20 h-20 object-cover rounded-full border-4 border-white"
></image> ></image>
</view> </view>
@ -38,7 +38,7 @@
</view> </view>
<view class="text-center"> <view class="text-center">
<text class="text-lg">0</text> <text class="text-lg">0</text>
<text class="block text-gray-600">获猫币</text> <text class="block text-gray-600">关注度</text>
</view> </view>
<view class="text-center"> <view class="text-center">
<text class="text-lg">0</text> <text class="text-lg">0</text>
@ -49,21 +49,25 @@
<view class="pl-4 pr-4"> <view class="pl-4 pr-4">
<!-- 宠物信息 --> <!-- 宠物信息 -->
<view class="bg-white p-4 rounded-lg"> <view class="bg-white p-4 rounded-lg">
<text class="text-xl">cat</text> <text class="text-xl">{{ petInfo.name || 'cat' }}</text>
<view class="flex items-center mt-2"> <view class="flex items-center mt-2">
<wd-icon name="calendar" size="20" class="text-[#ffc107]"></wd-icon> <wd-icon name="calendar" size="20" class="text-[#ffc107]"></wd-icon>
<text class="ml-2 text-gray-600">距离生日还有12天哦</text> <text class="ml-2 text-gray-600">
距离生日还有{{ daysUntilBirthday(petInfo.age) }}天哦
</text>
</view> </view>
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<view class="flex justify-between py-4"> <view class="flex justify-between py-4">
<button <button
@click="editPet(petInfo.id)"
class="bg-[#F0985A] text-white rounded-lg py-2 px-6 h-9 flex-grow-[8] flex items-center justify-center" class="bg-[#F0985A] text-white rounded-lg py-2 px-6 h-9 flex-grow-[8] flex items-center justify-center"
> >
修改头像 修改信息
</button> </button>
<button <button
@click="share"
class="bg-[#ffc107] text-white rounded-lg py-2 px-6 h-9 flex-grow-[2] flex items-center justify-center ml-4" class="bg-[#ffc107] text-white rounded-lg py-2 px-6 h-9 flex-grow-[2] flex items-center justify-center ml-4"
> >
分享 分享
@ -97,15 +101,59 @@
<script setup> <script setup>
import EmptyState from '@/components/EmptyState.vue' import EmptyState from '@/components/EmptyState.vue'
import TopBar from '@/components/TopBar.vue' import TopBar from '@/components/TopBar.vue'
import { imgUrl } from '@/utils/commUtils' import { imgUrl, toast, toPath } from '@/utils/commUtils'
import { httpGet } from '@/utils/http'
import { ref } from 'vue' import { ref } from 'vue'
const tabs = ref(['全部', '心情', '养护', '清洁']) const tabs = ref(['全部', '心情', '养护', '清洁'])
const activeTab = ref('全部') const activeTab = ref('全部')
const petInfo = ref({})
const goBack = () => { const getPetId = async (id) => {
uni.navigateBack() try {
const res = await httpGet('/petInfo/find_by_id/' + id)
if (res.code === 200) {
petInfo.value = res.data
console.log(petInfo.value)
} else {
toast(res.data.message)
}
} catch (e) {
console.log(e)
}
} }
const editPet = (id) => {
toPath('/pages/pet/pet-add-page?id=' + id)
}
const share = () => {}
const daysUntilBirthday = (birthDateStr) => {
//
const birthDate = new Date(birthDateStr)
const today = new Date()
//
const nextBirthday = new Date(today.getFullYear(), birthDate.getMonth(), birthDate.getDate())
//
if (nextBirthday < today) {
nextBirthday.setFullYear(today.getFullYear() + 1)
}
//
const oneDay = 24 * 60 * 60 * 1000 //
const daysLeft = Math.ceil((nextBirthday - today) / oneDay)
return daysLeft
}
onLoad(async (options) => {
if (options.id) {
await getPetId(options.id)
}
})
</script> </script>
<style scoped> <style scoped>

View File

@ -1,5 +1,5 @@
import sheep from "@/sheep" import sheep from '@/sheep'
import PLATFORM from "./platform" import PLATFORM from './platform'
// 获取服务baseUrl // 获取服务baseUrl
export const baseUrl = import.meta.env.VITE_SERVER_BASEURL export const baseUrl = import.meta.env.VITE_SERVER_BASEURL
@ -61,9 +61,14 @@ export const scanCodeAsync = () => {
// 路径导航 // 路径导航
export const toPath = (path) => { export const toPath = (path) => {
if (path === '/') {
uni.switchTab({ url: '/pages/index/index' })
return
}
// 如果没有指定路由默认跳转到首页去 // 如果没有指定路由默认跳转到首页去
if (!path) { if (!path) {
uni.navigateTo({ url: '/pages/index/index' }) uni.switchTab({ url: '/pages/index/index' })
return return
} }

View File

@ -65,7 +65,7 @@ export default ({ command, mode }) => {
pagesJsonDir: path.resolve(__dirname, './src/pages.json'), pagesJsonDir: path.resolve(__dirname, './src/pages.json'),
includes: ['path', 'aliasPath', 'name', 'meta'], includes: ['path', 'aliasPath', 'name', 'meta'],
}), }),
mpliveMainfestPlugin(env.SHOPRO_MPLIVE_ON), // mpliveMainfestPlugin(env.SHOPRO_MPLIVE_ON),
UniLayouts(), UniLayouts(),
UniPlatform(), UniPlatform(),
UniManifest(), UniManifest(),