feat: 获取扫码的参数

This commit is contained in:
2025-09-04 21:27:58 +08:00
parent 46a3b6a878
commit 613a2be148
5 changed files with 75 additions and 38 deletions

View File

@@ -5,21 +5,24 @@
<!-- 日历组件 -->
<Calender
:visible="calendarVisible"
mode="single"
:default-value="selectedDate"
@close="handleCalendarClose"
@select="handleDateSelect"
/>
:visible="calendarVisible"
mode="single"
:default-value="selectedDate"
@close="handleCalendarClose"
@select="handleDateSelect"
/>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import ChatMainList from "../chat/ChatMainList.vue";
import Calender from "@/components/Calender/index.vue";
import { onLoad } from "@dcloudio/uni-app";
import { GetWxMiniProgramUrlParam } from "@/utils/UrlParams";
import { useAppStore } from "@/store";
const appStore = useAppStore();
const calendarVisible = ref(false);
const selectedDate = ref("");
@@ -35,17 +38,28 @@ const handleDateSelect = (data) => {
calendarVisible.value = false;
console.log("选择的日期:", data.date);
uni.$emit("selectCalendarDate", selectedDate.value); // 传回父组件
};
uni.$on("openCalendar", () => {
calendarVisible.value = true;
});
onUnmounted(() => {
// uni.$off('openCalendar')
})
const getWeixinMiniProgramParams = (e) => {
console.log("Params:", e);
if (e.q && e.q != "undefined") {
const qrUrl = decodeURIComponent(e.q); // 获取到二维码原始链接内容
const params = GetWxMiniProgramUrlParam(qrUrl);
appStore.setSceneId(params.sceneId);
}
};
onLoad((e) => {
getWeixinMiniProgramParams(e);
});
onUnmounted(() => {
// uni.$off('openCalendar')
});
</script>
<style lang="scss" scoped>