Skip to content

Commit

Permalink
Merge pull request #37 from HXTIA/fix-24_5_19-bugs
Browse files Browse the repository at this point in the history
Fix 24 5 19 bugs
  • Loading branch information
HardenSG authored May 19, 2024
2 parents 895ddb8 + 5c30231 commit 4d4895a
Show file tree
Hide file tree
Showing 31 changed files with 347 additions and 160 deletions.
3 changes: 1 addition & 2 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import './app.scss'
import { Get, getStorage, preloadResource, requestUrlCreator, trackJsError } from './utils'
import { JSON_MAP } from './static/SVG/lottie-map'

const filterRules = /evaluating 'n\[0\]\.node'|Cannot read property 'node' of null/
const filterRules = /node/
function App(props) {
useError((err) => {
if (!filterRules.test(err)) {
console.log('错了', err)

trackJsError({
token: getStorage('userInfo')?.token ?? 'no_login',
errMsg: err.toString(),
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const useAnimation = ({
/** 运行函数 */
const run = useCallback(() => {
if (instance) {
/* __PURE__ */ console.log(' === 取消重复运行lottie === ')
/*#__PURE__ */ console.log(' === 取消重复运行lottie === ')
return
}
preloadResource(template, false)
.then((res) => {
setTimeout(async () => {
/* __PURE__ */ console.log(' === lottie执行,当前模版为 === ', template)
/*#__PURE__ */ console.log(' === lottie执行,当前模版为 === ', template)
const ins = await loadAnimation(node, { animationData: res.data, ..._options })
setInstance(ins)
}, 0)
Expand All @@ -47,12 +47,12 @@ const useAnimation = ({
/** 如果配置为自动运行在挂载的时候就执行 */
useEffect(() => {
if (isAutoRun) {
/* __PURE__ */ console.log('自动执行')
/*#__PURE__ */ console.log('自动执行')
run()
}
return () => {
if (instance) {
/* __PURE__ */ console.log(' === lottie实例销毁 === ', instance)
/*#__PURE__ */ console.log(' === lottie实例销毁 === ', instance)
instance.destroy()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ const useRequest = <T, V extends { [key: string]: any } = any>(
...(reqData || {}),
...(params || {}),
}
/* __PURE__ */ console.log(' === 本次请求数据 === ', req)
/*#__PURE__ */ console.log(' === 本次请求数据 === ', req)

/** 请求开始 */
PerfTackerInstance.requestBegin()
res = await fn<T>({ url, data: req, silent })
console.log(res.extraData?.count)

/* __PURE__ */ console.log(' === 响应返回 === ', res)
/*#__PURE__ */ console.log(' === 响应返回 === ', res)

/** 校验是否成功 */
if (res.isSuccess) {
Expand All @@ -92,7 +92,7 @@ const useRequest = <T, V extends { [key: string]: any } = any>(
}
setTimeout(() => {
setLoading(false)
}, 200)
}, 400)
complete && complete()
return res.data
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Detail/components/Poster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Index: FC<TPosterProps> = ({ posterData }) => {
const trackError = useCallback((type, err) => {
showToast('保存图片失败了,重新进入尝试一下')
trackJsError({
token: getStorage('userInfo').token || 'no_login',
token: getStorage('userInfo')?.token || 'no_login',
errMsg: err,
err_name: type,
location: 'detail/poster',
Expand Down
37 changes: 19 additions & 18 deletions src/pages/Detail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { View, Text, Image } from '@tarojs/components'
import React, { FC, useCallback, useMemo, useState } from 'react'
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'
import Taro, { useShareAppMessage } from '@tarojs/taro'
import {
IWork,
Expand All @@ -15,34 +15,35 @@ import {
import Button from '@taroify/core/button/button'
import useRequest from 'src/hooks/useRequest'
import Loading from 'src/components/baseBuiltComp/Loading'
import useUpdateEffect from 'src/hooks/useUpdateEffect'
import './index.module.scss'
import Poster from './components/Poster'
import { ActionMappingStatus, FilterType, taskInterUrl } from '../main/Index/common'

const Index: FC = () => {
const { data, loading, err } = useRequest<IWork>(
() => ({
url: requestUrlCreator({ rootPath: 'WX_WORK', absolutePath: `/${query()?.id}` }),
url: requestUrlCreator({ rootPath: 'WX_WORK', absolutePath: `/work${query()?.id}` }),
type: 'Get',
silent: true,
}),
{ auto: true },
)
const imgs = useMemo(() => data?.pictureLinks?.split(',').map((v) => v) || [], [data])

const [isShowPoster, setIsShowPoster] = useState(false)
const updateTaskStatus = useCallback(() => {
if (data!.status > 1) {
showToast('任务已过期,无法更新状态')
return
}
Post({
url: requestUrlCreator({ absolutePath: '/changeStatus' }),
data: {
id: data?.id,
status: !data?.status,
},
})
}, [data])
// const updateTaskStatus = useCallback(() => {
// if (data!.status > 1) {
// showToast('任务已过期,无法更新状态')
// return
// }
// Post({
// url: requestUrlCreator({ absolutePath: '/changeStatus' }),
// data: {
// id: data?.id,
// status: !data?.status,
// },
// })
// }, [data])

useShareAppMessage((payload) => {
const { from, target } = payload
Expand Down Expand Up @@ -125,13 +126,13 @@ const Index: FC = () => {
分享好友
</Button>
</View>
{data!.status < 2 && (
{/* {data!.status < 2 && (
<View className='btn_groups'>
<Button className='full-btn green' onClick={updateTaskStatus}>
置为 {taskStatusEnum[Number(!data?.status ?? 0)]}
</Button>
</View>
)}
)} */}
</View>
)}
{isShowPoster && (
Expand Down
1 change: 0 additions & 1 deletion src/pages/Initial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const Index = () => {
const orgCacheState = useSelector((root: RootState) => root.runtimeModel.organizationCache)
const [isLogin, setLogin] = useState<boolean | undefined>()
/** 用户信息 拿到token 组织 年级 班级 */
// TODO: 这个地方有问题
const {
orgId: _orgId,
orgName: _orgName,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Setting/Course/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const Index = () => {
onClick={() =>
goTo({
url: URL.Index,
methodType: 'switchTab',
methodType: 'reLaunch',
extraParams: {
...query(),
},
Expand Down
4 changes: 1 addition & 3 deletions src/pages/Setting/Feedback/index.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export default definePageConfig({
/** 页面标题 */
navigationBarTitleText: '反馈页面',
navigationBarTitleText: '',
/** 是否开启下拉刷新 */
enablePullDownRefresh: false,
/** 自定义导航栏 */
navigationStyle: 'custom',
/** 自定义背景颜色 */
backgroundColor: '#ffffff',
})
70 changes: 70 additions & 0 deletions src/pages/Setting/Feedback/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@import 'src/app.scss';

.feedback_wrapper {
display: flex;
flex-direction: column;
align-items: center;
width: 100vw;
height: 100vh;

.title_banner {
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 30%;
padding: 0 20% 0 20%;
background: url('https://hx.404fwf.cn/notifyBoard/img/title_banner.png') center center no-repeat;
background-size: contain;
}

.content_wrapper {
position: relative;
width: 100%;
height: 60%;
margin-top: -10%;

.area {
box-sizing: border-box;
position: absolute;
width: 90%;
height: 100%;
left: 50%;
transform: translateX(-50%);
padding: 50rpx 20rpx 0 20rpx;
z-index: 2;
border: 4rpx solid black;
border-radius: 30rpx;
background-color: #fff;
box-shadow: 10rpx -10rpx 20rpx #e0dede;

.btn {
width: 280rpx;
height: 80rpx;
text-align: center;
line-height: 80rpx;
// box-shadow: -10rpx 13rpx $primary-color;
background-color: $primary-color;
margin-top: 70rpx;
}
}

.bg {
position: absolute;
width: 100%;
height: 60%;
background-color: $primary-color;
border-top: 5rpx solid black;
border-bottom: 5rpx solid black;
transform: translateY(-60%);
top: 50%;
z-index: 1;
}
}
}

page {
/* 覆盖field宽度 */
--form-label-width: 100rpx;
}
76 changes: 73 additions & 3 deletions src/pages/Setting/Feedback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,78 @@
import { View } from '@tarojs/components'
import React from 'react'
import { View, Button } from '@tarojs/components'
import React, { useCallback, useState } from 'react'
import { Field, Textarea, Input } from '@taroify/core'
import { goTo, showModal, showToast, trackFeedbackContent } from 'src/utils'
import './index.module.scss'

const Index = () => {
return <View>反馈页面</View>
const [text, setText] = useState('')
const [phone, setPhone] = useState(0)

const clickBtn = useCallback(async () => {
if (text.length <= 0) {
showToast('您还没有填写内容')
return
}

const res = await showModal({
title: '反馈一下🤔',
content: '您提出的宝贵建议我们会仔细斟酌,请附上您的联系方式方便采纳后与您联系🫡',
confirmText: '马上提交',
cancelText: '再考虑下',
})
if (!res) return

console.log('提交')
trackFeedbackContent({
user_phone: phone ?? 0,
user_feedback: text,
})
showToast('反馈成功,即将返回上一页!')
setTimeout(() => {
goTo({ methodType: 'navigateBack' })
}, 1000)
}, [phone, text])
return (
<View className='feedback_wrapper'>
<View className='title_banner' />
<View className='content_wrapper'>
<View className='area'>
<Field align='start' label='建议' required>
<Textarea
style={{
height: '200px',
backgroundColor: 'rgba(245, 245, 245, 1)',
borderRadius: '10rpx',
padding: '10rpx',
}}
limit={500}
placeholder='请输入您的建议'
onChange={({ detail: { value } }) => setText(value)}
/>
</Field>
<Field label='手机号'>
<Input
style={{
backgroundColor: 'rgba(245, 245, 245, 1)',
width: '100%',
height: '60rpx',
lineHeight: '60rpx',
borderRadius: '10rpx',
paddingLeft: '10rpx',
}}
placeholder='请输入手机号'
type='number'
onChange={({ detail: { value } }) => setPhone(value as unknown as number)}
/>
</Field>
<Button className='btn' onClick={clickBtn}>
提交
</Button>
</View>
<View className='bg' />
</View>
</View>
)
}

export default React.memo(Index)
Loading

0 comments on commit 4d4895a

Please sign in to comment.