2019-02-21更新

This commit is contained in:
Hellohao
2020-02-21 21:36:23 +08:00
parent ee52957d31
commit a53c59e176
98 changed files with 3411 additions and 14873 deletions
@@ -37,6 +37,8 @@ public static void main(String[] args) {
factory.setMaxFileSize("102400KB"); // KB,MB
/// 总上传数据大小
factory.setMaxRequestSize("102400KB");
//factory.setLocation("/tmp");
return factory.createMultipartConfig();
}
@@ -3,6 +3,7 @@ package cn.hellohao.controller;
import cn.hellohao.pojo.*;
import cn.hellohao.pojo.vo.PageResultBean;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.AlbumServiceI;
import cn.hellohao.service.impl.ImgServiceImpl;
import cn.hellohao.service.impl.UserServiceImpl;
import cn.hellohao.utils.*;
@@ -45,7 +46,12 @@ public class AdminController {
private UploadConfigService uploadConfigService;
@Autowired
private CodeService codeService;
@Autowired
private ImgAndAlbumService imgAndAlbumService;
@Autowired
private AlbumService albumService;
@Autowired
AlbumServiceI albumServiceI;
@RequestMapping(value = "/goadmin")
public String goadmin1(HttpSession session, Model model, HttpServletRequest request) {
@@ -147,8 +153,9 @@ public class AdminController {
if(uploadConfig.getIsupdate()!=1){
jsonObject.put("VisitorUpload", 0);//是否禁用了游客上传
}else{
Integer temp = imgService.getusermemory(0);
jsonObject.put("VisitorUpload", uploadConfig.getIsupdate());//是否禁用了游客上传
jsonObject.put("UsedSize", (imgService.getusermemory(0)/1024));//访客已用大小
jsonObject.put("UsedSize", (temp == null ? 0 : temp/1024));//访客已用大小
jsonObject.put("VisitorMemory", uploadConfig.getVisitormemory());//访客共大小
}
return jsonObject.toString();
@@ -216,7 +223,7 @@ public class AdminController {
@PostMapping("/deleimg")
@ResponseBody
public String deleimg(HttpSession session, Integer id, Integer sourcekey) {
public String deleimg(HttpSession session, Integer id, Integer sourcekey,String imgname) {
JSONObject jsonObject = new JSONObject();
User u = (User) session.getAttribute("user");
Images images = imgService.selectByPrimaryKey(id);
@@ -248,11 +255,13 @@ public class AdminController {
System.err.println("未获取到对象存储参数,删除失败。");
}
Integer ret = imgService.deleimg(id);
if(ret>0){ imgAndAlbumService.deleteImgAndAlbum(imgname);}
Integer count = 0;
if (ret > 0) {
jsonObject.put("usercount", imgService.countimg(u.getId()));
jsonObject.put("count", imgService.counts(null));
count = 1;
imgAndAlbumService.deleteImgAndAlbum(imgname);//关联表删除关于这张照片的所有记录
} else {
count = 0;
}
@@ -265,15 +274,15 @@ public class AdminController {
@PostMapping("/deleallimg")
@ResponseBody
public String deleallimg(HttpSession session, @RequestParam("ids[]") Integer[] ids) {
public String deleallimg(HttpSession session, @RequestParam("ids[]") Integer[] ids,@RequestParam("sources[]") Integer[] sources,
@RequestParam("imgnames[]") String[] imgnames) {
JSONObject jsonObject = new JSONObject();
Integer v = 0;
ImgServiceImpl de = new ImgServiceImpl();
User u = (User) session.getAttribute("user");
Integer Sourcekey = GetCurrentSource.GetSource(u.getId());
for (int i = 0; i < ids.length; i++) {
Images images = imgService.selectByPrimaryKey(ids[i]);
Keys key = keysService.selectKeys(images.getSource());
Keys key = keysService.selectKeys(sources[i]);
Boolean b =false;
if(Sourcekey==5){
b =true;
@@ -282,19 +291,19 @@ public class AdminController {
}
if(b){
if (key.getStorageType() == 1) {
de.delect(key, images.getImgname());
de.delect(key, imgnames[i]);
} else if (key.getStorageType() == 2) {
de.delectOSS(key, images.getImgname());
de.delectOSS(key, imgnames[i]);
} else if (key.getStorageType() == 3) {
de.delectUSS(key, images.getImgname());
de.delectUSS(key, imgnames[i]);
} else if (key.getStorageType() == 4) {
de.delectKODO(key, images.getImgname());
de.delectKODO(key, imgnames[i]);
} else if (key.getStorageType() == 5) {
LocUpdateImg.deleteLOCImg(images.getImgname());
LocUpdateImg.deleteLOCImg(imgnames[i]);
}else if (key.getStorageType() == 6) {
de.delectCOS(key, images.getImgname());
de.delectCOS(key, imgnames[i]);
}else if (key.getStorageType() == 7) {
de.delectFTP(key, images.getImgname());
de.delectFTP(key, imgnames[i]);
}else {
System.err.println("未获取到对象存储参数,删除失败。");
}
@@ -303,6 +312,7 @@ public class AdminController {
v = 0;
} else {
v = 1;
imgAndAlbumService.deleteImgAndAlbum(imgnames[i]);//关联表删除关于这张照片的所有记录
}
}else {
v = 0;
@@ -397,4 +407,61 @@ public class AdminController {
}
@RequestMapping(value = "/albumlist")
public String albumlist(HttpSession session, Model model) {
Config config = configService.getSourceype();
User u = (User) session.getAttribute("user");
model.addAttribute("config", config);
model.addAttribute("level", u.getLevel());
model.addAttribute("email", u.getEmail());
model.addAttribute("loginid", 100);
return "admin/albumlist";
}
@RequestMapping("/getAlbumURLList")
@ResponseBody
public Map<String, Object> getAlbumURLList (HttpSession session,@RequestParam(required = false, defaultValue = "1") int page,
@RequestParam(required = false) int limit,Album album){
User u = (User) session.getAttribute("user");
PageHelper.startPage(page, limit);
List<Album> list = null;
if (u.getLevel() == 2) {
album.setUserid(null);
list = albumServiceI.selectAlbumURLList(album);
PageInfo<Album> rolePageInfo = new PageInfo<>(list);
Map<String, Object> map = new HashMap<String, Object>();
map.put("code", 0);
map.put("msg", "");
map.put("count", rolePageInfo.getTotal());
map.put("data", rolePageInfo.getList());
return map;
} else {
album.setUserid(u.getId());
list = albumServiceI.selectAlbumURLList(album);
PageInfo<Album> rolePageInfo = new PageInfo<>(list);
Map<String, Object> map = new HashMap<String, Object>();
map.put("code", 0);
map.put("msg", "");
map.put("count", rolePageInfo.getTotal());
map.put("data", rolePageInfo.getList());
return map;
}
}
@RequestMapping("/delAlbum")
@ResponseBody
public Integer delAlbum(String albumkey){
Integer ret = albumServiceI.delete(albumkey);
return ret;
}
@RequestMapping("/delAlbumAll")
@ResponseBody
public Integer delAlbumAll( @RequestParam("albumkeyArr[]") String[] albumkeyArr ){
Integer ret = albumServiceI.deleteAll(albumkeyArr);
return ret;
}
}
@@ -4,6 +4,7 @@ import cn.hellohao.pojo.*;
import cn.hellohao.service.*;
import cn.hellohao.service.impl.*;
import cn.hellohao.utils.*;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,7 +65,7 @@ public class ClientController {
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
if (uploadConfig.getApi() == 1) {
if (email != null && pass != null) {
Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()));
Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()),null);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
@@ -129,7 +130,7 @@ public class ClientController {
} else if (key.getStorageType() == 4) {
m = kodoImageupload.clientuploadKODO(map, userpath, uploadConfig);
} else if (key.getStorageType() == 5) {
m2 = LocUpdateImg.clientuploadFTP(map, userpath, uploadConfig);
m2 = LocUpdateImg.clientLocUpdateImg(map, userpath, uploadConfig);
} else if (key.getStorageType() == 6) {
m = cosImageupload.clientuploadCOS(map, userpath, uploadConfig);
} else if (key.getStorageType() == 7) {
@@ -232,7 +233,7 @@ public class ClientController {
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
if (uploadConfig.getApi() == 1) {
if (email != null && pass != null) {
Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()));
Integer ret = userService.login(email, Base64Encryption.encryptBASE64(pass.getBytes()),null);
if (ret > 0) {
User u = userService.getUsers(email);
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
@@ -470,7 +471,7 @@ Print.Normal(resultBean.toString());
public String login( HttpSession httpSession, String email, String password) {
JSONArray jsonArray = new JSONArray();
String basepass = Base64Encryption.encryptBASE64(password.getBytes());
Integer ret = userService.login(email, basepass);
Integer ret = userService.login(email, basepass,null);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
@@ -506,4 +507,28 @@ Print.Normal(resultBean.toString());
return count.toString();
}
@GetMapping("/getNoticeText")
@ResponseBody
public String getNoticeText() {
Msg msg = new Msg();
return noticeService.getNotice();
}
@GetMapping("/getNotice")
@ResponseBody
public Msg getNotice() {
Msg msg = new Msg();
String url = "http://tc.hellohao.cn/getNoticeText";
if(TestUrl.testUrlWithTimeOut(url,2000)){
String urls =url;
msg.setData(HttpUtil.get(urls));
}else{
msg.setData("暂无公告");
}
return msg;
}
}
@@ -2,8 +2,10 @@ package cn.hellohao.controller;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.utils.Print;
import org.springframework.ui.Model;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
@@ -50,6 +52,20 @@ public class ExceptionHandling {
return e.getMessage();
}
@ExceptionHandler
public String test3(HttpRequestMethodNotSupportedException e,Model model){
ModelAndView modelAndView = new ModelAndView("/index");
Print.Normal("URL访问类型不正确:"+ e.getMessage());
//e.printStackTrace();
modelAndView.addObject("error","URL访问类型不正确。");
model.addAttribute("error","URL访问类型不正确。");
//返回错误信息,并显示给用户
//return e.getMessage();
return "exception";
}
// @ExceptionHandler
// public String methodArgumentNotValid(BindException e) {
@@ -32,8 +32,6 @@ public class UpdateImgController {
@Autowired
private KeysService keysService;
@Autowired
private OSSImageupload ossImageupload;
@Autowired
private ConfigService configService;
@Autowired
private UploadConfigService uploadConfigService;
@@ -47,6 +45,8 @@ public class UpdateImgController {
private FTPImageupload ftpImageupload;
@Autowired
private ImgService imgService;
@Autowired
private UploadServicel uploadServicel;
private String[] iparr;
@@ -66,7 +66,7 @@ public class UpdateImgController {
if(uploadConfig.getImgcounttourists()!=null){imgcounttourists = uploadConfig.getImgcounttourists();}
if(uploadConfig.getImgcountuser()!=null){imgcountuser = uploadConfig.getImgcountuser();}
if (email != null) {
Integer ret = userService.login(u.getEmail(), u.getPassword());
Integer ret = userService.login(u.getEmail(), u.getPassword(),null);
if (ret > 0) {
User user = userService.getUsers(u.getEmail());
model.addAttribute("username", user.getUsername());
@@ -96,110 +96,11 @@ public class UpdateImgController {
@RequestMapping(value = "/upimg")
@ResponseBody
public String upimg( HttpSession session,HttpServletRequest request
public Msg upimg( HttpSession session,HttpServletRequest request
, @RequestParam(value = "file", required = false) MultipartFile multipartFile,Integer setday,String upurlk) throws Exception {
String userip = GetIPS.getIpAddr(request);
Print.Normal("上传者ip:"+userip);
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
Config config = configService.getSourceype();
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
Integer usermemory =0;
Integer memory =0;
Integer sourcekey=0;
Integer maxsize = 0;
String userpath = "tourist";
Boolean b =false;
if(uploadConfig.getBlacklist()!=null){
iparr = uploadConfig.getBlacklist().split(";");
for (String s : iparr) {
if(s.equals(userip)){
jsonObject.put("imgurls",911);
return jsonObject.toString();
}
}
}
if(Integer.parseInt(Base64Encryption.decryptBASE64(upurlk))!=yzupdate()){
jsonObject.put("imgurls",403);
return jsonObject.toString();
}
if(u==null){
sourcekey = GetCurrentSource.GetSource(null);
memory = uploadConfig.getVisitormemory();
maxsize = uploadConfig.getFilesizetourists();
usermemory= imgService.getusermemory(0);
if(usermemory==null){usermemory = 0;}
}else{
userpath = u.getUsername();
sourcekey = GetCurrentSource.GetSource(u.getId());
memory = userService.getUsers(u.getEmail()).getMemory();
maxsize = uploadConfig.getFilesizeuser();
usermemory= imgService.getusermemory(u.getId());
if(usermemory==null){usermemory = 0;}
}
if(uploadConfig.getUrltype()==2){
userpath = dateFormat.format(new Date());
}
Keys key = keysService.selectKeys(sourcekey);
if(sourcekey==5){b =true;}
else{b = StringUtils.doNull(sourcekey,key);}
if(!b){
jsonObject.put("imgurls",-1);
return jsonObject.toString();
}
int tmp =(memory==-1? -2:(usermemory/1024));
if(tmp>=memory){
jsonObject.put("imgurls",-5);
return jsonObject.toString();
}
long stime = System.currentTimeMillis();
Map<String, MultipartFile> map = new HashMap<>();
Print.Normal("文件大小:"+multipartFile.getSize());
if(multipartFile.getSize()>maxsize*1024*1024){
jsonObject.put("imgurls",-6);
return jsonObject.toString();
}
String fileName = multipartFile.getOriginalFilename();
String lastname = fileName.substring(fileName.lastIndexOf(".") + 1);
if (!multipartFile.isEmpty()) {
map.put(lastname, multipartFile);
}
Map<ReturnImage, Integer> m = null;
m = GetSource.storageSource(key.getStorageType(),map, userpath,null,setday);
Images img = new Images();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Print.Normal("上传图片的时间是:"+df.format(new Date()));
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if(key.getStorageType()==5){
if(config.getDomain()!=null){
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(config.getDomain()+"/links/"+entry.getKey().getImgurl());
}else{
jsonObject.put("imgurls",config.getDomain()+"/links/"+entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl("http://"+IPPortUtil.getLocalIP()+":"+IPPortUtil.getLocalPort()+"/links/"+entry.getKey().getImgurl());//图片链接
}
}else{
jsonObject.put("imgurls",entry.getKey().getImgurl());
jsonObject.put("imgnames",entry.getKey().getImgname());
img.setImgurl(entry.getKey().getImgurl());
}
jsonArray.add(jsonObject);
img.setUpdatetime(df.format(new Date()));
img.setSource(key.getStorageType());
img.setUserid(u == null?0:u.getId());
img.setSizes((entry.getValue()) / 1024);
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
img.setImgtype(setday>0?1:0);
img.setAbnormal(userip);
userService.insertimg(img);
long etime = System.currentTimeMillis();
Print.Normal("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
return jsonObject.toString();
Msg msg = new Msg();
msg = uploadServicel.uploadForLoc(session,request,multipartFile,setday,upurlk,iparr);
return msg;
}
//根据网络图片url上传
@@ -419,6 +320,25 @@ public class UpdateImgController {
}
@RequestMapping("/{key1}/TOIMG{key2}N.{key3}")
public String selectByFy(@PathVariable("key1") String key1,@PathVariable("key2") String key2,@PathVariable("key3") String key3,Model model) {
System.out.println(key1);
System.out.println(key2);
return "forward:/links/"+key1+"/TOIMG"+key2+"N."+key3;
}
// http://127.0.0.1:8088/2020/02/18/TOIMG369f20218091644N.png
@RequestMapping("/{key1:\\d+}/{key2}/{key3}/TOIMG{key4}N.{key5}")
public String selectByFy2(@PathVariable("key1") String key1,@PathVariable("key2") String key2,
@PathVariable("key3") String key3,@PathVariable("key4") String key4,
@PathVariable("key5") String key5,Model model) {
System.out.println(key1);
System.out.println(key2);
System.out.println(key3);
System.out.println(key4);
return "forward:/links/"+key1+"/"+key2+"/"+key3+"/TOIMG"+key4+"N."+key5;
}
private Integer yzupdate(){
Calendar cal = Calendar.getInstance();
int y=cal.get(Calendar.YEAR);
@@ -434,4 +354,5 @@ public class UpdateImgController {
return "err";
}
}
@@ -1,5 +1,6 @@
package cn.hellohao.controller;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -7,7 +8,9 @@ import java.util.Random;
import java.util.UUID;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
@@ -108,16 +111,20 @@ public class UserController {
@RequestMapping("/login")
@ResponseBody
public String login( HttpSession httpSession, String email, String password,Integer logotmp) {
public String login( HttpServletResponse response,HttpSession httpSession, String email, String password,Integer logotmp) {
JSONArray jsonArray = new JSONArray();
if((logotmp-number1)==(istmp1-number1)){
String basepass = Base64Encryption.encryptBASE64(password.getBytes());
Integer ret = userService.login(email, basepass);
Integer ret = userService.login(email, basepass,null);
if (ret > 0) {
User user = userService.getUsers(email);
if (user.getIsok() == 1) {
httpSession.setAttribute("user", user);
httpSession.setAttribute("email", user.getEmail());
Cookie cookie = new Cookie("Hellohao_UniqueUserKey", userService.getUsers(user.getEmail()).getUid());
cookie.setMaxAge(60*60*24*90);
cookie.setPath("/");
response.addCookie(cookie);
jsonArray.add(1);
} else if(ret==-1){
jsonArray.add(-1);
@@ -133,11 +140,48 @@ public class UserController {
return jsonArray.toString();
}
@RequestMapping("/login_c")
@ResponseBody
public String login( HttpSession httpSession, String Hellohao_UniqueUserKey) {
JSONArray jsonArray = new JSONArray();
Integer ret = userService.login(null, null,Hellohao_UniqueUserKey);
if (ret > 0) {
User user = userService.getUsersMail(Hellohao_UniqueUserKey);
if (user.getIsok() == 1) {
httpSession.setAttribute("user", user);
httpSession.setAttribute("email", user.getEmail());
jsonArray.add(1);
} else if(ret==-1){
jsonArray.add(-1);
}else {
jsonArray.add(-2);
}
} else {
jsonArray.add(0);
}
return jsonArray.toString();
}
//退出
@RequestMapping(value = "/exit.do")
@ResponseBody
public String exit(Model model, HttpServletRequest request, HttpSession session) {
public String exit(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
JSONObject jsonObject = new JSONObject();
Cookie[] cookies = request.getCookies();
for (Cookie cookie : cookies) {
Cookie c = null;
cookie.setPath("/");
if(cookie.getName().equals("Hellohao_UniqueUserKey")){
//cookie.setValue(null);
c = new Cookie("Hellohao_UniqueUserKey","");
c.setPath("/");
cookie.setMaxAge(0);//60*60*24*90
response.addCookie(c);
}
}
//注销,移除session
User user = (User) session.getAttribute("user");
if (user.getEmail() != null && user.getPassword() != null) {
@@ -0,0 +1,25 @@
package cn.hellohao.dao;
import cn.hellohao.pojo.Album;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.validation.constraints.Max;
import java.util.List;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:15
*/
@Mapper
public interface AlbumMapper {
Album selectAlbum(Album album);
Integer addAlbum(Album album);
Integer deleteAlbum(@Param("albumkey") String albumkey);
List<Album> selectAlbumURLList(Album album);
}
@@ -0,0 +1,26 @@
package cn.hellohao.dao;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.ImgAndAlbum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:15
*/
@Mapper
public interface ImgAndAlbumMapper {
Integer addImgAndAlbum(ImgAndAlbum imgAndAlbum);
List<ImgAndAlbum> getAlbumForImgname(@Param("imgname") String imgname);
Integer deleteImgAndAlbum(@Param("imgname") String imgname);
Integer deleteImgAndAlbumForKey(@Param("albumkey") String albumkey);
List<Images> selectImgForAlbumkey(@Param("albumkey") String albumkey);
}
+7 -1
View File
@@ -20,7 +20,7 @@ public interface ImgMapper {
Integer counts(@Param("userid") Integer userid);
Integer setabnormal(@Param("imgname") String imgname,@Param("abnormal") String abnormal);
Integer setImg(Images images);
Integer deleimgname(@Param("imgname") String imgname);
Integer deleall(@Param("id") Integer id);
@@ -28,4 +28,10 @@ public interface ImgMapper {
List<Images> gettimeimg(@Param("time") String time);
Integer getusermemory(@Param("userid") Integer userid);
Integer md5Count(@Param("md5key") String md5key);
Images selectImgUrlByMD5(@Param("md5key") String md5key);
}
@@ -14,7 +14,7 @@ public interface UserMapper {
Integer register(User user);
//登录
Integer login(@Param("email") String email, @Param("password") String password);
Integer login(@Param("email") String email, @Param("password") String password,@Param("uid") String uid);
//获取用户信息
User getUsers(@Param("email") String email);
@@ -1,13 +1,20 @@
package cn.hellohao.interceptor;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.net.URLEncoder;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import cn.hellohao.pojo.User;
import cn.hellohao.service.impl.NOSImageupload;
import cn.hellohao.service.impl.UserServiceImpl;
import cn.hellohao.utils.Base64Encryption;
import cn.hellohao.utils.Print;
import cn.hellohao.utils.SpringContextHolder;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
@@ -25,17 +32,43 @@ public class InterceptorConfig implements HandlerInterceptor {
*/
//这个方法是在访问接口之前执行的,我们只需要在这里写验证登陆状态的业务逻辑,就可以在用户调用指定接口之前验证登陆状态了
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
UserServiceImpl userService = SpringContextHolder.getBean(UserServiceImpl.class);
HttpSession session = request.getSession();
//这里的User是登陆时放入session的
User user = (User) session.getAttribute("user");
//这里的User是登陆时放入session的
User user = (User) session.getAttribute("user");
if(user==null){
Cookie[] cookies = request.getCookies();
String Hellohao_UniqueUserKey = "";
for (Cookie cookie : cookies) {
if(cookie.getName().equals("Hellohao_UniqueUserKey") && Hellohao_UniqueUserKey.equals("")){
Hellohao_UniqueUserKey = URLDecoder.decode(cookie.getValue(), "GBK");
}
// if(cookie.getName().equals("pass_hellohaobycookie") && pass.equals("")){
// pass =URLDecoder.decode(cookie.getValue(), "GBK");
// }
}
if(Hellohao_UniqueUserKey!=null && !Hellohao_UniqueUserKey.equals("")){
//String basepass = Base64Encryption.encryptBASE64(pass.getBytes());
Integer ret = userService.login(null, null,Hellohao_UniqueUserKey);
if (ret > 0) {
User u = userService.getUsersMail(Hellohao_UniqueUserKey);
if (u.getIsok() == 1) {
session.setAttribute("user", u);
session.setAttribute("email", u.getEmail());
//request.getRequestDispatcher("/admin/goadmin").forward(request, response);
}
}
}
}
User suser = (User) session.getAttribute("user");
String email = null;
Integer level = 0;
if (user != null) {
email = user.getEmail();
level = user.getLevel();
if (suser != null) {
email = suser.getEmail();
level = suser.getLevel();
}
// String email = (String) session.getAttribute("email");
//如果session中没有user,表示没登陆
if (email == null) {
//这个方法返回false表示忽略当前请求,如果一个用户调用了需要登陆才能使用的接口,如果他没有登陆这里会直接忽略掉
//当然你可以利用response给用户返回一些提示信息,告诉他没登陆
@@ -43,7 +76,6 @@ public class InterceptorConfig implements HandlerInterceptor {
request.getRequestDispatcher("/err").forward(request, response);
return false;
} else {
//System.out.println("进入成功");
return true; //如果session里有user,表示该用户已经登陆,放行,用户即可继续调用自己需要的接口
}
+75
View File
@@ -0,0 +1,75 @@
package cn.hellohao.pojo;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:13
*/
public class Album {
private String albumkey;
private String albumtitle;
private String createdate;
private String password;
private Integer userid;
private String username;
public Album() {
}
public Album(String albumkey, String albumtitle, String createdate, String password, Integer userid, String username) {
this.albumkey = albumkey;
this.albumtitle = albumtitle;
this.createdate = createdate;
this.password = password;
this.userid = userid;
this.username = username;
}
public String getAlbumkey() {
return albumkey;
}
public void setAlbumkey(String albumkey) {
this.albumkey = albumkey;
}
public String getAlbumtitle() {
return albumtitle;
}
public void setAlbumtitle(String albumtitle) {
this.albumtitle = albumtitle;
}
public String getCreatedate() {
return createdate;
}
public void setCreatedate(String createdate) {
this.createdate = createdate;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
+50 -2
View File
@@ -2,6 +2,9 @@ package cn.hellohao.pojo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
public class Images {
// 默认的时间字符串格式
@@ -20,13 +23,21 @@ public class Images {
private Integer storageType;
private String starttime;
private String stoptime;
@Length(min = 1, max = 100, message = "图片描述不得超过100个字符")
private String explains;
private String md5key;
//Album
@NotBlank(message = "画廊标题不能为空")
@Length(min = 1, max = 50, message = "画廊标题不得超过50个字符")
private String albumtitle;
@Length(min = 0, max = 10, message = "画廊密码不能超过10个字符")
private String password;
public Images() {
super();
}
public Images(Integer id, String imgname, String imgurl, Integer userid, Integer sizes, String abnormal, Integer source, Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime) {
public Images(Integer id, String imgname, String imgurl, Integer userid, Integer sizes, String abnormal, Integer source, Integer imgtype, String updatetime, String username, Integer storageType, String starttime, String stoptime, String explains, String albumtitle, String password,String md5key) {
this.id = id;
this.imgname = imgname;
this.imgurl = imgurl;
@@ -40,6 +51,10 @@ public class Images {
this.storageType = storageType;
this.starttime = starttime;
this.stoptime = stoptime;
this.explains = explains;
this.albumtitle = albumtitle;
this.password = password;
this.md5key = md5key;
}
public Integer getId() {
@@ -145,6 +160,39 @@ public class Images {
public void setStoptime(String stoptime) {
this.stoptime = stoptime;
}
public String getExplains() {
return explains;
}
public void setExplains(String explains) {
this.explains = explains;
}
public String getAlbumtitle() {
return albumtitle;
}
public void setAlbumtitle(String albumtitle) {
this.albumtitle = albumtitle;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMd5key() {
return md5key;
}
public void setMd5key(String md5key) {
this.md5key = md5key;
}
}
@@ -0,0 +1,35 @@
package cn.hellohao.pojo;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:12
*/
public class ImgAndAlbum {
private String imgname;
private String albumkey;
public ImgAndAlbum() {
}
public ImgAndAlbum(String imgname, String albumkey) {
this.imgname = imgname;
this.albumkey = albumkey;
}
public String getImgname() {
return imgname;
}
public void setImgname(String imgname) {
this.imgname = imgname;
}
public String getAlbumkey() {
return albumkey;
}
public void setAlbumkey(String albumkey) {
this.albumkey = albumkey;
}
}
+112
View File
@@ -0,0 +1,112 @@
package cn.hellohao.pojo;
import java.io.Serializable;
/**
* 交互消息,默认成功
* @author Hellohao
*
*/
public class Msg implements Serializable {
private static final long serialVersionUID = 5196249482551119279L;
//返回码
private String code ="200";
//提示信息
private String info="操作成功";
//返回数据
private Object data;
//异常
private String exceptions;
public Msg() {}
public void set(String code, String info){
this.code = code;
this.info = info;
}
/**
* 默认成功操作
* @param data
*/
public Msg(Object data) {
super();
this.data = data;
}
public Msg(String code, String info) {
super();
this.code = code;
this.info = info;
}
public Msg(String code, String info, Object data) {
super();
this.code = code;
this.info = info;
this.data = data;
}
public Msg(String code, String info, Object data, String exceptions) {
super();
this.code = code;
this.info = info;
this.data = data;
this.exceptions = exceptions;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getExceptions() {
return exceptions;
}
public void setExceptions(String exceptions) {
this.exceptions = exceptions;
}
@Override
public String toString() {
return "Msg [code=" + code + ", info=" + info + ", data=" + data
+ ", exceptions=" + exceptions + "]";
}
}
@@ -0,0 +1,24 @@
package cn.hellohao.service;
import cn.hellohao.pojo.Album;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:15
*/
@Service
public interface AlbumService {
Album selectAlbum(Album album);
Integer addAlbum(Album album);
Integer deleteAlbum(String albumkey);
List<Album> selectAlbumURLList(Album album);
}
@@ -0,0 +1,25 @@
package cn.hellohao.service;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.ImgAndAlbum;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:29
*/
@Service
public interface ImgAndAlbumService {
Integer addImgAndAlbum(ImgAndAlbum imgAndAlbum);
List<ImgAndAlbum> getAlbumForImgname(String imgname);
Integer deleteImgAndAlbum(String imgname);
Integer deleteImgAndAlbumForKey(String albumkey);
List<Images> selectImgForAlbumkey(String albumkey);
}
@@ -18,7 +18,7 @@ public interface ImgService {
Integer counts(Integer userid);
Integer setabnormal(String imgname,String abnormal);
Integer setImg(Images images);
Integer deleimgname(String imgname);
@@ -27,4 +27,9 @@ public interface ImgService {
List<Images> gettimeimg(String time);
Integer getusermemory(Integer userid);
Integer md5Count(String md5key);
Images selectImgUrlByMD5(String md5key);
}
@@ -11,7 +11,7 @@ public interface UserService {
Integer register(User user);
//登录
Integer login(String email, String password);
Integer login(String email, String password,String uid);
//获取用户信息
User getUsers(String email);
@@ -0,0 +1,89 @@
package cn.hellohao.service.impl;
import cn.hellohao.dao.AlbumMapper;
import cn.hellohao.dao.ConfigMapper;
import cn.hellohao.dao.ImgAndAlbumMapper;
import cn.hellohao.exception.CodeException;
import cn.hellohao.pojo.Album;
import cn.hellohao.pojo.ImgAndAlbum;
import cn.hellohao.pojo.Msg;
import cn.hellohao.service.AlbumService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.UUID;
/**
* @author Hellohao
* @version 1.0
* @date 2019-12-18 22:30
*/
@Service
public class AlbumServiceI implements AlbumService {
@Autowired
AlbumMapper albumMapper;
@Autowired
ImgAndAlbumMapper andAlbumMapper;
@Autowired
ConfigMapper configMapper;
@Override
public Album selectAlbum(Album album) {
return albumMapper.selectAlbum(album);
}
@Override
public Integer addAlbum(Album album) {
return albumMapper.addAlbum(album);
}
@Transactional
public Integer addAlbumForImgAndAlbumMapper(ImgAndAlbum imgAndAlbum) {
Integer tem = 0;
Integer r2 = andAlbumMapper.addImgAndAlbum(imgAndAlbum);
if(r2>0){
tem = 1;
}else{
throw new CodeException("插入画廊数据失败,回滚");
}
return tem;
}
@Override
public Integer deleteAlbum(String albumkey) {
return albumMapper.deleteAlbum(albumkey);
}
@Override
public List<Album> selectAlbumURLList(Album album) {
return albumMapper.selectAlbumURLList(album);
}
@Transactional
public Integer delete(String albumkey) {
Integer ret1 = albumMapper.deleteAlbum(albumkey);
if(ret1>0){
ret1 = andAlbumMapper.deleteImgAndAlbumForKey(albumkey);
}else{
throw new CodeException("删除画廊失败。");
}
return ret1;
}
@Transactional
public Integer deleteAll(String[] albumkeyArr) {
Integer ret1 = 0 ;
for (String s : albumkeyArr) {
ret1 = albumMapper.deleteAlbum(s);
if(ret1>0){
ret1 = andAlbumMapper.deleteImgAndAlbumForKey(s);
}else{
throw new CodeException("删除画廊失败。");
}
}
return ret1;
}
}
@@ -3,10 +3,7 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.DateUtils;
import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import cn.hellohao.utils.*;
import com.netease.cloud.auth.BasicCredentials;
import com.netease.cloud.auth.Credentials;
import com.netease.cloud.services.nos.NosClient;
@@ -45,7 +42,7 @@ public class COSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
try {
// 指定要上传到的存储桶
String bucketName = BarrelName;
@@ -54,7 +51,7 @@ public class COSImageupload {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, userkey, file);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgname(userkey);//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/" + userkey);
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
@@ -106,16 +103,16 @@ public class COSImageupload {
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
return file;
}
// private File changeFile(MultipartFile multipartFile) throws Exception {
// // 获取文件名
// String fileName = multipartFile.getOriginalFilename();
// // 获取文件后缀
// String prefix = fileName.substring(fileName.lastIndexOf("."));
// // todo 修改临时文件文件名
// File file = File.createTempFile(fileName, prefix);
// multipartFile.transferTo(file);
// return file;
// }
//初始化网易NOS对象存储
public static Integer Initialize(Keys k) {
@@ -148,7 +145,7 @@ public class COSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
try {
ReturnImage returnImage = new ReturnImage();
if(entry.getValue().getSize()/1024<=uploadConfig.getFilesizeuser()*1024){
@@ -36,13 +36,13 @@ public class FTPImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
String userkey =username + File.separator+ uuid+times + "." + entry.getKey();
file = SetFiles.changeFile(entry.getValue());
String userkey =username + "/"+ uuid+times + "." + entry.getKey();
if (flag) {
ftps.upload(file, File.separator+userkey, "");
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + File.separator+ userkey);
returnImage.setImgname(userkey);//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/"+ userkey);
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
String deleimg = DateUtils.plusDay(setday);
@@ -83,16 +83,16 @@ public class FTPImageupload {
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
return file;
}
// private File changeFile(MultipartFile multipartFile) throws Exception {
// // 获取文件名
// String fileName = multipartFile.getOriginalFilename();
// // 获取文件后缀
// String prefix = fileName.substring(fileName.lastIndexOf("."));
// // todo 修改临时文件文件名
// File file = File.createTempFile(fileName, prefix);
// multipartFile.transferTo(file);
// return file;
// }
//初始化FTP对象存储
public static Integer Initialize(Keys k) {
@@ -152,7 +152,7 @@ public class FTPImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
String userkey =username + File.separator+ uuid+times + "." + entry.getKey();
ftps.mkDir(File.separator+username);
if (flag) {
@@ -0,0 +1,45 @@
package cn.hellohao.service.impl;
import cn.hellohao.dao.ImgAndAlbumMapper;
import cn.hellohao.pojo.Images;
import cn.hellohao.pojo.ImgAndAlbum;
import cn.hellohao.service.ImgAndAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Tiansh
* @version 1.0
* @date 2019/12/19 15:40
*/
@Service
public class ImgAndAlbumServiceImpl implements ImgAndAlbumService {
@Autowired
ImgAndAlbumMapper imgAndAlbumMapper;
@Override
public Integer addImgAndAlbum(ImgAndAlbum imgAndAlbum) {
return imgAndAlbumMapper.addImgAndAlbum(imgAndAlbum);
}
@Override
public List<ImgAndAlbum> getAlbumForImgname(String imgname) {
return imgAndAlbumMapper.getAlbumForImgname(imgname);
}
@Override
public Integer deleteImgAndAlbum(String imgname) {
return imgAndAlbumMapper.deleteImgAndAlbum(imgname);
}
@Override
public Integer deleteImgAndAlbumForKey(String albumkey) {
return imgAndAlbumMapper.deleteImgAndAlbumForKey(albumkey);
}
@Override
public List<Images> selectImgForAlbumkey(String albumkey) {
return imgAndAlbumMapper.selectImgForAlbumkey(albumkey);
}
}
@@ -169,8 +169,8 @@ public class ImgServiceImpl implements ImgService {
}
@Override
public Integer setabnormal(String imgname,String abnormal) {
return imgMapper.setabnormal(imgname,abnormal);
public Integer setImg(Images images) {
return imgMapper.setImg(images);
}
@Override
@@ -192,4 +192,14 @@ public class ImgServiceImpl implements ImgService {
public Integer getusermemory(Integer userid) {
return imgMapper.getusermemory(userid);
}
@Override
public Integer md5Count(String md5key) {
return imgMapper.md5Count(md5key);
}
@Override
public Images selectImgUrlByMD5(String md5key) {
return imgMapper.selectImgUrlByMD5(md5key);
}
}
@@ -6,6 +6,7 @@ import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.DateUtils;
import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.SetFiles;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.ObjectMetadata;
import com.google.gson.Gson;
@@ -42,12 +43,12 @@ public class KODOImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
try {
Response response = uploadManager.put(file,username + "/" + uuid+times + "." + entry.getKey(),upToken);
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgname(username + "/" + uuid+times + "." + entry.getKey());//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
@@ -97,16 +98,16 @@ public class KODOImageupload {
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
return file;
}
// private File changeFile(MultipartFile multipartFile) throws Exception {
// // 获取文件名
// String fileName = multipartFile.getOriginalFilename();
// // 获取文件后缀
// String prefix = fileName.substring(fileName.lastIndexOf("."));
// // todo 修改临时文件文件名
// File file = File.createTempFile(fileName, prefix);
// multipartFile.transferTo(file);
// return file;
// }
//初始化
public static Integer Initialize(Keys k) {
@@ -147,7 +148,7 @@ public class KODOImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
try {
ReturnImage returnImage = new ReturnImage();
@@ -11,10 +11,7 @@ import java.util.UUID;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.DateUtils;
import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import cn.hellohao.utils.*;
import com.netease.cloud.services.nos.model.ObjectMetadata;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@@ -42,10 +39,10 @@ public class NOSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
nosClient.putObject(BarrelName, username + "/" + uuid+times + "." + entry.getKey(), file);
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgname(username + "/" + uuid+times + "." + entry.getKey());//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0){
@@ -103,17 +100,17 @@ public class NOSImageupload {
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
// MultipartFile to File
multipartFile.transferTo(file);
return file;
}
// private File changeFile(MultipartFile multipartFile) throws Exception {
// // 获取文件名
// String fileName = multipartFile.getOriginalFilename();
// // 获取文件后缀
// String prefix = fileName.substring(fileName.lastIndexOf("."));
// // todo 修改临时文件文件名
// File file = File.createTempFile(fileName, prefix);
// // MultipartFile to File
// multipartFile.transferTo(file);
// return file;
// }
//初始化网易NOS对象存储
@@ -162,7 +159,7 @@ public class NOSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
try {
Print.warning(entry.getValue().getSize());
ReturnImage returnImage = new ReturnImage();
@@ -49,7 +49,7 @@ public class OSSImageupload {
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
ossClient.putObject(key.getBucketname(), username + "/" + uuid+times + "." + entry.getKey(),file,meta);
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgname(username + "/" + uuid+times + "." + entry.getKey());//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
@@ -3,10 +3,7 @@ package cn.hellohao.service.impl;
import cn.hellohao.pojo.Keys;
import cn.hellohao.pojo.ReturnImage;
import cn.hellohao.pojo.UploadConfig;
import cn.hellohao.utils.DateUtils;
import cn.hellohao.utils.DeleImg;
import cn.hellohao.utils.ImgUrlUtil;
import cn.hellohao.utils.Print;
import cn.hellohao.utils.*;
import com.UpYun;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.ObjectMetadata;
@@ -35,13 +32,13 @@ public class USSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
upyun.setContentMD5(UpYun.md5(file));
boolean result = upyun.writeFile(username + "/" + uuid+times + "." + entry.getKey(), file, true);
if(result){
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(key.getRequestAddress() + "/" + username + "/" + uuid+times + "." + entry.getKey());
returnImage.setImgname(username + "/" + uuid+times + "." + entry.getKey());//entry.getValue().getOriginalFilename()
returnImage.setImgurl(key.getRequestAddress() + "/" +username + "/" + uuid+times + "." + entry.getKey());//key.getRequestAddress() + "/" +
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
String deleimg = DateUtils.plusDay(setday);
@@ -82,18 +79,18 @@ public class USSImageupload {
}
// 转换文件方法
private File changeFile(MultipartFile multipartFile) throws Exception {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
// MultipartFile to File
multipartFile.transferTo(file);
return file;
}
// // 转换文件方法
// private File changeFile(MultipartFile multipartFile) throws Exception {
// // 获取文件名
// String fileName = multipartFile.getName();//getOriginalFilename
// // 获取文件后缀
// String prefix = fileName.substring(fileName.lastIndexOf("."));
// // todo 修改临时文件文件名
// File file = File.createTempFile(fileName, prefix);
// // MultipartFile to File
// multipartFile.transferTo(file);
// return file;
// }
//初始化
public static Integer Initialize(Keys k) {
@@ -126,7 +123,7 @@ public class USSImageupload {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
file = changeFile(entry.getValue());
file = SetFiles.changeFile(entry.getValue());
// 上传文件流。
System.out.println("客户端:待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
ReturnImage returnImage = new ReturnImage();
@@ -0,0 +1,225 @@
package cn.hellohao.service.impl;
import cn.hellohao.dao.*;
import cn.hellohao.pojo.*;
import cn.hellohao.utils.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author Hellohao
* @version 1.0
* @date 2020/1/9 15:46
*/
@Service
public class UploadServicel {
@Autowired
ConfigMapper configMapper;
@Autowired
UploadConfigMapper uploadConfigMapper;
@Autowired
KeysMapper keysMapper;
@Autowired
ImgMapper imgMapper;
@Autowired
UserMapper userMapper;
public Msg uploadForLoc(HttpSession session, HttpServletRequest request,
MultipartFile multipartFile, Integer setday, String upurlk, String[] iparr) {
Msg msg = new Msg();
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
Config config = configMapper.getSourceype();
UploadConfig uploadConfig = uploadConfigMapper.getUpdateConfig();
String userip = GetIPS.getIpAddr(request);
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy/MM/dd");
User u = (User) session.getAttribute("user");
Integer usermemory = 0;
Integer memory = 0;
Integer sourcekey = 0;
Integer maxsize = 0;
String userpath = "tourist";
Boolean b = false;
String md5key = "";
FileInputStream fis = null;
File file = SetFiles.changeFile_new(multipartFile);
MultipartFile multipartFile2 = null;
try {
md5key = DigestUtils.md5Hex(new FileInputStream(file));
InputStream inputStream = new FileInputStream(file);
multipartFile2 = new MockMultipartFile(file.getName(), inputStream);
fis = new FileInputStream(file);
byte[] bytes = new byte[3];
fis.read(bytes, 0, bytes.length);
String xxx = ImgUrlUtil.bytesToHexString(bytes);
xxx = xxx.toUpperCase();
if(fis!=null){fis.close();}
if(TypeDict.checkType(xxx).equals("0000")) {
msg.setCode("4000");
return msg;
}
} catch (Exception e) {
e.printStackTrace();
msg.setCode("5000");
return msg;
}
//判断图片是否存在
if(imgMapper.md5Count(md5key)>0){
Print.warning("图片存在啦");
Images images = imgMapper.selectImgUrlByMD5(md5key);
jsonObject.put("imgurls", images.getImgurl());
jsonObject.put("imgnames",file.getName());
jsonArray.add(jsonObject);
msg.setData(jsonArray);
return msg;
}
String prefix = file.getName().substring(file.getName().lastIndexOf(".")+1);
MultipartFile mf =null;
try{
InputStream inputStream = new FileInputStream(file);
mf = new MockMultipartFile(file.getName(), inputStream);
inputStream.close();
}catch (Exception e){
System.out.println("0000000");
}
if (uploadConfig.getBlacklist() != null) {
iparr = uploadConfig.getBlacklist().split(";");
for (String s : iparr) {
if (s.equals(userip)) {
msg.setCode("911");
return msg;
}
}
}
if (Integer.parseInt(Base64Encryption.decryptBASE64(upurlk)) != yzupdate()) {
msg.setCode("4003");
return msg;
}
//验证文件是否是图片
if (u == null) {
sourcekey = GetCurrentSource.GetSource(null);
memory = uploadConfig.getVisitormemory();
maxsize = uploadConfig.getFilesizetourists();
usermemory = imgMapper.getusermemory(0);
if (usermemory == null) {
usermemory = 0;
}
} else {
userpath = u.getUsername();
sourcekey = GetCurrentSource.GetSource(u.getId());
memory = userMapper.getUsers(u.getEmail()).getMemory();
maxsize = uploadConfig.getFilesizeuser();
usermemory = imgMapper.getusermemory(u.getId());
if (usermemory == null) {
usermemory = 0;
}
}
if (uploadConfig.getUrltype() == 2) {
userpath = dateFormat.format(new Date());
}
Keys key = keysMapper.selectKeys(sourcekey);
if (sourcekey == 5) {
b = true;
} else {
b = StringUtils.doNull(sourcekey, key);
}
if (!b) {
msg.setCode("4001");
return msg;
}
int tmp = (memory == -1 ? -2 : (usermemory / 1024));
if (tmp >= memory) {
msg.setCode("4005");
return msg;
}
long stime = System.currentTimeMillis();
Map<String, MultipartFile> map = new HashMap<>();
if (mf.getSize() > maxsize * 1024 * 1024) {
msg.setCode("4006");
return msg;
}
String fileName = mf.getOriginalFilename();
if (!mf.isEmpty()) {
map.put(prefix, mf);//prefix
}
Map<ReturnImage, Integer> m = null;
m = GetSource.storageSource(key.getStorageType(), map, userpath, null, setday);
Images img = new Images();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
for (Map.Entry<ReturnImage, Integer> entry : m.entrySet()) {
if (key.getStorageType() == 5) {
if (config.getDomain() != null) {
jsonObject.put("imgurls", config.getDomain() +"/"+ entry.getKey().getImgurl());
jsonObject.put("imgnames", entry.getKey().getImgname());
img.setImgurl(config.getDomain() +"/"+ entry.getKey().getImgurl());
} else {
jsonObject.put("imgurls", config.getDomain() +"/"+ entry.getKey().getImgurl());
jsonObject.put("imgnames", entry.getKey().getImgname());
img.setImgurl("http://" + IPPortUtil.getLocalIP() + ":" + IPPortUtil.getLocalPort() +"/"+ entry.getKey().getImgurl());//图片链接
}
} else {
jsonObject.put("imgurls", entry.getKey().getImgurl());
jsonObject.put("imgnames", entry.getKey().getImgname());
img.setImgurl( entry.getKey().getImgurl());
}
jsonArray.add(jsonObject);
img.setUpdatetime(df.format(new Date()));
img.setSource(key.getStorageType());
img.setUserid(u == null ? 0 : u.getId());
img.setSizes((entry.getValue()) / 1024);
if(uploadConfig.getUrltype()==2){
//img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), "", ""));
String[] imgname = entry.getKey().getImgurl().split ("/");
String name = "";
for (int i = 0; i < imgname.length; i++) {
if(i>2 && i!=imgname.length-1){
name+=imgname[i]+"/";
}
if(i==imgname.length-1){
name+=imgname[i];
}
}
img.setImgname(entry.getKey().getImgname());
}else{
img.setImgname(SetText.getSubString(entry.getKey().getImgurl(), key.getRequestAddress() + "/", ""));
}
img.setImgtype(setday > 0 ? 1 : 0);
img.setAbnormal(userip);
img.setMd5key(md5key);
userMapper.insertimg(img);
long etime = System.currentTimeMillis();
Print.Normal("上传图片所用时长:" + String.valueOf(etime - stime) + "ms");
}
msg.setData(jsonArray);
return msg;
}
public String uploadForURL() {
return "";
}
private Integer yzupdate() {
Calendar cal = Calendar.getInstance();
int y = cal.get(Calendar.YEAR);
int m = cal.get(Calendar.MONTH);
int d = cal.get(Calendar.DATE);
//int h=cal.get(Calendar.HOUR_OF_DAY);
//int mm=cal.get(Calendar.MINUTE);
return y + m + d + 999;
}
}
@@ -26,9 +26,9 @@ public class UserServiceImpl implements UserService {
}
@Override
public Integer login(String email, String password) {
public Integer login(String email, String password,String uid) {
// TODO Auto-generated method stub
return userMapper.login(email, password);
return userMapper.login(email, password,uid);
}
@Override
-81
View File
@@ -1,81 +0,0 @@
package cn.hellohao.test;
import cn.hellohao.utils.Print;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
/**
* Hello world!
*/
class GetPostTest {
public static String sendGet(String url, String param) {
String result = "";
String urlName = "https://v1.hitokoto.cn/";
try {
URL realURL = new URL(urlName);
URLConnection conn = realURL.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36");
conn.connect();
Map<String, List<String>> map = conn.getHeaderFields();
for (String s : map.keySet()) {
System.out.println(s + "-->" + map.get(s));
}
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
String line;
while ((line = in.readLine()) != null) {
result += "\n" + line;
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
public static String sendPost(String url,String param){
String result = "";
try {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36");
//post设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(param);
out.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));
String line;
while((line = in.readLine()) != null){
result +="\n" + line;
}
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
public static void main(String[] args) {
Print.warning(GetPostTest.sendGet("",""));
}
}
//public class App {
// public static void main(String[] args) throws Exception {
// System.out.println("hello world");
// String sendRecvGet =GetPostTest.sendGet("http://localhost:8989/testServletEncoding/encodingTest","param=xxxxx嘻嘻嘻");
// System.out.println(sendRecvGet);
// //String sendRecvPost =GetPostTest.sendPost("http://localhost:8989/testServletEncoding/encodingTest","param=就是我");
// //System.out.println(sendRecvPost);
// }
//}
-54
View File
@@ -1,54 +0,0 @@
package cn.hellohao.test;
import cn.hellohao.utils.Print;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import java.io.FileInputStream;
/**
* @author Hellohao
* @version 1.0
* @date 2019/7/29 17:38
* https://blog.csdn.net/WatsonYee/article/details/82389769
*/
public class FTP {
public static void main(String[] args) throws Exception{
//创建FTP客户端,所有的操作都基于FTPClinet
FTPClient ftp = new FTPClient();
//连接FTP服务器
ftp.connect("hellohao.cn",21);
//如果是需要认证的服务器,就需要账号和密码来登录
ftp.login("test", "test");
//获取服务器返回的状态码
int reply = ftp.getReplyCode();
System.out.println(reply);
/*
* 判断是否连接成功
* 所有以2开头的代码是正完成响应。
* FTP服务器将在最终发送一个肯定的完成响应成功完成命令。
*/
if (!FTPReply.isPositiveCompletion(reply)) {
ftp.disconnect();
System.out.println("连接失败");
return;
}
System.out.println("连接成功");
//返回一个布尔类型的值,来表示是否创建成功
boolean isCreate = ftp.makeDirectory("/ftp");
//设置文件上传类型
ftp.setFileType(ftp.BINARY_FILE_TYPE);
//获取文件的输入流
FileInputStream fis = new FileInputStream("C:\\Users\\tiansh\\Desktop\\11.jpg");
//调用storeFile方法将文件上传到FTP服务器
//第一个参数是上传到服务器的路径,包含了文件名
boolean isUpload = ftp.storeFile("/ftp/upload22.jpg", fis);
boolean isUpload2 = ftp.storeFile("/ftp/upload222.jpg", fis);
Print.warning(isUpload+"=="+isUpload2);
Print.Normal(isUpload);
//设置文件权限
boolean isSet = ftp.sendSiteCommand("chmod 744 " + "/ftp/upload.jpg");
//ftp.deleteFile("/ftp/upload.jpg");
}
}
-76
View File
@@ -1,76 +0,0 @@
package cn.hellohao.test;
import cn.hellohao.utils.Print;
import cn.hutool.crypto.SecureUtil;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.io.*;
import java.security.SecureRandom;
import java.util.Date;
public class test1 {
public static void main(String[] args) throws Exception {
readFile(File.separator + "HellohaoData"+File.separator+"img.ini");
//charu("Hellohao/b3da10930021007.png|");
}
public static void charu(String src) {
String filePath =File.separator + "HellohaoData" ;
File file = new File(filePath);
File file1 = new File(filePath+File.separator+"img.ini");
if(!file.exists()){
file.mkdirs();
}
if(!file1.exists()){
try {
file1.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileWriter fw = null;
try {
//如果文件存在,则追加内容;如果文件不存在,则创建文件
fw = new FileWriter(file1, true);
} catch (IOException e) {
e.printStackTrace();
}
PrintWriter pw = new PrintWriter(fw);
pw.println(src);//插入每行的内容
pw.flush();
try {
fw.flush();
pw.close();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
// 读取文件内容
public static String readFile(String path) {//路径
File file = new File(path);
StringBuilder result = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "GBK"));//构造一个BufferedReader类来读取文件
String s = null;
while ((s = br.readLine()) != null) {//使用readLine方法,一次读一行
result.append(System.lineSeparator() + s);
Print.Normal( s);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
}
+56 -1
View File
@@ -6,6 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.util.UUID;
/**
* @author Hellohao
* @version 1.0
@@ -29,22 +31,75 @@ public class FirstRun implements InitializingBean {
RunSqlScript.PASSWORD = jdbcpass;
RunSqlScript.DBURL = jdbcurl;
Print.Normal("正在校验数据库参数...");
RunSqlScript.RunInsert(dynamic);
RunSqlScript.RunInsert(compressed);
String uid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
RunSqlScript.RunInsert("update user set uid='"+uid+"' where id = 1");
Integer ret1 = RunSqlScript.RunSelectCount(sql1);
if(ret1==0){
Print.Normal("In execution...");
RunSqlScript.RunInsert(sql2);
;
}else{
if(ret1>0){
Print.Normal("Good! No action required!");
Print.Normal("Stage 1");
}else{
Print.Normal("Mysql 报了一个错");
}
}
Integer imgandalbum = RunSqlScript.RunSelectCount(judgeTable+"'imgandalbum'");
if(imgandalbum==0){
RunSqlScript.RunInsert(sql3);
Print.Normal("Stage 2");
}
Integer album = RunSqlScript.RunSelectCount(judgeTable+"'album'");
if(album==0){
RunSqlScript.RunInsert(sql4);
Print.Normal("Stage 3");
}
Integer ret2 = RunSqlScript.RunSelectCount(judgeTable+"'imgdata' and column_name = 'explains'");
if(ret2==0){
RunSqlScript.RunInsert(sql6);
Print.Normal("Stage 4");
}
Integer ret3 = RunSqlScript.RunSelectCount(judgeTable+"'album' and column_name = 'userid'");
if(ret3==0){
RunSqlScript.RunInsert(sql7);
Print.Normal("Stage 5");
}
Integer ret4 = RunSqlScript.RunSelectCount(judgeTable+"'imgdata' and column_name = 'md5key'");
if(ret4==0){
RunSqlScript.RunInsert(sql8);
Print.Normal("Stage 6");
}
RunSqlScript.RunInsert("alter table imgdata drop index index_md5key_url;");
RunSqlScript.RunInsert(inddx_md5key);
Print.Normal("Stage success");
}
//检查表是否存在,后边加'imgdata' and column_name = 'explains' 检查字段是否存在
private String judgeTable = "select count(*) from information_schema.columns where table_name = ";
//创建blacklist 2019-11-29
private String sql1 = "select count(*) from information_schema.columns where table_name = 'uploadconfig' and column_name = 'blacklist'";
private String sql2 = "alter table uploadconfig add blacklist varchar(500);";
//创建imgandalbum和album 添加imgdata表字段explain 2019-12-20
private String sql3 ="CREATE TABLE `imgandalbum` (`imgname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
private String sql4 ="CREATE TABLE `album` (`albumkey` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`albumtitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,`createdate` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic";
private String sql6 = "alter table imgdata add explains varchar(500)";
//添加album表字段userid
private String sql7 = "alter table album add userid int(10)";
//添加imgdata表字段md5key
private String sql8 = "alter table imgdata add md5key varchar(500)";
private String inddx_md5key = "ALTER TABLE imgdata ADD INDEX index_md5key_url ( md5key,imgurl)";
private String dynamic = "alter table imgdata row_format=dynamic";
private String compressed = "alter table imgdata row_format=compressed";
}
@@ -20,10 +20,15 @@ public class IPPortUtil {
* @throws MalformedObjectNameException
* 获取当前机器的端口号
*/
public static String getLocalPort() throws MalformedObjectNameException {
public static String getLocalPort() {//throws MalformedObjectNameException
MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"),
Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
Set<ObjectName> objectNames = null;
try {
objectNames = beanServer.queryNames(new ObjectName("*:type=Connector,*"),
Query.match(Query.attr("protocol"), Query.value("HTTP/1.1")));
} catch (MalformedObjectNameException e) {
e.printStackTrace();
}
String port = objectNames.iterator().next().getKeyProperty("port");
return port;
}
@@ -24,18 +24,19 @@ public class LocUpdateImg {
File file = null;
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
String uuid = "TOIMG"+UUID.randomUUID().toString().replace("-", "").toLowerCase().substring(0,5);//生成一个没有-的uuid,然后取前5位
java.text.DateFormat format1 = new java.text.SimpleDateFormat("MMddhhmmss");
String times = format1.format(new Date());
// 上传文件流。
System.out.println("待上传的图片:"+username + "/" + uuid+times + "." + entry.getKey());
File dest = new File(filePath + username + File.separator+ uuid+times + "." + entry.getKey());
System.out.println("待上传的图片:"+username + "/" + uuid+times + "N." + entry.getKey());
File dest = new File(filePath + username + File.separator+ uuid+times + "N." + entry.getKey());
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
try {
MultipartFile multipartFile = entry.getValue();
FileInputStream fileInputStream = (FileInputStream) multipartFile.getInputStream();
//FileInputStream fileInputStream = (FileInputStream) multipartFile.getInputStream();
InputStream fileInputStream = (InputStream)multipartFile.getInputStream();
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(dest));
byte[] bs = new byte[1024];
int len;
@@ -45,12 +46,12 @@ public class LocUpdateImg {
bos.flush();
bos.close();
ReturnImage returnImage = new ReturnImage();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
returnImage.setImgname(username + "/" +uuid+times + "N." + entry.getKey());//entry.getValue().getOriginalFilename()
returnImage.setImgurl(username + "/" + uuid+times + "N." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
if(setday>0) {
String deleimg = DateUtils.plusDay(setday);
DeleImg.charu(username + "/" + uuid + times + "." + entry.getKey() + "|" + deleimg + "|" + "5");
DeleImg.charu(username + "/" + uuid + times + "N." + entry.getKey() + "|" + deleimg + "|" + "5");
}
} catch (IOException e) {
e.printStackTrace();
@@ -88,7 +89,7 @@ public class LocUpdateImg {
/**
* 客户端接口
* */
public static Map<ReturnImage, Integer> clientuploadFTP(Map<String, MultipartFile> fileMap, String username, UploadConfig uploadConfig) {
public static Map<ReturnImage, Integer> clientLocUpdateImg(Map<String, MultipartFile> fileMap, String username, UploadConfig uploadConfig) {
String filePath =File.separator + "HellohaoData" + File.separator;
File file = null;
Map<ReturnImage, Integer> ImgUrl = new HashMap<>();
@@ -116,7 +117,7 @@ public class LocUpdateImg {
bos.close();
returnImage.setImgname(entry.getValue().getOriginalFilename());
returnImage.setImgurl(username + "/" + uuid+times + "." + entry.getKey());
ImgUrl.put(returnImage, (int) (entry.getValue().getSize()));
ImgUrl.put(returnImage, (int) (entry.getValue().getSize())/1024);
} catch (IOException e) {
e.printStackTrace();
System.err.println("上传失败");
+52 -5
View File
@@ -2,18 +2,65 @@ package cn.hellohao.utils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.*;
public class SetFiles {
// 转换文件方法
public static File changeFile(MultipartFile multipartFile) throws Exception {
public static File changeFile(MultipartFile multipartFile) {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
String fileName = multipartFile.getName();//multipartFile.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
File file = null;
try {
file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
// 转换文件方法
public static File changeFile_new(MultipartFile multipartFile) {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();//getOriginalFilename
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// todo 修改临时文件文件名
File file = null;
try {
file = File.createTempFile(fileName, prefix);
multipartFile.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
return file;
}
//判断文件是否是图片格式
public static Boolean VerifyImage(MultipartFile multipartFile){
byte[] b = new byte[3];
FileInputStream fis = null;
String suf = null;
try {
fis = new FileInputStream(SetFiles.changeFile(multipartFile).getPath());
fis.read(b, 0, b.length);
suf = ImgUrlUtil.bytesToHexString(b);
suf = suf.toUpperCase();
if(fis!=null){fis.close();}
} catch (Exception e) {
e.printStackTrace();
}
if(TypeDict.checkType(suf).equals("0000")) {
return false;
}else{
return true;
}
}
}
@@ -0,0 +1,49 @@
package cn.hellohao.utils;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class TestUrl {
public static void main(String[] args) {
//testUrl("http://1.3.3.3/test");
//最好使用下面这个,上面那个超时时间不定,所以可能会导致卡住的情况
testUrlWithTimeOut("http://tc.hellohao.cn2/getNoticeText", 2000);
}
public static void testUrl(String urlString){
long lo = System.currentTimeMillis();
URL url;
try {
url = new URL(urlString);
InputStream in = url.openStream();
System.out.println("连接可用");
} catch (Exception e1) {
System.out.println("连接打不开!");
url = null;
}
System.out.println(System.currentTimeMillis()-lo);
}
public static boolean testUrlWithTimeOut(String urlString,int timeOutMillSeconds){
long lo = System.currentTimeMillis();
URL url;
try {
url = new URL(urlString);
URLConnection co = url.openConnection();
co.setConnectTimeout(timeOutMillSeconds);
co.connect();
return true;
//System.out.println("连接可用");
} catch (Exception e1) {
//System.out.println("连接打不开!");
url = null;
return false;
}
//System.out.println(System.currentTimeMillis()-lo);
}
}
-146
View File
@@ -1,146 +0,0 @@
package cn.hellohao.utils;
import jdk.nashorn.internal.objects.annotations.Where;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
/**
* @author Hellohao
* @version 1.0
* @date 2019/10/11 17:26
*/
public class demo {
/**
* 向指定 URL 发送POST方法的请求
*
* @param url
* 发送请求的 URL
* @param string
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String string,Integer i) {
String intFlag = String.valueOf((int)(Math.random() * 1000000));
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(string);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
System.out.println("发送 POST 请求出现异常!"+e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally{
try{
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
System.out.println("已成功执行"+i+"次");
return result;
}
//文件上传
public static String uploadFileToOSS(MultipartFile multfile,String isurl) {
CloseableHttpClient client = null;
String result = null;
try {
client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(isurl);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
//addTextBody(String,String)该方法可以传入参数,例如请求的地址需要接受一个id
//builder.addTextBody("id", "1");
// builder.addTextBody("arg", "value");
//addBinaryBody()该方法传入二进制内容,可以传入InputStream,File, 参数三是传入的类型,参数四是文件名称
builder.addBinaryBody("file", multfile.getInputStream(), ContentType.MULTIPART_FORM_DATA, "1.png");
httpPost.setEntity(builder.build());
HttpResponse response = client.execute(httpPost);
if (response.getStatusLine().getStatusCode() == 200) {
// 取回服务器端的响应结果
result = EntityUtils.toString(response.getEntity(), "utf-8");
}
} catch (Exception e) {
e.printStackTrace();
}finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return result;
}
public static void main(String[] args)throws Exception {
File file = new File("D:/22.png");
// for(int i=1;i<99999999;i++){
// String intFlag = String.valueOf((int)(Math.random() * 1000000));
// //sendPost("http://shenhhh.net/index.php?m=User&a=signup","phone=13232"+intFlag+"&password=asd"+intFlag+"",i);
// //String ret = sendPost("https://test.demo-1s.com/register","name=jbb"+intFlag+"&email=jbb"+intFlag+"@jbb.com&password=jbb"+intFlag,i);
//
// String ret = sendPost("https://www.png8.com/upload/localhost","file="+file,i);
// System.out.println("账号:goto"+intFlag+"-- 密码:baa"+intFlag+"-- 邮箱:jbb"+intFlag+"@jbb.com -- 返回值:"+ret);
// }
//文件上传
//while (true){
FileInputStream fileInputStream = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(),
ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
String a =uploadFileToOSS(multipartFile ,"https://tu.sunpma.com/upload/localhost");
System.out.println("");
Print.Normal("【"+a+"】");
System.out.println("");
}
// }
}
+2 -5
View File
@@ -12,12 +12,13 @@ Expression=0 30 04 * * ?
#下边的配置项不需要修改。
spring.thymeleaf.suffix=.html
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*.xml
logging.level.cn.hellohao.dao=debug
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.thymeleaf.cache=false
multipart.maxFileSize=10240KB
@@ -25,7 +26,3 @@ multipart.maxRequestSize=10240KB
spring.thymeleaf.mode = LEGACYHTML5
spring.http.multipart.location=/data/upload_tmp
systemupdate=2019-11-29
+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.hellohao.dao.AlbumMapper">
<select id="selectAlbum" parameterType="cn.hellohao.pojo.Album" resultType="cn.hellohao.pojo.Album">
SELECT
*
FROM
`album`
<where>
<if test="albumkey != null">
`albumkey` = #{albumkey}
</if>
<if test="userid != null">
`userid` = #{userid}
</if>
</where>
</select>
<insert id="addAlbum" parameterType="cn.hellohao.pojo.Album">
insert into `album` (albumkey,albumtitle,createdate,`password`,userid)
values (#{albumkey},#{albumtitle},#{createdate},#{password},#{userid})
</insert>
<delete id="deleteAlbum" parameterType="string">
delete from album where albumkey=#{albumkey}
</delete>
<select id="selectAlbumURLList" parameterType="cn.hellohao.pojo.Album" resultType="cn.hellohao.pojo.Album">
SELECT
a.albumkey,
a.albumtitle,
a.createdate,
a.`password`,
a.userid,
u.username
FROM `album` a LEFT JOIN user u on a.userid = u.id
<where>
<if test="albumkey != null">
`albumkey` like '%${albumkey}%'
</if>
<if test="username != null">
`username` like '%${username}%'
</if>
</where>
order by a.createdate
</select>
</mapper>
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.hellohao.dao.ImgAndAlbumMapper">
<select id="selectImgAndAlbum" parameterType="string" resultType="cn.hellohao.pojo.ImgAndAlbum">
SELECT
*
FROM
`imgandalbum`
<where>
<if test="albumkey != null">
`albumkey` = #{albumkey}
</if>
</where>
</select>
<select id="getAlbumForImgname" resultType="cn.hellohao.pojo.ImgAndAlbum" parameterType="string">
SELECT
*
FROM
`imgandalbum`
<where>
<if test="imgname != null">
`imgname` = #{imgname}
</if>
</where>
</select>
<insert id="addImgAndAlbum" parameterType="cn.hellohao.pojo.ImgAndAlbum">
insert into `imgandalbum` (imgname,albumkey) values (#{imgname},#{albumkey})
</insert>
<delete id="deleteImgAndAlbum" parameterType="string">
delete from imgandalbum where imgname=#{imgname}
</delete>
<delete id="deleteImgAndAlbumForKey" parameterType="string">
delete from imgandalbum where albumkey=#{albumkey}
</delete>
<select id="selectImgForAlbumkey" parameterType="string" resultType="cn.hellohao.pojo.Images">
select * from imgdata a
LEFT JOIN imgandalbum b on a.imgname = b.imgname
LEFT JOIN album c on b.albumkey = c.albumkey
where b.albumkey = #{albumkey}
</select>
</mapper>
+31 -4
View File
@@ -13,7 +13,9 @@
a.sizes,
a.abnormal,
a.source,
a.imgtype
a.imgtype,
a.explains,
a.md5key
FROM
imgdata a
LEFT JOIN user b ON a.userid = b.id
@@ -60,8 +62,17 @@
</select>
<!-- 根据图片名字标记IP -->
<update id="setabnormal" parameterType="string">
UPDATE imgdata set abnormal=#{abnormal} where imgname=#{imgname}
<update id="setImg" parameterType="cn.hellohao.pojo.Images">
UPDATE imgdata
<set>
<if test="abnormal!=null">
abnormal=#{abnormal}
</if>
<if test="explains!=null">
explains=#{explains}
</if>
</set>
where imgname=#{imgname}
</update>
<!-- 非法图片删除他 根据名称-->
<delete id="deleimgname" parameterType="string">
@@ -78,7 +89,23 @@
</select>
<!--查询指定用户总内存-->
<select id="getusermemory" parameterType="integer" resultType="integer">
SELECT sum(sizes) FROM `imgdata` where userid = #{userid}
SELECT sum(sizes) as sizes FROM `imgdata` where userid = #{userid}
</select>
<select id="md5Count" resultType="integer">
select count(*) from imgdata
<where>
1=1
<if test="md5key != null">
and md5key=#{md5key}
</if>
</where>
</select>
<select id="selectImgUrlByMD5" parameterType="string" resultType="cn.hellohao.pojo.Images">
select imgname,imgurl from imgdata where md5key = #{md5key}
</select>
</mapper>
+1 -1
View File
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.hellohao.dao.NoticeMapper">
<select id="getNotice" resultType="string">
select text from Notice where id = 1
select text from notice where id = 1
</select>
</mapper>
+18 -4
View File
@@ -18,6 +18,7 @@
select COUNT(*)
from user
where email = #{email}
</select>
<!-- uid查询用户并修改 -->
<update id="uiduser" parameterType="cn.hellohao.pojo.User">
@@ -29,8 +30,21 @@
<select id="login" parameterType="string" resultType="integer">
select COUNT(*)
from user
where email = #{email}
and password = #{password}
<!-- where email = #{email}-->
<!-- and password = #{password}-->
<where>
1=1
<if test="email != null">
and email = #{email}
</if>
<if test="password != null">
and password = #{password}
</if>
<if test="uid != null">
and uid = #{uid}
</if>
</where>
</select>
<!-- 查询当前用户:根据邮箱 -->
@@ -81,8 +95,8 @@
<!-- 插入图片信息 -->
<insert id="insertimg" parameterType="cn.hellohao.pojo.Images">
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype)
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype})
INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key)
VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key})
</insert>
<!-- 修改资料 -->
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -1,6 +1,7 @@
body{
background-color:gray;
background-color:#FFF;
/*background: #5583EE;background: -moz-linear-gradient(right, #5583EE 0%, #41D8DD 100%);background: -webkit-linear-gradient(right, #5583EE 0%, #41D8DD 100%);background: linear-gradient(to right, #5583EE 0%, #41D8DD 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#5583EE', endColorstr='#41D8DD',GradientType=1 );*/
}
h1{
color:rgb(225,223,220);
+6 -3
View File
@@ -1,7 +1,7 @@
/*-- ========================================= --
0.0 CSS IMPORT
/*-- ========================================= --*/
@import url("bootstrap.min.css");
@import url("/static/css/bootstrap.min.css");
@import url("font-awesome.min.css");
@import url("animate.min.css");
@import url("owl.carousel.css");
@@ -371,6 +371,8 @@ a.link-1.active::before
color:#262626;
background:#4ebd87;
width: 200px;
border-radius: 25px;
margin-top: 5px;
}
.button-green::before{
background:#4ebd87;
@@ -1736,7 +1738,7 @@ section .half-overlay.is-visible{
top:100%;
}
.about-section .bg-container-static{
background:url(../img/background/sample2.jpg) no-repeat;
/*background:url(../img/background/sample2.jpg) no-repeat;*/
background-size:cover;
background-position:50% 50%;
}
@@ -1860,7 +1862,7 @@ section .half-overlay.is-visible{
}
.works-section .bg-container-static{
background:url(../img/background/sample3.jpg) no-repeat;
/*background:url(../img/background/sample3.jpg) no-repeat;*/
background-size:cover;
background-position:50% 50%;
}
@@ -2163,6 +2165,7 @@ canvas#bg-canvas{
left:0px;
top:0px;
z-index:1;
background: rgba(38,38,38,0.7);
}
-1
View File
@@ -1 +0,0 @@
临时图片路径
@@ -0,0 +1,211 @@
body{ background-color:#fcfcfc;}
.grid {
position: relative;
margin: 0 auto;
}
.js .grid::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
background-size: 60px auto;
-webkit-transition: opacity 0.3s;
transition: opacity 0.3s;
}
.js .grid--loaded::after {
opacity: 0;
}
.grid__item {
width: 270px;
padding: 10px;
}
.grid__item--current {
opacity: 0 !important;
}
.img-wrap {
display: block;
}
.img-wrap:focus,
.img-wrap:hover {
outline: none;
}
.img-wrap img {
display: block;
max-width: 100%;
}
.preview {
position: fixed;
z-index: 1000;
top: 0;
left: 0;
display: -webkit-flex;
display: -ms-flex;
display: flex;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-ms-flex-line-pack: center;
-webkit-align-content: center;
align-content: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
width: 100%;
height: 100%;
pointer-events: none;
}
.preview--open {
pointer-events: auto;
}
/* circle overlay (generated SVG) */
.overlay {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}
.overlay circle {
-webkit-transition: fill-opacity 0.3s, -webkit-transform 0s 0.3s;
transition: fill-opacity 0.3s, transform 0s 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
-webkit-transform: scale3d(0, 0, 1);
transform: scale3d(0, 0, 1);
fill: #1f1d1d;
fill-opacity: 0;
}
.preview--open .overlay circle {
-webkit-transition: -webkit-transform 0.4s;
transition: transform 0.4s;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
fill-opacity: 1;
}
.clone {
position: fixed;
z-index: 110;
-webkit-transition: -webkit-transform 0.6s cubic-bezier(0.5, 1, 0.2, 1);
transition: transform 0.6s cubic-bezier(0.5, 1, 0.2, 1);
-webkit-backface-visibility: hidden;
}
.original {
position: relative;
z-index: 120;
display: block;
object-fit: contain;
-webkit-transition: opacity 0.2s;
transition: opacity 0.2s;
-webkit-backface-visibility: hidden;
}
.preview--open .animate {
/* open */
-webkit-transition: -webkit-transform 0.6s, opacity 0.2s;
transition: transform 0.6s, opacity 0.2s;
}
.animate {
/* close */
-webkit-transition: -webkit-transform 0.3s, opacity 0.2s;
transition: transform 0.3s, opacity 0.2s;
}
.description {
color: #fff;
}
.js .description--grid {
display: none;
}
.description--preview {
position: fixed;
z-index: 140;
bottom: 0;
left: 0;
width: 100%;
padding: 2em 1em;
text-align: center;
opacity: 0;
background: linear-gradient(180deg, transparent, #1f1d1d);
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
.preview--open .description--preview {
opacity: 1;
-webkit-transition-delay: 0.2s;
transition-delay: 0.2s;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
/* Close button */
.action {
font-size: 1.5em;
margin: 0;
padding: 0;
cursor: pointer;
vertical-align: top;
color: #6bd68a;
border: none;
background: none;
}
.action:hover,
.action:focus {
color: #6bd68a;
outline: none;
}
.action--close {
position: fixed;
z-index: 150;
top: 0;
right: 0;
padding: 1em;
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: scale3d(0.6, 0.6, 1);
transform: scale3d(0.6, 0.6, 1);
}
.preview--image-loaded .action--close {
opacity: 1;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
.text-hidden {
position: absolute;
display: block;
overflow: hidden;
width: 0;
height: 0;
color: transparent;
}
@@ -0,0 +1,164 @@
#verification{
margin-top: 100px;
}
.container{
color: #555;
}
.ghost {
position: relative;
animation: ghostUpdown 1s infinite alternate;
-webkit-animation: ghostUpdown 1s infinite alternate;
}
.sign-content.popup-in-content{
background: #fff;
border-radius: 5px;
padding: 60px 0 100px;
}
.popup-in-txt {
max-width: 500px;
margin: 0 auto;
}
.btn.signin_btn, .btn.signin_btn:focus {
width: 90%;
padding: 0;
height: 50px;
background: #5a84fd;
color: #fff;
font-size: 14px;
text-transform: uppercase;
border-radius: 3px;
box-shadow: 0 5px 30px rgba(0,66,255,.3);
margin-top: 23px;
margin: 15px;
}
.container ul{
padding: 0;
margin: 0 auto;
list-style: none;
}
.container ul li {
list-style: none;
}
/*=============Style css=========*/
.tlinks{text-indent:-9999px;height:0;line-height:0;font-size:0;overflow:hidden;}
/*-------------------------------------
2. Kit-name-head
--------------------------------------*/
.kit-name-head{
display: none;
height: 120px;
}
.kit-name-txt{
/*padding: 75px 0 71px;*/
padding: 33px 0 71px;
text-align: center;
}
.kit-name-head h2 {
font-size: 33px;
font-weight: 600;
color: #fff;
margin-bottom: 8px;/*18*/
}
.kit-name-head h2::first-letter {
text-transform: lowercase;
}
.kit-name-head h3{
font-size: 16px;
font-weight: 500;
color: #fff;
}
/*-------------------------------------
3. Form-demo
--------------------------------------*/
.single-form-demo-set {
text-align: center;
padding: 60px 0;
}
.single-form-img-content { margin-top: 60px;}
/*.form-img*/
.form-img {
position: relative;
box-shadow:0px 5px 30px 5px rgba(154,154,154,.3);
-webkit-transition: .5s;
-moz-transition:.5s;
-ms-transition:.5s;
-o-transition:.5s;
transition: .5s;
}
.form-img-hover{
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background:transparent;
-webkit-transform: scale(0);
-moz-transform:scale(0);
-ms-transform:scale(0);
-o-transform:scale(0);
transform: scale(0);
}
.form-img:hover .form-img-hover{
-webkit-transform: scale(1);
-moz-transform:scale(1);
-ms-transform:scale(1);
-o-transform:scale(1);
transform: scale(1);
-webkit-transition: .5s;
-moz-transition:.5s;
-ms-transition:.5s;
-o-transition:.5s;
transition: .5s;
}
.form-img:hover {
box-shadow:0px 5px 30px 5px rgba(154,154,154,.7);
}
/*.form-img*/
/*===============================
Scroll Top
===============================*/
#scroll-Top .return-to-top {
position: fixed;
right: 30px;
bottom: 30px;
display: none;
width: 40px;
line-height: 40px;
height: 40px;
text-align: center;
font-size: 30px;
cursor: pointer;
color: #fff;
background:#5a84fd;
border:1px solid #5a84fd;
border-radius:5px;
-webkit-transition: .5s;
-moz-transition:.5s;
-ms-transition:.5s;
-o-transition:.5s;
transition: .5s;
z-index: 2;
}
#scroll-Top .return-to-top:hover {
background:transparent;
color: #26d9b3;
border:1px solid #26d9b3;
border-radius:50%;
}
/*========================Thank you=================
@@ -0,0 +1,85 @@
/*!
* classie v1.0.1
* class helper functions
* from bonzo https://github.com/ded/bonzo
* MIT license
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true, unused: true */
/*global define: false, module: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = classie;
} else {
// browser global
window.classie = classie;
}
})( window );
+1
View File
@@ -0,0 +1 @@
(function(k,m){var g="3.7.0";var d=k.html5||{};var h=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;var c=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;var q;var i="_html5shiv";var a=0;var o={};var e;(function(){try{var t=m.createElement("a");t.innerHTML="<xyz></xyz>";q=("hidden" in t);e=t.childNodes.length==1||(function(){(m.createElement)("a");var v=m.createDocumentFragment();return(typeof v.cloneNode=="undefined"||typeof v.createDocumentFragment=="undefined"||typeof v.createElement=="undefined")}())}catch(u){q=true;e=true}}());function f(t,v){var w=t.createElement("p"),u=t.getElementsByTagName("head")[0]||t.documentElement;w.innerHTML="x<style>"+v+"</style>";return u.insertBefore(w.lastChild,u.firstChild)}function l(){var t=j.elements;return typeof t=="string"?t.split(" "):t}function p(t){var u=o[t[i]];if(!u){u={};a++;t[i]=a;o[a]=u}return u}function n(w,t,v){if(!t){t=m}if(e){return t.createElement(w)}if(!v){v=p(t)}var u;if(v.cache[w]){u=v.cache[w].cloneNode()}else{if(c.test(w)){u=(v.cache[w]=v.createElem(w)).cloneNode()}else{u=v.createElem(w)}}return u.canHaveChildren&&!h.test(w)?v.frag.appendChild(u):u}function r(v,x){if(!v){v=m}if(e){return v.createDocumentFragment()}x=x||p(v);var y=x.frag.cloneNode(),w=0,u=l(),t=u.length;for(;w<t;w++){y.createElement(u[w])}return y}function s(t,u){if(!u.cache){u.cache={};u.createElem=t.createElement;u.createFrag=t.createDocumentFragment;u.frag=u.createFrag()}t.createElement=function(v){if(!j.shivMethods){return u.createElem(v)}return n(v,t,u)};t.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/[\w\-]+/g,function(v){u.createElem(v);u.frag.createElement(v);return'c("'+v+'")'})+");return n}")(j,u.frag)}function b(t){if(!t){t=m}var u=p(t);if(j.shivCSS&&!q&&!u.hasCSS){u.hasCSS=!!f(t,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")}if(!e){s(t,u)}return t}var j={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:g,shivCSS:(d.shivCSS!==false),supportsUnknownElements:e,shivMethods:(d.shivMethods!==false),type:"default",shivDocument:b,createElement:n,createDocumentFragment:r};k.html5=j;b(m)}(this,document));
File diff suppressed because one or more lines are too long
@@ -0,0 +1,364 @@
/**
* cbpGridGallery.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2014, Codrops
* http://www.codrops.com
*/
;( function( window ) {
'use strict';
var docElem = window.document.documentElement,
transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd',
'transition': 'transitionend'
},
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
support = {
transitions : Modernizr.csstransitions,
support3d : Modernizr.csstransforms3d
};
function setTransform( el, transformStr ) {
el.style.WebkitTransform = transformStr;
el.style.msTransform = transformStr;
el.style.transform = transformStr;
}
// from http://responsejs.com/labs/dimensions/
function getViewportW() {
var client = docElem['clientWidth'],
inner = window['innerWidth'];
if( client < inner )
return inner;
else
return client;
}
function extend( a, b ) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
a[key] = b[key];
}
}
return a;
}
function CBPGridGallery( el, options ) {
this.el = el;
this.options = extend( {}, this.options );
extend( this.options, options );
this._init();
}
CBPGridGallery.prototype.options = {
};
CBPGridGallery.prototype._init = function() {
// main grid
this.grid = this.el.querySelector( 'section.grid-wrap > ul.grid' );
// main grid items
this.gridItems = [].slice.call( this.grid.querySelectorAll( 'li:not(.grid-sizer)' ) );
// items total
this.itemsCount = this.gridItems.length;
// slideshow grid
this.slideshow = this.el.querySelector( 'section.slideshow > ul' );
// slideshow grid items
this.slideshowItems = [].slice.call( this.slideshow.children );
// index of current slideshow item
this.current = -1;
// slideshow control buttons
this.ctrlPrev = this.el.querySelector( 'section.slideshow > nav > span.nav-prev' );
this.ctrlNext = this.el.querySelector( 'section.slideshow > nav > span.nav-next' );
this.ctrlClose = this.el.querySelector( 'section.slideshow > nav > span.nav-close' );
// init masonry grid
this._initMasonry();
// init events
this._initEvents();
};
CBPGridGallery.prototype._initMasonry = function() {
var grid = this.grid;
imagesLoaded( grid, function() {
new Masonry( grid, {
itemSelector: 'li',
columnWidth: grid.querySelector( '.grid-sizer' )
});
});
};
CBPGridGallery.prototype._initEvents = function() {
var self = this;
// open the slideshow when clicking on the main grid items
this.gridItems.forEach( function( item, idx ) {
item.addEventListener( 'click', function() {
self._openSlideshow( idx );
} );
} );
// slideshow controls
this.ctrlPrev.addEventListener( 'click', function() { self._navigate( 'prev' ); } );
this.ctrlNext.addEventListener( 'click', function() { self._navigate( 'next' ); } );
this.ctrlClose.addEventListener( 'click', function() { self._closeSlideshow(); } );
// window resize
window.addEventListener( 'resize', function() { self._resizeHandler(); } );
// keyboard navigation events
document.addEventListener( 'keydown', function( ev ) {
if ( self.isSlideshowVisible ) {
var keyCode = ev.keyCode || ev.which;
switch (keyCode) {
case 37:
self._navigate( 'prev' );
break;
case 39:
self._navigate( 'next' );
break;
case 27:
self._closeSlideshow();
break;
}
}
} );
// trick to prevent scrolling when slideshow is visible
window.addEventListener( 'scroll', function() {
if ( self.isSlideshowVisible ) {
window.scrollTo( self.scrollPosition ? self.scrollPosition.x : 0, self.scrollPosition ? self.scrollPosition.y : 0 );
}
else {
self.scrollPosition = { x : window.pageXOffset || docElem.scrollLeft, y : window.pageYOffset || docElem.scrollTop };
}
});
};
CBPGridGallery.prototype._openSlideshow = function( pos ) {
this.isSlideshowVisible = true;
this.current = pos;
classie.addClass( this.el, 'slideshow-open' );
/* position slideshow items */
// set viewport items (current, next and previous)
this._setViewportItems();
// add class "current" and "show" to currentItem
classie.addClass( this.currentItem, 'current' );
classie.addClass( this.currentItem, 'show' );
// add class show to next and previous items
// position previous item on the left side and the next item on the right side
if( this.prevItem ) {
classie.addClass( this.prevItem, 'show' );
var translateVal = Number( -1 * ( getViewportW() / 2 + this.prevItem.offsetWidth / 2 ) );
setTransform( this.prevItem, support.support3d ? 'translate3d(' + translateVal + 'px, 0, -150px)' : 'translate(' + translateVal + 'px)' );
}
if( this.nextItem ) {
classie.addClass( this.nextItem, 'show' );
var translateVal = Number( getViewportW() / 2 + this.nextItem.offsetWidth / 2 );
setTransform( this.nextItem, support.support3d ? 'translate3d(' + translateVal + 'px, 0, -150px)' : 'translate(' + translateVal + 'px)' );
}
};
CBPGridGallery.prototype._navigate = function( dir ) {
if( this.isAnimating ) return;
if( dir === 'next' && this.current === this.itemsCount - 1 || dir === 'prev' && this.current === 0 ) {
this._closeSlideshow();
return;
}
this.isAnimating = true;
// reset viewport items
this._setViewportItems();
var self = this,
itemWidth = this.currentItem.offsetWidth,
// positions for the centered/current item, both the side items and the incoming ones
transformLeftStr = support.support3d ? 'translate3d(-' + Number( getViewportW() / 2 + itemWidth / 2 ) + 'px, 0, -150px)' : 'translate(-' + Number( getViewportW() / 2 + itemWidth / 2 ) + 'px)',
transformRightStr = support.support3d ? 'translate3d(' + Number( getViewportW() / 2 + itemWidth / 2 ) + 'px, 0, -150px)' : 'translate(' + Number( getViewportW() / 2 + itemWidth / 2 ) + 'px)',
transformCenterStr = '', transformOutStr, transformIncomingStr,
// incoming item
incomingItem;
if( dir === 'next' ) {
transformOutStr = support.support3d ? 'translate3d( -' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px, 0, -150px )' : 'translate(-' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px)';
transformIncomingStr = support.support3d ? 'translate3d( ' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px, 0, -150px )' : 'translate(' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px)';
}
else {
transformOutStr = support.support3d ? 'translate3d( ' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px, 0, -150px )' : 'translate(' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px)';
transformIncomingStr = support.support3d ? 'translate3d( -' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px, 0, -150px )' : 'translate(-' + Number( (getViewportW() * 2) / 2 + itemWidth / 2 ) + 'px)';
}
// remove class animatable from the slideshow grid (if it has already)
classie.removeClass( self.slideshow, 'animatable' );
if( dir === 'next' && this.current < this.itemsCount - 2 || dir === 'prev' && this.current > 1 ) {
// we have an incoming item!
incomingItem = this.slideshowItems[ dir === 'next' ? this.current + 2 : this.current - 2 ];
setTransform( incomingItem, transformIncomingStr );
classie.addClass( incomingItem, 'show' );
}
var slide = function() {
// add class animatable to the slideshow grid
classie.addClass( self.slideshow, 'animatable' );
// overlays:
classie.removeClass( self.currentItem, 'current' );
var nextCurrent = dir === 'next' ? self.nextItem : self.prevItem;
classie.addClass( nextCurrent, 'current' );
setTransform( self.currentItem, dir === 'next' ? transformLeftStr : transformRightStr );
if( self.nextItem ) {
setTransform( self.nextItem, dir === 'next' ? transformCenterStr : transformOutStr );
}
if( self.prevItem ) {
setTransform( self.prevItem, dir === 'next' ? transformOutStr : transformCenterStr );
}
if( incomingItem ) {
setTransform( incomingItem, dir === 'next' ? transformRightStr : transformLeftStr );
}
var onEndTransitionFn = function( ev ) {
if( support.transitions ) {
if( ev.propertyName.indexOf( 'transform' ) === -1 ) return false;
this.removeEventListener( transEndEventName, onEndTransitionFn );
}
if( self.prevItem && dir === 'next' ) {
classie.removeClass( self.prevItem, 'show' );
}
else if( self.nextItem && dir === 'prev' ) {
classie.removeClass( self.nextItem, 'show' );
}
if( dir === 'next' ) {
self.prevItem = self.currentItem;
self.currentItem = self.nextItem;
if( incomingItem ) {
self.nextItem = incomingItem;
}
}
else {
self.nextItem = self.currentItem;
self.currentItem = self.prevItem;
if( incomingItem ) {
self.prevItem = incomingItem;
}
}
self.current = dir === 'next' ? self.current + 1 : self.current - 1;
self.isAnimating = false;
};
if( support.transitions ) {
self.currentItem.addEventListener( transEndEventName, onEndTransitionFn );
}
else {
onEndTransitionFn();
}
};
setTimeout( slide, 25 );
}
CBPGridGallery.prototype._closeSlideshow = function( pos ) {
// remove class slideshow-open from the grid gallery elem
classie.removeClass( this.el, 'slideshow-open' );
// remove class animatable from the slideshow grid
classie.removeClass( this.slideshow, 'animatable' );
var self = this,
onEndTransitionFn = function( ev ) {
if( support.transitions ) {
if( ev.target.tagName.toLowerCase() !== 'ul' ) return;
this.removeEventListener( transEndEventName, onEndTransitionFn );
}
// remove classes show and current from the slideshow items
classie.removeClass( self.currentItem, 'current' );
classie.removeClass( self.currentItem, 'show' );
if( self.prevItem ) {
classie.removeClass( self.prevItem, 'show' );
}
if( self.nextItem ) {
classie.removeClass( self.nextItem, 'show' );
}
// also reset any transforms for all the items
self.slideshowItems.forEach( function( item ) { setTransform( item, '' ); } );
self.isSlideshowVisible = false;
};
if( support.transitions ) {
this.el.addEventListener( transEndEventName, onEndTransitionFn );
}
else {
onEndTransitionFn();
}
};
CBPGridGallery.prototype._setViewportItems = function() {
this.currentItem = null;
this.prevItem = null;
this.nextItem = null;
if( this.current > 0 ) {
this.prevItem = this.slideshowItems[ this.current - 1 ];
}
if( this.current < this.itemsCount - 1 ) {
this.nextItem = this.slideshowItems[ this.current + 1 ];
}
this.currentItem = this.slideshowItems[ this.current ];
}
// taken from https://github.com/desandro/vanilla-masonry/blob/master/masonry.js by David DeSandro
// original debounce by John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
CBPGridGallery.prototype._resizeHandler = function() {
var self = this;
function delayed() {
self._resize();
self._resizeTimeout = null;
}
if ( this._resizeTimeout ) {
clearTimeout( this._resizeTimeout );
}
this._resizeTimeout = setTimeout( delayed, 50 );
}
CBPGridGallery.prototype._resize = function() {
if ( this.isSlideshowVisible ) {
// update width value
if( this.prevItem ) {
var translateVal = Number( -1 * ( getViewportW() / 2 + this.prevItem.offsetWidth / 2 ) );
setTransform( this.prevItem, support.support3d ? 'translate3d(' + translateVal + 'px, 0, -150px)' : 'translate(' + translateVal + 'px)' );
}
if( this.nextItem ) {
var translateVal = Number( getViewportW() / 2 + this.nextItem.offsetWidth / 2 );
setTransform( this.nextItem, support.support3d ? 'translate3d(' + translateVal + 'px, 0, -150px)' : 'translate(' + translateVal + 'px)' );
}
}
}
// add to global namespace
window.CBPGridGallery = CBPGridGallery;
})( window );
@@ -0,0 +1,80 @@
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true */
/*global define: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else {
// browser global
window.classie = classie;
}
})( window );
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,347 @@
;(function(window) {
'use strict';
var support = { transitions: Modernizr.csstransitions },
// transition end event name
transEndEventNames = { 'WebkitTransition': 'webkitTransitionEnd', 'MozTransition': 'transitionend', 'OTransition': 'oTransitionEnd', 'msTransition': 'MSTransitionEnd', 'transition': 'transitionend' },
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
onEndTransition = function( el, callback ) {
var onEndCallbackFn = function( ev ) {
if( support.transitions ) {
if( ev.target != this ) return;
this.removeEventListener( transEndEventName, onEndCallbackFn );
}
if( callback && typeof callback === 'function' ) { callback.call(this); }
};
if( support.transitions ) {
el.addEventListener( transEndEventName, onEndCallbackFn );
}
else {
onEndCallbackFn();
}
};
/**
* some helper functions
*/
function throttle(fn, delay) {
var allowSample = true;
return function(e) {
if (allowSample) {
allowSample = false;
setTimeout(function() { allowSample = true; }, delay);
fn(e);
}
};
}
function nextSibling(el) {
var nextSibling = el.nextSibling;
while(nextSibling && nextSibling.nodeType != 1) {
nextSibling = nextSibling.nextSibling
}
return nextSibling;
}
function extend( a, b ) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
a[key] = b[key];
}
}
return a;
}
/**
* GridFx obj
*/
function GridFx(el, options) {
this.gridEl = el;
this.options = extend( {}, this.options );
extend( this.options, options );
this.items = [].slice.call(this.gridEl.querySelectorAll('.grid__item'));
this.previewEl = nextSibling(this.gridEl);
this.isExpanded = false;
this.isAnimating = false;
this.closeCtrl = this.previewEl.querySelector('button.action--close');
this.previewDescriptionEl = this.previewEl.querySelector('.description--preview');
this._init();
}
/**
* options
*/
GridFx.prototype.options = {
pagemargin : 0,
// x and y can have values from 0 to 1 (percentage). If negative then it means the alignment is left and/or top rather than right and/or bottom
// so, as an example, if we want our large image to be positioned vertically on 25% of the screen and centered horizontally the values would be x:1,y:-0.25
imgPosition : { x : 1, y : 1 },
onInit : function(instance) { return false; },
onResize : function(instance) { return false; },
onOpenItem : function(instance, item) { return false; },
onCloseItem : function(instance, item) { return false; },
onExpand : function() { return false; }
}
GridFx.prototype._init = function() {
// callback
this.options.onInit(this);
var self = this;
// init masonry after all images are loaded
imagesLoaded( this.gridEl, function() {
// initialize masonry
new Masonry(self.gridEl, {
itemSelector: '.grid__item',
isFitWidth : true
});
// show grid after all images (thumbs) are loaded
classie.add(self.gridEl, 'grid--loaded');
// init/bind events
self._initEvents();
// create the large image and append it to the DOM
self._setOriginal();
// create the clone image and append it to the DOM
self._setClone();
});
};
/**
* initialize/bind events
*/
GridFx.prototype._initEvents = function () {
var self = this,
clickEvent = (document.ontouchstart!==null ? 'click' : 'touchstart');
this.items.forEach(function(item) {
var touchend = function(ev) {
ev.preventDefault();
self._openItem(ev, item);
item.removeEventListener('touchend', touchend);
},
touchmove = function(ev) {
item.removeEventListener('touchend', touchend);
},
manageTouch = function() {
item.addEventListener('touchend', touchend);
item.addEventListener('touchmove', touchmove);
};
item.addEventListener(clickEvent, function(ev) {
if(clickEvent === 'click') {
ev.preventDefault();
self._openItem(ev, item);
}
else {
manageTouch();
}
});
});
// close expanded image
this.closeCtrl.addEventListener('click', function() {
self._closeItem();
});
window.addEventListener('resize', throttle(function(ev) {
// callback
self.options.onResize(self);
}, 10));
}
/**
* open a grid item
*/
GridFx.prototype._openItem = function(ev, item) {
if( this.isAnimating || this.isExpanded ) return;
this.isAnimating = true;
this.isExpanded = true;
// item's image
var gridImg = item.querySelector('img'),
gridImgOffset = gridImg.getBoundingClientRect();
// index of current item
this.current = this.items.indexOf(item);
// set the src of the original image element (large image)
this._setOriginal(item.querySelector('a').getAttribute('href'));
// callback
this.options.onOpenItem(this, item);
// set the clone image
this._setClone(gridImg.src, {
width : gridImg.offsetWidth,
height : gridImg.offsetHeight,
left : gridImgOffset.left,
top : gridImgOffset.top
});
// hide original grid item
classie.add(item, 'grid__item--current');
// calculate the transform value for the clone to animate to the full image view
var win = this._getWinSize(),
originalSizeArr = item.getAttribute('data-size').split('x'),
originalSize = {width: originalSizeArr[0], height: originalSizeArr[1]},
dx = ((this.options.imgPosition.x > 0 ? 1-Math.abs(this.options.imgPosition.x) : Math.abs(this.options.imgPosition.x)) * win.width + this.options.imgPosition.x * win.width/2) - gridImgOffset.left - 0.5 * gridImg.offsetWidth,
dy = ((this.options.imgPosition.y > 0 ? 1-Math.abs(this.options.imgPosition.y) : Math.abs(this.options.imgPosition.y)) * win.height + this.options.imgPosition.y * win.height/2) - gridImgOffset.top - 0.5 * gridImg.offsetHeight,
z = Math.min( Math.min(win.width*Math.abs(this.options.imgPosition.x) - this.options.pagemargin, originalSize.width - this.options.pagemargin)/gridImg.offsetWidth, Math.min(win.height*Math.abs(this.options.imgPosition.y) - this.options.pagemargin, originalSize.height - this.options.pagemargin)/gridImg.offsetHeight );
// apply transform to the clone
this.cloneImg.style.WebkitTransform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0) scale3d(' + z + ', ' + z + ', 1)';
this.cloneImg.style.transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0) scale3d(' + z + ', ' + z + ', 1)';
// add the description if any
var descriptionEl = item.querySelector('.description');
if( descriptionEl ) {
this.previewDescriptionEl.innerHTML = descriptionEl.innerHTML;
}
var self = this;
setTimeout(function() {
// controls the elements inside the expanded view
classie.add(self.previewEl, 'preview--open');
// callback
self.options.onExpand();
}, 0);
// after the clone animates..
onEndTransition(this.cloneImg, function() {
// when the original/large image is loaded..
imagesLoaded(self.originalImg, function() {
// close button just gets shown after the large image gets loaded
classie.add(self.previewEl, 'preview--image-loaded');
// animate the opacity to 1
self.originalImg.style.opacity = 1;
// and once that's done..
onEndTransition(self.originalImg, function() {
// reset cloneImg
self.cloneImg.style.opacity = 0;
self.cloneImg.style.WebkitTransform = 'translate3d(0,0,0) scale3d(1,1,1)';
self.cloneImg.style.transform = 'translate3d(0,0,0) scale3d(1,1,1)';
self.isAnimating = false;
});
});
});
};
/**
* create/set the original/large image element
*/
GridFx.prototype._setOriginal = function(src) {
if( !src ) {
this.originalImg = document.createElement('img');
this.originalImg.className = 'original';
this.originalImg.style.opacity = 0;
this.originalImg.style.maxWidth = 'calc(' + parseInt(Math.abs(this.options.imgPosition.x)*100) + 'vw - ' + this.options.pagemargin + 'px)';
this.originalImg.style.maxHeight = 'calc(' + parseInt(Math.abs(this.options.imgPosition.y)*100) + 'vh - ' + this.options.pagemargin + 'px)';
// need it because of firefox
this.originalImg.style.WebkitTransform = 'translate3d(0,0,0) scale3d(1,1,1)';
this.originalImg.style.transform = 'translate3d(0,0,0) scale3d(1,1,1)';
src = '';
this.previewEl.appendChild(this.originalImg);
}
this.originalImg.setAttribute('src', src);
};
/**
* create/set the clone image element
*/
GridFx.prototype._setClone = function(src, settings) {
if( !src ) {
this.cloneImg = document.createElement('img');
this.cloneImg.className = 'clone';
src = '';
this.cloneImg.style.opacity = 0;
this.previewEl.appendChild(this.cloneImg);
}
else {
this.cloneImg.style.opacity = 1;
// set top/left/width/height of grid item's image to the clone
this.cloneImg.style.width = settings.width + 'px';
this.cloneImg.style.height = settings.height + 'px';
this.cloneImg.style.top = settings.top + 'px';
this.cloneImg.style.left = settings.left + 'px';
}
this.cloneImg.setAttribute('src', src);
};
/**
* closes the original/large image view
*/
GridFx.prototype._closeItem = function() {
if( !this.isExpanded || this.isAnimating ) return;
this.isExpanded = false;
this.isAnimating = true;
// the grid item's image and its offset
var gridItem = this.items[this.current],
gridImg = gridItem.querySelector('img'),
gridImgOffset = gridImg.getBoundingClientRect(),
self = this;
classie.remove(this.previewEl, 'preview--open');
classie.remove(this.previewEl, 'preview--image-loaded');
// callback
this.options.onCloseItem(this, gridItem);
// large image will animate back to the position of its grid's item
classie.add(this.originalImg, 'animate');
// set the transform to the original/large image
var win = this._getWinSize(),
dx = gridImgOffset.left + gridImg.offsetWidth/2 - ((this.options.imgPosition.x > 0 ? 1-Math.abs(this.options.imgPosition.x) : Math.abs(this.options.imgPosition.x)) * win.width + this.options.imgPosition.x * win.width/2),
dy = gridImgOffset.top + gridImg.offsetHeight/2 - ((this.options.imgPosition.y > 0 ? 1-Math.abs(this.options.imgPosition.y) : Math.abs(this.options.imgPosition.y)) * win.height + this.options.imgPosition.y * win.height/2),
z = gridImg.offsetWidth/this.originalImg.offsetWidth;
this.originalImg.style.WebkitTransform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0) scale3d(' + z + ', ' + z + ', 1)';
this.originalImg.style.transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0) scale3d(' + z + ', ' + z + ', 1)';
// once that's done..
onEndTransition(this.originalImg, function() {
// clear description
self.previewDescriptionEl.innerHTML = '';
// show original grid item
classie.remove(gridItem, 'grid__item--current');
// fade out the original image
setTimeout(function() { self.originalImg.style.opacity = 0; }, 60);
// and after that
onEndTransition(self.originalImg, function() {
// reset original/large image
classie.remove(self.originalImg, 'animate');
self.originalImg.style.WebkitTransform = 'translate3d(0,0,0) scale3d(1,1,1)';
self.originalImg.style.transform = 'translate3d(0,0,0) scale3d(1,1,1)';
self.isAnimating = false;
});
});
};
/**
* gets the window sizes
*/
GridFx.prototype._getWinSize = function() {
return {
width: document.documentElement.clientWidth,
height: window.innerHeight
};
};
window.GridFx = GridFx;
})(window);
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
/*! modernizr 3.1.0 (Custom Build) | MIT *
* http://modernizr.com/download/?-csstransitions-prefixed !*/
!function(e,n,t){function r(e,n){return typeof e===n}function o(){var e,n,t,o,s,i,a;for(var f in C){if(e=[],n=C[f],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(o=r(n.fn,"function")?n.fn():n.fn,s=0;s<e.length;s++)i=e[s],a=i.split("."),1===a.length?Modernizr[a[0]]=o:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=o),g.push((o?"":"no-")+a.join("-"))}}function s(e){var n=x.className,t=Modernizr._config.classPrefix||"";if(w&&(n=n.baseVal),Modernizr._config.enableJSClass){var r=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(r,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),w?x.className.baseVal=n:x.className=n)}function i(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function a(e,n){return!!~(""+e).indexOf(n)}function f(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):w?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function l(e,n){return function(){return e.apply(n,arguments)}}function u(e,n,t){var o;for(var s in e)if(e[s]in n)return t===!1?e[s]:(o=n[e[s]],r(o,"function")?l(o,t||n):o);return!1}function p(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n.toLowerCase()}).replace(/^ms-/,"-ms-")}function d(){var e=n.body;return e||(e=f(w?"svg":"body"),e.fake=!0),e}function c(e,t,r,o){var s,i,a,l,u="modernizr",p=f("div"),c=d();if(parseInt(r,10))for(;r--;)a=f("div"),a.id=o?o[r]:u+(r+1),p.appendChild(a);return s=f("style"),s.type="text/css",s.id="s"+u,(c.fake?c:p).appendChild(s),c.appendChild(p),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(n.createTextNode(e)),p.id=u,c.fake&&(c.style.background="",c.style.overflow="hidden",l=x.style.overflow,x.style.overflow="hidden",x.appendChild(c)),i=t(p,e),c.fake?(c.parentNode.removeChild(c),x.style.overflow=l,x.offsetHeight):p.parentNode.removeChild(p),!!i}function m(n,r){var o=n.length;if("CSS"in e&&"supports"in e.CSS){for(;o--;)if(e.CSS.supports(p(n[o]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var s=[];o--;)s.push("("+p(n[o])+":"+r+")");return s=s.join(" or "),c("@supports ("+s+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return t}function v(e,n,o,s){function l(){p&&(delete P.style,delete P.modElem)}if(s=r(s,"undefined")?!1:s,!r(o,"undefined")){var u=m(e,o);if(!r(u,"undefined"))return u}for(var p,d,c,v,h,y=["modernizr","tspan"];!P.style;)p=!0,P.modElem=f(y.shift()),P.style=P.modElem.style;for(c=e.length,d=0;c>d;d++)if(v=e[d],h=P.style[v],a(v,"-")&&(v=i(v)),P.style[v]!==t){if(s||r(o,"undefined"))return l(),"pfx"==n?v:!0;try{P.style[v]=o}catch(g){}if(P.style[v]!=h)return l(),"pfx"==n?v:!0}return l(),!1}function h(e,n,t,o,s){var i=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+b.join(i+" ")+i).split(" ");return r(n,"string")||r(n,"undefined")?v(a,n,o,s):(a=(e+" "+z.join(i+" ")+i).split(" "),u(a,n,t))}function y(e,n,r){return h(e,t,t,n,r)}var g=[],C=[],_={_version:"3.1.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){C.push({name:e,fn:n,options:t})},addAsyncTest:function(e){C.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=_,Modernizr=new Modernizr;var x=n.documentElement,w="svg"===x.nodeName.toLowerCase(),S="Moz O ms Webkit",b=_._config.usePrefixes?S.split(" "):[];_._cssomPrefixes=b;var E=function(n){var r,o=prefixes.length,s=e.CSSRule;if("undefined"==typeof s)return t;if(!n)return!1;if(n=n.replace(/^@/,""),r=n.replace(/-/g,"_").toUpperCase()+"_RULE",r in s)return"@"+n;for(var i=0;o>i;i++){var a=prefixes[i],f=a.toUpperCase()+"_"+r;if(f in s)return"@-"+a.toLowerCase()+"-"+n}return!1};_.atRule=E;var z=_._config.usePrefixes?S.toLowerCase().split(" "):[];_._domPrefixes=z;var N={elem:f("modernizr")};Modernizr._q.push(function(){delete N.elem});var P={style:N.elem.style};Modernizr._q.unshift(function(){delete P.style}),_.testAllProps=h;_.prefixed=function(e,n,t){return 0===e.indexOf("@")?E(e):(-1!=e.indexOf("-")&&(e=i(e)),n?h(e,n,t):h(e,"pfx"))};_.testAllProps=y,Modernizr.addTest("csstransitions",y("transition","all",!0)),o(),s(g),delete _.addTest,delete _.addAsyncTest;for(var T=0;T<Modernizr._q.length;T++)Modernizr._q[T]();e.Modernizr=Modernizr}(window,document);
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+1
View File
@@ -0,0 +1 @@
!function(t){"use strict";function e(e){return this.each(function(){var i=t(this),n=i.data("plugin.backgroundBlur"),o=t.extend({},r.DEFAULTS,i.data(),"object"==typeof e&&e);n||i.data("plugin.backgroundBlur",n=new r(this,o)),"fadeIn"===e?n.fadeIn():"fadeOut"===e?n.fadeOut():"string"==typeof e&&n.generateBlurredImage(e)})}var i=function(){for(var t,e=3,i=document.createElement("div"),n=i.getElementsByTagName("i");i.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->",n[0];);return e>4?e:t}(),n=function(){return"_"+Math.random().toString(36).substr(2,9)},o={svgns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",createElement:function(t,e){var i=document.createElementNS(o.svgns,t);return e&&o.setAttr(i,e),i},setAttr:function(t,e){for(var i in e)"href"===i?t.setAttributeNS(o.xlink,i,e[i]):t.setAttribute(i,e[i]);return t}},r=function(e,i){this.internalID=n(),this.$element=t(e),this.$width=this.$element.width(),this.$height=this.$element.height(),this.element=e,this.options=t.extend({},r.DEFAULTS,i),this.$overlayEl=this.createOverlay(),this.$blurredImage={},this.useVelocity=this.detectVelocity(),this.attachListeners(),this.generateBlurredImage(this.options.imageURL)};r.VERSION="0.0.1",r.DEFAULTS={imageURL:"",blurAmount:10,imageClass:"",overlayClass:"",duration:!1,opacity:1},r.prototype.detectVelocity=function(){return!!window.jQuery.Velocity},r.prototype.attachListeners=function(){this.$element.on("ui.blur.loaded",t.proxy(this.fadeIn,this)),this.$element.on("ui.blur.unload",t.proxy(this.fadeOut,this))},r.prototype.fadeIn=function(){this.options.duration&&this.options.duration>0&&(this.useVelocity?this.$blurredImage.velocity({opacity:this.options.opacity},{duration:this.options.duration}):this.$blurredImage.animate({opacity:this.options.opacity},{duration:this.options.duration}))},r.prototype.fadeOut=function(){this.options.duration&&this.options.duration>0?this.useVelocity?this.$blurredImage.velocity({opacity:0},{duration:this.options.duration}):this.$blurredImage.animate({opacity:0},{duration:this.options.duration}):this.$blurredImage.css({opacity:0})},r.prototype.generateBlurredImage=function(t){var e=this.$blurredImage;this.internalID=n(),e.length>0&&(this.options.duration&&this.options.duration>0?this.useVelocity?e.first().velocity({opacity:0},{duration:this.options.duration,complete:function(){e.remove()}}):e.first().animate({opacity:0},{duration:this.options.duration,complete:function(){e.remove()}}):e.remove()),this.$blurredImage=i?this.createIMG(t,this.$width,this.$height):this.createSVG(t,this.$width,this.$height)},r.prototype.createOverlay=function(){return this.options.overlayClass&&""!==this.options.overlayClass?t("<div></div>").prependTo(this.$element).addClass(this.options.overlayClass):!1},r.prototype.createSVG=function(e,i,n){var r=this,s=o.createElement("svg",{xmlns:o.svgns,version:"1.1",width:i,height:n,id:"blurred"+this.internalID,"class":this.options.imageClass,viewBox:"0 0 "+i+" "+n,preserveAspectRatio:"none"}),a="blur"+this.internalID,u=o.createElement("filter",{id:a}),l=o.createElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:this.options.blurAmount}),h=o.createElement("image",{x:0,y:0,width:i,height:n,externalResourcesRequired:"true",href:e,style:"filter:url(#"+a+")",preserveAspectRatio:"none"});h.addEventListener("load",function(){r.$element.trigger("ui.blur.loaded")},!0),h.addEventListener("SVGLoad",function(){r.$element.trigger("ui.blur.loaded")},!0),u.appendChild(l),s.appendChild(u),s.appendChild(h);var d=t(s);return r.options.duration&&r.options.duration>0&&(d.css({opacity:0}),window.setTimeout(function(){"0"===d.css("opacity")&&d.css({opacity:1})},this.options.duration+100)),this.element.insertBefore(s,this.element.firstChild),d},r.prototype.createIMG=function(t,e,i){var n=this,o=this.prependImage(t),r=2*this.options.blurAmount>100?100:2*this.options.blurAmount;return o.css({filter:"progid:DXImageTransform.Microsoft.Blur(pixelradius="+r+") ",top:2.5*-this.options.blurAmount,left:2.5*-this.options.blurAmount,width:e+2.5*this.options.blurAmount,height:i+2.5*this.options.blurAmount}).attr("id","blurred"+this.internalID),o.load(function(){n.$element.trigger("ui.blur.loaded")}),this.options.duration&&this.options.duration>0&&window.setTimeout(function(){"0"===o.css("opacity")&&o.css({opacity:1})},this.options.duration+100),o},r.prototype.prependImage=function(e){var i,n=t('<img src="'+e+'" />');return i=this.$overlayEl?n.insertBefore(this.$overlayEl).attr("id",this.internalID).addClass(this.options.imageClass):n.prependTo(this.$element).attr("id",this.internalID).addClass(this.options.imageClass)};var s=t.fn.backgroundBlur;t.fn.backgroundBlur=e,t.fn.backgroundBlur.Constructor=r,t.fn.backgroundBlur.noConflict=function(){return t.fn.backgroundBlur=s,this}}(jQuery);
File diff suppressed because one or more lines are too long
+64
View File
@@ -0,0 +1,64 @@
/*! Hellohao -pro | (c) 2019 Hellohao Foundation, Inc. | Hellohao.cn/license */
//cookie登录
// var cookiepass = $.cookie('pass_hellohaobycookie');
// var cookiename = $.cookie('name_hellohaobycookie');
var Hellohao_UniqueUserKey = $.cookie('Hellohao_UniqueUserKey');
if(Hellohao_UniqueUserKey!=null && Hellohao_UniqueUserKey!=""){
cookieLogin(Hellohao_UniqueUserKey)
}else{
$.ajax({
type: "POST",
url: "/islogin",
dataType: "json",
success: function (data) {
if(data.lgoinret==1){
bodys();
}else{
}
}
});
}
function cookieLogin(Hellohao_UniqueUserKey){
$.ajax({
type: "POST",
url: "/user/login_c",
data: {Hellohao_UniqueUserKey: Hellohao_UniqueUserKey},
dataType: "json",
success: function (data) {
$('#loginModal').modal('hide');
if (data == 1) {
$.cookie('name_hellohaobycookie', loginemail, { expires: 90});
$.cookie('pass_hellohaobycookie', loginpassword, { expires: 90});
bodys();
} else {
$.cookie('name_hellohaobycookie', null);
$.cookie('pass_hellohaobycookie', null);
}
}
});
}
function bodys() {
var h = '<li class="active"><a class="menu-link" data-section="home" data-nav-title="home"\n' +
' data-section-pos="0" data-section-posy="0">Home <i class="fa fa-fw fa-home"></i>\n' +
' </a></li>';
var h1 = '<li><a class="menu-link" target="_blank" href="/admin/goadmin" id="usernames">控制面板&nbsp;<i class="fa fa-fw fa-list"></i></a></li>';
var h2 = '<li><a class="menu-link" href="javascript:exit();" onclick="">退出&nbsp;<span class="glyphicon glyphicon-log-out"></span></a></li>';
$("#usersrc").html(h + h1 + h2);
}
//网站退出
function exit() {
$.ajax({
type: "POST",
url: "/user/exit.do",
dataType: "json",
success: function (data) {
$.cookie('name_hellohaobycookie', null);
$.cookie('pass_hellohaobycookie', null);
layer.msg('账号已退出', {icon: 1});
window.location.reload();
}
});
}
+3
View File
@@ -0,0 +1,3 @@
/*! jquery.cookie v1.4.1 | MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
@@ -170,7 +170,7 @@ TABLE OF CONTENTS
//-- 4.2 show half overlay on home section
var show_half_overlay = setTimeout(function () {
$('.home-section').find('.half-overlay').addClass('is-visible');
$('#webtext').addClass('fadeInDown');
clearTimeout(this);
}, 2300);
});
@@ -844,4 +844,4 @@ TABLE OF CONTENTS
});
});
//-- end document.ready function
})(jQuery);
})(jQuery);
+3 -2
View File
@@ -73,10 +73,10 @@ layui.use(['element', 'layer'], function () {
};
element.on('nav(test)', function (elem) {
// 如果点击的目录还有子目录就不做任何操作.
if ($(elem).find("span.layui-nav-more").length === 0) {
var obj = $(this);
var title = obj.find("cite").html();
var id = obj.attr("lay-id");
var url = obj.attr("lay-url");
@@ -235,9 +235,10 @@ layui.use(['element', 'layer'], function () {
var filter = "test"; //菜单
var id = $(this).attr("lay-id");
var navElem = $(".layui-nav[lay-filter='" + filter + "']"); //菜单导航元素
//移除所有的展开事件
navElem.find("li").removeClass("layui-nav-itemed");
//移除所有选中、获取当前tab选择导航、标注选中样式、展开条目
navElem.find("li, dd").removeClass("layui-this").find("a[lay-id='" + id + "']").parent().first().addClass("layui-this").parents("li,dd").addClass("layui-nav-itemed");
buildBreadcrumb();
if (rememberTab) {
sessionStorage.setItem("currentTabId", id);
@@ -1,538 +0,0 @@
/*!
* Bootstrap v3.3.4 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
text-shadow: none;
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-default.disabled,
.btn-default:disabled,
.btn-default[disabled] {
background-color: #e0e0e0;
background-image: none;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #245580;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #265a88;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #265a88;
border-color: #245580;
}
.btn-primary.disabled,
.btn-primary:disabled,
.btn-primary[disabled] {
background-color: #265a88;
background-image: none;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-success.disabled,
.btn-success:disabled,
.btn-success[disabled] {
background-color: #419641;
background-image: none;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-info.disabled,
.btn-info:disabled,
.btn-info[disabled] {
background-color: #2aabd2;
background-image: none;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-warning.disabled,
.btn-warning:disabled,
.btn-warning[disabled] {
background-color: #eb9316;
background-image: none;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-danger.disabled,
.btn-danger:disabled,
.btn-danger[disabled] {
background-color: #c12e2a;
background-image: none;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #2e6da4;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
background-repeat: repeat-x;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
@media (max-width: 767px) {
.navbar .navbar-nav .open .dropdown-menu > .active > a,
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #286090;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
background-repeat: repeat-x;
border-color: #2b669a;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
text-shadow: none;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
}
/*# sourceMappingURL=bootstrap-theme.css.map */
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 it is too large Load Diff
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 it is too large Load Diff
@@ -1,13 +0,0 @@
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
require('../../js/transition.js')
require('../../js/alert.js')
require('../../js/button.js')
require('../../js/carousel.js')
require('../../js/collapse.js')
require('../../js/dropdown.js')
require('../../js/modal.js')
require('../../js/tooltip.js')
require('../../js/popover.js')
require('../../js/scrollspy.js')
require('../../js/tab.js')
require('../../js/affix.js')
File diff suppressed because it is too large Load Diff
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
@@ -102,7 +102,7 @@ table {
margin: 20px auto;
cursor: pointer;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
border-radius:25px
}
@@ -392,7 +392,7 @@ table {
color: #565656;
padding: 0 18px;
display: inline-block;
border-radius: 3px;
border-radius: 25px;
margin-left: 10px;
cursor: pointer;
font-size: 14px;
@@ -406,7 +406,7 @@ table {
}
#uploader .statusBar .btns .uploadBtn {
/*background: #00b7ee;*/
/*background: #4ebd87; 00b7ee*/
background:#4ebd87;
color: #fff;
border-color: transparent;
@@ -171,6 +171,7 @@ function d(val) {return val+parseInt('3e7',16);}
// 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候,把图片打开。
disableGlobalDnd: true,
duplicate:true,
fileNumLimit: imgcount, //做多允许上传几个
//fileSizeLimit: 2000 * 1024 * 1024, // 200 M 文件总大小
fileSingleSizeLimit: filesize // 50 M 单文件大小
@@ -199,50 +200,55 @@ function d(val) {return val+parseInt('3e7',16);}
// 文件上传成功
uploader.on( 'uploadSuccess', function(file,response) {
$("#address").css('display', 'block');
if(response.imgurls==-100){
if(response.code==-100){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("本站已禁用游客上传,请登录本站。", {icon: 2});
});
// arr_url += '未配置存储源,请先后台配置存储源\r\n';
// arr_markdown += '未配置存储源,请先后台配置存储源\r\n';
// arr_html += '未配置存储源,请先后台配置存储源\r\n';
}else if(response.imgurls==-1){
}else if(response.code=='4000'){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("非法文件上传,仅支持:jpg,png,bmp,gif,jif格式。", {icon: 2});
});
}else if(response.code=='4001'){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("未配置存储源,或存储源配置不正确。", {icon: 2});
});
}else if(response.imgurls==-5){
}else if(response.code=='4005'){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("上传失败,可用空间不足", {icon: 2});
});
} else if(response.imgurls==403){
} else if(response.code==4003){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("非法调用,请刷新页面后重试", {icon: 2});
});
}else if(response.imgurls==-6){
}else if(response.code=='4006'){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("图片超出大小。", {icon: 2});
});
}else if(response.imgurls==911){
}else if(response.code=='911'){
layui.use('layer', function () {
layer = layui.layer;
layer.msg("你目前不能上传图片,请联系管理员", {icon: 2});
});
}else{
arr_url += response.imgurls + '\r\n';
arr_markdown += '!['+response.imgnames+'](' + response.imgurls + ')\r\n';
arr_html += '<img src="' + response.imgurls + '" alt="'+response.imgnames+'" title="'+response.imgnames+'" /> \r\n';
arr_url += response.data[0].imgurls + '\r\n';
arr_markdown += '!['+response.data[0].imgnames+'](' + response.data[0].imgurls + ')\r\n';
arr_html += '<img src="' + response.data.imgurls + '" alt="'+response.data[0].imgnames+'" title="'+response.data[0].imgnames+'" /> \r\n';
arr_ddcode +='[img]'+response.data[0].imgurls+'[/img]';
}
if(urltypes==1){
$("#urls").text(arr_url);
}else if(urltypes==2){
$("#urls").text(arr_markdown);
}else{
}else if(urltypes==3){
$("#urls").text(arr_html);
}else{
$("#urls").text(arr_ddcode);
}
});
@@ -279,6 +285,7 @@ function d(val) {return val+parseInt('3e7',16);}
});
}else{
$('#urlsc').html('<a style="color: #4ebd87;font-size: 0.9em;cursor:pointer;font-weight: bold;">已禁止游客上传,请登陆后使用</a>')
return;
}
// 当有文件添加进来时执行,负责view的创建
function addFile( file ) {
@@ -2819,7 +2819,6 @@ var count2 = 0;
// accept中的中生成匹配正则。
if ( opts.accept ) {
arr = [];
for ( i = 0, len = opts.accept.length; i < len; i++ ) {
item = opts.accept[ i ].extensions;
item && arr.push( item );
File diff suppressed because one or more lines are too long
+15 -5
View File
@@ -28,14 +28,12 @@
<h3><i class="layui-icon layui-icon-login-qq">&nbsp;</i>开发者交流群:864800972</h3>
<hr />
<!-- th:text="${systemupdate}"-->
<h3><i class="layui-icon layui-icon-auz">&nbsp;</i><span id="dates" >2019-12-13</span> &nbsp;&nbsp;&nbsp;<a onclick="sysupdate();" class="layui-btn layui-btn-normal layui-btn-sm">检查更新</a></h3>
<h3><i class="layui-icon layui-icon-auz">&nbsp;</i><span id="dates">2020-02-21</span> &nbsp;&nbsp;&nbsp;<a onclick="sysupdate();" class="layui-btn layui-btn-normal layui-btn-sm">检查更新</a></h3>
<hr />
<h3 style="font-weight: bold;"><i class="layui-icon layui-icon-rmb">&nbsp;</i>支持一下作者吧:</h3>
<h3 style="font-weight: bold;"><i class="layui-icon layui-icon-rmb">&nbsp;</i>捐赠开发者:<a onclick="jz()" style="cursor:pointer;">展开</a></h3>
<br />
<h3>
<img th:src="@{/img/ds.jpg}"
style="border-radius :5px;max-width: 80%;-moz-box-shadow: 2px 2px 10px #909090;-webkit-box-shadow: 2px 2px 10px #909090;box-shadow:2px 2px 10px #909090;" />
<!-- src="http://cdn.wwery.com/Hellohao/df2710722111702.jpg"-->
<img id="jzm" th:src="@{/img/ds.jpg}" style=" display:none;border-radius :5px;max-width: 60%;-moz-box-shadow: 2px 2px 10px #909090;-webkit-box-shadow: 2px 2px 10px #909090;box-shadow:2px 2px 10px #909090;" />
</h3>
</div>
@@ -71,6 +69,18 @@
});
}
function jz() {
var display =$('#jzm').css('display');
if(display == 'none'){
$('#jzm').show();
}else{
$('#jzm').hide();
}
$('body,html').animate({
scrollTop:$("#jzm").offset().top
},800);
}
</script>
</body>
</html>
@@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>我的画廊</title>
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}">
</head>
<body>
<div class="layui-main">
<div class="demoTable" style="margin-top: 15px;">
查询画廊:
<div class="layui-inline">
<input class="layui-input" name="id" id="demoReload" placeholder="请输入用户名" autocomplete="off">
</div>
<button class="layui-btn" data-type="reload" onclick="query()">查询</button>
</div>
<br />
<table id="dates" lay-filter="test"></table>
</div>
<input type="hidden" id="domain" th:value="${config.getDomain()}" />
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/layui/layui/layui.js}"></script>
<script type="text/javascript">
var tableIns = null;
var domain = '';
$.ajaxSetup({
cache: false
});
var table = null;
layui.use(['form','table','layer'], function(){
table = layui.table;
var layer = layui.layer;
var form = layui.form;
domain = $('#domain').val();
tableIns = table.render({
elem: '#dates'
,cache: false//关闭本地磁盘缓存,
,toolbar: '<div class="layui-btn-group">\n' +
' <button type="button" lay-event="delall" class="layui-btn layui-btn-sm">\n' +
' <i class="layui-icon">&#xe640;</i>删除选中\n' +
' </button>\n' +
'</div>' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
,defaultToolbar:['filter', 'print']
,url:'/admin/getAlbumURLList'
,limit:10 //默认为10
,cols: [ [
{type:'checkbox',width:40,}
,{field:'albumtitle',width:300, title: '画廊标题'}
,{field:'albumkey', width:300, title: '画廊地址', templet: function(d){return domain+'/'+d.albumkey;}}
,{field:'username', title: '创建用户',templet: function(d){
var str = d.password;
if(d.username=='' || d.username==null){str='游客';}
return str;
}
}
,{field:'createdate', title: '创建时间',sort: true}
,{field:'password', title: '访问密码',templet: function(d){
var str = d.password;
if(d.password=='' || d.password==null){str='无';}
return str;
}
}
,{field:'level',width:70, title: '操作',templet: function(d){
return '<div class="layui-btn-group">\n' +
' <button type="button" class="layui-btn layui-btn-sm" lay-event="del">\n' +
' <i class="layui-icon">&#xe640;</i>\n' +
' </button>\n' +
'</div>';
}
}
] ]
,page: true
,done:function(res, curr, count){
//数据的回调用,可不写
}
});
// 行点击事件
table.on('tool', function (obj) {
var data = obj.data;
var event = obj.event;
if (event === 'del') {
var index = layer.confirm('确定删除这个画廊吗?', {
btn: ['删除','取消'] //按钮
}, function(){
$.ajax({
type: "POST",
url: "/admin/delAlbum",
async:false,
data: {albumkey: data.albumkey},
dataType: "json",
success: function (data) {
if (data > 0) {
table.reload('dates');//重新获取表数据
layer.msg('删除成功', {icon: 1});
}
}
});
layer.close(index);
}, function(){
});
}else{
layer.msg('参数异常', {icon: 2});
}
});
//头工具栏事件
table.on('toolbar(test)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
case 'delall':
var index = layer.confirm('确定删除选中画廊?', {
btn: ['删除','取消'] //按钮
}, function(){
var data = checkStatus.data;
var arr = new Array();
for(var i = 0;i<data.length;i++){
arr.push(data[i].albumkey)
}
delall(arr);
table.reload('dates');//重新获取表数据
layer.close(index);
}, function(){
});
//layer.alert(JSON.stringify(data));
break;
};
});
});
function query(){
var data = $('#demoReload').val();
//这里以搜索为例
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
username: data
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
}
function delall(arr) {
$.ajax({
type: "POST",
url: "/admin/delAlbumAll",
data: {albumkeyArr: arr},
dataType: "json",
success: function (data) {
if (data > 0) {
layer.msg('删除成功', {icon: 1});
}
}
});
}
</script>
</body>
</html>
+25 -18
View File
@@ -78,14 +78,14 @@
<div class="layui-side-scroll" style="position: relative;">
<ul class="layui-nav layui-nav-tree" lay-filter="test" lay-accordion="true">
<li class="layui-nav-item">
<a lay-url="/table.html" lay-id="home" style="font-weight: bold;">
<a lay-url="/table.html" lay-id="home" style="font-weight: 500;">
<i class="layui-icon layui-icon-home"></i>&emsp;<cite>系统概况</cite>
</a>
</li>
<li class="layui-nav-item xiaoguo">
<a style="font-weight: bold;">
<a style="font-weight: 500;">
<i class="layui-icon layui-icon-username"></i>&emsp;<cite>个人中心</cite>
</a>
<dl class="layui-nav-child">
@@ -111,7 +111,7 @@
</dl>
</li>
<li class="layui-nav-item xiaoguo" th:if=" ${levels} gt '1'">
<a style="font-weight: bold;">
<a style="font-weight: 500;">
<i class="layui-icon layui-icon-user"></i>&emsp;<cite>用户管理</cite>
</a>
<dl class="layui-nav-child">
@@ -137,7 +137,7 @@
</dl>
</li>
<li class="layui-nav-item xiaoguo" th:if=" ${levels} gt '1'">
<a style="font-weight: bold;">
<a style="font-weight: 500;">
<i class="layui-icon layui-icon-set-sm"></i>&emsp;<cite>系统设置</cite>
</a>
<dl class="layui-nav-child">
@@ -170,7 +170,7 @@
</dl>
</li>
<li class="layui-nav-item xiaoguo" th:if=" ${levels} gt '1'">
<a style="font-weight: bold;">
<a style="font-weight: 500;">
<i class="layui-icon layui-icon-about"></i>&emsp;<cite>更&nbsp;多</cite>
</a>
<dl class="layui-nav-child">
@@ -228,9 +228,12 @@
</div>
<div class="site-mobile-shade"></div>
</div>
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/layui/layui/layui.js}"></script>
<script th:src="@{/layui/js/jquery.js}"></script>
<script th:src="@{/layui/js/zadmin.js}"></script>
<script th:src="@{/js/js.cookie.min.js}"></script>
<!--<script th:src="@{/js/hellohao.js}"></script>-->
<script>
var usermemory = Number([[${usermemory}]]);
var memory = Number([[${memory}]]);
@@ -249,24 +252,13 @@
});
function exit() {
$.ajax({
type: "POST",
url: "/user/exit.do",
dataType: "json",
success: function (data) {
layer.msg('账号已退出');
parent.location.reload();//刷新父元素
}
});
}
function kuorong() {
layer.open({
type: 1,
title:'空间扩容',
shadeClose: true,
skin: 'layui-layer-rim', //加上边框
area: ['420px', '240px'], //宽高
//skin: 'layui-layer-rim', //加上边框
area: ['450px', '240px'], //宽高
content: '<div style="width: 360px;"><br /><br /><div class="layui-form-item">\n' +
' <label class="layui-form-label">扩容码:</label>\n' +
' <div class="layui-input-block">\n' +
@@ -296,6 +288,21 @@ function kr() {
}
});
}
//网站退出
function exit() {
$.ajax({
type: "POST",
url: "/user/exit.do",
dataType: "json",
success: function (data) {
// $.cookie('name_hellohaobycookie', null);
// $.cookie('pass_hellohaobycookie', null);
layer.msg('账号已退出', {icon: 1});
window.location.reload();
}
});
}
</script>
</body>
@@ -15,7 +15,7 @@
<div class="layui-inline">
<label class="layui-form-label">用户容量(M)</label>
<div class="layui-input-inline">
<input id="memory" style="width: 250px;" th:value="${memory}" type="tel" name="groupname" lay-verify="required|phone" autocomplete="off" class="layui-input">
<input id="memory" style="width: 250px;" th:value="${memory}" type="number" name="groupname" lay-verify="required|phone" autocomplete="off" class="layui-input">
<input th:value="${uid}" type="hidden" id="uid"/>
</div>
</div>
@@ -63,21 +63,26 @@ function updateuser() {
,shade: 0.01
});
var memory = $('#memory').val();
$.ajax({
type: "POST",
url: "/admin/root/updateuser",
data: {memory:memory,groupid:groupid,uid:uid,id:id},
dataType: "json",
success: function (data) {
if (data > 0) {
table.reload('datas');//重新获取表数据
layer.msg('修改成功', {icon: 1});
}else{
layer.msg('修改失败', {icon: 2});
if(memory!=""){
$.ajax({
type: "POST",
url: "/admin/root/updateuser",
data: {memory:memory,groupid:groupid,uid:uid,id:id},
dataType: "json",
success: function (data) {
if (data > 0) {
table.reload('datas');//重新获取表数据
layer.msg('修改成功', {icon: 1});
}else{
layer.msg('修改失败', {icon: 2});
}
}
}
});
layer.closeAll();
});
layer.closeAll();
}else{
layer.closeAll();
layer.msg('用户容量不能为空', {icon: 2});
}
}
</script>
</body>
@@ -272,28 +272,29 @@
if(StorageType==4){Endpoint = $("#Endpoint2").val();}else{Endpoint = $("#Endpoint").val();}
}
if($("#StorageType").val()==5){
$.ajax({
type: "POST",
url: "/admin/root/updatekey",
data: {
AccessKey: 0,
AccessSecret: 0,
Endpoint: 0,
Bucketname: 0,
RequestAddress: 0,
StorageType: 5
},
dataType: "json",
success: function (data) {
if (data > 0) {
layer.msg("保存成功", {icon: 1});
} else if(data==-1){
layer.msg("对象存储有参数为空,初始化失败", {icon: 2});
}else{
layer.msg("保存失败", {icon: 2});
}
}
});
// $.ajax({
// type: "POST",
// url: "/admin/root/updatekey",
// data: {
// AccessKey: 0,
// AccessSecret: 0,
// Endpoint: 0,
// Bucketname: 0,
// RequestAddress: 0,
// StorageType: 5
// },
// dataType: "json",
// success: function (data) {
// if (data > 0) {
// layer.msg("保存成功", {icon: 1});
// } else if(data==-1){
// layer.msg("对象存储有参数为空,初始化失败", {icon: 2});
// }else{
// layer.msg("保存失败", {icon: 2});
// }
// }
// });
layer.msg("本都存储不需要保存配置", {icon: 4});
}else if($("#StorageType").val()==7){
if(AccessKey!="" && AccessSecret!="" &&Endpoint!="" && RequestAddress!="" && StorageType!=""){
$.ajax({
@@ -321,8 +322,7 @@
}else{
layer.msg("有参数不正确,请检查", {icon: 2});
}
}
else{
}else{
if(AccessKey!="" && AccessSecret!="" &&Endpoint!="" && Bucketname!="" && RequestAddress!="" && StorageType!=""){
$.ajax({
type: "POST",
+59 -28
View File
@@ -8,27 +8,37 @@
<meta name="description" content="">
<link rel="icon" type="image/ico" href="https://hellohao.nos-eastchina1.126.net/BlogImg/favicon.ico"/>
<link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/static/css/font-awesome.css}" rel="stylesheet">
<link th:href="@{/static/css/custom.css}" rel="stylesheet">
<link th:href="@{/static/css/style.css}" rel="stylesheet">
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}">
<style>
body{
font-family: 黑体;
}
</style>
<link th:href="@{/static/css/font-awesome.css}" rel="stylesheet" />
<link th:href="@{/static/css/custom.css}" rel="stylesheet" />
<link th:href="@{/static/css/style.css}" rel="stylesheet" />
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}" />
<link rel="stylesheet" th:href="@{/static/css/animate.min.css}" />
</head>
<body class="gray-bg">
<div>
<div class="row" style="width: 95%; margin: 0 auto;margin-top: 50px;" th:if=" ${levels} gt '1'">
<h2 class="font-bold">系统概况</h2>
<h3 class="font-bold">开发者公告</h3>
</div>
<div class="row " style="width: 95%; margin: 0 auto;margin-top: 50px;" th:if=" ${levels} gt '1'">
<blockquote class="animated fadeInRight">
<p class="bg-primary" id="notice" style="border-radius: 5px;padding: 20px;line-height: 27px;">暂无重要公告通知。</p>
</blockquote>
</div>
<div class="row" style="width: 95%; margin: 0 auto;margin-top: 50px;" th:if=" ${levels} gt '1'">
<h3 class="font-bold">系统概况</h3>
</div>
<div class="row" style="width: 95%; margin: 0 auto;margin-top: 50px;" th:if=" ${levels} eq '1'">
<h2 class="font-bold"> </h2>
</div>
<div class="wrapper wrapper-content animated fadeInRight" th:if=" ${levels} gt '1'">
<div class="wrapper wrapper-content" th:if=" ${levels} gt '1'">
<div class="row" style="width: 95%; margin: 0 auto;">
<div class="col-sm-3">
<div class="col-sm-3 Mouseevent animated fadeInLeft">
<div class="widget style1 navy-bg">
<div class="row">
<div class="col-xs-4">
@@ -41,7 +51,7 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="col-sm-3 Mouseevent animated fadeInLeft">
<div class="widget style1 navy-bg" style="background-color: #4ebd87;">
<div class="row">
<div class="col-xs-4">
@@ -54,7 +64,7 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="col-sm-3 Mouseevent animated fadeInLeft">
<div class="widget style1 yellow-bg">
<div class="row">
<div class="col-xs-4">
@@ -67,7 +77,7 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="col-sm-3 Mouseevent animated fadeInLeft">
<div class="widget style1 lazur-bg">
<div class="row">
<div class="col-xs-4">
@@ -83,13 +93,13 @@
</div>
</div>
<div class="row" style="margin-top: 50px;width: 95%; margin: 0 auto;">
<h2 class="font-bold">我的信息</h2>
<h3 class="font-bold">我的信息</h3>
</div>
<div class="row" style="width: 95%; margin: 0 auto;">
<div class="col-sm-6">
<div class="col-sm-6 Mouseevent animated fadeInRight">
<div class="widget navy-bg no-padding">
<div class="p-m">
<h2 class="m-xs">容量使用</h2>
<h2 class="m-xs">容量使用&nbsp;<a class="layui-btn layui-btn-sm layui-btn-danger" style="height: 23px;line-height: 24px;" onclick="kuorong()" title="获取更大空间">扩&nbsp;容</a></h2>
<h3 class="font-bold no-margins" id="ly">
<div id="leftstate" style=" color:#f2f2f2;font-size:10px;height: 10px;position:absolute;bottom:55px; width: 70%;z-index: 1;">
<div class="layui-progress layui-progress-big" lay-filter="datasize" style="height: 12px;position:absolute;bottom:20px; width: 100%;margin-left: 3%;" >
@@ -99,7 +109,8 @@
</div>
</h3>
<h3 class="m-xs">
<a class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger" onclick="kuorong()" title="获取更大空间">扩&nbsp;容</a>
<br />
<!-- <a class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger" onclick="kuorong()" title="获取更大空间">&nbsp;</a>-->
</h3>
</div>
<div class="flot-chart">
@@ -107,7 +118,7 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="col-sm-3 Mouseevent animated fadeInRight">
<div class="widget lazur-bg no-padding">
<div class="p-m">
<h1 class="m-xs" id="usercount">0</h1>
@@ -125,25 +136,25 @@
<div class="widget yellw-bg no-padding">
<table class="table" >
<tbody>
<tr>
<tr class="animated bounceInUp delay-0.5s">
<td>
<button type="button" class="btn btn-danger m-r-sm">系统名称:</button>
<span th:text="${sysetmname}" style="font-weight: bold;"></span>
</td>
</tr>
<tr>
<tr class="animated bounceInUp delay-1s">
<td>
<button type="button" class="btn btn-info m-r-sm">系统架构:</button>
<span th:text="${isarch}" style="font-weight: bold;"></span>
</td>
</tr>
<tr>
<tr class="animated bounceInUp delay-2s">
<td>
<button type="button" class="btn btn-info m-r-sm">JDK版本:</button>
<span th:text="${jdk}" style="font-weight: bold;"></span>
</td>
</tr>
<tr>
<tr class="animated bounceInUp delay-3s">
<td>
<button type="button" class="btn btn-info m-r-sm">开发语言:</button>
<span style="font-weight: bold;">JAVA开发</span>
@@ -156,7 +167,7 @@
</div>
<div class="row">
</div>
</div>
<!-- 全局js -->
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/jquery-ui-1.10.4.min.js}" type="text/javascript"></script>
@@ -205,6 +216,17 @@
$("#source").text(str);
}
});
$.ajax({
type: "GET",
url: "/getNotice",
dataType: "json",
success: function (data) {
console.log(data);
$('#notice').text(data.data);
}
});
})
$(document).ready(function () {
var d1 = [ [1262304000000, 6], [1264982400000, 3057], [1267401600000, 20434], [1270080000000, 31982], [1272672000000, 26602], [1275350400000, 27826], [1277942400000, 24302], [1280620800000, 24237], [1283299200000, 21004], [1285891200000, 12144], [1288569600000, 10577], [1291161600000, 10295] ];
@@ -404,10 +426,10 @@
type: 1,
title:'空间扩容',
shadeClose: true,
skin: 'layui-layer-rim',
area: ['420px', '240px'],
//skin: 'layui-layer-rim',
area: ['450px', '240px'],
content: '<div style="width: 360px;"><br /><br /><div class="layui-form-item">\n' +
' <label class="layui-form-label">扩容码:</label>\n' +
' <label class="layui-form-label"style="width: 90px;">扩容码:</label>\n' +
' <div class="layui-input-block">\n' +
' <input type="text" name="title" id="krm" required lay-verify="required" placeholder="请输入你的扩容码" autocomplete="off" class="layui-input"> ' +
'<span style="color: #DAA5A6; font-size: 12px;">扩容码为一次性,只能扩容一次,切勿泄露。</span><br/><br/><button type="button" onclick="kr()" style="float: right;" class="layui-btn layui-btn-radius layui-btn-normal" onclick="">激 活</button>'+
@@ -436,6 +458,15 @@
});
}
$(".Mouseevent").each(function(index){
$(this).mouseenter(function(obj) {
$(this).removeClass('fadeInLeft');
$(this).addClass('pulse');
});
$(this).mouseleave(function(obj) {
$(this).removeClass('pulse');
});
});
</script>
+52 -54
View File
@@ -9,7 +9,6 @@
<link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet"/>
<link th:href="@{/static/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/style.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/toastr.min.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/login-register.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/bootstrap-table.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/sweetalert.min.css}" media="all" rel="stylesheet" type="text/css"/>
@@ -19,7 +18,6 @@
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/bootstrap.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/toastr.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/login-register.js}"></script>
<script th:src="@{/static/bootstrap-3.3.4-dist/js/bootstrap-table-hellohao1.13.1.js}"></script>
<script th:src="@{/static/js/clipboard.min.js}"></script>
@@ -234,22 +232,7 @@
var t;
$(function () {
var loginid = [[${loginid}]];
toastr.options.positionClass = 'toast-bottom-right';
toastr.options = {
closeButton: true,//是否显示关闭按钮
debug: false,
progressBar: true,
positionClass: "toast-bottom-right",
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "2000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
$(document).ready(function() {
$('#reservation').daterangepicker(null, function(start, end, label) {
});
@@ -292,49 +275,36 @@
function (isConfirm) {
if (isConfirm) {
var rows = $("#table_server").bootstrapTable('getSelections');
if (rows.length == 0) {// rows 主要是为了判断是否选中,下面的else内容才是主要
if (rows.length == 0) {
swal("请先勾选图片再删除", "目前未选中任何图片", "error");
return;
} else {
var ids = new Array();// 声明一个数组
var ids = new Array();
var sources = new Array();
var imgnames = new Array();
$(rows).each(function () {// 通过获得别选中的来进行遍历
ids.push(this.id);// cid为获得到的整条数据中的一列
ids.push(this.id);
sources.push(this.source);
imgnames.push(this.imgname);
});
deleallimg(ids);
deleallimg(ids,sources,imgnames);
}
}
});
}
function deleallimg(ids) {
function deleallimg(ids,sources,imgnames) {
var loading = layer.msg('正在删除', {icon: 16, shade: 0.3, time:0});
$.ajax({
type: "POST",
url: "/admin/deleallimg",
data: {ids: ids},
data: {ids: ids,sources:sources,imgnames:imgnames},
dataType: "json",
success: function (data) {
layer.close(loading);
if (data.val > 0) {
layer.close(loading);
$("#table_server").bootstrapTable('refresh', t);
swal({
title: "删除成功",
text: "已成功删除所选图片。",
type: "success",
showCancelButton: false,//true显示两个按钮
confirmButtonColor: "#A5DC86",
confirmButtonText: "确定",
//cancelButtonText: "取消删除!",
closeOnConfirm: true,
closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
}
});
} else {
layer.close(loading);
$("#table_server").bootstrapTable('refresh', t);
layer.msg('已成功删除所选图片', {icon: 1});
}
$("#table_server").bootstrapTable('refresh', t);
$("#imgcount").text(data.count);
$("#usercount").text(data.usercount);
$("#imgreviewcount").text(data.imgreviewcount);
@@ -347,13 +317,13 @@
url: "/user/exit.do",
dataType: "json",
success: function (data) {
toastr.success("账号已退出。");
layer.msg('账号已退出', {icon: 1});
window.location.reload();
}
});
}
//删除
function deleimg(id, sourcekey) {
function deleimg(id, sourcekey,imgname) {
swal({
title: "确认是否删除该图片?",
text: "删除后将无法恢复,请谨慎操作。",
@@ -368,16 +338,16 @@
$.ajax({
type: "POST",
url: "/admin/deleimg",
data: {id: id, sourcekey: sourcekey},
data: {id: id, sourcekey: sourcekey,imgname:imgname},
dataType: "json",
success: function (data) {
if (data.val > 0) {
$("#table_server").bootstrapTable('refresh', t);
toastr.success("删除成功");
layer.msg('删除成功', {icon: 1});
$("#imgcount").text(data.count);
$("#usercount").text(data.usercount);
} else {
toastr.error("删除失败");
layer.msg('删除失败', {icon: 2});
$("#table_server").bootstrapTable('refresh', t);
}
}
@@ -393,18 +363,42 @@
}
});
copy.on('success', function (e) {
toastr.success("复制成功");
layer.msg('复制成功');
copy.off("success");
});
copy.on('error', function (e) {
toastr.error("复制失败");
layer.msg('复制失败');
copy.off("error");
});
}
function lookimgs(id,urls) {
//单张图片预览
var viewer = new Viewer(document.getElementById('imgs'+id));
var viewer = new Viewer(document.getElementById('imgs'+id),{
// inline: true,
// url: 'data-original',
// navbar: false,
// zoomRatio: 0.4,
// button: true,
// title: false,
// keyboard: false,
toolbar: {
zoomIn: 1,
zoomOut: 1,
oneToOne: 1,
reset: 1,
prev: 0,
play: 0,
next: 0,
rotateLeft: 1,
rotateRight: 1,
flipHorizontal: 1,
flipVertical: 1,
},
viewed: function () {
viewer.view(0);
}
});
document.getElementById('imgs'+id).click();
}
@@ -512,12 +506,16 @@
var view = {
imgurl: rows.imgurl,
path:rows.imgname,
size:rows.sizes
size:rows.sizes,
id:rows.id,
source:rows.source
};
var htm = '<a onclick="copy(\'' + rows.imgurl +
'\')" class="btn btn-info btn-xs"><span class="glyphicon glyphicon-list-alt" title="复制"></span></a>'+ "&nbsp;&nbsp;";//复制
htm += Mustache.render("<a onclick='erwm(\"{{&imgurl}}\",\"{{path}}\",\"{{size}}\")' class='btn btn-success btn-xs'><span title='二维码' class='glyphicon glyphicon-qrcode'></span></a>"+ "&nbsp;&nbsp;", view) ;//二维码
htm += "<a onclick='deleimg(" + rows.id + "," + rows.source + ")' class='btn btn-danger btn-xs'><span title='删除' class='glyphicon glyphicon-trash'></span></a>";//删除
//htm += "<a onclick='deleimg(" + rows.id + "," + rows.source + ")' class='btn btn-danger btn-xs'><span title='删除' class='glyphicon glyphicon-trash'></span></a>";//删除
htm += Mustache.render("<a onclick='deleimg(\"{{&id}}\",\"{{source}}\",\"{{path}}\")' class='btn btn-danger btn-xs'><span title='删除' class='glyphicon glyphicon-trash'></span></a>",view);
return htm;
},
align: 'center'
@@ -268,7 +268,7 @@
<label class="layui-form-label">站点描述</label>
<div class="layui-input-block">
<textarea id="webms" name="webms" placeholder="请输入站点标描述,这样有利于搜索引擎" class="layui-textarea" th:text="${config.getWebms()}"></textarea>
<span style="color: #DAA5A6;"><xmp>添加网站统计的JS代码,不需要要添加<script>标签</script></xmp></span>
<!-- <span style="color: #DAA5A6;"><xmp>添加网站统计的JS代码,不需要要添加<script>标签</script></xmp></span>-->
</div>
</div>
</form>
+37 -3
View File
@@ -4,14 +4,48 @@
<meta charset="UTF-8">
<title>登录超时</title>
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<script th:src="@{/js/js.cookie.min.js}"></script>
</head>
<body>
<h2>登录已过期,请重新登录</h2>
<br />
<br />
<br />
<br />
<br />
<h2 id="logmsg" align="center" style=" color: #555;">登录已过期,请重新登录</h2>
<script>
$(function () {
top.location.href="/";
})
// var isurl = window.location.protocol+'//'+window.location.host+'/admin/goadmin';//document.referrer+'/admin/goadmin'
// //cookie登录
// var cookiepass = $.cookie('pass_hellohaobycookie');
// var cookiename = $.cookie('name_hellohaobycookie');
// if(cookiepass!=null && cookiepass!="" && cookiepass!="null"){
// $('#logmsg').text('正在验证本地登录');
// cookieLogin(cookiename,cookiepass)
// }else{
// top.location.href="/";
// }
function cookieLogin(loginemail,loginpassword){
$.ajax({
type: "POST",
url: "/user/login_c",
data: {email: loginemail, password: loginpassword},
dataType: "json",
success: function (data) {
if (data == 1) {
$.cookie('name_hellohaobycookie', loginemail, { expires: 90});
$.cookie('pass_hellohaobycookie', loginpassword, { expires: 90});
top.location.href=isurl;
} else {
$('#logmsg').text('本地账号已失效。');
$.cookie('name_hellohaobycookie', null);
$.cookie('pass_hellohaobycookie', null);
}
}
});
}
</script>
</body>
</html>
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>登录超时</title>
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
</head>
<body>
<br />
<br />
<br />
<br />
<br />
<h2 id="logmsg" align="center" style=" color: #555;" th:text="${error}"></h2>
</body>
</html>
+177 -105
View File
@@ -7,29 +7,20 @@
<meta name="description" th:content="${config.getWebms()}" />
<meta name="author" content="Hellohao" />
<title th:text="${config.getWebname()}"></title>
<!-- <title th:text="Hellohao图床"></title>-->
<link rel="shortcut icon" th:href="${config.getWebfavicons()}" type="image/x-icon"/>
<link rel="icon" type="image/ico" th:href="${config.getWebfavicons()}" />
<link rel="stylesheet" th:href="@{css/style.css}" type="text/css" />
<link th:href="@{/webuploade/css/webuploader.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/webuploade/css/style.css}" media="all" rel="stylesheet" type="text/css"/>
<script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/static/css/toastr.min.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet" />
<link th:href="@{/static/css/login-register.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/static/css/sweetalert.min.css}" media="all" rel="stylesheet" type="text/css"/>
<link th:href="@{/webuploade/css/component.css}" media="all" rel="stylesheet" type="text/css"/>
<!-- <link th:href="@{/static/css/popover.css}" media="all" rel="stylesheet" type="text/css"/>-->
<link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}" />
<link rel="stylesheet" th:href="@{/css/intro.css}" />
<link rel="stylesheet" th:href="@{/css/verify.css}" />
<link rel="stylesheet" th:href="@{/static/css/animate.min.css}" />
<script th:src="@{/static/js/toastr.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/login-register.js}"></script>
<script th:src="@{/static/js/clipboard.min.js}"></script>
<script th:src="@{/static/js/bootbox.min.js}"></script>
<script th:src="@{/static/js/sweetalert2.min.js}"></script>
<script th:src="@{/layui/layui/layui.js}"></script>
<style type="text/css">
a{
text-decoration: none;
@@ -144,7 +135,7 @@
</style>
</head>
<body class="simple">
<body class="simple" id="body">
<div class="text-center w-mian" id="videohtml">
</div>
<div class="preloader-container">
@@ -164,12 +155,12 @@
data-section-pos="0" data-section-posy="0">首页 <i class="fa fa-fw fa-home"></i>
</a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-3">登录&nbsp;<span class="glyphicon glyphicon-user" aria-hidden="true"></span></a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-4">注册&nbsp;<span class="glyphicon glyphicon-education" aria-hidden="true"></span></a></li>
<li><a href="javascript:;" class="md-trigger" data-modal="modal-4">注册 <span class="glyphicon glyphicon-retweet" aria-hidden="true"></span></a></li>
<!-- <li><a class="menu-link" href="https://github.com/Hello-hao/Tbed" target="_blank"
>GitHub<i class="fa fa-github"></i></a></li>
<li><a class="menu-link" href="http://www.hellohao.cn" target="_blank"
>作者<i class="fa fa-github"></i></a></li>-->
<!-- <li><a class="menu-link" href="https://github.com/Hello-hao/Tbed" target="_blank"-->
<!-- >GitHub<i class="fa fa-github"></i></a></li>-->
<!-- <li><a class="menu-link" href="http://www.hellohao.cn" target="_blank"-->
<!-- >作者<i class="fa fa-github"></i></a></li>-->
<!-- <li><a href="javascript:;" class="md-trigger" data-modal="modal-2">赞助商&nbsp;<i class="fa fa-share-alt"></i></a></li>-->
@@ -186,11 +177,12 @@
<div class="bg-container"></div>
<div class="content col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-12 col-xs-rlt no-pad centering-y">
<div class="col-md-12 col-sm-12">
<h1 style="font-size: 4.0em;" th:text="${config.getWebname()}"></h1>
<h1 class="animated" id="webtext" style="font-size: 3.5em;" th:text="${config.getWebname()}"></h1>
<a id="goupdate" class="menu-link goupdate" data-section="contact" data-nav-title="contact" data-section-pos="-100"
data-section-posy="0"><span class="glyphicon glyphicon-open" aria-hidden="true"></span>立即上传</a>
<!-- <a id="goupdate2" onclick="xiazai()" class="goupdate">-->
<!-- <span class="glyphicon glyphicon-th-large" aria-hidden="true"></span>客户端</a>-->
<br />
<div class="sub-title" id="wordsrotator">
<h4>纯粹免费的图片驿站</h4>
</div>
@@ -198,8 +190,10 @@
Hellohao Figure bed:support several mainstream object storage, CDN acceleration is more stable.
Technology constantly updated, we will always move forward on the road ahead.
</p>
<div id="countdown" class="countdown-container">
<center>
<div id="countdown" class="countdown-container" style="text-align: center;">
<!-- days left -->
<br />
<div class="dash days_dash" style="max-width: 172px;">
<div class="counter">
<div class="dash_title">days</div>
@@ -225,11 +219,12 @@
</div>
</div>
</div>
</center>
</div>
<div id="beian" style="text-align: center;">
<div id="beian" style="text-align: center;float: initial;z-index: 99999;margin-top: 30px;">
<br />
<span th:utext="${config.getLinks()}">
<span style="margin-top: 20px;" th:utext="${config.getLinks()}">
<a href="http://www.hellohao.cn">Hellohao©技术支持</a>
</span>
<br />
@@ -237,6 +232,11 @@
<br />
</div>
<!-- <footer class="navbar-fixed-bottom">-->
<!-- <div class="container" align="center" th:utext="${config.getLinks()}">-->
<!--&lt;!&ndash; <p align="center">&copy; Photo album sharing from <span th:text="${webname}">hellohao</span></p>&ndash;&gt;-->
<!-- </div>-->
<!-- </footer>-->
</div>
</section>
<div class="tlinks">Collect from <a href="/" >网站建设</a></div>
@@ -284,10 +284,10 @@
<form class="contact-form" action="contact.php" method="post" enctype="multipart/form-data">
<div class="col-xs-12 text-center no-pad">
<div class="input-container no-mrg" id="urlstext">
<a class="copytext" onclick="copy()">
<a class="copytext" onclick="copyText()">
COPY
</a>
<textarea id="urls" name="message" style="padding:20px;font-weight: 600; border: 1px solid #838383;border-radius: 5px;"></textarea>
<textarea id="urls" name="message" readonly="readonly" style="padding:20px;font-weight: 600; border: 1px solid #838383;border-radius: 5px;"></textarea>
<div class="input-border-bottom"></div>
</div>
<div class="col-xs-12 notif-container no-pad">
@@ -297,10 +297,13 @@
</form>
<div class="col-xs-12 no-pad text-left mrg-top-xs">
<div style="margin: 0 auto;text-align:center">
<button type="button" onclick="urltype(1);" class="button button-green button-small">URL</button>
<button type="button" onclick="urltype(2);" class="button button-green button-small">Markdown</button>
<button type="button" onclick="urltype(3);" class="button button-green button-small">HTML</button>
</div>
<button type="button" style="width: 195px;height: 36px;padding: 10px 50px;" onclick="urltype(1);" class="button button-green button-small">URL</button>
<button type="button" style="width: 195px;height: 36px;padding: 10px 50px;" onclick="urltype(2);" class="button button-green button-small">Markdown</button>
<button type="button" style="width: 195px;height: 36px;padding: 10px 50px;" onclick="urltype(3);" class="button button-green button-small">HTML</button>
<button type="button" style="width: 195px;height: 36px;padding: 10px 50px;" onclick="urltype(4);" class="button button-green button-small">BBCode</button>
<!-- New Album-->
</div>
</div>
</div>
</div>
@@ -373,8 +376,6 @@
</div>
</div>
</div>
<!-- 赞助商-->
<div class="md-modal md-effect-3" id="modal-2">
<div class="md-content">
@@ -395,20 +396,27 @@
</div>
</div>
<div class="md-overlay"></div>
<script type="text/javascript" th:src="@{js/jquery.js}"></script>
<script th:src="@{/static/js/login-register.js}"></script>
<script th:src="@{/static/js/clipboard.min.js}"></script>
<script th:src="@{/static/js/bootbox.min.js}"></script>
<script th:src="@{/static/js/sweetalert2.min.js}"></script>
<script th:src="@{/layui/layui/layui.js}"></script>
<script th:src="@{/js/jquery.qrcode.min.js}"></script>
<script th:src="@{/webuploade/js/webuploader.js}"></script>
<script th:src="@{/webuploade/js/upload.js}" ></script>
<script type="text/javascript" th:src="@{js/jquery.js}"></script>
<script th:src="@{/webuploade/js/classie.js}"></script>
<script th:src="@{/webuploade/js/modalEffects.js}" ></script>
<script th:src="@{js/html5shiv.js}"></script>
<script th:src="@{js/respond.min.js}"></script>
<script th:src="@{/webuploade/js/classie.js}"></script>
<script th:src="@{/webuploade/js/modalEffects.js}"></script>
<!-- bootstrap -->
<script type="text/javascript" th:src="@{js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/static/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{js/plugins.min.js}"></script>
<script type="text/javascript" th:src="@{js/main_constellation.js}"></script>
<script th:src="@{/js/verify.js}"></script>
<script th:src="@{/js/base64.min.js}"></script>
<script th:src="@{/js/js.cookie.min.js}"></script>
<script th:src="@{/js/hellohao.js}"></script>
<script th:inline="javascript">
var isday = 0;
@@ -419,7 +427,8 @@
var arr_url = "";
var arr_markdown = "";
var arr_html = "";
var urltypes = 1;//1 url 2 md 3 a标签
var arr_ddcode = "";
var urltypes = 1;//1 url 2 md 3 a标签 4 论坛格式
var VisitorUpload = [[${VisitorUpload}]];
var filesize = [[${filesize}]];
var imgcount = [[${imgcount}]];
@@ -430,6 +439,24 @@
layer = layui.layer;
});
var oDiv=document.getElementById('body');
var x = 10;
var y = 1;
var rand = parseInt(Math.random() * (x - y + 1) + y);
var c1 = '';
var c2 = '';
if(rand==1){c1 = '26d9b3';c2 = '5a84fd';}
else if(rand==2){c1 = '6DE195';c2 = 'C4E759';}
else if(rand==3){c1 = '41C7AF';c2 = '54E38E';}
else if(rand==4){c1 = '99E5A2';c2 = 'D4FC78';}
else if(rand==5){c1 = 'A16BFE';c2 = 'DEB0DF';}
else if(rand==6){c1 = 'F78FAD';c2 = 'FDEB82';}
else if(rand==7){c1 = 'BC3D2F';c2 = 'A16BFE';}
else if(rand==8){c1 = 'A43AB2';c2 = 'E13680';}
else if(rand==9){c1 = '8DEBFF';c2 = '41D8DD';}
else{c1 = '5583EE';c2 = '5a84fd';}
oDiv.style.cssText="background: #"+c1+";background: -moz-linear-gradient(right, #"+c1+" 0%, #"+c2+" 100%);background: -webkit-linear-gradient(right, #"+c1+" 0%, #"+c2+" 100%);background: linear-gradient(to right, #"+c1+" 0%, #"+c2+" 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#"+c1+"', endColorstr='#"+c2+"',GradientType=1 );";
$(document).ready(function () {
$(".jb").fadeToggle();
$(".jb").fadeToggle(4000);
@@ -466,39 +493,7 @@
$("#explain").text(explain);
$("#links").html(links);
$("#whts").attr("title",'图片大小不得超过'+[[${uploadConfig.getFilesizetourists()}]]+' MB,登录本站可上传'+[[${uploadConfig.getFilesizeuser()}]]+' M图片以及查看历史图片记录等更多操作。');
$.ajax({
type: "POST",
url: "/islogin",
dataType: "json",
success: function (data) {
if(data.lgoinret==1){
var h = '<li class="active"><a class="menu-link" data-section="home" data-nav-title="home"\n' +
' data-section-pos="0" data-section-posy="0">Home <i class="fa fa-fw fa-home"></i>\n' +
' </a></li>';
var h1 = '<li><a class="menu-link" target="_blank" href="/admin/goadmin" id="usernames">控制面板&nbsp;<i class="fa fa-fw fa-list"></i></a></li>';
var h2 = '<li><a class="menu-link" href="javascript:exit();" title="666" onclick="">退出&nbsp;<span class="glyphicon glyphicon-log-out"></span></a></li>';
$("#usersrc").html(h + h1 + h2);
}
}
});
toastr.options.positionClass = 'toast-bottom-right';
toastr.options = {
closeButton: true,//是否显示关闭按钮
debug: false,
progressBar: true,
positionClass: "toast-bottom-right",
onclick: null,
showDuration: "300",
hideDuration: "1000",
timeOut: "2000",
extendedTimeOut: "1000",
showEasing: "swing",
hideEasing: "linear",
showMethod: "fadeIn",
hideMethod: "fadeOut"
};
//toastr.info("欢迎使用Hellohao图床!");
});
function zhuce(mail, registerusername, registerpassword) {
@@ -597,28 +592,35 @@
success: function (data) {
$('#loginModal').modal('hide');
if (data == 1) {
toastr.success("登录成功。");
//toastr.success("登录成功。");
//$.cookie('name_hellohaobycookie', loginemail, { expires: 90});
//$.cookie('pass_hellohaobycookie', loginpassword, { expires: 90});
//$.cookie('Hellohao_UniqueUserKey', loginpassword, { expires: 90});
layer.msg('登录成功', {icon: 1});
setTimeout(function () {
window.location.reload();
}, 1000);
} else {
dd();
$.cookie('name_hellohaobycookie', null);
$.cookie('pass_hellohaobycookie', null);
if (data == -1) {
$('#dlts').text('您的账号是未激活状态,无法登陆。');
toastr.error('您的账号是未激活状态,无法登陆。');
//toastr.error('您的账号是未激活状态,无法登陆。');
layer.msg('您的账号是未激活状态,无法登陆', {icon: 4});
again();
} else if(data==-2){
$('#dlts').text('您的账号已被冻结。');
toastr.error('您的账号已被冻结。');
layer.msg('您的账号已被冻结', {icon: 2});
again(1);
}else if(data==-3){
$('#dlts').text('非法登录,请刷新页面重新尝试。');
toastr.error('非法登录,请刷新页面重新尝试。');
layer.msg('非法登录,请刷新页面重新尝试', {icon: 2});
again(1);
}
else {
$('#dlts').text('登录失败,你的邮箱或密码不正确,请重试。');
toastr.error('登录失败,你的邮箱或者密码不正确,请重试。');
layer.msg('登录失败,你的邮箱或者密码不正确,请重试', {icon: 2});
again(1);
}
setTimeout(function () {
@@ -631,19 +633,6 @@
$('#dlts').text('请滑动验证码进行验证,才可登录。');
}
}
function exit() {
$.ajax({
type: "POST",
url: "/user/exit.do",
dataType: "json",
success: function (data) {
toastr.success("账号已退出。");
window.location.reload();
}
});
}
function imgsc() {
var str = '输入图片URL地址:';
if(isday>0){
@@ -660,19 +649,20 @@
});
}
function copy() {
var data = $('#urls').val();
function copyText() {
var data = data = $('#urls').val();
var copy = new ClipboardJS('.copytext', {
text: function (trigger) {
return data;
}
});
copy.on('success', function (e) {
toastr.success("复制成功");
layer.msg('复制成功');
copy.off("success");
});
copy.on('error', function (e) {
toastr.error("复制失败");
layer.msg('复制失败');
copy.off("error");
});
}
@@ -698,6 +688,10 @@
if(result) {
var rx=/^https?:\/\//i;
if(rx.test(result)==true){
var msgid = layer.msg('上传中..', {
icon: 16
,shade: 0.01
});
qq = GetDateStr(new Date());
$('#loadingModal').modal({backdrop: 'static', keyboard: false,upurlk:qq});
$.ajax({
@@ -706,8 +700,8 @@
dataType: "json",
data: {imgurl: result,setday:isday,upurlk:qq},
success: function (data) {
layer.close(msgid);
for(var i=0;i<data.length;i++){
if(data[i]==-1){
$('#loadingModal').modal('hide');
swal('上传失败', '未配置存储源,请先后台配置存储源');
@@ -739,18 +733,21 @@
arr_url += data[i] + '\r\n';
arr_markdown += '![ ](' + data[i] + ')\r\n';
arr_html += '<img src="' + data[i] + '" alt="Image" title="Image" /> \r\n';
arr_ddcode +='[img]'+data[i]+'[/img]\r\n';
}
if(urltypes==1){
$("#urls").text(arr_url);
}else if(urltypes==2){
$("#urls").text(arr_markdown);
}else{
}else if(urltypes==3){
$("#urls").text(arr_html);
}else{
$("#urls").text(arr_ddcode);
}
}
}
});
}else{Popups('网址格式错误','网址必须以http(s)://开头。','error');}
}else{layer.close(msgid);Popups('网址格式错误','网址必须以http(s)://开头。','error');}
}
}
@@ -772,8 +769,10 @@
$("#urls").text(arr_url);
}else if(urltypes==2){
$("#urls").text(arr_markdown);
}else{
}else if(urltypes==3){
$("#urls").text(arr_html);
}else{
$("#urls").text(arr_ddcode);
}
}
//获取当前时间
@@ -974,23 +973,28 @@
function setday() {
swal("输入图片期限(天),到期自动销毁图片,最高365天:\n(输入0为永久保存)", {
content: "input",
// text: "单位名称 <input type='text' name='myinput' id='jfdw'>"
// +"文件 <input type='text' name='myinput' id='jfwj'>"
// +"文号 <input type='text' name='myinput' id='jfwh'>"
// +"原因 <input type='text' name='myinput' id='jfyy'>",
html: true,
})
.then((value) => {
var result =value;
var reg=/^[0-9]\d*$/;
if(result!=null && result!="" ){
if(reg.test(result)){
if(result<=365){
isday = result;
// 初始化以后添加
uploader.options.formData.setday = isday;
var reg=/^[0-9]\d*$/;
if(result!=null && result!="" ){
if(reg.test(result)){
if(result<=365){
isday = result;
// 初始化以后添加
uploader.options.formData.setday = isday;
}else{
swal('输入天数有误,最大不可超过365天');
}
}else{
swal('输入天数有误,最大不可超过365天');
swal('输入格式不正确,只可输入0-9之间正整数');
}
}else{
swal('输入格式不正确,只可输入0-9之间正整数');
}
}
if(isday>0){
$('#setday').text(isday+'天后销毁');
}else{
@@ -998,6 +1002,74 @@
}
});
}
var win = null;
//浏览器窗口大小变化时
$(window).resize(function() {
var window_width = $(window).width();//获取浏览器窗口宽度
var window_height = $(window).height();//获取浏览器窗口高度
if(window_width<880){
layer.full(win);
}
});
function Popup(url,pass) {
layer.close(win);
if(pass==null || pass==''){
pass = '无'
}
var imgbase64 = jrQrcode.getQrBase64(url);
var body = '<div class="layui-row">\n' +
'<form class="layui-form" action="">\n' +
'<div class="layui-form-item" style="width: 80%;margin: 20px auto;">\n' +
'<div class="layui-input-block" style="margin-left: 0px;">\n' +
'<input id="albumurl" value="'+url+'" style="color:#999;border-radius:5px;border:1px #999 solid;" readonly="readonly" type="text" name="title" lay-verify="title" class="layui-input">\n' +
'</div>\n' +
'<div class="layui-form-mid "style="width:100%;text-align: center;color: #999999;font-weight: 500;">画廊密码:<span id="ckey" style="font-weight: 600;">'+pass+'</span><button onclick="copyurl()" style="margin-left: 50px;" type="button" class="copyurl layui-btn layui-btn-sm layui-btn-normal">复制链接及密码</button></div>\n' +
'</div>\n' +
'</form>\n' +
'</div>\n' +
'<div class="layui-row">\n' +
'<div align="center"><img style="width: 150px;" src="'+imgbase64+'" /><p style="font-size: 12px;color: #999999;">将二维码分享给好友</p><p style="font-size: 12px;color: #999999;">对方通过扫码即可查看相册</p></div>\n' +
'</div>';
layer.open({
type: 1,
title:'画廊分享链接',
area: ['520px', '400px'], //宽高
//skin: 'layui-layer-demo', //样式类名
closeBtn: 1, //不显示关闭按钮
anim: 2,
shadeClose: false, //开启遮罩关闭
content: body
});
}
function copyurl() {
var data = "";
var k = $('#ckey').text();
var u = $('#albumurl').val();
if(k=='无'){
data = '画廊链接:'+u+ ' 复制这段内容后用浏览器打开,即可查看画廊哦';
}else{
data = '画廊链接:'+u+' 提取码:'+k+ ' 复制这段内容后用浏览器打开,即可查看画廊哦';
}
var copy = new ClipboardJS('.copyurl', {
text: function (trigger) {
return data;
}
});
copy.on('success', function (e) {
layer.msg('复制成功');
copy.off("success");
});
copy.on('error', function (e) {
layer.msg("复制失败");
copy.off("error");
});
}
</script>