代码优化
This commit is contained in:
@@ -3,7 +3,6 @@ import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import Container from "@/components/Container.vue";
|
||||
import Avatar from "@/components/Avatar.vue";
|
||||
import SButton from "@/components/SButton.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import Signin from "@/components/Signin.vue";
|
||||
import UserHeader from "@/components/UserHeader.vue";
|
||||
import { createOrderAPI, getHomeData, getVIPDescAPI } from "@/apis";
|
||||
@@ -151,15 +150,13 @@ onBeforeUnmount(() => {
|
||||
</view>
|
||||
</view>
|
||||
<SButton :onClick="onPay">支付</SButton>
|
||||
<SModal :show="showModal" :onClose="() => (showModal = false)">
|
||||
<Signin :onClose="() => (showModal = false)" />
|
||||
</SModal>
|
||||
<view class="my-orders" v-if="user.id">
|
||||
<view @click="toOrderPage">
|
||||
<text>我的订单</text>
|
||||
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<Signin :show="showModal" :onClose="() => (showModal = false)" />
|
||||
</view>
|
||||
</view>
|
||||
</Container>
|
||||
|
||||
@@ -62,16 +62,18 @@ const onCreateRoom = async () => {
|
||||
showModal.value = true;
|
||||
};
|
||||
const onSignin = () => {
|
||||
if (roomID.value && user.value.id) enterRoom(roomID.value);
|
||||
showSignin.value = false;
|
||||
if (roomID.value) enterRoom(roomID.value);
|
||||
};
|
||||
onShow(async () => {
|
||||
const result = await getBattleDataAPI();
|
||||
data.value = result;
|
||||
if (user.value.id) {
|
||||
const result = await getBattleDataAPI();
|
||||
data.value = result;
|
||||
}
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
roomID.value = options.roomID || "";
|
||||
if (options.roomID) {
|
||||
roomID.value = options.roomID;
|
||||
if (user.value.id) enterRoom(options.roomID);
|
||||
else showSignin.value = true;
|
||||
}
|
||||
@@ -167,9 +169,7 @@ onLoad(async (options) => {
|
||||
</view>
|
||||
<CreateRoom v-if="!warnning" :onConfirm="() => (showModal = false)" />
|
||||
</SModal>
|
||||
<SModal :show="showSignin" :onClose="() => (showSignin = false)">
|
||||
<Signin :onClose="onSignin" />
|
||||
</SModal>
|
||||
<Signin :show="showSignin" :onClose="onSignin" />
|
||||
</view>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
@@ -5,7 +5,6 @@ import Container from "@/components/Container.vue";
|
||||
import AppFooter from "@/components/AppFooter.vue";
|
||||
import AppBackground from "@/components/AppBackground.vue";
|
||||
import UserHeader from "@/components/UserHeader.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import Signin from "@/components/Signin.vue";
|
||||
import BubbleTip from "@/components/BubbleTip.vue";
|
||||
|
||||
@@ -244,9 +243,7 @@ onShareTimeline(() => {
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<SModal :show="showModal" :onClose="() => (showModal = false)">
|
||||
<Signin :onClose="() => (showModal = false)" />
|
||||
</SModal>
|
||||
<Signin :show="showModal" :onClose="() => (showModal = false)" />
|
||||
</view>
|
||||
<AppFooter />
|
||||
</Container>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { onShow, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
|
||||
import Container from "@/components/Container.vue";
|
||||
import PointRecord from "@/components/PointRecord.vue";
|
||||
import RingBarChart from "@/components/RingBarChart.vue";
|
||||
import SModal from "@/components/SModal.vue";
|
||||
import Signin from "@/components/Signin.vue";
|
||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||
import RewardUs from "@/components/RewardUs.vue";
|
||||
@@ -400,9 +399,11 @@ onShareTimeline(() => {
|
||||
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<SModal :show="showModal" :onClose="() => (showModal = false)" :noBg="true">
|
||||
<Signin :onClose="() => (showModal = false)" :noBg="true" />
|
||||
</SModal>
|
||||
<Signin
|
||||
:show="showModal"
|
||||
:onClose="() => (showModal = false)"
|
||||
:noBg="true"
|
||||
/>
|
||||
<ScreenHint2 :show="showTip || showTip2" :onClose="closeHint">
|
||||
<RewardUs
|
||||
v-if="showTip"
|
||||
|
||||
Reference in New Issue
Block a user