From e89f63d1cef5bac7f3cdefb78da716d991426009 Mon Sep 17 00:00:00 2001 From: wwl Date: Fri, 10 May 2024 23:36:28 +0800 Subject: [PATCH] fix bug --- .env.development | 6 +++--- src/components/sp-login/index.weapp.js | 2 +- src/pages/index.js | 6 +++--- src/pages/other/goods.js | 17 ++++++++++------- src/pages/recommend/apply.js | 4 ++-- src/pages/recommend/detail.js | 25 ++++++++++++++----------- src/pages/recommend/detail.scss | 2 +- src/pages/recommend/status.js | 6 ++++-- src/subpages/auth/reg-rule.js | 3 ++- 9 files changed, 40 insertions(+), 31 deletions(-) diff --git a/.env.development b/.env.development index 9879ff2..9c69600 100755 --- a/.env.development +++ b/.env.development @@ -1,8 +1,8 @@ -APP_BASE_URL=https://slb.birkenstock.net.cn/api/h5app/wxapp -APP_WEBSOCKET=wss://slb.birkenstock.net.cn/ws +APP_BASE_URL=https://test.birkenstock.net.cn/api/h5app/wxapp +APP_WEBSOCKET=wss://test.birkenstock.net.cn/ws APP_COMPANY_ID=1 APP_PLATFORM=standard -APP_CUSTOM_SERVER=https://slb.birkenstock.net.cn/ +APP_CUSTOM_SERVER=https://test.birkenstock.net.cn/ APP_HOME_PAGE=/pages/index APP_TRACK=youshu APP_YOUSHU_TOKEN=bi281e87ab2424481a diff --git a/src/components/sp-login/index.weapp.js b/src/components/sp-login/index.weapp.js index 9d07b58..049c89b 100755 --- a/src/components/sp-login/index.weapp.js +++ b/src/components/sp-login/index.weapp.js @@ -70,7 +70,7 @@ function SpLogin (props, ref) { const auth_type = isWeixin ? 'wxapp' : 'aliapp' api.wx.login({ code: codeRef.current, showError: false, auth_type }).then(async ({ token }) => { if (token) { - Taro.showLoading({ title: '' }) + Taro.showLoading({ title: '', mask: true }) await setToken(token) onChange && onChange() Taro.hideLoading() diff --git a/src/pages/index.js b/src/pages/index.js index 626f61a..537b8f2 100755 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -366,14 +366,14 @@ function Home () { }) } }) || []).sort((a, b) => a.sort - b.sort) - const _swiperList = [...activeSwiper, { + const _swiperList = [{ type: 'image', src: process.env.APP_IMAGE_CDN_NEW + '/1774/kv.jpg?t' + new Date().getTime(), goods: [], onClick: () => { Taro.navigateTo({ url: '/pages/other/goods' }) } - }, ...list] + }, ...activeSwiper, ...list] setState((draft) => { draft.swiperList = _swiperList draft.goodList = _swiperList[0].goods || [] @@ -693,7 +693,7 @@ function Home () { ))} - {!isUpOperation && currentIndex === 0 ? { diff --git a/src/pages/other/goods.js b/src/pages/other/goods.js index e732622..4b06407 100644 --- a/src/pages/other/goods.js +++ b/src/pages/other/goods.js @@ -7,7 +7,7 @@ import { View, Text, Picker, Input } from "@tarojs/components" import './goods.scss' const initState = { - loading: false, + loading: true, shopList: [] } function goods () { @@ -33,12 +33,12 @@ function goods () { } } useEffect(() => { - getShop() setTimeout(() => { setState((draft) => { draft.loading = false }) - }, 300) + }, 500) + getShop() }, []) const getShop = async () => { @@ -59,13 +59,16 @@ function goods () { } return ( - - - {goods_1774.map((item, index) => + + + {goods_1774.map((item, index) => {(index === 3 || index === 5) && handleGoBuy(item, index)} >} )} + {/* {goods_1774.map((item, index) => + {(index === 3 || index === 5) && handleGoBuy(item, index)} >} + )} */} - + 返回首页 diff --git a/src/pages/recommend/apply.js b/src/pages/recommend/apply.js index 8cdc7c2..a8ca820 100644 --- a/src/pages/recommend/apply.js +++ b/src/pages/recommend/apply.js @@ -109,7 +109,7 @@ export default function detail () { if (!checked) { const res = await Taro.showModal({ title: '提示', - content: `请先阅读并同意${appName}活动细则`, + content: `请先阅读并同意BIRKENSTOCK活动细则`, showCancel: true, cancel: '取消', cancelText: '拒绝', @@ -249,7 +249,7 @@ export default function detail () { onClick={() => Taro.navigateTo({ url: '/subpages/auth/reg-rule?type=activity_rule' })} style={`color: #000000;text-decoration: underline;`} > - {`《${appName}活动细则》`} + {`《BIRKENSTOCK活动细则》`} diff --git a/src/pages/recommend/detail.js b/src/pages/recommend/detail.js index 6221bd4..917894b 100644 --- a/src/pages/recommend/detail.js +++ b/src/pages/recommend/detail.js @@ -8,7 +8,7 @@ import api from '@/api' import dayjs from 'dayjs' import { AtIcon } from 'taro-ui' import { classNames, navigateTo } from '@/utils' -import { useLogin } from '@/hooks' +// import { useLogin } from '@/hooks' import './detail.scss' const initState = { @@ -28,10 +28,10 @@ export default function detail () { const $instance = getCurrentInstance() const [state, setState] = useImmer(initState) const { appName } = useSelector((_state) => _state.sys) - const { userInfo = {} } = useSelector((_state) => _state.user) - const { isLogin } = useLogin({ - autoLogin: true, - }) + const { userInfo = null } = useSelector((_state) => _state.user) + // const { isLogin } = useLogin({ + // autoLogin: false, + // }) // useDidShow(() => { // }, []) @@ -65,7 +65,7 @@ export default function detail () { } draft.checked = !!_item // MM-DD - draft.changci = changci.map((item, index) => ({ index: index + 1, start: dayjs(item.start_time).format('MM-DD HH:mm'), end: dayjs(item.end_time).format('HH:mm'), limit: item.join_limit, join: item.has_join_num, id: item.registration_session_id, activity_id: item.activity_id, has_stauts: item.has_stauts == 1 })) + draft.changci = changci.map((item, index) => ({ index: index + 1, start: dayjs(item.start_time).format('M月D日 H:mm'), end: dayjs(item.end_time).format('HH:mm'), limit: item.join_limit, join: item.has_join_num, id: item.registration_session_id, activity_id: item.activity_id, has_stauts: item.has_stauts == 1 })) draft.applyStatus = _applyStatus }) } @@ -75,7 +75,7 @@ export default function detail () { }, []) useEffect(() => { - if (isLogin && userInfo) { + if (userInfo) { setState(draft => { draft.formInfo = { username: userInfo.username, @@ -83,13 +83,13 @@ export default function detail () { } }) } - }, [userInfo, isLogin]) + }, [userInfo]) const { isLoading, activeInfo = {}, changci, visible, formInfo, checked, status, isShare, alwaysBackUrl, isSub, applyStatus } = state const handleConfirm = async () => { - if (!isLogin || !userInfo) return + if (!userInfo) return if (activeInfo.status) { Taro.navigateTo({ url: '/pages/recommend/status?success=true&id=' + activeInfo.activity_id }) return @@ -238,6 +238,7 @@ export default function detail () { } const handleGoApply = (item) => { + if (!userInfo) return if (item.has_stauts) { navigateTo('/pages/recommend/status?id=' + activeInfo.activity_id + '&time=') } else { @@ -264,7 +265,7 @@ export default function detail () { {activeInfo.activity_name} - {activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end}`} + {/* {activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end}`} */} {activeInfo.address} @@ -279,7 +280,9 @@ export default function detail () { {changci.length > 0 && changci.map((item, index) => 第{item.index}场 {item.start}-{item.end} - handleGoApply(item)} >{item.has_stauts ? '已报名' : item.limit - item.join > 0 ? `${item.limit - item.join}席可选` : '已满员'} + + handleGoApply(item)} >{item.has_stauts ? '已报名' : item.limit - item.join > 0 ? `${item.limit - item.join}席可选` : '已满员'} + )} diff --git a/src/pages/recommend/detail.scss b/src/pages/recommend/detail.scss index 096aa0f..3ee790f 100644 --- a/src/pages/recommend/detail.scss +++ b/src/pages/recommend/detail.scss @@ -226,7 +226,7 @@ padding: 16rpx 16rpx 16rpx 36rpx; color: #999; margin-bottom: 16rpx; - .btn { + .btn_n { width: 140rpx; height: 54rpx; line-height: 54rpx; diff --git a/src/pages/recommend/status.js b/src/pages/recommend/status.js index 485a83f..94132d0 100644 --- a/src/pages/recommend/status.js +++ b/src/pages/recommend/status.js @@ -38,6 +38,8 @@ export default function status () { const _start = dayjs(activity_info.start_time * 1000) const _end = dayjs(activity_info.end_time * 1000) const _session = changci.find(item => item.has_stauts == 1) || {} + _session.start = dayjs(_session.start_time).format('M月D日 H:mm') + _session.end = dayjs(_session.end_time).format('H:mm') const _item = _session.recordList?.[0] || {} let url = '' const qrData = JSON.stringify({ @@ -52,7 +54,6 @@ export default function status () { list.map((item) => { record[item.field_name] = item.answer || '' }) - console.log("🚀 ~ file: status.js:52 ~ record:", _item) setState(draft => { draft.activeInfo = { ...activity_info, @@ -195,7 +196,8 @@ export default function status () { } 活动时间 - {activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end} ${session.start_time.substr(11, 5)} - ${session.end_time.substr(11, 5)}`} + {/* {activeInfo.start == activeInfo.end ? activeInfo.start : `${activeInfo.start} - ${activeInfo.end} ${session.start_time.substr(11, 5)} - ${session.end_time.substr(11, 5)}`} */} + {session.start} - {session.end} 活动地点 diff --git a/src/subpages/auth/reg-rule.js b/src/subpages/auth/reg-rule.js index fc9a2da..9ffc6fc 100755 --- a/src/subpages/auth/reg-rule.js +++ b/src/subpages/auth/reg-rule.js @@ -43,7 +43,8 @@ export default class RegRule extends Component { data = registerContent + privacyContent navBarTitle = `${registerTitle}和${privactTitle}` } else if (type === 'activity_rule') { - data = await Taro.request({ url: process.env.APP_IMAGE_CDN_NEW + '/active-rule.txt' }).then(res => res.data) + const res = await Taro.request({ url: process.env.APP_IMAGE_CDN_NEW + '/active-rule.txt?t=' + Date.now() }) + data = res.data || '' navBarTitle = 'BIRKENSTOCK活动细则' } else if (type) {