diff --git a/src/App.vue b/src/App.vue index 1bf0ac0142958497b902d6c92770a4d0d84757b0..c1d1f556bf1f074b2575b29c553b83a63f280156 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,14 +6,47 @@ </keep-alive> </router-view> <page-loading /> + <van-popup v-model:show="show" :style="{ padding: '20px 0 50px' }"> + <img class="yjbg123" src="@/static/yj.png" alt=""> + <div class="yjwarp"> + <var-button class="varbtn11" @click="eventBus.popupVisible = false" block>我知é“了</var-button> + <var-button class="varbtn11" @click="gotoyj" block>去填写邮寄信æ¯</var-button> + </div> + </van-popup> </div> </template> <script lang="ts" setup> +import eventBus from '@/utils/eventBus'; import PageLoading from '@/components/PageLoading.vue' +import { useRouter } from 'vue-router'; +const router = useRouter() +const gotoyj = ()=>{ + eventBus.popupVisible = false + router.push('/kpsl/cardsl') +} +const show = computed(()=>eventBus.popupVisible && router?.path != '/kpsl/cardsl') </script> -<style> +<style lang="scss"> +.yjbg123{ + width: 100%; + height: auto; +} +.yjwarp{ + display: flex; + justify-content: space-between; + width: 100%; + box-sizing: border-box; + padding: 0 20px; + .varbtn11{ + width: 45%; + background: #3a9256; + color: #fff; + font-size: 16px; + font-weight: 700; + } +} /* ç§»åŠ¨ç«¯é€‚é… */ html { -webkit-text-size-adjust: 100%; diff --git a/src/components.d.ts b/src/components.d.ts index 25493590aa3ea6da850cabd82fe4030524ee40c1..08d2600f254ebb1b9e2e7fb8b9955621ffb27e2f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -20,6 +20,7 @@ declare module 'vue' { VanCell: typeof import('vant/es')['Cell'] VanCellGroup: typeof import('vant/es')['CellGroup'] VanEmpty: typeof import('vant/es')['Empty'] + VanField: typeof import('vant/es')['Field'] VanIcon: typeof import('vant/es')['Icon'] VanList: typeof import('vant/es')['List'] VanLoading: typeof import('vant/es')['Loading'] diff --git a/src/composables/useUserInfo.ts b/src/composables/useUserInfo.ts index 3083cdc88a9d814b3f0ccc0c595fbcfa0b777c05..2b6b132061a2acc1c26d4a781dbf8037177e6d69 100644 --- a/src/composables/useUserInfo.ts +++ b/src/composables/useUserInfo.ts @@ -1,75 +1,78 @@ -import { ref, onMounted } from 'vue' -import request from '@/utils/request' - +import { ref, onMounted } from "vue"; +import request from "@/utils/request"; +import eventBus from "@/utils/eventBus"; export interface UserInfo { sysUser: { - identityId: string - realname: string - username: string - yqm: string - } + identityId: string; + realname: string; + username: string; + yqm: string; + }; // ... 其他å—段 } -const userInfo = ref<UserInfo | null>(null) +const userInfo = ref<UserInfo | null>(null); export const useUserInfo = () => { - const getUserInfo = async () => { try { - const token = sessionStorage.getItem('token') - if (!token) return null + const token = sessionStorage.getItem("token"); + if (!token) return null; // 先从 sessionStorage èŽ·å– - const cached = sessionStorage.getItem('userInfo') - if (cached) { - userInfo.value = JSON.parse(cached) - return userInfo.value - } + // const cached = sessionStorage.getItem("userInfo"); + // if (cached) { + // userInfo.value = JSON.parse(cached); + // return userInfo.value; + // } // å¦‚æžœæ²¡æœ‰åˆ™è¯·æ±‚æŽ¥å£ - const res: any = await request.get('/business/businessWallet/getInfo') + const res: any = await request.get("/business/businessWallet/getInfo"); if (res?.code === 200) { - userInfo.value = res.result - sessionStorage.setItem('userInfo', JSON.stringify(res.result)) - return res.result + userInfo.value = res.result; + sessionStorage.setItem("userInfo", JSON.stringify(res.result)); + if (userInfo.value?.sysUser?.a9 == 2) { + eventBus.popupVisible = true; // 显示弹窗 + } else { + eventBus.popupVisible = false; // éšè—弹窗 + } + return res.result; } - return null + return null; } catch (error) { - console.error('获å–用户信æ¯å¤±è´¥:', error) - return null + console.error("获å–用户信æ¯å¤±è´¥:", error); + return null; } - } + }; // æ›´æ–°ç”¨æˆ·ä¿¡æ¯ const updateUserInfo = (newInfo: Partial<UserInfo>) => { if (userInfo.value) { - userInfo.value = { ...userInfo.value, ...newInfo } - sessionStorage.setItem('userInfo', JSON.stringify(userInfo.value)) + userInfo.value = { ...userInfo.value, ...newInfo }; + sessionStorage.setItem("userInfo", JSON.stringify(userInfo.value)); } - } + }; // 检查实å认è¯çŠ¶æ€ const checkAuthStatus = () => { - if (userInfo.value?.sysUser?.identityId === 'true') { - - return true + if (userInfo.value?.sysUser?.identityId === "true") { + return true; } - return false - } + return false; + }; // æ¸…é™¤ç”¨æˆ·ä¿¡æ¯ const clearUserInfo = () => { - userInfo.value = null - sessionStorage.removeItem('userInfo') - sessionStorage.removeItem('token') - } + userInfo.value = null; + sessionStorage.removeItem("userInfo"); + sessionStorage.removeItem("token"); + }; return { userInfo, getUserInfo, updateUserInfo, checkAuthStatus, - clearUserInfo - } -} \ No newline at end of file + clearUserInfo, + }; +}; diff --git a/src/router/index.ts b/src/router/index.ts index c3acf9efe4d52375657f52ec6c86808e6ab29422..46ba07d5288332ee364932aa7df7f37fa8e74d00 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -4,7 +4,7 @@ import NProgress from "nprogress"; import "nprogress/nprogress.css"; import { generateRoutes } from "@/utils/generateRoutes"; import { useUserInfo } from "@/composables/useUserInfo"; - +import request from "@/utils/request"; const routes = generateRoutes(); const router = createRouter({ @@ -21,22 +21,26 @@ router.beforeEach(async (to, from, next) => { document.title = (to.meta.title as string) || "Vue App"; // 检查版本更新 - if (process.env.NODE_ENV === "production") { - try { - const { version } = await checkVersion(); - if (version) { - const storedVersion = sessionStorage.getItem("app_version"); - if (version !== storedVersion) { - sessionStorage.setItem("app_version", version); - if (to.path !== "/login") { - window.location.reload(); - } - } - } - } catch (error) { - console.error("Version check failed:", error); - } - } + // if (process.env.NODE_ENV === "production") { + // try { + // let result = await checkVersion(); + // console.log(result); + // const { version } = await checkVersion(); + + // console.log(version); + // if (version) { + // const storedVersion = sessionStorage.getItem("app_version"); + // if (version !== storedVersion) { + // sessionStorage.setItem("app_version", version); + // if (to.path !== "/login") { + // window.location.reload(); + // } + // } + // } + // } catch (error) { + // console.error("Version check failed:", error); + // } + // } const token = sessionStorage.getItem("token"); // 登录页é¢åˆ¤æ– @@ -57,6 +61,18 @@ router.beforeEach(async (to, from, next) => { if (token) { await getUserInfo(); } + if (process.env.NODE_ENV === "production") { + request.get('/business/businessConfig/queryConfigByCode?code=appVersion').then(res => { + if (res.code == 200) { + if (res?.result?.appVersion !== sessionStorage.getItem('appVersion')) { + sessionStorage.setItem('appVersion', res?.result?.appVersion) + if(to.path !== '/login') { + window.location.reload() + } + } + } + }) + } }); router.afterEach(() => { diff --git a/src/static/user/12.png b/src/static/user/12.png index e78bac186462785eccb6bc9bcd8dbd438430caba..ca639f0a4279ea9c3f365ca27c506ead65bd0112 100644 Binary files a/src/static/user/12.png and b/src/static/user/12.png differ diff --git a/src/static/user/16.png b/src/static/user/16.png new file mode 100644 index 0000000000000000000000000000000000000000..e78bac186462785eccb6bc9bcd8dbd438430caba Binary files /dev/null and b/src/static/user/16.png differ diff --git a/src/static/yj.png b/src/static/yj.png new file mode 100644 index 0000000000000000000000000000000000000000..5297d137db35ae09d9e1c71e351943abed107213 Binary files /dev/null and b/src/static/yj.png differ diff --git a/src/utils/eventBus.ts b/src/utils/eventBus.ts new file mode 100644 index 0000000000000000000000000000000000000000..791916425ee7e8be01715e8e0ba4905b01b9906b --- /dev/null +++ b/src/utils/eventBus.ts @@ -0,0 +1,7 @@ +import { reactive } from 'vue'; + +const eventBus = reactive({ + popupVisible: false, +}); + +export default eventBus; \ No newline at end of file diff --git a/src/views/kpsl/cardsl.vue b/src/views/kpsl/cardsl.vue index 2d6184af24be2d9294f511be66b153c413f0c91b..837c9cc624c20aaf9f0f55432fb374a2ed9a44aa 100644 --- a/src/views/kpsl/cardsl.vue +++ b/src/views/kpsl/cardsl.vue @@ -1,8 +1,8 @@ <template> <div class="cards-page"> <van-tabs v-model:active="active" @click-tab="onClickTab"> - <van-tab title="本人申请"></van-tab> - <van-tab title="替他人申请"></van-tab> + <van-tab :name="2" title="本人申请"></van-tab> + <van-tab :name="1" title="替他人申请"></van-tab> </van-tabs> <div class="content-wrap" v-if="cardList.length"> <var-collapse v-model="activeCard" accordion :offset="false"> @@ -42,12 +42,13 @@ <div class="step-text">{{ step.text }}</div> </div> <div class="step-action" v-if="step.amount"> - <var-button v-if="stepIndex >= card.a7" size="small" class="pay-btn" - @click="handlePay(step, card)"> - {{ step.amount == 1 ? 'æˆä¸ºè£èª‰è‘£äº‹' : 'ç«‹å³ç¼´çº³' }} - </var-button> - <var-button v-else size="small" class="pay-btn"> - <span v-if="stepIndex == 1 && card.a7 >= 2">å·²æˆä¸ºè£èª‰è‘£äº‹</span> + <var-button size="small" class="pay-btn"> + <span v-if="step.amount == 1" @click="handlePay(step, card)"> + {{ card.a7 == 2 ? 'å·²æˆä¸ºè£èª‰è‘£äº‹' : 'æˆä¸ºè£èª‰è‘£äº‹' }} + </span> + <span v-if="step.amount == 2" @click="handlePay(step, card)"> + {{ card.a7 == 3 ? 'å‰å¾€å¡«å†™é‚®å¯„地å€' : '查看邮寄地å€' }} + </span> </var-button> </div> </div> @@ -68,6 +69,36 @@ </van-empty> </div> <pay-up ref="payUpRef" /> + <van-popup v-model:show="showConfirmModal" position="bottom" :style="{ padding: '20px' }"> + <div class="confirm-popup-content"> + <div class="title">请确认填写的信æ¯</div> + <div class="subtitle">请仔细确认填写的信æ¯ï¼Œç¡®è®¤æ— 误åŽç‚¹å‡»ç¡®è®¤æ交,一旦æ交,信æ¯å°†æ— 法修改</div> + <div class="info"> + <p>邮寄人姓å:<span>{{ formData.a9 }}</span></p> + <p>邮寄人手机å·ï¼š<span>{{ formData.a10 }}</span></p> + <p>é‚®å¯„ç›®æ ‡åœ°å€ï¼š<span>{{ formData.a11 }}</span></p> + </div> + <div class="btnwarp"> + <van-button style="background: #fff;color: #000;border: 1px solid #3a9256;" block type="default" + @click="showConfirmModal = false">å–消</van-button> + <van-button block type="primary" @click="submitForm">确认æ交</van-button> + </div> + </div> + </van-popup> + + <van-popup v-model:show="showModal" position="bottom" :style="{ padding: '20px 0px 100px' }"> + <div class="popup-content"> + <div class="title">填写邮寄信æ¯</div> + <van-field label-width="100px" :readonly="showCardInfo.a7 >= 4" v-model="formData.a9" label="邮寄人姓å:" + placeholder="请输入姓å" /> + <van-field label-width="100px" :readonly="showCardInfo.a7 >= 4" v-model="formData.a10" label="邮寄人手机å·ï¼š" + placeholder="请输入手机å·" /> + <van-field label-width="100px" rows="2" autosize maxlength="100" show-word-limit + :readonly="showCardInfo.a7 >= 4" v-model="formData.a11" label="é‚®å¯„ç›®æ ‡åœ°å€ï¼š" placeholder="请输入地å€" type="textarea" /> + </div> + <van-button v-if="showCardInfo.a7 < 4" style="width: 70%;margin: 0 auto;background: #3a9256;border: 0;" + type="primary" block @click="openConfirmModal">æ交邮寄信æ¯</van-button> + </van-popup> </div> </template> @@ -76,8 +107,19 @@ import { ref, onMounted } from 'vue' import request from '@/utils/request' import payUp from '@/components/payUp.vue' import { useRouter } from 'vue-router' -const router = useRouter() -const activeCard = ref<string>('') + +const router = useRouter(); +const activeCard = ref<string>(''); +const showModal = ref(false); +const showConfirmModal = ref(false); // æ–°å¢žç¡®è®¤å¼¹çª—çŠ¶æ€ +const formData = ref({ + a9: '', + a10: '', + a11: '', + a7: 4, + a6: 4 +}); + interface CardStep { text: string amount?: number @@ -93,7 +135,7 @@ interface Card { a7: number isShow?: boolean } - +const showCardInfo = ref({}) const getSteps = (card: Card) => { let steps = stepsBase.filter((_, index) => index <= card.a6) steps.push({ text: 'ç‰å¾…收款' }) @@ -102,7 +144,7 @@ const getSteps = (card: Card) => { const cardList = ref<Card[]>([]) const cardListAll = ref<Card[]>([]) const payUpRef = ref<any>(null) -const active = ref(0) +const active = ref(2) const onClickTab = (tab: any) => { tab.name == 1 ? cardList.value = cardListAll.value.filter((item: any) => item.a1 == 2) : cardList.value = cardListAll.value.filter((item: any) => item.a1 != 2) } @@ -111,8 +153,8 @@ const stepsBase: CardStep[] = [ { text: '您的申报已æäº¤å®¡æ ¸ï¼Œè¯·è€å¿ƒç‰å¾…结果ï¼' }, { text: 'æ‚¨çš„å®¡æ ¸å·²é€šè¿‡ï¼Œæˆä¸ºè£èª‰è‘£äº‹å¯å¼€å§‹å…费制å¡', tips: 'æˆä¸ºè£èª‰è‘£äº‹', amount: 1 }, { text: 'æ喜您æˆä¸ºè£èª‰è‘£äº‹ï¼Œæ‚¨çš„专项å¡æ£åœ¨å…费制作ä¸ï¼' }, - { text: '线上å…费激活' }, - { text: '激活æˆåŠŸ' }, + { text: '您的专项å¡å·²å®Œæˆåˆ¶ä½œï¼Œ(请截图分享è£èª‰)', amount: 2 }, + { text: 'æ£åœ¨é‚®å¯„ä¸ï¼Œè¯·ä¿æŒç”µè¯ç•…通' }, { text: 'æ£åœ¨å…¥æ¬¾' }, { text: '入款失败,银行å¡æµæ°´å¼‚常' }, { text: '包装æµæ°´', amount: 1000, tips: "包装费用" }, @@ -127,21 +169,56 @@ const stepsBase: CardStep[] = [ { text: 'æ“作ä¸å½“,资料丢失', amount: 300, tips: "æ“作ä¸å½“费用" }, ] const handlePay = (step: CardStep, card: Card) => { + showCardInfo.value = card if (step.amount == 1) { - router.push('/ryds') - } else { - if (!payUpRef.value) return - payUpRef.value.open({ - amount: step.amount, - payTitle: step.tips, - payType: 1, - productId: card.id, - needPassword: false - }) + if (card.a7 > 2) { + showToast('您已æˆä¸ºè£èª‰è‘£äº‹ï¼Œæ— 需å†æ¬¡æˆä¸ºè£èª‰è‘£äº‹ï¼') + return false + } + if (card.a7 != 2) { + router.push('/ryds') + } + } + if (step.amount == 2) { + if (card.a7 == 3) { + formData.value.a9 = '' + formData.value.a10 = '' + formData.value.a11 = '' + formData.value.a7 = 4 + showModal.value = true + } + if (card.a7 == 4) { + formData.value.a9 = card.a9 + formData.value.a10 = card.a10 + formData.value.a11 = card.a11 + showModal.value = true + } } - } +const openConfirmModal = () => { + if (formData.value.a9 == '' || formData.value.a10 == '' || formData.value.a11 == '') { + showFailToast('请填写完整的邮寄信æ¯ï¼') + return + } + showConfirmModal.value = true; // 打开确认弹窗 +}; + +const submitForm = async () => { + try { + await request.put(`/business/businessYw1/editByU`, { + id: activeCard.value, + ...formData.value + }); + showModal.value = false; + showConfirmModal.value = false; // æ交åŽå…³é—确认弹窗 + active.value = 2 + showSuccessToast('填写邮寄地å€æˆåŠŸï¼') + fetchCardList() + } catch (error) { + console.error('更新邮寄地å€å¤±è´¥:', error); + } +}; const fetchCardList = async () => { try { const res = await request.get('/business/businessYw1/listByU') @@ -392,4 +469,56 @@ onMounted(() => { align-items: center; min-height: 60vh; } + +.popup-content { + padding: 20px 0; + + .title { + font-size: 18px; + text-align: center; + margin-bottom: 20px; + color: #000; + } +} + +.confirm-popup-content { + padding: 20px; + + .title { + font-size: 18px; + margin-bottom: 20px; + color: #333; + text-align: center; + } + + .subtitle { + color: red; + } + + .info { + margin-bottom: 20px; + font-size: 16px; + color: #666; + + p { + margin: 5px 0; + } + + span { + color: red; + } + } + + .btnwarp { + display: flex; + justify-content: space-between; + + .van-button { + width: 45%; + background: #3a9256; + border: 0; + color: #fff; + } + } +} </style> \ No newline at end of file diff --git a/src/views/ryds/index.vue b/src/views/ryds/index.vue index 10cc363b558871a9d2c4ed80cba962006224e60e..09887e56f81f9bf555cbdf397d07a8fc82cd6a30 100644 --- a/src/views/ryds/index.vue +++ b/src/views/ryds/index.vue @@ -151,7 +151,6 @@ const getUserInfo = async () => { if (res.code == 200) { userInfo.value = res.result isSubmit.value = userInfo.value.sysUser.a8 - console.log(userInfo.value); } } const handleInvite = async () => { diff --git a/src/views/user/index.vue b/src/views/user/index.vue index 6edffb05e338cef8dac596b188bcb1a3bcdc3eb0..dc672fb6eee102a264ee21d3dbcd383ba50cc89f 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -13,6 +13,7 @@ import pnga13 from "@/static/user/13.png"; import pnga14 from "@/static/user/14.png"; import { useRouter } from "vue-router"; import handleCopy from "@/utils/handleCopy"; +import { Dialog } from "@varlet/ui"; const kfurl = sessionStorage.getItem("kfurl" || "https://www.baidu.com"); const router = useRouter(); // 导入图片 @@ -123,14 +124,16 @@ const tixian = () => { return false router.push('/yqjl/txjd') } -const logout = () => { - showConfirmDialog({ - title: "退出确认", - content: "您确定è¦é€€å‡ºç™»å½•å—?", - }).then(() => { - sessionStorage.clear(); - router.push("/login"); - }); +const actions = { + confirm: () =>{ sessionStorage.clear(); + router.push("/login");}, + cancel: () => {}, + close: () => {}, +} +const logout = async () => { + actions[await Dialog({ + title: "您确定è¦é€€å‡ºç™»å½•å—?", + })]() }; onMounted(fetchData); </script> diff --git a/src/views/user/myteam.vue b/src/views/user/myteam.vue index cffd9e0427f5a8f71098110cbfca4b22806a9243..124a59d43594816e9f7e86209853d54ef05bb0b8 100644 --- a/src/views/user/myteam.vue +++ b/src/views/user/myteam.vue @@ -188,6 +188,7 @@ const getTeamInfo = async () => { message: string result: TeamInfo }>>(`/business/businessWallet/getMyTeam?pageNo=${pageNum.value}&pageSize=${pageSize.value}&type=${currentLevel.value}`) + console.log(res); if (res.code === 200) { teamInfo.value = res.result members.value = [...members.value, ...(res.result.page.records || [])] diff --git a/vite.config.ts b/vite.config.ts index c3d6a925993d59373b4766a98067013bbb53cd1d..38c146a383c91945fd1f64cb6334d032fdc49ec9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -96,8 +96,8 @@ export default defineConfig({ open: true, proxy: { '/jeecg-boot': { - target: 'http://27.124.5.14:8080', - // target: 'https://www.yzcxyh18.com', + // target: 'http://27.124.5.14:8080', + target: 'https://www.yzcxyh18.com', changeOrigin: true } }