修改包名;生成二维码功能逻辑调整
This commit is contained in:
		
							
								
								
									
										2
									
								
								backend/.idea/runConfigurations/MiniProgram.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								backend/.idea/runConfigurations/MiniProgram.xml
									
									
									
										generated
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
				
			|||||||
  <configuration default="false" name="MiniProgram" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
 | 
					  <configuration default="false" name="MiniProgram" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
 | 
				
			||||||
    <option name="ACTIVE_PROFILES" />
 | 
					    <option name="ACTIVE_PROFILES" />
 | 
				
			||||||
    <module name="microservice-provider-miniprogram-8080" />
 | 
					    <module name="microservice-provider-miniprogram-8080" />
 | 
				
			||||||
    <option name="SPRING_BOOT_MAIN_CLASS" value="com.school.Application" />
 | 
					    <option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.Application" />
 | 
				
			||||||
    <method v="2">
 | 
					    <method v="2">
 | 
				
			||||||
      <option name="Make" enabled="true" />
 | 
					      <option name="Make" enabled="true" />
 | 
				
			||||||
    </method>
 | 
					    </method>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school;
 | 
					package com.cxyxiaomo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.boot.SpringApplication;
 | 
					import org.springframework.boot.SpringApplication;
 | 
				
			||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
					import org.springframework.boot.autoconfigure.SpringBootApplication;
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Apply;
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.service.ApplyService;
 | 
					import com.cxyxiaomo.index.service.ApplyService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
@@ -1,17 +1,13 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Notice;
 | 
				
			||||||
import com.school.index.pojo.Notice;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.pojo.Report;
 | 
					import com.cxyxiaomo.index.service.NoticeService;
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					 | 
				
			||||||
import com.school.index.service.NoticeService;
 | 
					 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
					import org.springframework.web.bind.annotation.ResponseBody;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Controller
 | 
					@Controller
 | 
				
			||||||
@RequestMapping("notice")
 | 
					@RequestMapping("notice")
 | 
				
			||||||
public class NoticeController {
 | 
					public class NoticeController {
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.service.OtherService;
 | 
					import com.cxyxiaomo.index.service.OtherService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Report;
 | 
					import com.cxyxiaomo.index.pojo.Report;
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.service.ReportService;
 | 
					import com.cxyxiaomo.index.service.ReportService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.pojo.User;
 | 
					import com.cxyxiaomo.index.pojo.User;
 | 
				
			||||||
import com.school.index.service.UserService;
 | 
					import com.cxyxiaomo.index.service.UserService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.controller;
 | 
					package com.cxyxiaomo.index.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.awt.image.BufferedImage;
 | 
					import java.awt.image.BufferedImage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -14,7 +14,7 @@ import com.google.zxing.common.BitMatrix;
 | 
				
			|||||||
import com.google.zxing.BarcodeFormat;
 | 
					import com.google.zxing.BarcodeFormat;
 | 
				
			||||||
import com.google.zxing.EncodeHintType;
 | 
					import com.google.zxing.EncodeHintType;
 | 
				
			||||||
import com.google.zxing.MultiFormatWriter;
 | 
					import com.google.zxing.MultiFormatWriter;
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
					import org.springframework.web.bind.annotation.ResponseBody;
 | 
				
			||||||
@@ -29,16 +29,19 @@ public class toCodeController {
 | 
				
			|||||||
    private static final int RED = 0xDC143C;
 | 
					    private static final int RED = 0xDC143C;
 | 
				
			||||||
    private static final int GREEN = 0x008001;
 | 
					    private static final int GREEN = 0x008001;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${qrcode.save-path}")
 | 
				
			||||||
 | 
					    private String savePath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private toCodeController() {
 | 
					    private toCodeController() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static BufferedImage toBufferedImage(BitMatrix matrix,Integer isHealth) {
 | 
					    public static BufferedImage toBufferedImage(BitMatrix matrix, Integer isHealth) {
 | 
				
			||||||
        int width = matrix.getWidth();
 | 
					        int width = matrix.getWidth();
 | 
				
			||||||
        int height = matrix.getHeight();
 | 
					        int height = matrix.getHeight();
 | 
				
			||||||
        int color;
 | 
					        int color;
 | 
				
			||||||
        if (isHealth == 0){
 | 
					        if (isHealth == 0) {
 | 
				
			||||||
            color = RED;
 | 
					            color = RED;
 | 
				
			||||||
        }else{
 | 
					        } else {
 | 
				
			||||||
            color = GREEN;
 | 
					            color = GREEN;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        BufferedImage image = new BufferedImage(width, height,
 | 
					        BufferedImage image = new BufferedImage(width, height,
 | 
				
			||||||
@@ -51,9 +54,9 @@ public class toCodeController {
 | 
				
			|||||||
        return image;
 | 
					        return image;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void writeToFile(BitMatrix matrix, String format, File file,Integer isHealth)
 | 
					    public static void writeToFile(BitMatrix matrix, String format, File file, Integer isHealth)
 | 
				
			||||||
            throws IOException {
 | 
					            throws IOException {
 | 
				
			||||||
        BufferedImage image = toBufferedImage(matrix,isHealth);
 | 
					        BufferedImage image = toBufferedImage(matrix, isHealth);
 | 
				
			||||||
        if (!ImageIO.write(image, format, file)) {
 | 
					        if (!ImageIO.write(image, format, file)) {
 | 
				
			||||||
            throw new IOException("Could not write an image of format "
 | 
					            throw new IOException("Could not write an image of format "
 | 
				
			||||||
                    + format + " to " + file);
 | 
					                    + format + " to " + file);
 | 
				
			||||||
@@ -61,8 +64,8 @@ public class toCodeController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void writeToStream(BitMatrix matrix, String format,
 | 
					    public static void writeToStream(BitMatrix matrix, String format,
 | 
				
			||||||
                                     OutputStream stream,Integer isHealth) throws IOException {
 | 
					                                     OutputStream stream, Integer isHealth) throws IOException {
 | 
				
			||||||
        BufferedImage image = toBufferedImage(matrix,isHealth);
 | 
					        BufferedImage image = toBufferedImage(matrix, isHealth);
 | 
				
			||||||
        if (!ImageIO.write(image, format, stream)) {
 | 
					        if (!ImageIO.write(image, format, stream)) {
 | 
				
			||||||
            throw new IOException("Could not write an image of format " + format);
 | 
					            throw new IOException("Could not write an image of format " + format);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -70,14 +73,14 @@ public class toCodeController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @RequestMapping("/showCode")
 | 
					    @RequestMapping("/showCode")
 | 
				
			||||||
    @ResponseBody
 | 
					    @ResponseBody
 | 
				
			||||||
    public void showCode(String stuId,String name, Integer isHealth) throws Exception {
 | 
					    public void showCode(String stuId, String name, Integer isHealth) throws Exception {
 | 
				
			||||||
        String health;
 | 
					        String health;
 | 
				
			||||||
        if (isHealth == 1) {
 | 
					        if (isHealth == 1) {
 | 
				
			||||||
            health = "健康";
 | 
					            health = "健康";
 | 
				
			||||||
        }else{
 | 
					        } else {
 | 
				
			||||||
            health = "不健康";
 | 
					            health = "不健康";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        String text = stuId+" "+name+" "+health; // 二维码内容
 | 
					        String text = stuId + " " + name + " " + health; // 二维码内容
 | 
				
			||||||
        int width = 400; // 二维码图片宽度
 | 
					        int width = 400; // 二维码图片宽度
 | 
				
			||||||
        int height = 400; // 二维码图片高度
 | 
					        int height = 400; // 二维码图片高度
 | 
				
			||||||
        String format = "jpg";// 二维码的图片格式
 | 
					        String format = "jpg";// 二维码的图片格式
 | 
				
			||||||
@@ -88,7 +91,7 @@ public class toCodeController {
 | 
				
			|||||||
        BitMatrix bitMatrix = new MultiFormatWriter().encode(text,
 | 
					        BitMatrix bitMatrix = new MultiFormatWriter().encode(text,
 | 
				
			||||||
                BarcodeFormat.QR_CODE, width, height, hints);
 | 
					                BarcodeFormat.QR_CODE, width, height, hints);
 | 
				
			||||||
        // 生成二维码
 | 
					        // 生成二维码
 | 
				
			||||||
        File outputFile = new File("D:/毕设/school/wx/img" + File.separator + "code.jpg");
 | 
					        File outputFile = new File(savePath + File.separator + "code.jpg");
 | 
				
			||||||
        toCodeController.writeToFile(bitMatrix, format, outputFile,isHealth);
 | 
					        toCodeController.writeToFile(bitMatrix, format, outputFile, isHealth);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.dao;
 | 
					package com.cxyxiaomo.index.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Apply;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.dao;
 | 
					package com.cxyxiaomo.index.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Notice;
 | 
					import com.cxyxiaomo.index.pojo.Notice;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.dao;
 | 
					package com.cxyxiaomo.index.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Feedback;
 | 
					import com.cxyxiaomo.index.pojo.Feedback;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.dao;
 | 
					package com.cxyxiaomo.index.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Report;
 | 
					import com.cxyxiaomo.index.pojo.Report;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.dao;
 | 
					package com.cxyxiaomo.index.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.User;
 | 
					import com.cxyxiaomo.index.pojo.User;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,10 +1,8 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
					import org.springframework.format.annotation.DateTimeFormat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
public class Notice {
 | 
					public class Notice {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.index.pojo;
 | 
					package com.cxyxiaomo.index.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Apply;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.dao.ApplyDao;
 | 
					import com.cxyxiaomo.index.dao.ApplyDao;
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Apply;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.cxyxiaomo.index.pojo.Notice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface NoticeService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void addNotice(Notice notice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void delNotice(Integer id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    List<Notice> noticeList(Integer limit);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,11 +1,10 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.dao.NoticeDao;
 | 
					import com.cxyxiaomo.index.dao.NoticeDao;
 | 
				
			||||||
import com.school.index.pojo.Notice;
 | 
					import com.cxyxiaomo.index.pojo.Notice;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Feedback;
 | 
					import com.cxyxiaomo.index.pojo.Feedback;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.dao.OtherDao;
 | 
					import com.cxyxiaomo.index.dao.OtherDao;
 | 
				
			||||||
import com.school.index.pojo.Feedback;
 | 
					import com.cxyxiaomo.index.pojo.Feedback;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Report;
 | 
					import com.cxyxiaomo.index.pojo.Report;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.dao.ReportDao;
 | 
					import com.cxyxiaomo.index.dao.ReportDao;
 | 
				
			||||||
import com.school.index.dao.UserDao;
 | 
					import com.cxyxiaomo.index.dao.UserDao;
 | 
				
			||||||
import com.school.index.pojo.Report;
 | 
					import com.cxyxiaomo.index.pojo.Report;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.User;
 | 
					import com.cxyxiaomo.index.pojo.User;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					package com.cxyxiaomo.index.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.dao.UserDao;
 | 
					import com.cxyxiaomo.index.dao.UserDao;
 | 
				
			||||||
import com.school.index.pojo.User;
 | 
					import com.cxyxiaomo.index.pojo.User;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,16 +1,13 @@
 | 
				
			|||||||
package com.school.visitor.controller;
 | 
					package com.cxyxiaomo.visitor.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					import com.cxyxiaomo.index.pojo.Res;
 | 
				
			||||||
import com.school.index.pojo.Res;
 | 
					import com.cxyxiaomo.visitor.pojo.Visitor;
 | 
				
			||||||
import com.school.visitor.pojo.Visitor;
 | 
					import com.cxyxiaomo.visitor.service.VisitorService;
 | 
				
			||||||
import com.school.visitor.service.VisitorService;
 | 
					 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Controller;
 | 
					import org.springframework.stereotype.Controller;
 | 
				
			||||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
					import org.springframework.web.bind.annotation.ResponseBody;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Date;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@Controller
 | 
					@Controller
 | 
				
			||||||
@RequestMapping("visitor")
 | 
					@RequestMapping("visitor")
 | 
				
			||||||
public class VisitorController {
 | 
					public class VisitorController {
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.visitor.dao;
 | 
					package com.cxyxiaomo.visitor.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.visitor.pojo.Visitor;
 | 
					import com.cxyxiaomo.visitor.pojo.Visitor;
 | 
				
			||||||
import org.apache.ibatis.annotations.Mapper;
 | 
					import org.apache.ibatis.annotations.Mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package com.school.visitor.pojo;
 | 
					package com.cxyxiaomo.visitor.pojo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
package com.school.visitor.service;
 | 
					package com.cxyxiaomo.visitor.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.visitor.pojo.Visitor;
 | 
					import com.cxyxiaomo.visitor.pojo.Visitor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
package com.school.visitor.service.impl;
 | 
					package com.cxyxiaomo.visitor.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.school.visitor.dao.VisitorDao;
 | 
					import com.cxyxiaomo.visitor.dao.VisitorDao;
 | 
				
			||||||
import com.school.visitor.pojo.Visitor;
 | 
					import com.cxyxiaomo.visitor.pojo.Visitor;
 | 
				
			||||||
import com.school.visitor.service.VisitorService;
 | 
					import com.cxyxiaomo.visitor.service.VisitorService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,17 +0,0 @@
 | 
				
			|||||||
package com.school.index.service;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.school.index.pojo.Apply;
 | 
					 | 
				
			||||||
import com.school.index.pojo.Notice;
 | 
					 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface NoticeService {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void addNotice(Notice notice);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void delNotice(Integer id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    List<Notice> noticeList(Integer limit);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -12,3 +12,5 @@ spring:
 | 
				
			|||||||
mybatis:
 | 
					mybatis:
 | 
				
			||||||
  mapper-locations: classpath:mapper/*.xml
 | 
					  mapper-locations: classpath:mapper/*.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					qrcode:
 | 
				
			||||||
 | 
					  save-path: D:\qr_code
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.index.dao.ApplyDao">
 | 
					<mapper namespace="com.cxyxiaomo.index.dao.ApplyDao">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <insert id="applySub">
 | 
					    <insert id="applySub">
 | 
				
			||||||
        insert into apply
 | 
					        insert into apply
 | 
				
			||||||
@@ -15,12 +15,12 @@
 | 
				
			|||||||
    <select id="lastApply" resultType="java.lang.Integer">
 | 
					    <select id="lastApply" resultType="java.lang.Integer">
 | 
				
			||||||
        select * from apply where stu_id = #{id} and state = 0 limit 1
 | 
					        select * from apply where stu_id = #{id} and state = 0 limit 1
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="applyListNoReplay" resultType="com.school.index.pojo.Apply">
 | 
					    <select id="applyListNoReplay" resultType="com.cxyxiaomo.index.pojo.Apply">
 | 
				
			||||||
        select a.*,u.name,u.stu_id as stuId from apply a
 | 
					        select a.*,u.name,u.stu_id as stuId from apply a
 | 
				
			||||||
        left join user u on a.stu_id = u.id
 | 
					        left join user u on a.stu_id = u.id
 | 
				
			||||||
        where a.state = 0
 | 
					        where a.state = 0
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="myApply" resultType="com.school.index.pojo.Apply">
 | 
					    <select id="myApply" resultType="com.cxyxiaomo.index.pojo.Apply">
 | 
				
			||||||
        select a.*,u.name,u.stu_id as stuId from apply a
 | 
					        select a.*,u.name,u.stu_id as stuId from apply a
 | 
				
			||||||
        left join user u on a.stu_id = u.id
 | 
					        left join user u on a.stu_id = u.id
 | 
				
			||||||
        where a.stu_id = #{id}
 | 
					        where a.stu_id = #{id}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.index.dao.NoticeDao">
 | 
					<mapper namespace="com.cxyxiaomo.index.dao.NoticeDao">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <insert id="addNotice">
 | 
					    <insert id="addNotice">
 | 
				
			||||||
        insert into notice (title, content , time) values
 | 
					        insert into notice (title, content , time) values
 | 
				
			||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
    <delete id="delNotice">
 | 
					    <delete id="delNotice">
 | 
				
			||||||
        delete from notice where id = #{id}
 | 
					        delete from notice where id = #{id}
 | 
				
			||||||
    </delete>
 | 
					    </delete>
 | 
				
			||||||
    <select id="noticeList" resultType="com.school.index.pojo.Notice">
 | 
					    <select id="noticeList" resultType="com.cxyxiaomo.index.pojo.Notice">
 | 
				
			||||||
        select * from notice order by time desc
 | 
					        select * from notice order by time desc
 | 
				
			||||||
        <if test="limit!= ''">
 | 
					        <if test="limit!= ''">
 | 
				
			||||||
            limit ${limit}
 | 
					            limit ${limit}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.index.dao.OtherDao">
 | 
					<mapper namespace="com.cxyxiaomo.index.dao.OtherDao">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <insert id="subFeedback">
 | 
					    <insert id="subFeedback">
 | 
				
			||||||
        insert into feedback (title, content, time, user_id) values
 | 
					        insert into feedback (title, content, time, user_id) values
 | 
				
			||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
        update feedback set reply = #{replay}
 | 
					        update feedback set reply = #{replay}
 | 
				
			||||||
        where id = #{id}
 | 
					        where id = #{id}
 | 
				
			||||||
    </update>
 | 
					    </update>
 | 
				
			||||||
    <select id="feedbackList" resultType="com.school.index.pojo.Feedback">
 | 
					    <select id="feedbackList" resultType="com.cxyxiaomo.index.pojo.Feedback">
 | 
				
			||||||
        select * from feedback
 | 
					        select * from feedback
 | 
				
			||||||
        <where>
 | 
					        <where>
 | 
				
			||||||
            <if test="id != null">
 | 
					            <if test="id != null">
 | 
				
			||||||
@@ -19,7 +19,7 @@
 | 
				
			|||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="feedbackListNoReplay" resultType="com.school.index.pojo.Feedback">
 | 
					    <select id="feedbackListNoReplay" resultType="com.cxyxiaomo.index.pojo.Feedback">
 | 
				
			||||||
        select * from feedback where reply is null
 | 
					        select * from feedback where reply is null
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.index.dao.ReportDao">
 | 
					<mapper namespace="com.cxyxiaomo.index.dao.ReportDao">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <insert id="doReport">
 | 
					    <insert id="doReport">
 | 
				
			||||||
        insert into report
 | 
					        insert into report
 | 
				
			||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
        (#{user_id},#{name},#{address},#{time},#{normal},#{yes_noon_temp},
 | 
					        (#{user_id},#{name},#{address},#{time},#{normal},#{yes_noon_temp},
 | 
				
			||||||
        #{yes_night_temp},#{today_morning_temp},#{isolation})
 | 
					        #{yes_night_temp},#{today_morning_temp},#{isolation})
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
    <select id="myReport" resultType="com.school.index.pojo.Report">
 | 
					    <select id="myReport" resultType="com.cxyxiaomo.index.pojo.Report">
 | 
				
			||||||
        select name,time,normal,address from report where user_id = #{id}
 | 
					        select name,time,normal,address from report where user_id = #{id}
 | 
				
			||||||
        order by time desc
 | 
					        order by time desc
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.index.dao.UserDao">
 | 
					<mapper namespace="com.cxyxiaomo.index.dao.UserDao">
 | 
				
			||||||
    <insert id="addUser">
 | 
					    <insert id="addUser">
 | 
				
			||||||
        insert into user
 | 
					        insert into user
 | 
				
			||||||
        (username, name, password, role, stu_id) values
 | 
					        (username, name, password, role, stu_id) values
 | 
				
			||||||
@@ -19,20 +19,20 @@
 | 
				
			|||||||
        update user set state = #{date}
 | 
					        update user set state = #{date}
 | 
				
			||||||
        where id = #{id}
 | 
					        where id = #{id}
 | 
				
			||||||
    </update>
 | 
					    </update>
 | 
				
			||||||
    <select id="selectAll" resultType="com.school.index.pojo.User">
 | 
					    <select id="selectAll" resultType="com.cxyxiaomo.index.pojo.User">
 | 
				
			||||||
        select * from `user`
 | 
					        select * from `user`
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="getUserByUsername" resultType="com.school.index.pojo.User">
 | 
					    <select id="getUserByUsername" resultType="com.cxyxiaomo.index.pojo.User">
 | 
				
			||||||
        select * from user where username = #{username}
 | 
					        select * from user where username = #{username}
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="getUser" resultType="com.school.index.pojo.User">
 | 
					    <select id="getUser" resultType="com.cxyxiaomo.index.pojo.User">
 | 
				
			||||||
        select * from user where username = #{username} and role_id = #{role}
 | 
					        select * from user where username = #{username} and role_id = #{role}
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="redCodeList" resultType="com.school.index.pojo.User">
 | 
					    <select id="redCodeList" resultType="com.cxyxiaomo.index.pojo.User">
 | 
				
			||||||
        select name,stu_id from user where TO_DAYS(NOW( )) != TO_DAYS(state) and role = 2
 | 
					        select name,stu_id from user where TO_DAYS(NOW( )) != TO_DAYS(state) and role = 2
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="redCodeList2" resultType="com.school.index.pojo.User">
 | 
					    <select id="redCodeList2" resultType="com.cxyxiaomo.index.pojo.User">
 | 
				
			||||||
        select name,stu_id from user where state = "1999-01-01"
 | 
					        select name,stu_id from user where state = "1999-01-01"
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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">
 | 
					<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<mapper namespace="com.school.visitor.dao.VisitorDao">
 | 
					<mapper namespace="com.cxyxiaomo.visitor.dao.VisitorDao">
 | 
				
			||||||
    <insert id="visitorApply">
 | 
					    <insert id="visitorApply">
 | 
				
			||||||
        insert into visitor
 | 
					        insert into visitor
 | 
				
			||||||
        (time,phone,issue,meet_name,create_time) values
 | 
					        (time,phone,issue,meet_name,create_time) values
 | 
				
			||||||
@@ -19,7 +19,7 @@
 | 
				
			|||||||
    <select id="showMyVisitor" resultType="java.lang.Integer">
 | 
					    <select id="showMyVisitor" resultType="java.lang.Integer">
 | 
				
			||||||
        select state from visitor where phone = #{phone} and TO_DAYS(NOW( )) - TO_DAYS(time) = 0
 | 
					        select state from visitor where phone = #{phone} and TO_DAYS(NOW( )) - TO_DAYS(time) = 0
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
    <select id="showVisitorList" resultType="com.school.visitor.pojo.Visitor">
 | 
					    <select id="showVisitorList" resultType="com.cxyxiaomo.visitor.pojo.Visitor">
 | 
				
			||||||
        select * from visitor where state = 0
 | 
					        select * from visitor where state = 0
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,8 +5,8 @@ const baseUrl = app.globalData.baseUrl
 | 
				
			|||||||
var util = require('../../utils/util.js');
 | 
					var util = require('../../utils/util.js');
 | 
				
			||||||
Page({
 | 
					Page({
 | 
				
			||||||
  data: {
 | 
					  data: {
 | 
				
			||||||
    imgUrl: '../../img/code.jpg',
 | 
					    imgUrl: '',
 | 
				
			||||||
    stuId: '',
 | 
					    stuId: wx.getStorageSync('stuId'),
 | 
				
			||||||
    name: wx.getStorageSync('name'),
 | 
					    name: wx.getStorageSync('name'),
 | 
				
			||||||
    isHealth: 0,
 | 
					    isHealth: 0,
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -14,36 +14,37 @@ Page({
 | 
				
			|||||||
   * 生命周期函数--监听页面加载
 | 
					   * 生命周期函数--监听页面加载
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  onLoad: function (options) {
 | 
					  onLoad: function (options) {
 | 
				
			||||||
    this.setData({
 | 
					    console.log("onLoad")
 | 
				
			||||||
      stuId: wx.getStorageSync('stuId'),
 | 
					 | 
				
			||||||
      name: wx.getStorageSync('name')
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
    this.onShow()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * 生命周期函数--监听页面初次渲染完成
 | 
					   * 生命周期函数--监听页面初次渲染完成
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  onReady: function () {
 | 
					  onReady: function () {
 | 
				
			||||||
 | 
					    console.log("onReady")
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onPullDownRefresh: function () {
 | 
				
			||||||
 | 
					    console.log("onPullDownRefresh");
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  onRefresh: function () {
 | 
				
			||||||
 | 
					    console.log("onRefresh");
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * 生命周期函数--监听页面显示
 | 
					   * 生命周期函数--监听页面显示
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  onShow: function () {
 | 
					  onShow: function () {
 | 
				
			||||||
 | 
					    console.log("onShow");
 | 
				
			||||||
 | 
					    this.updateQrCode();
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  updateQrCode: function () {
 | 
				
			||||||
    this.setData({
 | 
					    this.setData({
 | 
				
			||||||
      stuId: wx.getStorageSync('stuId'),
 | 
					      stuId: wx.getStorageSync('stuId'),
 | 
				
			||||||
      name: wx.getStorageSync('name')
 | 
					      name: wx.getStorageSync('name')
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    setInterval(() => {
 | 
					 | 
				
			||||||
      var time = util.formatTime(new Date())
 | 
					 | 
				
			||||||
      //为页面中time赋值
 | 
					 | 
				
			||||||
      this.setData({
 | 
					 | 
				
			||||||
        time: time
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    }, 1000);
 | 
					 | 
				
			||||||
    if (wx.getStorageSync("state") == this.formatDate(new Date())) {
 | 
					    if (wx.getStorageSync("state") == this.formatDate(new Date())) {
 | 
				
			||||||
      this.setData({
 | 
					      this.setData({
 | 
				
			||||||
        isHealth: 1
 | 
					        isHealth: 1
 | 
				
			||||||
@@ -53,6 +54,9 @@ Page({
 | 
				
			|||||||
        isHealth: 0
 | 
					        isHealth: 0
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    wx.showLoading({
 | 
				
			||||||
 | 
					      title: '请稍候'
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
    wx.request({
 | 
					    wx.request({
 | 
				
			||||||
      url: `${baseUrl}/code/showCode`,
 | 
					      url: `${baseUrl}/code/showCode`,
 | 
				
			||||||
      data: {
 | 
					      data: {
 | 
				
			||||||
@@ -60,9 +64,36 @@ Page({
 | 
				
			|||||||
        name: this.data.name,
 | 
					        name: this.data.name,
 | 
				
			||||||
        isHealth: this.data.isHealth
 | 
					        isHealth: this.data.isHealth
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      success: function (d) {}
 | 
					      success: (data) => {
 | 
				
			||||||
 | 
					        console.log(data)
 | 
				
			||||||
 | 
					        this.setData({
 | 
				
			||||||
 | 
					          imgUrl: '../../img/greenCode.png'
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        wx.hideLoading()
 | 
				
			||||||
 | 
					        wx.showToast({
 | 
				
			||||||
 | 
					          title: '加载成功',
 | 
				
			||||||
 | 
					          icon: 'none',
 | 
				
			||||||
 | 
					          duration: 800
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        setInterval(() => {
 | 
				
			||||||
 | 
					          var time = util.formatTime(new Date())
 | 
				
			||||||
 | 
					          //为页面中time赋值
 | 
				
			||||||
 | 
					          this.setData({
 | 
				
			||||||
 | 
					            time: time
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }, 1000);
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      fail: (error) => {
 | 
				
			||||||
 | 
					        console.log(error)
 | 
				
			||||||
 | 
					        wx.hideLoading()
 | 
				
			||||||
 | 
					        wx.showModal({
 | 
				
			||||||
 | 
					          title: '加载失败',
 | 
				
			||||||
 | 
					          showCancel: false
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  formatDate: function (date) {
 | 
					  formatDate: function (date) {
 | 
				
			||||||
    let year = date.getFullYear()
 | 
					    let year = date.getFullYear()
 | 
				
			||||||
    let month = date.getMonth() + 1
 | 
					    let month = date.getMonth() + 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
<view style="text-align: center;margin-top: 100px;">
 | 
					<view style="text-align: center;margin-top: 100px;">
 | 
				
			||||||
  <image src="{{imgUrl}}"></image>
 | 
					  <view><text>{{stuId}} {{name}}</text></view>
 | 
				
			||||||
  <view><text class="user-motto">{{stuId}}</text></view>
 | 
					  <image id="qrcode" src="{{imgUrl}}"></image>
 | 
				
			||||||
  <view><text class="user-motto">{{name}}</text></view>
 | 
					  <view><text class="time-text">{{time}}</text></view>
 | 
				
			||||||
  <view><text class="user-motto">{{time}}</text></view>
 | 
					 | 
				
			||||||
</view>
 | 
					</view>
 | 
				
			||||||
@@ -1 +1,9 @@
 | 
				
			|||||||
/* pages/home/code.wxss */
 | 
					/* pages/home/code.wxss */
 | 
				
			||||||
 | 
					.time-text {
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#qrcode {
 | 
				
			||||||
 | 
					    width: 70vw;
 | 
				
			||||||
 | 
					    height: 70vw;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user