|
@@ -0,0 +1,41 @@
|
|
|
|
|
+import { getAlgoInfo, algoInfoModify } from '@/api/algo/algo';
|
|
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
|
|
+
|
|
|
|
|
+const algoList = ref([]);
|
|
|
|
|
+
|
|
|
|
|
+const algoId = ref(0);
|
|
|
|
|
+const pushLinkPrompt = ref('');
|
|
|
|
|
+const pushStatement = ref('');
|
|
|
|
|
+
|
|
|
|
|
+export function useAlgo() {
|
|
|
|
|
+ const getAlgoDatas = () => {
|
|
|
|
|
+ return getAlgoInfo().then((res) => {
|
|
|
|
|
+ algoList.value = res;
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const modifyAlgoDatas = () => {
|
|
|
|
|
+ return algoInfoModify(algoId.value, pushLinkPrompt.value, pushStatement.value)
|
|
|
|
|
+ .then(function () {
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: '表格数据保存成功',
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(function () {
|
|
|
|
|
+ ElMessage.error('表格数据保存失败');
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ algoList,
|
|
|
|
|
+ getAlgoDatas,
|
|
|
|
|
+ algoId,
|
|
|
|
|
+ pushLinkPrompt,
|
|
|
|
|
+ pushStatement,
|
|
|
|
|
+ modifyAlgoDatas,
|
|
|
|
|
+ };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export default useAlgo;
|