parent
e916a547e2
commit
0e0c3d3352
@ -0,0 +1,68 @@
|
||||
package xyz.wbsite.action;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import xyz.wbsite.frame.utils.LocalData;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.utils.Message;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.base.Error;
|
||||
|
||||
@Controller
|
||||
public class AjaxController {
|
||||
|
||||
@RequestMapping("/ajax")
|
||||
@ResponseBody
|
||||
public BaseResponse ajax(@RequestParam("method") String method,HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
String jsonString = null;
|
||||
try {
|
||||
if (method == null){
|
||||
baseResponse.addError(new Error(ErrorType.BUSINESS_ERROR, "请求方法不能为空!"));
|
||||
return baseResponse;
|
||||
}
|
||||
Token token = LocalData.getToken();
|
||||
if (token == null) {
|
||||
token = LocalData.getTempToken();
|
||||
}
|
||||
if (!token.hasResource(method)) {
|
||||
baseResponse.addError(new Error(ErrorType.BUSINESS_ERROR, "无权调用该接口!"));
|
||||
return baseResponse;
|
||||
}
|
||||
|
||||
InputStreamReader isr = new InputStreamReader(request.getInputStream(),"UTF-8");
|
||||
BufferedReader in = new BufferedReader(isr);
|
||||
jsonString = in.readLine();
|
||||
|
||||
switch (method) {
|
||||
// 示例
|
||||
case "ajax.example.example":
|
||||
break;
|
||||
default:
|
||||
baseResponse.addError(ErrorType.INVALID_PARAMETER, Message.NOT_EXIST_METHOD);
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
baseResponse.addError(ErrorType.SYSTEM_ERROR, Message.ERROR_500);
|
||||
LogUtil.dumpException(ex);
|
||||
} finally {
|
||||
if(baseResponse.hasError()) {
|
||||
LogUtil.e("请求方法" + method + ", 请求参数:" + jsonString);
|
||||
LogUtil.e("返回结果包含异常" + MapperUtil.toJson(baseResponse));
|
||||
}
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -1,23 +1,73 @@
|
||||
package xyz.wbsite.action.screen;
|
||||
|
||||
import xyz.wbsite.framework.base.Screen;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.ui.Model;
|
||||
import java.util.ArrayList;
|
||||
import xyz.wbsite.frame.base.Screen;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
|
||||
public class Index extends Screen {
|
||||
|
||||
@Value("${file.root.path}")
|
||||
private String root;
|
||||
|
||||
@Override
|
||||
public void exec(Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||
String path = request.getParameter("path");
|
||||
if (path == null) {
|
||||
path = root;
|
||||
} else {
|
||||
path = root + "/" + path;
|
||||
}
|
||||
|
||||
System.out.println(path);
|
||||
File rootFile = new File(path);
|
||||
if (!rootFile.exists()) {
|
||||
rootFile.mkdirs();
|
||||
}
|
||||
File[] files = rootFile.listFiles();
|
||||
|
||||
model.addAttribute("files", files);
|
||||
model.addAttribute("path", new HtmlHepler().getPath(rootFile));
|
||||
model.addAttribute("html", new HtmlHepler());
|
||||
}
|
||||
|
||||
model.addAttribute("hello", "Hello world!!!");
|
||||
model.addAttribute("status", 0);
|
||||
public class HtmlHepler {
|
||||
|
||||
ArrayList<String> citys = new ArrayList<>();
|
||||
citys.add("北京");
|
||||
citys.add("上海");
|
||||
citys.add("深圳");
|
||||
model.addAttribute("citys", citys);
|
||||
public String getPath(File file) {
|
||||
if (file.getAbsolutePath().length() <= root.length()) {
|
||||
return "";
|
||||
}
|
||||
String s = file.getAbsolutePath().substring(root.length() - 1);
|
||||
s = s.replaceAll("\\\\", "/");
|
||||
return s;
|
||||
}
|
||||
|
||||
public String getHtml(File file) {
|
||||
if (!file.isDirectory() || file.listFiles().length == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<ul>");
|
||||
for (File f : file.listFiles()) {
|
||||
sb.append("<li>");
|
||||
if (f.isDirectory()) {
|
||||
sb.append("<a class='dir' href='?path=" + getPath(f) + "'>");
|
||||
sb.append(f.getName());
|
||||
sb.append("</a>");
|
||||
sb.append(getHtml(f));
|
||||
} else {
|
||||
sb.append("<a href='download?file=" + getPath(f) + "'>");
|
||||
sb.append(f.getName());
|
||||
sb.append("</a>");
|
||||
}
|
||||
|
||||
sb.append("</li>");
|
||||
}
|
||||
sb.append("</ul>");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package xyz.wbsite.api.mgr;
|
||||
|
||||
import xyz.wbsite.api.req.*;
|
||||
import xyz.wbsite.api.rsp.*;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
|
||||
/**
|
||||
* Api接口
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2018-10-23
|
||||
*/
|
||||
public interface ApiManager {
|
||||
|
||||
/**
|
||||
* Api#example
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
ApiExampleResponse example(ApiExampleRequest request, Token token);
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package xyz.wbsite.api.mgr;
|
||||
|
||||
import xyz.wbsite.api.req.*;
|
||||
import xyz.wbsite.api.rsp.*;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Api接口
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2018-10-23
|
||||
*/
|
||||
@Service
|
||||
public class ApiManagerImpl implements ApiManager {
|
||||
|
||||
/**
|
||||
* Api#example
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Override
|
||||
public ApiExampleResponse example(ApiExampleRequest request, Token token) {
|
||||
return new ApiExampleResponse();
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package xyz.wbsite.framework.config;
|
||||
package xyz.wbsite.config;
|
||||
|
||||
import xyz.wbsite.framework.utils.LogUtil;
|
||||
import xyz.wbsite.framework.utils.ProcessUtil;
|
||||
import xyz.wbsite.frame.utils.LogUtil;
|
||||
import xyz.wbsite.frame.utils.ProcessUtil;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.config;
|
||||
package xyz.wbsite.config;
|
||||
|
||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import java.util.Date;
|
@ -0,0 +1,29 @@
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* BaseFindRequest - 基类
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class BaseFindRequest extends BaseGetAllRequest {
|
||||
private int pageNumber = 1;
|
||||
private int pageSize = 10;
|
||||
|
||||
public int getPageNumber() {
|
||||
return pageNumber;
|
||||
}
|
||||
|
||||
public void setPageNumber(int pageNumber) {
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* BaseFindRequest - 基类
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* BaseRequest - 基类
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* BaseSearchRequest - 基类
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* BaseUpdateRequest - 基类
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import org.springframework.ui.Model;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* Error - 错误基类
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* ErrorType - 错误类型
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
public class FileUploadResponse extends BaseResponse {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import org.springframework.ui.Model;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
/**
|
||||
* SortTypeEnum - 排序方式
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
package xyz.wbsite.frame.base;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.freemarker;
|
||||
package xyz.wbsite.frame.freemarker;
|
||||
|
||||
import freemarker.template.TemplateModelException;
|
||||
import org.springframework.stereotype.Component;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.utils;
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.utils;
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.utils;
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
|
||||
/**
|
@ -1,8 +1,8 @@
|
||||
package xyz.wbsite.framework.utils;
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import xyz.wbsite.framework.base.BaseRequest;
|
||||
import xyz.wbsite.framework.base.BaseResponse;
|
||||
import xyz.wbsite.framework.base.ErrorType;
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validation;
|
||||
import javax.validation.Validator;
|
@ -1,4 +1,4 @@
|
||||
package xyz.wbsite.framework.utils;
|
||||
package xyz.wbsite.frame.utils;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
@ -1,57 +0,0 @@
|
||||
package xyz.wbsite.framework.base;
|
||||
|
||||
/**
|
||||
* BaseFindRequest - 基类
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class BaseFindRequest extends BaseGetAllRequest {
|
||||
private int pageNumber = 1;
|
||||
private int pageSize = 10;
|
||||
private int beginIndex = 0;
|
||||
private int endIndex = 10;
|
||||
|
||||
public int getPageNumber() {
|
||||
return pageNumber;
|
||||
}
|
||||
|
||||
public void setPageNumber(int pageNumber) {
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getBeginIndex() {
|
||||
beginIndex = pageSize * (pageNumber - 1);
|
||||
return beginIndex;
|
||||
}
|
||||
|
||||
public void setBeginIndex(int beginIndex) {
|
||||
this.beginIndex = beginIndex;
|
||||
}
|
||||
|
||||
public int getEndIndex() {
|
||||
endIndex = pageSize * (pageNumber - 1) + pageSize;
|
||||
return endIndex;
|
||||
}
|
||||
|
||||
public void setEndIndex(int endIndex) {
|
||||
this.endIndex = endIndex;
|
||||
}
|
||||
|
||||
public void updatePageNumber(int totalCount){
|
||||
int maxPage = totalCount / pageSize + (totalCount % pageSize > 0 ? 1 : 0);
|
||||
|
||||
if (pageNumber > maxPage){
|
||||
pageNumber = maxPage;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,105 @@
|
||||
import axios from 'axios'
|
||||
// 创建axios实例
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
withCredentials: true, // send cookies when cross-domain requests
|
||||
method: 'post', // request method
|
||||
timeout: 5000 // request timeout
|
||||
})
|
||||
|
||||
// 添加请求拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
// 在发送请求之前做些什么
|
||||
if (config.url === '/upload') {
|
||||
console.log()
|
||||
} else {
|
||||
console.log()
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
// 对请求错误做些什么
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
||||
// 添加响应拦截器
|
||||
service.interceptors.response.use(response => {
|
||||
// 对响应数据做点什么
|
||||
return response
|
||||
}, error => {
|
||||
// 对响应错误做点什么
|
||||
const rsp = { errors: [] }
|
||||
if (!error.response) {
|
||||
rsp.errors.push({ message: error.message })
|
||||
} else {
|
||||
switch (error.response.status) {
|
||||
case 401:
|
||||
rsp.errors.push({ message: '未授权,请登录(401)' })
|
||||
break
|
||||
case 403:
|
||||
rsp.errors.push({ message: '拒绝访问(403)' })
|
||||
break
|
||||
case 404:
|
||||
rsp.errors.push({ message: '请求地址错误(404)' })
|
||||
break
|
||||
case 408:
|
||||
rsp.errors.push({ message: '请求超时(408)' })
|
||||
break
|
||||
case 500:
|
||||
rsp.errors.push({ message: '服务器内部错误(500)' })
|
||||
break
|
||||
case 501:
|
||||
rsp.errors.push({ message: '服务未实现(501)' })
|
||||
break
|
||||
default:
|
||||
rsp.errors.push({ message: '请求错误(' + error.response.status + ')' })
|
||||
break
|
||||
}
|
||||
}
|
||||
return Promise.reject(rsp)
|
||||
})
|
||||
export function jsonRequest(config) {
|
||||
return service.request({
|
||||
params: {
|
||||
method: config.method
|
||||
},
|
||||
url: '/ajax',
|
||||
headers: { 'Content-Type': 'text/plain' },
|
||||
data: config.data
|
||||
}).then(response => {
|
||||
return Promise.resolve(response.data)
|
||||
}, response => {
|
||||
return Promise.resolve(response)
|
||||
})
|
||||
}
|
||||
export function fileRequest(config) {
|
||||
return service.request({
|
||||
url: '/upload',
|
||||
data: config.data,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
onUploadProgress: progressEvent => {
|
||||
console.log((progressEvent.loaded / progressEvent.total * 100 | 0) + '%')
|
||||
}
|
||||
}).then(response => {
|
||||
return Promise.resolve(response.data)
|
||||
}, response => {
|
||||
return Promise.resolve(response)
|
||||
})
|
||||
}
|
||||
|
||||
const ajax = {
|
||||
example: data => {
|
||||
return jsonRequest({
|
||||
method: 'ajax.example.example',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
fileUpload: file => {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
return fileRequest({
|
||||
data: fd
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default ajax
|
@ -0,0 +1,530 @@
|
||||
<script>
|
||||
window.nav = new Vue({
|
||||
data: {
|
||||
activeIndex: 'home',
|
||||
contextPath: '${contextPath?default("")}',
|
||||
homePath: '${homePath?default("")}',
|
||||
tip: {
|
||||
show: function (msg) {
|
||||
if(msg) {
|
||||
this.$indicator.open(msg);
|
||||
}else {
|
||||
this.$indicator.open();
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
this.$indicator.close();
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
i: function (message, callback) {
|
||||
this.$toast({
|
||||
message: message,
|
||||
position: 'middle',
|
||||
duration: 3000
|
||||
});
|
||||
setTimeout(callback, 3000)
|
||||
},
|
||||
alert: function (message, callback) {
|
||||
this.$messageBox.alert(message, "").then(callback);
|
||||
},
|
||||
confirm: function (message, callback) {
|
||||
this.$messageBox.confirm(message, "").then(callback);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vue.component('wb-field-select', {
|
||||
data: function () {
|
||||
return {
|
||||
selectValue: '',
|
||||
popupVisible: false,
|
||||
clearVisible: false,
|
||||
slots: [{
|
||||
values: this.items
|
||||
}],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentValue: {
|
||||
get: function () {
|
||||
return this.value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.popupVisible = true;
|
||||
if (!this.value) {
|
||||
this.currentValue = this.items[0];
|
||||
}
|
||||
},
|
||||
onClear: function () {
|
||||
this.currentValue = '';
|
||||
},
|
||||
onValuesChange: function (picker, values) {
|
||||
if (this.popupVisible) {
|
||||
this.currentValue = picker.getValues(0)[0];
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <input :placeholder="placeholder" @click="onSelect" readonly v-model="currentValue" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-popup style="width: 100%" v-model="popupVisible" position="bottom"><mt-picker :slots="slots" @change="onValuesChange"></mt-picker></mt-popup>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-dict', {
|
||||
data: function () {
|
||||
return {
|
||||
selectValue: '',
|
||||
popupVisible: false,
|
||||
clearVisible: false,
|
||||
slots: [{
|
||||
values: this.items
|
||||
}],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentValue: {
|
||||
get: function () {
|
||||
return this.value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
this.items.forEach(function (item) {
|
||||
item.keyValue = "[" + item.key + "]" + item.value;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.popupVisible = true;
|
||||
if (!this.value) {
|
||||
this.currentValue = "[" + this.items[0].key + "]" + this.items[0].value;
|
||||
}
|
||||
},
|
||||
onClear: function () {
|
||||
this.currentValue = '';
|
||||
},
|
||||
onValuesChange: function (picker, values) {
|
||||
if (this.popupVisible) {
|
||||
this.currentValue = "[" + picker.getValues(0)[0].key + "]" + picker.getValues(0)[0].value;
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <input :placeholder="placeholder" @click="onSelect" readonly v-model="currentValue" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-popup style="width: 100%" v-model="popupVisible" position="bottom"><mt-picker :slots="slots" valueKey="keyValue" @change="onValuesChange"></mt-picker></mt-popup>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-date', {
|
||||
data: function () {
|
||||
var startDate = new Date();
|
||||
startDate.setFullYear(1990, 0, 1);
|
||||
return {
|
||||
selectValue: '',
|
||||
clearVisible: false,
|
||||
startDate:startDate
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentValue: {
|
||||
get: function () {
|
||||
return this.value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.$refs.picker.open();
|
||||
},
|
||||
onClear: function () {
|
||||
this.currentValue = '';
|
||||
},
|
||||
onConfirm: function (value) {
|
||||
this.currentValue = value.format("yyyy-MM-dd")
|
||||
}
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <input :placeholder="placeholder" @click="onSelect" readonly v-model="currentValue" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-datetime-picker ref="picker" type="date" :startDate="startDate" v-model="selectValue" @confirm="onConfirm" year-format="{value}" month-format="{value}" date-format="{value}"></mt-datetime-picker>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-time', {
|
||||
data: function () {
|
||||
return {
|
||||
selectValue: '',
|
||||
clearVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentValue: {
|
||||
get: function () {
|
||||
return this.value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.$refs.picker.open();
|
||||
},
|
||||
onClear: function () {
|
||||
this.currentValue = '';
|
||||
},
|
||||
onConfirm: function (value) {
|
||||
this.currentValue = value;
|
||||
}
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <input :placeholder="placeholder" @click="onSelect" readonly v-model="currentValue" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-datetime-picker ref="picker" type="time" v-model="selectValue" @confirm="onConfirm" year-format="{value}" month-format="{value}" date-format="{value}"></mt-datetime-picker>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-datetime', {
|
||||
data: function () {
|
||||
return {
|
||||
selectValue: '',
|
||||
clearVisible: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentValue: {
|
||||
get: function () {
|
||||
return this.value;
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.$refs.picker.open();
|
||||
},
|
||||
onClear: function () {
|
||||
this.currentValue = '';
|
||||
},
|
||||
onConfirm: function (value) {
|
||||
this.currentValue = value.format("yyyy-MM-dd hh:mm")
|
||||
}
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <input :placeholder="placeholder" @click="onSelect" readonly v-model="currentValue" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-datetime-picker ref="picker" type="datetime" v-model="selectValue" @confirm="onConfirm" year-format="{value}" month-format="{value}" date-format="{value}"></mt-datetime-picker>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-cphm', {
|
||||
data: function () {
|
||||
return {
|
||||
prefixData: [
|
||||
{
|
||||
key: '',
|
||||
value: '京',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'Y']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '津',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R']
|
||||
},
|
||||
{key: '', value: '冀', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'O', 'R', 'T']},
|
||||
{key: '', value: '晋', children: ['A', 'B', 'C', 'D', 'E', 'F', 'H', 'J', 'K', 'L', 'M']},
|
||||
{key: '', value: '蒙', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M']},
|
||||
{
|
||||
key: '',
|
||||
value: '辽',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P']
|
||||
},
|
||||
{key: '', value: '吉', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K']},
|
||||
{
|
||||
key: '',
|
||||
value: '黑',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '沪',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'AX', 'BX', 'DX']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '苏',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'U']
|
||||
},
|
||||
{key: '', value: '浙', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L']},
|
||||
{
|
||||
key: '',
|
||||
value: '皖',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S']
|
||||
},
|
||||
{key: '', value: '闽', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K']},
|
||||
{key: '', value: '赣', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'S']},
|
||||
{
|
||||
key: '',
|
||||
value: '鲁',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'U', 'V', 'W', 'Y']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '豫',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'U']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '鄂',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'AW']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '湘',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'S', 'U']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '粤',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
||||
},
|
||||
{
|
||||
key: '',
|
||||
value: '桂',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R']
|
||||
},
|
||||
{key: '', value: '琼', children: ['A', 'B', 'C', 'D', 'E', 'F']},
|
||||
{key: '', value: '渝', children: ['A', 'B', 'C', 'D', 'F', 'G', 'H', 'N']},
|
||||
{
|
||||
key: '',
|
||||
value: '川',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
||||
},
|
||||
{key: '', value: '贵', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J']},
|
||||
{
|
||||
key: '',
|
||||
value: '云',
|
||||
children: ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S']
|
||||
},
|
||||
{key: '', value: '藏', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J']},
|
||||
{key: '', value: '陕', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'V']},
|
||||
{
|
||||
key: '',
|
||||
value: '甘',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P']
|
||||
},
|
||||
{key: '', value: '青', children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']},
|
||||
{key: '', value: '宁', children: ['A', 'B', 'C', 'D', 'E']},
|
||||
{
|
||||
key: '',
|
||||
value: '新',
|
||||
children: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'S']
|
||||
}
|
||||
],
|
||||
popupVisible: false,
|
||||
clearVisible: false,
|
||||
slots: [{
|
||||
values: [],
|
||||
defaultIndex: 9,
|
||||
className: 'slot1'
|
||||
}, {
|
||||
divider: true,
|
||||
content: '',
|
||||
className: 'slot2'
|
||||
}, {
|
||||
values: [],
|
||||
defaultIndex: 11,
|
||||
className: 'slot3'
|
||||
}],
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
if (!this.value) {//当model为空时初始化前缀
|
||||
this.$emit('input', this.prefixData[this.slots[0].defaultIndex].value + this.prefixData[this.slots[0].defaultIndex].children[this.slots[2].defaultIndex]);
|
||||
}
|
||||
this.slots[0].values = this.getSlot1();
|
||||
this.slots[2].values = this.getSlot3(this.prefixData[0].value);
|
||||
},
|
||||
computed: {
|
||||
prefix: {
|
||||
get: function () {
|
||||
return this.value.slice(0, 2);
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', value + this.value.slice(2, this.value.length));
|
||||
}
|
||||
},
|
||||
subfix: {
|
||||
get: function () {
|
||||
return this.value.slice(2, this.value.length);
|
||||
},
|
||||
set: function (value) {
|
||||
this.$emit('input', this.value.slice(0, 2) + value);
|
||||
value ? this.clearVisible = true : this.clearVisible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect: function () {
|
||||
this.popupVisible = true;
|
||||
},
|
||||
getSlot1: function () {
|
||||
var items = [];
|
||||
this.prefixData.forEach(function (item) {
|
||||
items.push(item.value);
|
||||
});
|
||||
return items;
|
||||
},
|
||||
getSlot3: function (value) {
|
||||
for (var i in this.prefixData) {
|
||||
if (value == this.prefixData[i].value) {
|
||||
return this.prefixData[i].children;
|
||||
}
|
||||
}
|
||||
return []
|
||||
},
|
||||
onClear: function () {
|
||||
this.subfix = '';
|
||||
},
|
||||
onValuesChange: function (picker, values) {
|
||||
if (this.popupVisible) {
|
||||
picker.setSlotValues(1, this.getSlot3(values[0]));
|
||||
this.prefix = picker.getSlotValue(0) + picker.getSlotValue(1)
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['value', 'label', 'placeholder', 'items'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <span @click="onSelect" style="padding-right: 5px;color:#47d3ff;line-height: 1.6">{{prefix}}</span>' +
|
||||
' <input :placeholder="placeholder" maxlength="6" v-model="subfix" class="mint-field-core">' +
|
||||
' <div class="mint-field-clear" v-if="clearVisible" @click="onClear"><i class="mintui mintui-field-error"></i></div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <mt-popup style="width: 100%" v-model="popupVisible" position="bottom"><mt-picker ref="picker" :slots="slots" @change="onValuesChange"></mt-picker></mt-popup>' +
|
||||
'</a>'
|
||||
});
|
||||
|
||||
Vue.component('wb-field-pictures', {
|
||||
data: function () {
|
||||
return {
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClear: function (item) {
|
||||
this.fileList.remove(item);
|
||||
},
|
||||
onValuesChange: function (picker, values) {
|
||||
if (this.popupVisible) {
|
||||
picker.setSlotValues(1, this.getSlot3(values[0]));
|
||||
this.prefix = picker.getSlotValue(0) + picker.getSlotValue(1)
|
||||
}
|
||||
},
|
||||
onTakePicture: function () {
|
||||
this.fileList.push({
|
||||
name: '',
|
||||
file: ''
|
||||
})
|
||||
setTimeout(function () {
|
||||
this.$refs.input[this.fileList.length - 1].click();
|
||||
}.bind(this), 1)
|
||||
},
|
||||
onChange: function (e, file) {
|
||||
file.file = e.target.files[0]
|
||||
file.name = e.target.files[0].name;
|
||||
this.$emit("handle-file", file, {
|
||||
finish: function () {
|
||||
this.$emit("input", this.fileList)
|
||||
}.bind(this),
|
||||
cancel: function () {
|
||||
this.fileList.remove(file);
|
||||
this.$emit("input", this.fileList)
|
||||
}.bind(this)
|
||||
});
|
||||
},
|
||||
|
||||
},
|
||||
props: ['value', 'label'],
|
||||
template: '' +
|
||||
'<a class="mint-cell mint-field"><!---->' +
|
||||
' <div class="mint-cell-wrapper">' +
|
||||
' <div class="mint-cell-title"><!----><span class="mint-cell-text">{{label}}</span><!----></div>' +
|
||||
' <div class="mint-cell-value">' +
|
||||
' <div style="padding-top: 11px;padding-bottom: 11px;text-align: left;width: 100%">' +
|
||||
' <mt-button type="primary" size="small" @click="onTakePicture">添加</mt-button>' +
|
||||
' <div style="line-height: 35px;" v-for="item in fileList" v-show="item.name">' +
|
||||
' <span class="mint-field-clear" style="padding-right: 10px;" @click="onClear(item)"><i class="mintui mintui-field-error"></i></span><!---->' +
|
||||
' <a>{{item.name}}</a><!---->' +
|
||||
' <input ref="input" @change="onChange($event,item)" type="file" style="display: none"/>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
'</a>'
|
||||
});
|
||||
</script>
|
@ -0,0 +1,217 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<#--baseJs-->
|
||||
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
|
||||
<#--移动端ui-->
|
||||
<script src="${Uri.getUrl('/static/dist/mint-ui.min.js')}" type="text/javascript"></script>
|
||||
<link href="${Uri.getUrl('/static/dist/mint-ui.min.css')}" rel="stylesheet"/>
|
||||
<#--ajax接口-->
|
||||
<script src="${Uri.getUrl('/static/js/ajax.js')}" type="text/javascript"></script>
|
||||
<style>
|
||||
* {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
html,body,#app{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.left-in-right-out-enter-active, .left-in-right-out-leave-active {
|
||||
transition: all 0.3s linear;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.left-in-right-out-enter {
|
||||
transform: translateX(-100%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.left-in-right-out-leave-to {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.right-in-left-out-enter-active, .right-in-left-out-leave-active {
|
||||
transition: all .3s linear;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-in-left-out-enter {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
.right-in-left-out-leave-to {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.left-in-right-out-enter-active, .left-in-right-out-leave-active {
|
||||
transition: all 0.3s linear;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.left-in-right-out-enter {
|
||||
transform: translateX(-100%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.left-in-right-out-leave-to {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.right-in-left-out-enter-active, .right-in-left-out-leave-active {
|
||||
transition: all .3s linear;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-in-left-out-enter {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
.right-in-left-out-leave-to {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<#include Layout.setControl("mint-ui-extend")/>
|
||||
<div id="app">
|
||||
<transition :name="transitionName">
|
||||
<router-view></router-view>
|
||||
</transition>
|
||||
</div>
|
||||
|
||||
<template id="home">
|
||||
<div class="view">
|
||||
<mt-header title="Hello world">
|
||||
<router-link to="/" slot="left">
|
||||
<mt-button icon="back">返回</mt-button>
|
||||
</router-link>
|
||||
<mt-button icon="more" slot="right"></mt-button>
|
||||
</mt-header>
|
||||
<div class="content" style="text-align: center;padding-top: 200px">
|
||||
Hello world <router-link to="demo">demo</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template id="demo">
|
||||
<div class="view">
|
||||
<mt-header title="表单输入">
|
||||
<mt-button icon="back" slot="left" @click="back">关闭</mt-button>
|
||||
</mt-header>
|
||||
<div class="content" style="text-align: center;">
|
||||
<mt-header title="Mint-ui自带控件"></mt-header>
|
||||
<mt-field label="普通文字" placeholder="请输入用户名" v-model="field1"></mt-field>
|
||||
<mt-field label="邮箱地址" placeholder="请输入邮箱" type="email" v-model="field2"></mt-field>
|
||||
<mt-field label="用户密码" placeholder="请输入密码" type="password" v-model="field3"></mt-field>
|
||||
<mt-field label="手机号码" placeholder="请输入手机号" type="tel" v-model="field4"></mt-field>
|
||||
<mt-field label="网站链接" placeholder="请输入网址" type="url" v-model="field5"></mt-field>
|
||||
<mt-field label="数字输入" placeholder="请输入数字" type="number" v-model="field6"></mt-field>
|
||||
<mt-field label="生日日期" placeholder="请输入生日" type="date" v-model="field7"></mt-field>
|
||||
<mt-field label="多行文字" placeholder="多行文字" type="textarea" rows="2" v-model="field8"></mt-field>
|
||||
|
||||
<mt-header title="扩展控件"></mt-header>
|
||||
<wb-field-select label="文字选择" placeholder="请选择" :items="['男','女']" v-model="field10"></wb-field-select>
|
||||
<wb-field-dict label="字典选择" placeholder="请选择" :items="[{key:'1',value:'男'},{key:'2',value:'女'}]"
|
||||
v-model="field11"></wb-field-dict>
|
||||
<wb-field-date label="日期选择" placeholder="请选择" v-model="field12"></wb-field-date>
|
||||
<wb-field-time label="时间选择" placeholder="请选择" v-model="field13"></wb-field-time>
|
||||
<wb-field-datetime label="日期时间" placeholder="请选择" v-model="field14"></wb-field-datetime>
|
||||
<wb-field-cphm label="车牌号码" placeholder="车牌号" v-model="field15"></wb-field-cphm>
|
||||
|
||||
<wb-field-pictures label="选择照片" v-model="field16" @handle-file="handleFile"></wb-field-pictures>
|
||||
|
||||
<div style="padding: 10px">
|
||||
<mt-button type="primary" size="large" @click="doSearch()">打印类容</mt-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var router = new VueRouter({
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Vue.extend({template: '#home'})
|
||||
},
|
||||
{
|
||||
path: '/demo',
|
||||
name: 'demo',
|
||||
component: Vue.extend({
|
||||
template: '#demo',
|
||||
mounted: function () {
|
||||
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
field1: '',
|
||||
field2: '',
|
||||
field3: '',
|
||||
field4: '',
|
||||
field5: '',
|
||||
field6: '',
|
||||
field7: '',
|
||||
field8: '',
|
||||
field9: '',
|
||||
field10: '',
|
||||
field11: '',
|
||||
field12: '',
|
||||
field13: '',
|
||||
field14: '',
|
||||
field15: '',
|
||||
field16: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSearch: function () {
|
||||
console.log(this.field10);
|
||||
console.log(this.field11);
|
||||
console.log(this.field12);
|
||||
console.log(this.field13);
|
||||
console.log(this.field14);
|
||||
console.log(this.field15);
|
||||
console.log(this.field16);
|
||||
},
|
||||
back: function () {
|
||||
if (window.android) {
|
||||
android.finish()
|
||||
} else {
|
||||
location.href = "${Uri.getUrl('/app/index.htm')}"
|
||||
}
|
||||
},
|
||||
handleFile: function (file, call) {
|
||||
//do upload
|
||||
console.log("正在上传文件" + file.name);
|
||||
if (true) {
|
||||
call.finish();
|
||||
} else {
|
||||
call.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
]
|
||||
});
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
transitionName: ''
|
||||
},
|
||||
router: router,
|
||||
watch: {
|
||||
'$route': function (to, from) {
|
||||
this.transitionName = to.meta.index < from.meta.index ? 'left-in-right-out' : 'right-in-left-out'
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<#include Layout.setScreen()/>
|
||||
</body>
|
||||
</html>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>文件管理</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
|
||||
<#--baseJs-->
|
||||
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
|
||||
<#--element-ui-->
|
||||
<script src="${Uri.getUrl('/static/dist/index.min.js')}" type="text/javascript"></script>
|
||||
<link href="${Uri.getUrl('/static/dist/index.min.css')}" rel="stylesheet"/>
|
||||
<#--ajax接口-->
|
||||
<script src="${Uri.getUrl('/static/js/ajax.js')}" type="text/javascript"></script>
|
||||
<link href="${Uri.getUrl('/static/css/base.css')}" rel="stylesheet"/>
|
||||
</head>
|
||||
<body>
|
||||
<#include Layout.setControl("macro")/>
|
||||
<#include Layout.setControl("nav")/>
|
||||
<#include Layout.setScreen()/>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,134 @@
|
||||
<div id="app" v-cloak>
|
||||
<div class="frame">
|
||||
<div class="login-box">
|
||||
<div class="login-title">系统登录</div>
|
||||
|
||||
<el-form :model="form" :rules="rules" ref="form" class="form">
|
||||
<el-form-item prop="name">
|
||||
<el-input placeholder="用户名" v-model="form.name">
|
||||
<template slot="prepend"><i class="icon iconfont el-icon-user"></i></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="password">
|
||||
<el-input placeholder="密码" v-model="form.password" type="password">
|
||||
<template slot="prepend"><i class="icon iconfont el-icon-lock"></i></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" style="width: 100%" :loading="isLogin" :disabled="isLogin"
|
||||
@click="submitForm('form')">登录
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<a class="tip">系统登录</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style>
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
background: #001d3a;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.frame {
|
||||
width: 600px;
|
||||
height: 500px;
|
||||
background: #42424263;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-shadow: 0 0 10px 0 #afafaf52;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
display: inline-block;
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.login-title {
|
||||
line-height: 50px;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
padding-left: 20px;
|
||||
font-size: 15px;
|
||||
height: 50px;
|
||||
color: #757575;
|
||||
}
|
||||
|
||||
.form {
|
||||
width: 300px;
|
||||
margin-top: 20px;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.form .el-input-group__prepend {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
padding: 5px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color: #b7b7b7;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: "#app",
|
||||
data: {
|
||||
form: {
|
||||
name: '',
|
||||
password: ''
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{required: true, message: '请输入用户名', trigger: 'blur'}
|
||||
],
|
||||
password: [
|
||||
{required: true, message: '请输入密码', trigger: 'change'}
|
||||
],
|
||||
},
|
||||
isLogin: false
|
||||
},
|
||||
mounted: function () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
submitForm: function (formName) {
|
||||
this.$refs[formName].validate(function (valid) {
|
||||
if (valid) {
|
||||
this.isLogin = true;
|
||||
setTimeout(function(){
|
||||
nav.i("登录成功!", function () {
|
||||
location.href = "/index.htm"
|
||||
});
|
||||
},1000)
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
resetForm: function (formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
@ -0,0 +1,86 @@
|
||||
package xyz.wbsite;
|
||||
|
||||
import xyz.wbsite.frame.utils.*;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* UtilTest - - 测试用例
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class UtilTest {
|
||||
|
||||
@Test
|
||||
public void testIDgenerator() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
long l = IDgenerator.nextId();
|
||||
System.out.println(l);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAESUtil() {
|
||||
// 加密
|
||||
String data = "我有一个苹果";
|
||||
String secret = "1234567890123456";
|
||||
System.out.println("加密后的Base64密文是:" + AESUtil.encrypt2Base64(data.getBytes(), secret));
|
||||
|
||||
// 解密
|
||||
String encrypt2Base64 = AESUtil.encrypt2Base64(data.getBytes(), secret);
|
||||
byte[] decrypt = AESUtil.decrypt(Base64Util.decode(encrypt2Base64), secret);
|
||||
System.out.println("解密后的明文是:" + new String(decrypt));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase64Util() {
|
||||
String s = Base64Util.encodeToString(("我搜搜").getBytes());
|
||||
System.out.println(s);
|
||||
|
||||
byte[] decode = Base64Util.decode(s);
|
||||
System.out.println(new String(decode));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMD5Util() {
|
||||
String encode = MD5Util.encode("123456");
|
||||
System.out.println(encode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessUtil() {
|
||||
ProcessUtil.execExe("D:\\example.exe");
|
||||
ProcessUtil.execBat("D:\\example.bat");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRSAUtil() {
|
||||
{//创建秘钥对
|
||||
RSAUtil.createKey();
|
||||
}
|
||||
|
||||
{//加解密
|
||||
|
||||
//加密
|
||||
String encrypt = RSAUtil.encrypt2Base64("我有一个苹果".getBytes());
|
||||
System.out.println(encrypt);
|
||||
|
||||
//解密
|
||||
String decrypt = RSAUtil.decrypt2String(encrypt);
|
||||
System.out.println(decrypt);
|
||||
}
|
||||
|
||||
|
||||
String sign = RSAUtil.sign2Base64("我有一个苹果".getBytes());
|
||||
System.out.println(sign);
|
||||
|
||||
boolean b = RSAUtil.doCheck("我有一个苹果".getBytes(), sign);
|
||||
System.out.println(b);
|
||||
}
|
||||
}
|
@ -1,24 +1,16 @@
|
||||
package xyz.wbsite.config;
|
||||
|
||||
import xyz.wbsite.framework.base.Token;
|
||||
import xyz.wbsite.framework.springmvc.GlobalHandlerInterceptor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import xyz.wbsite.frame.base.Token;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.filter.CharacterEncodingFilter;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class TestConfig {
|
||||
|
||||
@Bean
|
||||
public Token getTestToken() {
|
||||
Token token = new Token();
|
||||
token.setId(-1);
|
||||
token.setUserId(-1);
|
||||
token.setId(0);
|
||||
token.setUserId(0);
|
||||
token.setUserName("system");
|
||||
return token;
|
||||
}
|
||||
|
Loading…
Reference in new issue