commit
406123bf8d
|
|
@ -0,0 +1,24 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["svelte.svelte-vscode"]
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# Svelte + Vite
|
||||
|
||||
This template should help get you started developing with Svelte in Vite.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
||||
|
||||
## Need an official Svelte framework?
|
||||
|
||||
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
|
||||
|
||||
## Technical considerations
|
||||
|
||||
**Why use this over SvelteKit?**
|
||||
|
||||
- It brings its own routing solution which might not be preferable for some users.
|
||||
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
|
||||
|
||||
This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
|
||||
|
||||
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
|
||||
|
||||
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
|
||||
|
||||
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.
|
||||
|
||||
**Why include `.vscode/extensions.json`?**
|
||||
|
||||
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
|
||||
|
||||
**Why enable `checkJs` in the JS template?**
|
||||
|
||||
It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration.
|
||||
|
||||
**Why is HMR not preserving my local component state?**
|
||||
|
||||
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).
|
||||
|
||||
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
|
||||
|
||||
```js
|
||||
// store.js
|
||||
// An extremely simple external store
|
||||
import { writable } from 'svelte/store'
|
||||
export default writable(0)
|
||||
```
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>医疗救助辅助审核</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "Node",
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
/**
|
||||
* svelte-preprocess cannot figure out whether you have
|
||||
* a value or a type, so tell TypeScript to enforce using
|
||||
* `import type` instead of `import` for Types.
|
||||
*/
|
||||
"importsNotUsedAsValues": "error",
|
||||
"isolatedModules": true,
|
||||
"resolveJsonModule": true,
|
||||
/**
|
||||
* To have warnings / errors of the Svelte compiler at the
|
||||
* correct position, enable source maps by default.
|
||||
*/
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
/**
|
||||
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||
* Disable this if you'd like to use dynamic types.
|
||||
*/
|
||||
"checkJs": true
|
||||
},
|
||||
/**
|
||||
* Use global.d.ts instead of compilerOptions.types
|
||||
* to avoid limiting type declarations.
|
||||
*/
|
||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "msclient",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^1.1.0",
|
||||
"svelte": "^3.52.0",
|
||||
"vite": "^3.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^7.0.96",
|
||||
"bulma": "^0.9.4",
|
||||
"fabric": "^5.2.4",
|
||||
"sass": "^1.56.1",
|
||||
"uuid": "^9.0.0"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 509 KiB |
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
import Route from "./route/Route.svelte";
|
||||
</script>
|
||||
|
||||
<Route path="/image" />
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
.disable-selection {
|
||||
user-select: none;
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
[
|
||||
{
|
||||
"name": "所有数据",
|
||||
"count": 0,
|
||||
"id": "all",
|
||||
"height": 0,
|
||||
"is_active": true,
|
||||
"icon": "mdi mdi-library-outline"
|
||||
},
|
||||
{
|
||||
"name": "暂存",
|
||||
"count": 5,
|
||||
"id": "saved",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-content-save-outline",
|
||||
"color": "hsl(171, 100%, 41%)"
|
||||
},
|
||||
{
|
||||
"name": "待审核",
|
||||
"count": 4,
|
||||
"id": "pending",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-account-clock",
|
||||
"color": "hsl(48, 100%, 67%)"
|
||||
},
|
||||
{
|
||||
"name": "初审通过",
|
||||
"count": 0,
|
||||
"id": "check-passed",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-sticker-check-outline",
|
||||
"color": "hsl(204, 86%, 53%)"
|
||||
},
|
||||
{
|
||||
"name": "初审退回",
|
||||
"count": 6,
|
||||
"id": "check-failed",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-alert-circle-outline",
|
||||
"color": "hsl(348, 100%, 61%)"
|
||||
},
|
||||
{
|
||||
"name": "复审通过",
|
||||
"count": 80,
|
||||
"id": "review-passed",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-check",
|
||||
"color": "hsl(141, 53%, 53%)"
|
||||
},
|
||||
{
|
||||
"name": "复审退回",
|
||||
"count": 9,
|
||||
"id": "review-failed",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-list-status",
|
||||
"color": "hsl(348, 100%, 61%)"
|
||||
},
|
||||
{
|
||||
"name": "归档",
|
||||
"count": 99,
|
||||
"id": "archive",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-folder-zip-outline",
|
||||
"color": "hsl(0, 0%, 21%)"
|
||||
},
|
||||
{
|
||||
"name": "垃圾箱",
|
||||
"count": 18,
|
||||
"id": "trush",
|
||||
"height": 0,
|
||||
"is_active": false,
|
||||
"icon": "mdi mdi-trash-can-outline",
|
||||
"color": "hsl(0, 0%, 56%)"
|
||||
}
|
||||
]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
|
|
@ -0,0 +1,141 @@
|
|||
<script>
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { onMount } from "svelte";
|
||||
import { fabric } from "fabric";
|
||||
|
||||
import Navbar from "./Navbar.svelte";
|
||||
|
||||
let canvas_dom;
|
||||
let canvas;
|
||||
let image;
|
||||
let window_width;
|
||||
let window_height;
|
||||
let canvas_width = 0;
|
||||
let canvas_height = 0;
|
||||
let active;
|
||||
|
||||
function LabelItem(label, items) {
|
||||
this.label = label;
|
||||
|
||||
this.items = items.map((e) => {
|
||||
return new OperationItem(e[0], e[1], e[2]);
|
||||
});
|
||||
}
|
||||
|
||||
function OperationItem(name, icon, handler = null) {
|
||||
this.id = uuidv4();
|
||||
this.name = name;
|
||||
this.icon = icon;
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
const Menu = [
|
||||
new LabelItem("采集操作", [
|
||||
["确认并返回", "mdi mdi-checkbox-marked-circle-outline"],
|
||||
["重新采集", "mdi mdi-reply-outline"],
|
||||
["取消", "mdi mdi-alpha-x-circle-outline"],
|
||||
]),
|
||||
new LabelItem("图像操作", [
|
||||
["向左旋转", "mdi mdi-file-rotate-left-outline"],
|
||||
["向右旋转", "mdi mdi-file-rotate-right-outline"],
|
||||
["文本加强", "mdi mdi-image-filter-center-focus-strong"],
|
||||
["裁剪", "mdi mdi-crop"],
|
||||
["滚轮缩放", "mdi mdi-loupe"],
|
||||
]),
|
||||
new LabelItem("文件操作", [
|
||||
["保存到本地", "mdi mdi-content-save-outline"],
|
||||
["打印图片", "mdi mdi-printer-outline"],
|
||||
]),
|
||||
];
|
||||
|
||||
function resize() {
|
||||
setTimeout(() => {
|
||||
canvas_height = window_height - 64;
|
||||
canvas_width = (window_width * 13) / 16;
|
||||
canvas.setWidth(canvas_width);
|
||||
canvas.setHeight(canvas_height);
|
||||
fabric.Image.fromURL("test.jpg", function (oImg) {
|
||||
let scale = Math.min(
|
||||
canvas_height / oImg.height,
|
||||
canvas_width / oImg.width
|
||||
);
|
||||
oImg.scale(scale);
|
||||
oImg.set("selectable", false);
|
||||
canvas.add(oImg);
|
||||
});
|
||||
}, 50);
|
||||
}
|
||||
|
||||
function init_canvas() {
|
||||
canvas = new fabric.StaticCanvas(canvas_dom, {
|
||||
width: canvas_width,
|
||||
height: canvas_height,
|
||||
});
|
||||
canvas.set("selectable", false);
|
||||
fabric.Image.fromURL("test.jpg", function (oImg) {
|
||||
let scale = Math.min(
|
||||
canvas_height / oImg.height,
|
||||
canvas_width / oImg.width
|
||||
);
|
||||
oImg.scale(scale);
|
||||
canvas.add(oImg);
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
canvas_height = window_height - 64;
|
||||
canvas_width = (window_width * 13) / 16;
|
||||
init_canvas();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
bind:innerHeight={window_height}
|
||||
bind:innerWidth={window_width}
|
||||
on:resize={resize}
|
||||
/>
|
||||
|
||||
<div class="disable-selection">
|
||||
<Navbar />
|
||||
<div class="columns is-gapless">
|
||||
<div class="column is-2" style="margin: 10px">
|
||||
<aside class="menu">
|
||||
{#each Menu as m}
|
||||
<p class="menu-label" style="font-size: 0.9em">{m.label}</p>
|
||||
<ul class="menu-list">
|
||||
{#each m.items as item}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<li>
|
||||
<a
|
||||
class:is-active={active === item.id}
|
||||
on:click={() => {
|
||||
active = item.id;
|
||||
}}
|
||||
><span class="icon-text">
|
||||
<span class="icon">
|
||||
<i class={item.icon} />
|
||||
</span><span> {item.name}</span></span
|
||||
>
|
||||
</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/each}
|
||||
</aside>
|
||||
</div>
|
||||
<div class="column">
|
||||
<canvas
|
||||
bind:this={canvas_dom}
|
||||
width={canvas_width}
|
||||
height={canvas_height}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
canvas {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<script>
|
||||
import { user_store, User } from "./User";
|
||||
import { RouterGuide } from "../route/Route";
|
||||
|
||||
export let active = true;
|
||||
let guide = new RouterGuide();
|
||||
let username = "";
|
||||
let password = "";
|
||||
let error = false;
|
||||
let err_msg = "";
|
||||
|
||||
function close() {
|
||||
active = false;
|
||||
}
|
||||
|
||||
function ignore_error() {
|
||||
error = false;
|
||||
username = "";
|
||||
password = "";
|
||||
}
|
||||
|
||||
function login_error(msg) {
|
||||
error = true;
|
||||
err_msg = msg;
|
||||
}
|
||||
|
||||
function input_complete_check(event) {
|
||||
if (event.key == "Enter") {
|
||||
login();
|
||||
}
|
||||
}
|
||||
|
||||
function login() {
|
||||
// TODO:fetch(url).then 帐号密码错误,请重新尝试*****
|
||||
if (password === "" || username === "") {
|
||||
return login_error("帐号密码不可为空!");
|
||||
}
|
||||
user_store.set(new User(username, "123", "123", "checker"));
|
||||
guide.push("/index");
|
||||
active = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal" class:is-active={active}>
|
||||
<div class="modal-background" />
|
||||
<div class="modal-card" style="width: 360px">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">请输入帐号和密码</p>
|
||||
<button class="delete" aria-label="close" on:click={close} />
|
||||
</header>
|
||||
<section class="modal-card-body">
|
||||
<div class="field">
|
||||
<span class="label" class:is-danger={error}>帐号</span>
|
||||
<div class="field-body">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input
|
||||
bind:value={username}
|
||||
on:keydown={input_complete_check}
|
||||
class="input"
|
||||
class:is-danger={error}
|
||||
type="text"
|
||||
placeholder="请输入帐号"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span class="label" class:is-danger={error}>密码</span>
|
||||
<div class="field-body">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input
|
||||
bind:value={password}
|
||||
on:keydown={input_complete_check}
|
||||
class="input"
|
||||
class:is-danger={error}
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{#if error}
|
||||
<div>
|
||||
<div class="notification is-danger is-light">
|
||||
<button class="delete" on:click={ignore_error} />
|
||||
{err_msg}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button class="button" on:click={login}>登录</button>
|
||||
<button class="button" on:click={close}>取消</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import Navbar from "./Navbar.svelte";
|
||||
import Items from "../assets/Procedure.json";
|
||||
import PageSketch from "./PageSketch.svelte";
|
||||
|
||||
let window_scrolly;
|
||||
let window_height;
|
||||
let filler = 0;
|
||||
let items = Items;
|
||||
let applicants = [];
|
||||
onMount(async () => {
|
||||
filler = window_height - 56;
|
||||
applicants = [11, 12, 123, 100];
|
||||
/*const response = await fetch("../.././public/SideNavItem.json", {
|
||||
mode: "cors",
|
||||
});
|
||||
items = await response.json();*/
|
||||
});
|
||||
|
||||
function resize() {
|
||||
setTimeout(() => {
|
||||
filler = window_height - 56;
|
||||
}, 50);
|
||||
}
|
||||
|
||||
function select_item(name) {
|
||||
console.log("select_item", name);
|
||||
items.forEach((e) => {
|
||||
if (e.id !== name) {
|
||||
e.is_active = false;
|
||||
} else {
|
||||
e.is_active = true;
|
||||
}
|
||||
});
|
||||
items = items;
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
bind:innerHeight={window_height}
|
||||
bind:outerHeight={window_scrolly}
|
||||
on:resize={resize}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Navbar />
|
||||
<div class="columns is-gapless" style:Height="{filler}px">
|
||||
<div
|
||||
class="column is-one-third-tablet is-one-quarter-desktop is-one-quarter-widescreen is-one-fifth-fullhd"
|
||||
>
|
||||
<nav class="panel" style:Height="{filler}px">
|
||||
<div class="panel-block">
|
||||
<div class="field has-addons">
|
||||
<p class="control has-icons-left">
|
||||
<input class="input" type="text" placeholder="姓名或身份证号" />
|
||||
<span class="icon is-left">
|
||||
<i class="mdi mdi-magnify" />
|
||||
</span>
|
||||
</p>
|
||||
<p class="control">
|
||||
<span class="button is-info"> 检索 </span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#each items as item}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a
|
||||
class="panel-block disable-selection"
|
||||
class:item-active={item.is_active}
|
||||
on:click={() => select_item(item.id)}
|
||||
style="display: block;"
|
||||
>
|
||||
<span class="panel-icon" class:has-text-info={item.is_active}>
|
||||
<i class={item.icon} aria-hidden="true" />
|
||||
</span>
|
||||
{item.name}
|
||||
<span
|
||||
class="tag is-rounded is-light"
|
||||
class:is-link={item.is_active}
|
||||
style="float: right;">{item.count}</span
|
||||
>
|
||||
</a>
|
||||
{/each}
|
||||
</nav>
|
||||
</div>
|
||||
<div
|
||||
class="column scroller"
|
||||
style:Height="{filler}px"
|
||||
style="margin-left: 2px"
|
||||
>
|
||||
{#each applicants as ap}
|
||||
<PageSketch id={ap.id} />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.item-active {
|
||||
color: hsl(217, 71%, 53%);
|
||||
background-color: hsl(0, 0%, 94%);
|
||||
}
|
||||
|
||||
.scroller {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<script>
|
||||
import { onDestroy } from "svelte";
|
||||
import { user_store } from "./User";
|
||||
import { RouterGuide } from "../route/Route";
|
||||
|
||||
let user;
|
||||
let guide = new RouterGuide();
|
||||
|
||||
function logout() {
|
||||
guide.push("/login");
|
||||
}
|
||||
|
||||
const unsubscribe = user_store.subscribe((value) => {
|
||||
user = value;
|
||||
});
|
||||
|
||||
onDestroy(unsubscribe);
|
||||
</script>
|
||||
|
||||
<nav class="navbar is-light" aria-label="main navigation">
|
||||
<div class="navbar-brand">
|
||||
<span class="navbar-item">
|
||||
<p class="is-size-4 disable-selection">医疗救助智能辅助审核</p>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 首页 </a>
|
||||
|
||||
{#if user.is_permission_access("DataEntry")}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 录入 </a>
|
||||
{/if}
|
||||
{#if user.is_permission_access("Search")}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 查询 </a>
|
||||
{/if}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 设置 </a>
|
||||
|
||||
{#if user.is_permission_access("LogsCheck")}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 操作日志 </a>
|
||||
{/if}
|
||||
{#if user.is_permission_access("AccountManagement")}
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<a class="navbar-item disable-selection"> 账户管理 </a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<div class="buttons">
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<button class="button is-light" on:click={logout}> 登出 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { Operation } from "./utils";
|
||||
|
||||
export let id;
|
||||
|
||||
const url = "";
|
||||
let data = {
|
||||
id: id,
|
||||
icon: "../asserts/SIGN2.png",
|
||||
step: "check-failed",
|
||||
name: "常申凯",
|
||||
collector: "湾沚镇xxx",
|
||||
//checker: "李芳宜",
|
||||
reviewer: "汤飞燕",
|
||||
records: [
|
||||
{ operation: "review-passed", time: "2月29日" },
|
||||
{ operation: "saved", time: "2月29日" },
|
||||
],
|
||||
};
|
||||
const op = new Operation(data.step);
|
||||
let get_name = (s) => {
|
||||
return op.get_name(s);
|
||||
};
|
||||
onMount(async () => {
|
||||
/*let response = await fetch(url + id);
|
||||
console.log(response.status, url + id);
|
||||
if (response.ok) {
|
||||
data = await response.json();
|
||||
}*/
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="box crate disable-selection" style="border-left: 0.4em solid {op.get_color()}">
|
||||
<article class="media">
|
||||
<div class="media-left">
|
||||
<figure class="image is-64x64">
|
||||
<!-- svelte-ignore a11y-img-redundant-alt -->
|
||||
<img src="./src/assets/SIGN2.png" alt="Image" />
|
||||
</figure>
|
||||
</div>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{data.name}</strong>
|
||||
<span class="field is-grouped">
|
||||
{#each data.records as r}
|
||||
<div class="control">
|
||||
<div class="tags has-addons">
|
||||
<span class="tag is-light">{get_name(r.operation)}</span>
|
||||
<span class="tag is-info">{r.time}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
上传:{data.collector}
|
||||
{#if data.checker}
|
||||
<br />
|
||||
初审:{data.checker}
|
||||
{#if data.reviewer}
|
||||
<br />
|
||||
复审:{data.reviewer}
|
||||
{/if}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<nav class="level is-mobile disable-selection">
|
||||
<div class="level-left">
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<span class="level-item action" aria-label="reply">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-printer" aria-hidden="true" />
|
||||
</span>
|
||||
<span>打印</span>
|
||||
</span>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<span class="level-item action" aria-label="retweet">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-text-box-edit-outline" aria-hidden="true" />
|
||||
</span>
|
||||
<span>编辑</span>
|
||||
</span>
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<span class="level-item action" aria-label="like">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-delete-outline " aria-hidden="true" />
|
||||
</span>
|
||||
<span>删除</span>
|
||||
</span>
|
||||
<span class="level-item action" aria-label="like">
|
||||
<span class="icon is-small">
|
||||
<i class="mdi mdi-content-save-outline" aria-hidden="true" />
|
||||
</span>
|
||||
<span>保存</span>
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.crate {
|
||||
margin: 1em 1em 1em 1em;
|
||||
}
|
||||
|
||||
.crate:hover {
|
||||
border: 1px solid rgb(14, 2, 19);
|
||||
}
|
||||
|
||||
.action:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import { writable } from "svelte/store";
|
||||
|
||||
const RolePermissions = {
|
||||
collector: ["DataEntry", "Search"],
|
||||
checker: ["DataEntry", "Search"],
|
||||
reviewer: ["Search"],
|
||||
root: ["Settings", "AccountManagement", "LogsCheck"],
|
||||
};
|
||||
|
||||
export function User(username, Id, token, role) {
|
||||
let _username = username;
|
||||
let _id = Id;
|
||||
let _token = token;
|
||||
let _role;
|
||||
if (RolePermissions[role] !== undefined) {
|
||||
_role = role;
|
||||
} else {
|
||||
_role = undefined;
|
||||
}
|
||||
|
||||
this.is_permission_access = (operation) => {
|
||||
if (_role === undefined) {
|
||||
return false;
|
||||
}
|
||||
return RolePermissions[role].includes(operation);
|
||||
};
|
||||
|
||||
this.username = () => {
|
||||
return _username;
|
||||
};
|
||||
|
||||
this.token = () => {
|
||||
return _token;
|
||||
};
|
||||
|
||||
this.id = () => {
|
||||
return _id;
|
||||
};
|
||||
|
||||
this.role = () => {
|
||||
return _role;
|
||||
};
|
||||
}
|
||||
|
||||
export const user_store = writable(new User());
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import procedure from "../assets/Procedure.json";
|
||||
|
||||
export function Operation(step) {
|
||||
this.step = step;
|
||||
|
||||
const StepNameMap = {
|
||||
saved: "保存中",
|
||||
pending: "待审核",
|
||||
"check-passed": "初审通过",
|
||||
"check-failed": "初审退回",
|
||||
"review-passed": "复审通过",
|
||||
"review-failed": "复审退回",
|
||||
archive: "归档",
|
||||
trush: "删除",
|
||||
};
|
||||
|
||||
this.get_name = (s) => {
|
||||
if (!s) {
|
||||
return procedure.find((e) => e.id === this.step).name;
|
||||
}
|
||||
console.log(s);
|
||||
return procedure.find((e) => e.id === s).name;
|
||||
};
|
||||
|
||||
this.get_color = () => {
|
||||
return procedure.find((e) => e.id === this.step).color;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import "@mdi/font/css/materialdesignicons.min.css";
|
||||
|
||||
import "bulma";
|
||||
import "./assets/DisableSelection.css"
|
||||
import App from "./App.svelte";
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById("app"),
|
||||
});
|
||||
|
||||
export default app;
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import { writable } from "svelte/store";
|
||||
import { setContext } from "svelte";
|
||||
|
||||
import Main from "../lib/Main.svelte";
|
||||
import Login from "../lib/Login.svelte";
|
||||
import Image from "../lib/ImageShow.svelte";
|
||||
|
||||
const RouterMap = {
|
||||
index: Main,
|
||||
login: Login,
|
||||
image: Image,
|
||||
};
|
||||
|
||||
const ReAbsolutePath = /^\/[a-zA-Z0-9\_]{1,}[a-zA-Z0-9\_\/]/;
|
||||
const ReRelativePath = /^[a-zA-Z0-9][a-zA-Z0-9\_]{1,}[a-zA-Z0-9\_\/]/;
|
||||
|
||||
export function Path({ path, params = {} }) {
|
||||
let pre_current = path.match(
|
||||
/^[a-zA-Z0-9\/][a-zA-Z0-9\_]{1,}[a-zA-Z0-9\_\/]/
|
||||
);
|
||||
let current;
|
||||
if (pre_current) {
|
||||
this.path_remain = path.replace(pre_current[0], "");
|
||||
current = pre_current[0].replace("/", "");
|
||||
}
|
||||
|
||||
if (current in RouterMap) {
|
||||
this.component = RouterMap[current];
|
||||
}
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
export const router = writable(null);
|
||||
|
||||
export function RouterGuide() {
|
||||
let is_absolute = (p) => {
|
||||
let current = p.match(ReAbsolutePath);
|
||||
if (current) {
|
||||
return true;
|
||||
}
|
||||
current = p.match(ReRelativePath);
|
||||
if (current) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
this.push = (path, params) => {
|
||||
let p = new Path({ path, params });
|
||||
|
||||
if (is_absolute(path)) {
|
||||
router.set(p);
|
||||
} else {
|
||||
router.set(null);
|
||||
setContext("route", p);
|
||||
}
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<script>
|
||||
import { onDestroy, getContext, setContext } from "svelte";
|
||||
import { router, RouterGuide, Path } from "./Route.js";
|
||||
|
||||
export let path = null;
|
||||
export let params = {};
|
||||
|
||||
let r;
|
||||
let guide = new RouterGuide();
|
||||
if (path !== null) {
|
||||
r = guide.push(path, params);
|
||||
}
|
||||
const unsubscribe = router.subscribe((value) => {
|
||||
if (value !== null) {
|
||||
r = value;
|
||||
} else {
|
||||
r = getContext("route");
|
||||
}
|
||||
});
|
||||
onDestroy(unsubscribe);
|
||||
</script>
|
||||
|
||||
<svelte:component this={r.component} {...params} />
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [svelte()]
|
||||
})
|
||||
Loading…
Reference in New Issue