wanggang
1 year ago
10 changed files with 21225 additions and 1 deletions
@ -0,0 +1,67 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Omu.ValueInjecter; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Identity; |
|||
|
|||
namespace BaseService.UserManagement |
|||
{ |
|||
[Route("api/[controller]/[action]")]
|
|||
[Authorize(IdentityPermissions.Roles.Default)] |
|||
public class RoleAppService : ApplicationService |
|||
{ |
|||
private IdentityRoleManager _roleManager { get; } |
|||
private IIdentityRoleRepository _repository { get; } |
|||
|
|||
public RoleAppService(IdentityRoleManager roleManager, IIdentityRoleRepository roleRepository) |
|||
{ |
|||
_roleManager = roleManager; |
|||
_repository = roleRepository; |
|||
} |
|||
|
|||
[HttpGet] |
|||
public async Task<PagedResultDto<IdentityRoleDto>> GetListAsync(GetIdentityRolesInput input) |
|||
{ |
|||
var totalCount = await _repository.GetCountAsync(input.Filter).ConfigureAwait(false); |
|||
var items = await _repository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, |
|||
input.Filter).ConfigureAwait(false); |
|||
var dtos = ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(items); |
|||
return new PagedResultDto<IdentityRoleDto>(totalCount, dtos); |
|||
} |
|||
|
|||
[HttpPost] |
|||
[Authorize(IdentityPermissions.Roles.Create)] |
|||
public async Task<IdentityRoleDto> CreateAsync(IdentityRoleCreateDto input) |
|||
{ |
|||
var role = new IdentityRole(GuidGenerator.Create(), input.Name); |
|||
role.InjectFrom(input); |
|||
await _roleManager.CreateAsync(role).ConfigureAwait(false); |
|||
var dto = ObjectMapper.Map<IdentityRole, IdentityRoleDto>(role); |
|||
return dto; |
|||
} |
|||
|
|||
[HttpPut("{id}")] |
|||
[Authorize(IdentityPermissions.Roles.Update)] |
|||
public async Task<IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input) |
|||
{ |
|||
var role = await _roleManager.GetByIdAsync(id).ConfigureAwait(false); |
|||
role.InjectFrom(input); |
|||
await _roleManager.UpdateAsync(role).ConfigureAwait(false); |
|||
var dto = ObjectMapper.Map<IdentityRole, IdentityRoleDto>(role); |
|||
return dto; |
|||
} |
|||
|
|||
[HttpDelete("{id}")] |
|||
[Authorize(IdentityPermissions.Roles.Delete)] |
|||
public async Task<IActionResult> Delete(Guid id) |
|||
{ |
|||
var role = await _roleManager.GetByIdAsync(id).ConfigureAwait(false); |
|||
await _roleManager.DeleteAsync(role).ConfigureAwait(false); |
|||
return new OkResult(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
export default function html(strings, ...values) { |
|||
let output = ""; |
|||
let index; |
|||
for (index = 0; index < values.length; index += 1) { |
|||
output += strings[index] + values[index]; |
|||
} |
|||
output += strings[index]; |
|||
return output; |
|||
} |
@ -0,0 +1,85 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<base href="./" /> |
|||
<title></title> |
|||
<style> |
|||
body { |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
|
|||
body * { |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
#app { |
|||
width: 100vw; |
|||
height: 100vh; |
|||
overflow-y: scroll; |
|||
display: flex; |
|||
} |
|||
|
|||
#app>ul { |
|||
margin: 0; |
|||
padding: 0; |
|||
list-style: none; |
|||
width: 200px; |
|||
border: 1px solid gray; |
|||
} |
|||
|
|||
#app>ul>li { |
|||
padding: .5em; |
|||
} |
|||
|
|||
#app>iframe { |
|||
width: calc(100vw - 200px); |
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="importmap"> |
|||
{ |
|||
"imports": { |
|||
"vue": "./lib/vue.esm-browser.js", |
|||
"vue-router": "./lib/vue-router.esm-browser.js", |
|||
"pinia": "./lib/pinia.esm-browser.js" |
|||
} |
|||
} |
|||
</script> |
|||
<script> |
|||
window.process = { env: { NODE_ENV: 'production' } }; |
|||
</script> |
|||
<script type="module"> |
|||
import { createApp, ref } from "vue"; |
|||
|
|||
const app = createApp({ |
|||
template: `<ul> |
|||
<li v-for="item in links"><a href="javascript:;" @click="load(item.href)">{{item.text}}</a></li> |
|||
</ul> |
|||
<iframe :src="src" frameborder="0" />`, |
|||
setup() { |
|||
const links = [ |
|||
{ text: "组件基础", href: "./pages/component.html" } |
|||
]; |
|||
const src = ref(""); |
|||
function load(href) { |
|||
src.value = href; |
|||
} |
|||
return { |
|||
links, |
|||
src, |
|||
load |
|||
} |
|||
} |
|||
}); |
|||
app.mount("#app"); |
|||
</script> |
|||
</body> |
|||
|
|||
</html> |
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,78 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<base href="./" /> |
|||
<title>双向绑定</title> |
|||
</head> |
|||
|
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="importmap"> |
|||
{ |
|||
"imports": { |
|||
"vue": "../lib/vue.esm-browser.js", |
|||
"vue-router": "../lib/vue-router.esm-browser.js", |
|||
"pinia": "../lib/pinia.esm-browser.js" |
|||
} |
|||
} |
|||
</script> |
|||
<script> |
|||
window.process = { env: { NODE_ENV: 'production' } }; |
|||
</script> |
|||
<script type="module"> |
|||
import { createApp, ref, reactive, watch, onMounted } from "vue"; |
|||
|
|||
const simpleComponent = { |
|||
components: {},//组件注册 |
|||
template: `<label>子组件:<input type="text" v-model="model.value"></label> |
|||
<button @click="$emit('click','call parent method from child')">click</button>`, |
|||
props: ['modelValue'], |
|||
emit: ["update:modelValue"], |
|||
setup(props, context) { |
|||
const model = reactive(props.modelValue); |
|||
watch(model, (value) => context.emit('update:modelValue', value)); |
|||
|
|||
const childMethod = () => { |
|||
alert('child method'); |
|||
} |
|||
|
|||
context.expose({ childMethod }); |
|||
return { |
|||
model, |
|||
childMethod |
|||
}; |
|||
} |
|||
}; |
|||
|
|||
const appComponent = { |
|||
components: { simpleComponent }, |
|||
template: `<label>父组件:<input type="text" v-model="model.value" /></label> |
|||
<button @click="onClick">click</button> |
|||
<simple-component ref="childRef" v-model="model" @click="parentMethod" />`, |
|||
props: ['modelValue'], |
|||
setup(props, context) { |
|||
const childRef = ref(null); |
|||
const model = reactive({ |
|||
value: "test" |
|||
}); |
|||
const onClick = () => { |
|||
childRef.value.childMethod(); |
|||
}; |
|||
const parentMethod = o => alert(o); |
|||
return { |
|||
model, |
|||
onClick, |
|||
parentMethod |
|||
}; |
|||
} |
|||
}; |
|||
|
|||
const app = createApp(appComponent); |
|||
app.mount("#app"); |
|||
</script> |
|||
</body> |
|||
|
|||
</html> |
@ -0,0 +1,6 @@ |
|||
# vue 3 |
|||
|
|||
```javascript |
|||
import { createApp } from "vue"; |
|||
createApp().mount("#app"); |
|||
``` |
Loading…
Reference in new issue