Commit c34d7f19 authored by 罗超's avatar 罗超

新增数据的绑定

parent 68ef6584
<template> <template>
<Screen v-if="screening" /> <div v-if="isFinish">
<Market v-else-if="market"></Market> <Screen v-if="screening" />
<Editor v-else-if="_isPC" /> <Market v-else-if="market"></Market>
<Mobile v-else /> <Editor v-else-if="_isPC" />
<Mobile v-else />
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from 'vue' import { onMounted,ref } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useScreenStore, useMainStore, useSnapshotStore } from '@/store' import { useScreenStore, useMainStore, useSnapshotStore } from '@/store'
import { LOCALSTORAGE_KEY_DISCARDED_DB } from '@/configs/storage' import { LOCALSTORAGE_KEY_DISCARDED_DB } from '@/configs/storage'
...@@ -19,6 +21,20 @@ import Screen from './views/Screen/index.vue' ...@@ -19,6 +21,20 @@ import Screen from './views/Screen/index.vue'
import Mobile from './views/Mobile/index.vue' import Mobile from './views/Mobile/index.vue'
import Market from './views/Market/Index.vue' import Market from './views/Market/Index.vue'
const isFinish = ref(false)
const userLoginHandler = async ()=>{
let param = query()
let userId = 1
if(param.uid) userId=parseInt(param.uid)
try {
await userStore().setUserLoginAsync(userId)
} catch (error) {
}
isFinish.value=true
}
userLoginHandler()
const _isPC = isPC() const _isPC = isPC()
const mainStore = useMainStore() const mainStore = useMainStore()
...@@ -30,14 +46,6 @@ if (process.env.NODE_ENV === 'production') { ...@@ -30,14 +46,6 @@ if (process.env.NODE_ENV === 'production') {
window.onbeforeunload = () => false window.onbeforeunload = () => false
} }
const userLoginHandler = async ()=>{
let param = query()
let userId = 1
if(param.uid) userId=parseInt(param.uid)
await userStore().setUserLoginAsync(userId)
}
userLoginHandler()
onMounted(async () => { onMounted(async () => {
await deleteDiscardedDB() await deleteDiscardedDB()
snapshotStore.initSnapshotDatabase() snapshotStore.initSnapshotDatabase()
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<h1 class="alifont" style="font-size:20px;">智慧设计平台</h1> <h1 class="alifont" style="font-size:20px;">智慧设计平台</h1>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-input v-model="searchKey" placeholder="输入模板关键字快速查找" class="input-with-select"> <el-input v-model="queryObj.Title" placeholder="输入模板关键字快速查找" class="input-with-select">
<template #append> <template #append>
<el-button type="primary" @click="queryTemplateBySearchHandler">搜索</el-button> <el-button type="primary" @click="queryTemplateBySearchHandler">搜索</el-button>
</template> </template>
...@@ -16,13 +16,19 @@ ...@@ -16,13 +16,19 @@
</el-row> </el-row>
<div class="q-mt-lg bg-white q-pa-lg rounded"> <div class="q-mt-lg bg-white q-pa-lg rounded">
<div class="row text-small items-center"> <div class="row text-small items-center">
<span class="q-mr-lg">适用线路:</span> <span style="margin-right: 50px;">适用线路:</span>
<el-check-tag :checked="queryObj.lineId == 0" @change="onLineChangeHandler(0)" <el-check-tag :checked="queryObj.lineId == 0" @change="onLineChangeHandler(0)"
class="text-small q-mr-md">全部</el-check-tag> class="text-small q-mr-md">全部</el-check-tag>
<el-check-tag :checked="queryObj.lineId == x.LineID" @change="onLineChangeHandler(x.LineID)" class="text-small q-mr-md" <el-check-tag :checked="queryObj.lineId == x.LineID" @change="onLineChangeHandler(x.LineID)" class="text-small q-mr-md"
v-for="x in lines" :key="x.LineID">{{x.LineName}}</el-check-tag> v-for="x in lines" :key="x.LineID">{{x.LineName}}</el-check-tag>
</div> </div>
<el-divider></el-divider> <el-divider style="margin:12px 0;border-top-color:#f3f6fb;"></el-divider>
<div class="row text-small items-center">
<span style="margin-right: 50px;">适用国家:</span>
<el-check-tag :checked="queryObj.CountryName == ''" @change="onCountryNameChangeHandler('')" class="text-small q-mr-md">通用</el-check-tag>
<el-check-tag :checked="queryObj.CountryName == x" @change="onCountryNameChangeHandler(x)" class="text-small q-mr-md"
v-for="(x,i) in countries" :key="i">{{x}}</el-check-tag>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -36,15 +42,20 @@ import { storeToRefs } from "pinia"; ...@@ -36,15 +42,20 @@ import { storeToRefs } from "pinia";
const {userInfo} = storeToRefs(userStore()) const {userInfo} = storeToRefs(userStore())
const lines = ref([] as Array<any>) const lines = ref([] as Array<any>)
const countries = ref(['日本','韩国','老挝','法国','意大利'] as Array<any>)
const queryObj = reactive({ const queryObj = reactive({
lineId: 0, lineId: 0,
searchKey: '' Title: '',
CountryName:''
}) })
const queryTemplateBySearchHandler = () => { } const queryTemplateBySearchHandler = () => { }
const onLineChangeHandler = (lineId: number) => { const onLineChangeHandler = (lineId: number) => {
queryObj.lineId = lineId queryObj.lineId = lineId
} }
const onCountryNameChangeHandler = (CountryName: string) => {
queryObj.CountryName = CountryName
}
const getLinesHandler = async ()=>{ const getLinesHandler = async ()=>{
try { try {
let response = await LineService.GetLineListAsync() let response = await LineService.GetLineListAsync()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment