-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from mao2006/quit-reserve
fix: 修复了用户模式不会自动保存答案的问题
- Loading branch information
Showing
8 changed files
with
178 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { defineStore } from 'pinia'; | ||
import { ref } from 'vue'; | ||
import type { UploadFile } from 'element-plus'; | ||
|
||
export const useImageStore = defineStore('image', () => { | ||
const fileList = ref<UploadFile[]>([]); // 用于存储上传的文件列表 | ||
|
||
const addFile = (file: UploadFile) => { | ||
fileList.value.push(file); // 添加文件到列表 | ||
}; | ||
|
||
const clearFiles = () => { | ||
fileList.value = []; // 清空文件列表 | ||
}; | ||
|
||
|
||
return { fileList, addFile, clearFiles }; | ||
}, { persist: true }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//存储单选和多选的 | ||
import { defineStore } from "pinia"; | ||
import { ref } from "vue"; | ||
|
||
const useOptionStore = defineStore('OptionStore', () => { | ||
const options = ref([]) | ||
const search = (id: any, serial_num: number) => { | ||
const optionSearched = options.value.find(q => q.id === id && q.serial_num === serial_num) | ||
console.log(optionSearched) | ||
return optionSearched ? optionSearched.option : '' | ||
} | ||
const update = (id: any, serial_num: number, option: string) => { | ||
const tempOption = options.value.find(q => q.id === id && q.serial_num === serial_num) | ||
if (tempOption) { | ||
tempOption.option = option | ||
} else { | ||
options.value.push({ | ||
id: id, | ||
serial_num: serial_num, | ||
option: option | ||
}) | ||
} | ||
} | ||
|
||
const deleteOption = (id: any) => { | ||
options.value = options.value.filter(o => o.id !== id) | ||
} | ||
|
||
return { | ||
options, | ||
search, | ||
update, | ||
deleteOption | ||
} | ||
}, { persist: true }) | ||
|
||
export default useOptionStore |
Oops, something went wrong.