├── Simple ├── wwwroot │ ├── vuex │ │ ├── actions.js │ │ ├── getters.js │ │ └── store.js │ ├── favicon.ico │ ├── resources │ │ └── img │ │ │ └── user.png │ ├── dist │ │ ├── 674f50d287a8c48dc19ba404d20fe713.eot │ │ ├── af7ae505a9eed503f8b8e6982036873e.woff2 │ │ ├── b02bdc1b846fd65473922f5f62832108.ttf │ │ ├── b06871f281fee6b241d60582ae9369b9.ttf │ │ ├── d2f69a92faa6fe990d2e613c358be705.woff │ │ └── fee66e712a8a08eef5805a46892932ad.woff │ ├── views │ │ ├── 404.vue │ │ ├── login.vue │ │ ├── sys │ │ │ ├── useradd.vue │ │ │ └── users.vue │ │ └── home.vue │ ├── App.vue │ ├── routes.js │ └── main.js ├── obj │ ├── Debug │ │ └── netcoreapp1.0 │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ │ │ ├── CoreCompileInputs.cache │ │ │ ├── Simple.dll │ │ │ ├── Simple.pdb │ │ │ ├── Simple.csproj.FileListAbsolute.txt │ │ │ └── Simple.AssemblyInfo.cs │ ├── Release │ │ └── netcoreapp1.0 │ │ │ ├── CoreCompileInputs.cache │ │ │ └── Simple.AssemblyInfo.cs │ ├── Simple.csproj.nuget.g.targets │ └── Simple.csproj.nuget.g.props ├── app.conf.js ├── bin │ └── Debug │ │ └── netcoreapp1.0 │ │ ├── Simple.dll │ │ ├── Simple.pdb │ │ ├── Simple.runtimeconfig.dev.json │ │ └── Simple.runtimeconfig.json ├── appsettings.json ├── vue-loader.conf.js ├── appsettings.Development.json ├── Controllers │ ├── HomeController.cs │ └── UsersController.cs ├── Views │ └── Home │ │ └── Index.cshtml ├── Model │ ├── UserInfo.cs │ └── UserInfoRepository.cs ├── Simple.csproj.user ├── Program.cs ├── Properties │ └── launchSettings.json ├── webpack.config.js ├── ScaffoldingReadMe.txt ├── utils.js ├── Startup.cs ├── package.json └── Simple.csproj ├── README.md ├── Simple.sln └── LICENSE /Simple/wwwroot/vuex/actions.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Simple/wwwroot/vuex/getters.js: -------------------------------------------------------------------------------- 1 | //test 2 | -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 50f07d57da3b496379c6f44ef2d78fd206027faa 2 | -------------------------------------------------------------------------------- /Simple/obj/Release/netcoreapp1.0/CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 50f07d57da3b496379c6f44ef2d78fd206027faa 2 | -------------------------------------------------------------------------------- /Simple/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/favicon.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # simple 2 | .net core + vue 开发单页应用 3 | 4 | 获取到源码后执行 5 | 6 | npm install 7 | 8 | 其他指令可在vs中完成 9 | -------------------------------------------------------------------------------- /Simple/app.conf.js: -------------------------------------------------------------------------------- 1 | exports.conf = { 2 | dev: true,//开发模式 3 | assetsSubDirectory:'~/wwwroot/resources'//资源目录 4 | } -------------------------------------------------------------------------------- /Simple/wwwroot/resources/img/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/resources/img/user.png -------------------------------------------------------------------------------- /Simple/bin/Debug/netcoreapp1.0/Simple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/bin/Debug/netcoreapp1.0/Simple.dll -------------------------------------------------------------------------------- /Simple/bin/Debug/netcoreapp1.0/Simple.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/bin/Debug/netcoreapp1.0/Simple.pdb -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/Simple.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/obj/Debug/netcoreapp1.0/Simple.dll -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/Simple.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/obj/Debug/netcoreapp1.0/Simple.pdb -------------------------------------------------------------------------------- /Simple/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Simple/wwwroot/dist/674f50d287a8c48dc19ba404d20fe713.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/674f50d287a8c48dc19ba404d20fe713.eot -------------------------------------------------------------------------------- /Simple/wwwroot/dist/af7ae505a9eed503f8b8e6982036873e.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/af7ae505a9eed503f8b8e6982036873e.woff2 -------------------------------------------------------------------------------- /Simple/wwwroot/dist/b02bdc1b846fd65473922f5f62832108.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/b02bdc1b846fd65473922f5f62832108.ttf -------------------------------------------------------------------------------- /Simple/wwwroot/dist/b06871f281fee6b241d60582ae9369b9.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/b06871f281fee6b241d60582ae9369b9.ttf -------------------------------------------------------------------------------- /Simple/wwwroot/dist/d2f69a92faa6fe990d2e613c358be705.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/d2f69a92faa6fe990d2e613c358be705.woff -------------------------------------------------------------------------------- /Simple/wwwroot/dist/fee66e712a8a08eef5805a46892932ad.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wenjq0911/simple/HEAD/Simple/wwwroot/dist/fee66e712a8a08eef5805a46892932ad.woff -------------------------------------------------------------------------------- /Simple/bin/Debug/netcoreapp1.0/Simple.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\wenjq\\.nuget\\packages" 5 | ] 6 | } 7 | } -------------------------------------------------------------------------------- /Simple/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var conf = require('./app.conf') 3 | module.exports = { 4 | loaders: utils.cssLoaders({ 5 | sourceMap: !conf.conf.dev, 6 | extract: conf.conf.dev 7 | }) 8 | } 9 | -------------------------------------------------------------------------------- /Simple/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Simple/bin/Debug/netcoreapp1.0/Simple.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "framework": { 4 | "name": "Microsoft.NETCore.App", 5 | "version": "1.0.4" 6 | }, 7 | "configProperties": { 8 | "System.GC.Server": true 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Simple/wwwroot/views/404.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /Simple/obj/Simple.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | -------------------------------------------------------------------------------- /Simple/wwwroot/App.vue: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /Simple/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace Simple.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public IActionResult Index() 12 | { 13 | return View(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Simple/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Simple 12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Simple/wwwroot/vuex/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import * as actions from './actions' 4 | import * as getters from './getters' 5 | 6 | Vue.use(Vuex) 7 | 8 | // 应用初始状态 9 | const state = { 10 | } 11 | 12 | // 定义所需的 mutations 13 | const mutations = { 14 | 15 | } 16 | 17 | // 创建 store 实例 18 | export default new Vuex.Store({ 19 | actions, 20 | getters, 21 | state, 22 | mutations 23 | }) -------------------------------------------------------------------------------- /Simple/Model/UserInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace Simple.Model 7 | { 8 | public class UserInfo 9 | { 10 | public string uuid { get; set; } 11 | public string login_name { get; set; } 12 | public string real_name { get; set; } 13 | public string email { get; set; } 14 | public string birthday { get; set; } 15 | public int age { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Simple/Simple.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 600 5 | Simple 6 | 7 | 8 | ProjectDebugger 9 | 10 | -------------------------------------------------------------------------------- /Simple/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore.Hosting; 7 | 8 | namespace Simple 9 | { 10 | public class Program 11 | { 12 | public static void Main(string[] args) 13 | { 14 | var host = new WebHostBuilder() 15 | .UseKestrel() 16 | .UseContentRoot(Directory.GetCurrentDirectory()) 17 | .UseIISIntegration() 18 | .UseStartup() 19 | .UseApplicationInsights() 20 | .Build(); 21 | 22 | host.Run(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/Simple.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Works\MainBusinessDemo\Web\Simple\Simple\bin\Debug\netcoreapp1.0\Simple.deps.json 2 | D:\Works\MainBusinessDemo\Web\Simple\Simple\bin\Debug\netcoreapp1.0\Simple.runtimeconfig.json 3 | D:\Works\MainBusinessDemo\Web\Simple\Simple\bin\Debug\netcoreapp1.0\Simple.runtimeconfig.dev.json 4 | D:\Works\MainBusinessDemo\Web\Simple\Simple\bin\Debug\netcoreapp1.0\Simple.dll 5 | D:\Works\MainBusinessDemo\Web\Simple\Simple\bin\Debug\netcoreapp1.0\Simple.pdb 6 | D:\Works\MainBusinessDemo\Web\Simple\Simple\obj\Debug\netcoreapp1.0\Simple.AssemblyInfo.cs 7 | D:\Works\MainBusinessDemo\Web\Simple\Simple\obj\Debug\netcoreapp1.0\Simple.dll 8 | D:\Works\MainBusinessDemo\Web\Simple\Simple\obj\Debug\netcoreapp1.0\Simple.pdb 9 | -------------------------------------------------------------------------------- /Simple/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:11947/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "Simple": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:11948" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Simple/wwwroot/routes.js: -------------------------------------------------------------------------------- 1 | import Login from './views/login.vue' 2 | import NotFound from './views/404.vue' 3 | import Home from './views/home.vue' 4 | import Users from './views/sys/users.vue' 5 | import UserAdd from './views/sys/useradd.vue' 6 | 7 | let routes = [ 8 | { 9 | path: '/login', 10 | component: Login, 11 | name: '', 12 | hidden: true 13 | }, 14 | { 15 | path: '/404', 16 | component: NotFound, 17 | name: '', 18 | hidden: true 19 | }, 20 | { 21 | path: '*', 22 | hidden: true, 23 | redirect: { path: '/404' } 24 | }, { 25 | path: '/', 26 | component: Home, 27 | name: '系统管理', 28 | iconCls: 'el-icon-setting',//图标样式class 29 | children: [ 30 | { path: '/users', component: Users, name: '用户管理' }, 31 | { path: '/useradd', component: UserAdd, name: '用户添加',hidden:true } 32 | ] 33 | }, 34 | ]; 35 | 36 | export default routes; -------------------------------------------------------------------------------- /Simple.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.4 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple", "Simple\Simple.csproj", "{904BE2ED-CBD7-4B5D-8AFA-0DB7A74DE99E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {904BE2ED-CBD7-4B5D-8AFA-0DB7A74DE99E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {904BE2ED-CBD7-4B5D-8AFA-0DB7A74DE99E}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {904BE2ED-CBD7-4B5D-8AFA-0DB7A74DE99E}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {904BE2ED-CBD7-4B5D-8AFA-0DB7A74DE99E}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Simple/wwwroot/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App' 3 | import ElementUI from 'element-ui' 4 | import 'element-ui/lib/theme-default/index.css' 5 | import VueRouter from 'vue-router' 6 | import store from './vuex/store' 7 | import Vuex from 'vuex' 8 | import VueSource from 'vue-resource' 9 | import routes from './routes' 10 | import 'font-awesome/css/font-awesome.min.css' 11 | 12 | 13 | Vue.use(ElementUI) 14 | Vue.use(VueRouter) 15 | Vue.use(Vuex) 16 | Vue.use(VueSource) 17 | 18 | //创建路由实例 19 | const router = new VueRouter({ 20 | routes 21 | }) 22 | router.beforeEach((to, from, next) => { 23 | 24 | //这里进行了简单的登录验证 25 | //访问login时直接清除user 26 | if (to.path == '/login') { 27 | sessionStorage.removeItem('user'); 28 | } 29 | 30 | let user = JSON.parse(sessionStorage.getItem('user')); 31 | if (!user && to.path != '/login') { 32 | next({ path: '/login' }) 33 | } else { 34 | next() 35 | } 36 | }) 37 | 38 | 39 | new Vue({ 40 | router, 41 | store, 42 | render: h => h(App) 43 | }).$mount('#app') -------------------------------------------------------------------------------- /Simple/obj/Debug/netcoreapp1.0/Simple.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("Simple")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyDescriptionAttribute("Package Description")] 17 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 18 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 19 | [assembly: System.Reflection.AssemblyProductAttribute("Simple")] 20 | [assembly: System.Reflection.AssemblyTitleAttribute("Simple")] 21 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 22 | 23 | // 由 MSBuild WriteCodeFragment 类生成。 24 | 25 | -------------------------------------------------------------------------------- /Simple/obj/Release/netcoreapp1.0/Simple.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("Simple")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] 16 | [assembly: System.Reflection.AssemblyDescriptionAttribute("Package Description")] 17 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 18 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 19 | [assembly: System.Reflection.AssemblyProductAttribute("Simple")] 20 | [assembly: System.Reflection.AssemblyTitleAttribute("Simple")] 21 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 22 | 23 | // 由 MSBuild WriteCodeFragment 类生成。 24 | 25 | -------------------------------------------------------------------------------- /Simple/obj/Simple.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | D:\Git\simple\Simple\obj\project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\wenjq\.nuget\packages\ 9 | PackageReference 10 | 4.0.0 11 | 12 | 13 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 14 | 15 | -------------------------------------------------------------------------------- /Simple/Model/UserInfoRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace Simple.Model 7 | { 8 | public class UserInfoRepository 9 | { 10 | static List db_users = new List() { 11 | /*new UserInfo(){ 12 | uuid="test", 13 | age=20, 14 | birthday="1997-01-01", 15 | email="test@qq.com", 16 | login_name="admin", 17 | real_name="管理员" 18 | }*/ 19 | }; 20 | 21 | public static IList LoadAll() { 22 | return db_users; 23 | } 24 | public static string Insert(UserInfo u) 25 | { 26 | u.uuid = Guid.NewGuid().ToString(); 27 | db_users.Add(u); 28 | return u.uuid; 29 | } 30 | public static string Update(UserInfo u) 31 | { 32 | db_users.Remove(db_users.Where(m => m.uuid.Equals(u.uuid)).FirstOrDefault()); 33 | db_users.Add(u); 34 | return u.uuid; 35 | } 36 | public static UserInfo Get(string uuid) { 37 | return db_users.Where(m=>m.uuid.Equals(uuid)).FirstOrDefault(); 38 | } 39 | public static void Delete(string uuid) 40 | { 41 | var u = db_users.Where(m => m.uuid.Equals(uuid)).FirstOrDefault(); 42 | db_users.Remove(u); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Simple/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var conf = require('./app.conf') 5 | function resolve(dir) { 6 | return path.join(__dirname, dir) 7 | } 8 | module.exports = { 9 | entry: { 10 | app: './wwwroot/main.js' 11 | }, 12 | output: { 13 | filename: 'bundle.js', 14 | path: path.resolve(__dirname, './wwwroot/dist/') 15 | }, 16 | module: { 17 | rules: [ 18 | { 19 | test: /\.vue$/, 20 | loader: 'vue-loader' 21 | }, 22 | { 23 | test: /\.js$/, 24 | loader: 'babel-loader', 25 | include: [resolve('wwwroot')] 26 | }, 27 | { 28 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 29 | loader: 'url-loader', 30 | options: { 31 | limit: 10000, 32 | name: utils.assetsPath('img/[name].[hash:7].[ext]'), 33 | options: { 34 | publicPath: 'dist/resources/img/' 35 | } 36 | } 37 | }, 38 | { 39 | test: /\.css$/, 40 | loader: 'style-loader!css-loader' 41 | }, 42 | { 43 | test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/, 44 | loader: 'file-loader', 45 | options: { 46 | publicPath: 'dist/' 47 | } 48 | }, 49 | ] 50 | }, 51 | resolve: { 52 | extensions: ['.js', '.vue', '.json'], 53 | } 54 | }; 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Simple/Controllers/UsersController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Newtonsoft.Json; 7 | using Simple.Model; 8 | 9 | namespace Simple.Controllers 10 | { 11 | [Route("api/[controller]")] 12 | public class UsersController : Controller 13 | { 14 | [HttpGet] 15 | public string Get() 16 | { 17 | return JsonConvert.SerializeObject(UserInfoRepository.LoadAll()); 18 | } 19 | 20 | [HttpGet("{uuid}")] 21 | public string Get(string uuid) 22 | { 23 | return JsonConvert.SerializeObject(UserInfoRepository.Get(uuid)); 24 | } 25 | 26 | [HttpGet("p/")] 27 | public string Get(string name, int page = 1, int pagesize = 20) 28 | { 29 | long count = 0; 30 | var list = UserInfoRepository.LoadAll(); 31 | count = list.Count; 32 | var obj = new 33 | { 34 | total = count, 35 | list = list.Where(m => (m.real_name.Equals(name)||string.IsNullOrEmpty(name))).Skip((page - 1) * pagesize).Take(pagesize) 36 | }; 37 | return JsonConvert.SerializeObject(obj); 38 | } 39 | 40 | [HttpPost] 41 | public void Post([FromBody]UserInfo user) 42 | { 43 | UserInfoRepository.Insert(user); 44 | } 45 | 46 | [HttpPut] 47 | public void Put([FromBody]UserInfo user) 48 | { 49 | UserInfoRepository.Update(user); 50 | } 51 | 52 | [HttpDelete("{uuid}")] 53 | public void Delete(string uuid) 54 | { 55 | UserInfoRepository.Delete(uuid); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Simple/ScaffoldingReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | ASP.NET MVC core dependencies have been added to the project. 3 | However you may still need to do make changes to your project. 4 | 5 | 1. Suggested changes to Startup class: 6 | 1.1 Add a constructor: 7 | public IConfigurationRoot Configuration { get; } 8 | 9 | public Startup(IHostingEnvironment env) 10 | { 11 | var builder = new ConfigurationBuilder() 12 | .SetBasePath(env.ContentRootPath) 13 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) 14 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 15 | .AddEnvironmentVariables(); 16 | Configuration = builder.Build(); 17 | } 18 | 1.2 Add MVC services: 19 | public void ConfigureServices(IServiceCollection services) 20 | { 21 | // Add framework services. 22 | services.AddMvc(); 23 | } 24 | 25 | 1.3 Configure web app to use use Configuration and use MVC routing: 26 | 27 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 28 | { 29 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 30 | loggerFactory.AddDebug(); 31 | 32 | if (env.IsDevelopment()) 33 | { 34 | app.UseDeveloperExceptionPage(); 35 | } 36 | else 37 | { 38 | app.UseExceptionHandler("/Home/Error"); 39 | } 40 | 41 | app.UseStaticFiles(); 42 | 43 | app.UseMvc(routes => 44 | { 45 | routes.MapRoute( 46 | name: "default", 47 | template: "{controller=Home}/{action=Index}/{id?}"); 48 | }); 49 | } 50 | -------------------------------------------------------------------------------- /Simple/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var conf = require('./app.conf') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | return path.posix.join(conf.conf.assetsSubDirectory, _path) 7 | } 8 | 9 | exports.cssLoaders = function (options) { 10 | options = options || {} 11 | 12 | var cssLoader = { 13 | loader: 'css-loader', 14 | options: { 15 | minimize: !conf.conf.dev, 16 | sourceMap: options.sourceMap 17 | } 18 | } 19 | 20 | // generate loader string to be used with extract text plugin 21 | function generateLoaders (loader, loaderOptions) { 22 | var loaders = [cssLoader] 23 | if (loader) { 24 | loaders.push({ 25 | loader: loader + '-loader', 26 | options: Object.assign({}, loaderOptions, { 27 | sourceMap: options.sourceMap 28 | }) 29 | }) 30 | } 31 | 32 | // Extract CSS when that option is specified 33 | // (which is the case during production build) 34 | if (options.extract) { 35 | return ExtractTextPlugin.extract({ 36 | use: loaders, 37 | fallback: 'vue-style-loader' 38 | }) 39 | } else { 40 | return ['vue-style-loader'].concat(loaders) 41 | } 42 | } 43 | 44 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 45 | return { 46 | css: generateLoaders(), 47 | postcss: generateLoaders(), 48 | less: generateLoaders('less'), 49 | sass: generateLoaders('sass', { indentedSyntax: true }), 50 | scss: generateLoaders('sass'), 51 | stylus: generateLoaders('stylus'), 52 | styl: generateLoaders('stylus') 53 | } 54 | } 55 | 56 | // Generate loaders for standalone style files (outside of .vue) 57 | exports.styleLoaders = function (options) { 58 | var output = [] 59 | var loaders = exports.cssLoaders(options) 60 | for (var extension in loaders) { 61 | var loader = loaders[extension] 62 | output.push({ 63 | test: new RegExp('\\.' + extension + '$'), 64 | use: loader 65 | }) 66 | } 67 | return output 68 | } 69 | -------------------------------------------------------------------------------- /Simple/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.Extensions.Configuration; 8 | using Microsoft.Extensions.DependencyInjection; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace Simple 12 | { 13 | public class Startup 14 | { 15 | public Startup(IHostingEnvironment env) 16 | { 17 | var builder = new ConfigurationBuilder() 18 | .SetBasePath(env.ContentRootPath) 19 | .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) 20 | .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) 21 | .AddEnvironmentVariables(); 22 | Configuration = builder.Build(); 23 | } 24 | 25 | public IConfigurationRoot Configuration { get; } 26 | 27 | // This method gets called by the runtime. Use this method to add services to the container. 28 | public void ConfigureServices(IServiceCollection services) 29 | { 30 | // Add framework services. 31 | services.AddMvc(); 32 | } 33 | 34 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 35 | public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) 36 | { 37 | loggerFactory.AddConsole(Configuration.GetSection("Logging")); 38 | loggerFactory.AddDebug(); 39 | 40 | if (env.IsDevelopment()) 41 | { 42 | app.UseDeveloperExceptionPage(); 43 | app.UseBrowserLink(); 44 | } 45 | else 46 | { 47 | app.UseExceptionHandler("/Home/Error"); 48 | } 49 | 50 | app.UseStaticFiles(); 51 | 52 | app.UseMvc(routes => 53 | { 54 | routes.MapRoute( 55 | name: "default", 56 | template: "{controller=Home}/{action=Index}/{id?}"); 57 | }); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Simple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple", 3 | "version": "1.0.0", 4 | "main": "main.js", 5 | "dependencies": { 6 | "axios": "^0.15.3", 7 | "echarts": "^3.3.2", 8 | "element-ui": "^1.2.8", 9 | "font-awesome": "^4.7.0", 10 | "nprogress": "^0.2.0", 11 | "vue": "^2.2.2", 12 | "vue-router": "^2.3.0", 13 | "vuex": "^2.0.0-rc.6" 14 | }, 15 | "devDependencies": { 16 | "autoprefixer": "^6.7.2", 17 | "axios-mock-adapter": "^1.7.1", 18 | "babel-core": "^6.22.1", 19 | "babel-loader": "^6.2.10", 20 | "babel-plugin-transform-runtime": "^6.22.0", 21 | "babel-polyfill": "^6.16.0", 22 | "babel-preset-env": "^1.2.1", 23 | "babel-preset-es2015": "^6.0.0", 24 | "babel-preset-stage-2": "^6.22.0", 25 | "babel-register": "^6.22.0", 26 | "chalk": "^1.1.3", 27 | "connect-history-api-fallback": "^1.3.0", 28 | "copy-webpack-plugin": "^4.0.1", 29 | "css-loader": "^0.26.1", 30 | "eventsource-polyfill": "^0.9.6", 31 | "express": "^4.14.1", 32 | "extract-text-webpack-plugin": "^2.0.0", 33 | "file-loader": "^0.10.0", 34 | "friendly-errors-webpack-plugin": "^1.1.3", 35 | "function-bind": "^1.0.2", 36 | "html-webpack-plugin": "^2.28.0", 37 | "http-proxy-middleware": "^0.17.3", 38 | "json-loader": "^0.5.4", 39 | "node-sass": "^4.5.0", 40 | "opn": "^4.0.2", 41 | "optimize-css-assets-webpack-plugin": "^1.3.0", 42 | "ora": "^1.0.0", 43 | "rimraf": "^2.6.0", 44 | "sass-loader": "^6.0.0", 45 | "semver": "^5.3.0", 46 | "shelljs": "^0.7.6", 47 | "style-loader": "^0.18.1", 48 | "url-loader": "^0.5.8", 49 | "vue-loader": "^11.1.4", 50 | "vue-resource": "^1.3.3", 51 | "vue-style-loader": "^2.0.0", 52 | "vue-template-compiler": "^2.2.4", 53 | "webpack": "^2.2.1", 54 | "webpack-bundle-analyzer": "^2.2.1", 55 | "webpack-dev-middleware": "^1.10.0", 56 | "webpack-hot-middleware": "^2.16.1", 57 | "webpack-merge": "^2.6.1" 58 | }, 59 | "scripts": { 60 | "test": "echo \"Error: no test specified\" && exit 1", 61 | "build": "webpack" 62 | }, 63 | "keywords": [], 64 | "author": "", 65 | "license": "ISC", 66 | "description": "", 67 | "-vs-binding": { "BeforeBuild": [ "build" ] } 68 | } 69 | -------------------------------------------------------------------------------- /Simple/Simple.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp1.0 5 | 6 | 7 | 8 | $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; 9 | 10 | 11 | 12 | 13 | 14 | 15 | PreserveNewest 16 | 17 | 18 | 19 | 20 | PreserveNewest 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | PreserveNewest 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | PreserveNewest 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Simple/wwwroot/views/login.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 86 | 87 | -------------------------------------------------------------------------------- /Simple/wwwroot/views/sys/useradd.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | -------------------------------------------------------------------------------- /Simple/wwwroot/views/sys/users.vue: -------------------------------------------------------------------------------- 1 | 46 | -------------------------------------------------------------------------------- /Simple/wwwroot/views/home.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 130 | 131 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------