master
mfay 4 years ago
parent 528d279bac
commit 7049d8fe02
  1. BIN
      20221020教师出入校审批系统-v2(1).docx
  2. 1
      IOReportSysBE/WW_verify_EdOZDpJGkCM11pc2.txt
  3. 1
      IOReportSysBE/src/main/java/edu/ncst/ioreport/config/SecurityConfig.java
  4. 6
      IOReportSysBE/src/main/java/edu/ncst/ioreport/config/security/provider/WechatIdLoginProvider.java
  5. 16
      IOReportSysBE/src/main/java/edu/ncst/ioreport/controller/UserController.java
  6. 51
      IOReportSysBE/src/main/java/edu/ncst/ioreport/utils/WeChatUtils.java
  7. 4
      IOReportSysBE/src/main/resources/application.yml
  8. 3
      IOReportSysMP/miniprogram/api/userApi/userApi.ts
  9. 28
      IOReportSysMP/miniprogram/app.ts
  10. 263
      IOReportSysMP/miniprogram/pages/health-card/healthcard.js
  11. 3
      IOReportSysMP/miniprogram/pages/health-card/healthcard.json
  12. 66
      IOReportSysMP/miniprogram/pages/health-card/healthcard.scss
  13. 216
      IOReportSysMP/miniprogram/pages/health-card/healthcard.ts
  14. 47
      IOReportSysMP/miniprogram/pages/health-card/healthcard.wxml
  15. 10
      IOReportSysMP/miniprogram/pages/index/index.js
  16. 13
      IOReportSysMP/miniprogram/pages/index/index.ts
  17. 6
      IOReportSysMP/miniprogram/pages/index/index.wxml
  18. 261
      IOReportSysMP/miniprogram/pages/travel-card/travelcard.js
  19. 3
      IOReportSysMP/miniprogram/pages/travel-card/travelcard.json
  20. 66
      IOReportSysMP/miniprogram/pages/travel-card/travelcard.scss
  21. 212
      IOReportSysMP/miniprogram/pages/travel-card/travelcard.ts
  22. 47
      IOReportSysMP/miniprogram/pages/travel-card/travelcard.wxml
  23. 2
      IOReportSysMP/miniprogram/utils/util.ts
  24. 1625
      IOReportSysMP/miniprogram/utils/weapp-qrcode/weapp-qrcode.js
  25. 2
      docker安装redis并设置密码.md
  26. BIN
      教师进出校报备管理系统待确认事项.docx
  27. BIN
      界面.docx

@ -90,6 +90,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/api/image/get/**",
"/*.html",
"/**/*.html",
"/**/*.txt",
"/**/*.css",
"/**/*.js",
"/error*",

@ -9,6 +9,7 @@ import edu.ncst.ioreport.vo.SessionKey;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
@ -22,6 +23,9 @@ public class WechatIdLoginProvider implements AuthenticationProvider {
@Autowired
private IUserService userService;
@Autowired
private RedisTemplate<String, String> stringRedisTemplate;
@SneakyThrows
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
@ -34,7 +38,7 @@ public class WechatIdLoginProvider implements AuthenticationProvider {
WechatIdAuthenticationToken token = (WechatIdAuthenticationToken) authentication;
String code = token.getWechatCode();
SessionKey sessionKeyDTO = WeChatUtils.code2session(code);
SessionKey sessionKeyDTO = WeChatUtils.code2session(code,stringRedisTemplate);
if (sessionKeyDTO == null) {
return null;

@ -44,7 +44,7 @@ public class UserController {
@ApiOperation("获取用户列表")
@PostMapping("/login")
public ResultVO<String> loginByWechat(HttpServletRequest request , @RequestParam String weChatCode,UserLoginVO paramUserLoginVO) {
public ResultVO<SessionKey> loginByWechat(HttpServletRequest request , @RequestParam(required = false) String weChatCode,UserLoginVO paramUserLoginVO) {
try {
if(paramUserLoginVO==null){
paramUserLoginVO = new ObjectMapper().readValue(request.getInputStream(), UserLoginVO.class);
@ -59,19 +59,15 @@ public class UserController {
if(StringUtil.isNullOrEmpty(weChatCode)){
throw new BusinessException(CodeMsg.PARAM_ERROR.fillArgs("登录信息不全"));
}
String wechatId = stringRedisTemplate.opsForValue().get("WECHATID#"+weChatCode);
if(StringUtil.isNullOrEmpty(wechatId)){
SessionKey sessionKeyDTO = WeChatUtils.code2session(weChatCode);
if (sessionKeyDTO == null) {
throw new BusinessException(CodeMsg.LOGIN_FAIL);
}
wechatId = sessionKeyDTO.getWeChatId();
stringRedisTemplate.opsForValue().set("WECHATID#"+weChatCode,wechatId,2, TimeUnit.DAYS);
SessionKey sessionKeyDTO = WeChatUtils.code2session(weChatCode,stringRedisTemplate);
if (sessionKeyDTO == null) {
throw new BusinessException(CodeMsg.LOGIN_FAIL);
}
return ResultUtils.success("ok",wechatId);
return ResultUtils.success("ok",sessionKeyDTO);
}
}
//
// @ApiOperation("获取用户列表")
// @GetMapping("/list")

@ -1,49 +1,64 @@
package edu.ncst.ioreport.utils;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import edu.ncst.ioreport.exception.BusinessException;
import edu.ncst.ioreport.vo.AccessToken;
import edu.ncst.ioreport.vo.SessionKey;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.concurrent.TimeUnit;
@Component
public class WeChatUtils {
private static final RestTemplate restTemplate;
//测试企业
private static final String corpId = "ww17f8d10783494584";
private static final String corpsecret = "i5t-rh8bXeNCgihcYPrG9ZPpWkivzPJ69sv570osk6I";
// private static final String corpId = "wwcb1e222a0708b4fc";
// private static final String corpsecret = "uWh34kbYvxR7txvICe97mrGIuooLRfhsWi5YBPWLuAg";
//教务处真实数据
// private static final String corpId = "wx61dd7aa1b722739c";
// private static final String corpsecret = "nxThL1GQnA2aXLCf2MEk3VZ4fPZ95uEYfqcnH--dWrA";
//
static {
restTemplate = new RestTemplate();
}
// 根据 Code 获取 Session
public static SessionKey code2session(String code) {
// 获取 accesstoken
String gettoken = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" + corpId + "&corpsecret=" + corpsecret + "&js_code=" +
code + "&grant_type=authorization_code";
public static SessionKey code2session(String code,RedisTemplate<String, String> stringRedisTemplate) {
//获取Sessionid和userid
String jscode2session = "https://qyapi.weixin.qq.com/cgi-bin/miniprogram/jscode2session?access_token=%s&js_code=%s&grant_type=authorization_code";
ResponseEntity<String> response = restTemplate.getForEntity(gettoken, String.class);
ObjectMapper objectMapper = new ObjectMapper();
SessionKey session = null;
SessionKey session=new SessionKey();
try {
AccessToken accessToken = objectMapper.readValue(response.getBody(), AccessToken.class);
response = restTemplate.getForEntity(String.format(jscode2session, accessToken.getAccessToken(), code), String.class);
session = objectMapper.readValue(response.getBody(), SessionKey.class);
String tokenStr = stringRedisTemplate.opsForValue().get("ACCESSTOKEN");
AccessToken token=null;
ObjectMapper objectMapper = new ObjectMapper();
ResponseEntity<String> response;
if(!StringUtil.isNullOrEmpty(tokenStr)){
token = JSON.parseObject(tokenStr,AccessToken.class);
}
if(token == null){
// 获取 accesstoken
String gettoken = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" + corpId + "&corpsecret=" + corpsecret;
response = restTemplate.getForEntity(gettoken, String.class);
token = objectMapper.readValue(response.getBody(), AccessToken.class);
stringRedisTemplate.opsForValue().set("ACCESSTOKEN", JSON.toJSONString(token),118, TimeUnit.MINUTES);
}else{
String jscode2session = "https://qyapi.weixin.qq.com/cgi-bin/miniprogram/jscode2session?access_token=%s&js_code=%s&grant_type=authorization_code";
response = restTemplate.getForEntity(String.format(jscode2session, token.getAccessToken(), code), String.class);
session = objectMapper.readValue(response.getBody(), SessionKey.class);
}
} catch (JsonProcessingException e) {
e.printStackTrace();
throw new BusinessException("登录失败"+e);
}
return session;
}
}

@ -7,12 +7,12 @@ spring:
password:
hikari:
max-lifetime: 300000
# redis password: redis221024 #redis 服务器连接密码 默认为空
# redis password: redis221024 hbljjg@2020 #redis 服务器连接密码 默认为空
redis:
database: 0 #redis 数据库索引(默认为0)
host: 127.0.0.1 #redis 服务器地址
port: 6379 #redis 服务器连接端口号
password: hbljjg@2020 #redis 服务器连接密码 默认为空
password: redis221024 #redis 服务器连接密码 默认为空
lettuce:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制) 默认8

@ -14,8 +14,9 @@ const getCurrentUser = async (wechatID:string)=>{
params.token = token
params.parameters=""
params = JSON.stringify(params)
// console.log(params)
console.log(params)
let res =await request({url: BASE_URL + 'api/users/FunctionCall/', method: 'POST',data:params })
console.log(res)
return res
}

@ -39,15 +39,25 @@ App<IAppOption>({
data: {weChatCode:code},
success: (res: any) => {
if(res&&res.data&&res.data.data){
wx.showToast({
title: '登录成功',
icon: 'success'
});
wx.setStorageSync(constant.WECHATID, res.data.data);
this.globalData.wechatID = res.data.data
if (this.userInfoReadyCallback){
this.userInfoReadyCallback(res.data.data);
}
let sessionKey = res.data.data;
if(!sessionKey.weChatId){
wx.showModal({
title:"登录失败",
content:"请联系管理员:"+sessionKey.errmsg,
showCancel:false
})
}else{
wx.showToast({
title: '登录成功',
icon: 'success'
});
wx.setStorageSync(constant.WECHATID, sessionKey.weChatId);
this.globalData.wechatID = sessionKey.weChatId
if (this.userInfoReadyCallback){
this.userInfoReadyCallback(sessionKey.weChatId);
}
}
}else{
wx.showToast({
title: '登录失败: '+res.msg,

@ -1,263 +0,0 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var constant_1 = __importDefault(require("../../utils/constant"));
var index_1 = __importDefault(require("../../services/index"));
var util_1 = require("../../utils/util");
var recordType = {
GREEN: '绿色',
YELLOW: "黄色",
RED: '红色'
};
// pages/health-card/healthcard.ts
Page({
/**
* 页面的初始数据
*/
data: {
count: 2,
files: [],
images: [],
uploadImg: "",
base64File: "",
showUpload: true,
user: {},
nomore: false,
recordType: recordType
},
clearImg: function (e) {
this.setData({
uploadImg: "",
base64File: "",
showUpload: true
});
},
chooseBase64Image: function () {
var _this = this;
var that = this;
wx.showLoading({ title: '图片上传中' });
return new Promise(function (resolve, reject) {
wx.chooseImage({
sizeType: ['original', 'compressed'],
count: 1,
sourceType: ['album'],
success: function (res) {
var tempFilePath = res.tempFilePaths[0];
var tempFile = res.tempFiles[0];
console.log(res);
console.log(tempFile);
// 返回选定照片的本地文件路径,tempFilePath可以作为img标签的src属性显示图片
that.setData({
uploadImg: tempFilePath,
});
wx.getImageInfo({
src: tempFilePath,
success: function (imageInfo) {
var imgType = imageInfo.type;
wx.getFileSystemManager().readFile({
filePath: tempFilePath,
encoding: "base64",
success: function (res) {
//返回base64格式
var base64Str = 'data:image/' + imgType + ';base64,' + res.data;
console.log(base64Str);
_this.setData({ base64File: base64Str, showUpload: false });
resolve(base64Str);
wx.hideLoading();
},
fail: function (err) {
console.log(err);
reject(err);
}
});
}
});
},
fail: function (err) {
console.log(err);
}
});
});
},
loadMore: function () {
return __awaiter(this, void 0, void 0, function () {
var count;
return __generator(this, function (_a) {
if (this.data.nomore) {
wx.showToast({ title: "已经到头了~" });
}
else {
count = this.data.count + 2;
this.setData({ count: count });
//console.log(this.data)
this.getCards(this.data.user);
}
return [2 /*return*/];
});
});
},
getCards: function (query) {
return __awaiter(this, void 0, void 0, function () {
var res, records;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, index_1.default.API.materialUpload.getIORecordsList.request({ userID: query.userID, type: "health", count: this.data.count })];
case 1:
res = _a.sent();
// console.log(res);
if (res && res.data) {
records = res.data;
if (records.length < this.data.count) {
this.setData({ nomore: true });
}
records.map(function (record) {
var imagePath = record.imagePath;
if (imagePath) {
var url = util_1.BASE_URL + "/api/image/get" + imagePath;
var tempMap = _this.data.images;
tempMap.push(url);
_this.setData({ images: tempMap });
}
});
this.setData({ files: res.data });
}
return [2 /*return*/];
}
});
});
},
previewImg: function (e) {
console.log(e.currentTarget.dataset);
console.log(this.data.fileUrls);
var urls = [];
urls.push(e.currentTarget.dataset.src);
wx.previewImage({
urls: urls,
});
},
onSubmit: function (_a) {
var detail = _a.detail;
return __awaiter(this, void 0, void 0, function () {
var submitRecord, res, reportid;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
// TODO gen order
if (!this.data.teacherID) {
wx.showToast({
title: '提交失败,缺少用户信息',
icon: 'none'
});
}
submitRecord = __assign(__assign({}, detail.value), { ioType: this.data.ioTypesArray.indexOf(this.data.ioType), teacherID: this.data.teacherID, commitTime: this.data.applyDate + ' ' + this.data.applyTime + ":00" });
return [4 /*yield*/, index_1.default.API.iORecords.addIORecord.request(submitRecord)];
case 1:
res = _b.sent();
console.log(res);
if (res && res.data) {
reportid = res.data;
wx.setStorageSync("myReport/myReport", reportid);
}
return [2 /*return*/];
}
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
// wx.removeStorageSync(constant.USER_INFO);
var user = wx.getStorageSync(constant_1.default.USER_INFO);
if (!user) {
wx.navigateTo({ url: "../../index/index" });
}
this.getCards(user);
this.setData(__assign(__assign({}, this.data), user));
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});

@ -1,66 +0,0 @@
.card-container {
margin: 20rpx;
background-color: var(--color-gray-0);
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
font-size: 17px;
// font-weight: 550;
.card-col-1 {
padding: 24rpx 0;
display: flex;
width: auto;
& yinput:nth-child(1) {
flex: 4 1 50px;
margin: 0 5rpx;
}
& yinput:nth-child(2) {
flex: 7 1 50px;
margin:0 5rpx;
}
}
}
.input-container {
padding-bottom: 80rpx;
.card-col-1 {
display: flex;
margin: 0 2px;
:nth-child(n) {
flex: 1 1 0;
}
}
}
.ui_uploader_item{
padding: 0 20rpx;
display: flex;
justify-content: flex-start;
icon{
flex:1
}
.image{
flex:15;
padding-bottom: 100rpx;
image{
width:500rpx
}
}
.submit-button {
position: fixed;
bottom: 0;
left: 0;
background-color: var(--color-primary);
color: white;
width: 100%;
border-radius: 0;
z-index: 99;
}
}

@ -1,216 +0,0 @@
import constant from "../../utils/constant"
import { IORecords, User } from '../../services/baseClass'
import services from "../../services/index"
import { BASE_URL } from '../../utils/util';
const recordType = {
GREEN: '绿色',
YELLOW: "黄色",
RED:'红色'
}
// pages/health-card/healthcard.ts
Page({
/**
*
*/
data: {
count:2,
files:[],
images:[],
uploadImg:"",
base64File:"",
showUpload:true,
user:{},
nomore:false,
recordType
},
clearImg(e) {
this.setData({
uploadImg: "",
base64File: "",
showUpload: true
})
},
chooseBase64Image() {
const that = this;
wx.showLoading({ title: '图片上传中' });
return new Promise((resolve, reject) => {
wx.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
count:1,
sourceType: ['album'], // 可以指定来源是相册还是相机,默认二者都有
success: (res)=> {
let tempFilePath = res.tempFilePaths[0];
let tempFile = res.tempFiles[0];
console.log(res);
console.log(tempFile);
// 返回选定照片的本地文件路径,tempFilePath可以作为img标签的src属性显示图片
that.setData({
uploadImg: tempFilePath,
});
wx.getImageInfo({
src:tempFilePath,
success:(imageInfo)=>{
var imgType = imageInfo.type
wx.getFileSystemManager().readFile({
filePath: tempFilePath, //选择图片返回的相对路径
encoding: "base64", //这个是很重要的
success: res => { //成功的回调
//返回base64格式
var base64Str = 'data:image/' + imgType + ';base64,' + res.data
console.log(base64Str)
this.setData({base64File:base64Str,showUpload:false})
resolve(base64Str)
wx.hideLoading();
},
fail: err => {
console.log(err)
reject(err)
}
})
}
})
},
fail: (err) => {
console.log(err)
}
});
})
},
async loadMore() {
if(this.data.nomore){
wx.showToast({title:"已经到头了~"})
}else{
let count = this.data.count+2;
this.setData({count:count});
//console.log(this.data)
this.getCards(this.data.user)
}
},
async getCards(query?:any){
let res = await services.API.materialUpload.getIORecordsList.request({userID:query.userID,type:"health",count:this.data.count});
// console.log(res);
if(res&&res.data){
let records = res.data
if(records.length<this.data.count){
this.setData({nomore:true})
}
records.map((record)=>{
let imagePath = record.imagePath
if(imagePath){
let url = BASE_URL + "/api/image/get"+imagePath;
let tempMap = this.data.images;
tempMap.push(url);
this.setData({images:tempMap})
}
})
this.setData({files:res.data})
}
},
previewImg(e) {
console.log(e.currentTarget.dataset);
console.log(this.data.fileUrls);
let urls = [];
urls.push(e.currentTarget.dataset.src)
wx.previewImage({
urls: urls, // 需要预览的图片http链接列表
});
},
onSubmit:async function({ detail }: { detail: any}) {
// TODO gen order
if(!this.data.teacherID){
wx.showToast({
title: '提交失败,缺少用户信息',
icon: 'none'
});
}
const submitRecord: IORecords = {
...detail.value,
ioType:this.data.ioTypesArray.indexOf(this.data.ioType),
teacherID:this.data.teacherID,
commitTime: this.data.applyDate + ' ' + this.data.applyTime+":00",
}
let res = await services.API.iORecords.addIORecord.request(submitRecord);
console.log(res);
if(res&&res.data){
let reportid = res.data;
wx.setStorageSync("myReport/myReport", reportid)
}
},
/**
* --
*/
onLoad() {
// wx.removeStorageSync(constant.USER_INFO);
let user = wx.getStorageSync(constant.USER_INFO);
if(!user){
wx.navigateTo({url:"../../index/index"})
}
this.getCards(user)
this.setData({
...this.data,
...(user as User)
})
},
/**
* --
*/
onReady() {
},
/**
* --
*/
onShow() {
},
/**
* --
*/
onHide() {
},
/**
* --
*/
onUnload() {
},
/**
* --
*/
onPullDownRefresh() {
},
/**
*
*/
onReachBottom() {
},
/**
*
*/
onShareAppMessage() {
}
})

@ -1,47 +0,0 @@
<navigationBar title="健康码"></navigationBar>
<view class="card-container">
<view class="card-col-1">
<yinput onlyRead padding="0" label="工号:" bindValue="teacherID" value="{{teacherID}}"></yinput>
<yinput onlyRead padding="0" label="姓名:" bindValue="name" value="{{name}}"></yinput>
</view>
</view>
<view class="page__bd">
<view class="weui-panel__bd" wx:for="{{files}}" wx:key="index">
<view aria-labelledby="js_p1m1_bd" class="weui-media-box weui-media-box_appmsg">
<view aria-hidden="true" class="weui-media-box__hd">
<image class="weui-media-box__thumb" data-src="{{images[index]}}" src="{{images[index]}}" bindtap="previewImg"></image>
</view>
<view aria-hidden="true" id="js_p1m1_bd" class="weui-media-box__bd">
<text class="weui-media-box__title">{{recordType[item.healthStatus]}}</text>
<view class="weui-media-box__desc">上传时间:{{item.uploadTime}}</view>
<view class="weui-media-box__desc">检测时间:{{item.testResultTime}}</view>
<view class="weui-media-box__desc">报告生成:{{item.genTime}}</view>
</view>
</view>
</view>
<view class="weui-panel__ft">
<view class="weui-cell weui-cell_active weui-cell_access weui-cell_link" wx:if="{{!nomore}}">
<text class="weui-cell__bd" bindtap="loadMore">查看更多</text>
<text class="weui-cell__ft" ></text>
</view>
<view class="weui-cell weui-cell_active weui-cell_access weui-cell_link" wx:if="{{nomore}}" >
<text class="weui-cell__bd" style="text-align: center;" bindtap="loadMore" >到头了~</text>
</view>
</view>
<view class="weui-uploader__input-box" wx:if="{{showUpload}}">
<view aria-role="button" aria-label="上传" class="weui-uploader__input" bindtap="chooseBase64Image" ></view>
</view>
<!-- 根据已选择的图片临时路径数组展示图片 -->
<view class='ui_uploader_item' wx:if="{{!showUpload}}">
<!-- 删除 -->
<icon class='ui_uploader_item_icon' bindtap='clearImg' type="clear" size="30" color="red"/>
<!-- 图片 -->
<view class="image">
<image mode="aspectFit" bindtap='previewImg' data-src="{{uploadImg}}" src='{{uploadImg}}'></image>
</view>
<view class="submit-button">
<ybutton bindtap="onPass" class="button-item" lineHeight="50px" title="确认上传" bgColor="var(--color-primary)" />
</view>
</view>
</view>

@ -160,19 +160,19 @@ Page({
},
uploadTravelCard: function () {
var that = this;
wx.showLoading({ title: '行程上传中' });
wx.showLoading({ title: '行程上传中' });
this.chooseBase64Image().then(function (suc) {
orderApi_1.default.uploadTripCode({ ImageBase64: suc.base64File, ext: suc.imgType }).then(function (res) {
wx.hideLoading();
if (res && res.data && res.data.success) {
wx.showLoading({ title: "行程上传成功,刷新中~" });
wx.showLoading({ title: "行程上传成功,刷新中~" });
that.onLoad();
setTimeout(function () { wx.hideLoading(); }, 2000);
}
else {
var message = res.data.message;
wx.showModal({
title: "行程上传错误",
title: "行程上传错误",
content: message,
showCancel: false
});
@ -180,7 +180,7 @@ Page({
}).catch(function (err) {
wx.hideLoading();
wx.showModal({
title: "行程上传错误",
title: "行程上传错误",
content: "uploadTripCode===" + JSON.stringify(err),
showCancel: false
});
@ -188,7 +188,7 @@ Page({
}).catch(function (err) {
wx.hideLoading();
wx.showModal({
title: "行程上传错误",
title: "行程上传错误",
content: "chooseBase64Image===" + JSON.stringify(err),
showCancel: false
});

@ -92,7 +92,7 @@ Page({
},
uploadHealthCard(){
let that = this
let that = this
wx.showLoading({ title: '健康码上传中' });
this.chooseBase64Image().then(suc=>{
orderAPI.uploadHealthCode({ImageBase64:suc.base64File,ext:'.'+suc.imgType}).then(res=>{
@ -128,7 +128,8 @@ Page({
},
uploadTravelCard(){
let that = this
wx.showLoading({ title: '行程码上传中' });
wx.showLoading({ title: '行程卡上传中' });
this.chooseBase64Image().then(suc=>{
orderAPI.uploadTripCode({ImageBase64:suc.base64File,ext:'.'+suc.imgType}).then(res=>{
let val = JSON.parse(res.data.return_val)
@ -136,18 +137,18 @@ Page({
wx.setStorageSync(constant.USER_INFO,val)
wx.hideLoading()
if(res&&res.data&&res.data.success){
wx.showToast({title:"行程上传成功~",icon:"success"})
wx.showToast({title:"行程上传成功~",icon:"success"})
}else{
let message=res.data.message
wx.showModal({
title:"行程上传错误",
title:"行程上传错误",
content:message,
showCancel:false})
}
}).catch(err=>{
wx.hideLoading()
wx.showModal({
title:"行程上传错误",
title:"行程上传错误",
content:"uploadTripCode==="+JSON.stringify(err),
showCancel:false})
})
@ -155,7 +156,7 @@ Page({
wx.hideLoading()
if(err&&err!=""){
wx.showModal({
title:"行程上传错误",
title:"行程上传错误",
content:"chooseBase64Image==="+JSON.stringify(err),
showCancel:false})
}

@ -21,7 +21,7 @@
<yinput onlyRead padding="0" label="健康码:" bindValue="name" value="{{user.HealthCodeNegativeTime}}"></yinput>
</view>
<view class="card-col-1">
<yinput onlyRead padding="0" label="行程:" bindValue="name" value="{{user.TravelCardRefreshTime}}"></yinput>
<yinput onlyRead padding="0" label="行程:" bindValue="name" value="{{user.TravelCardRefreshTime}}"></yinput>
</view>
<view class="card-col-1">
<yinput onlyRead padding="0" label="当前位置:" bindValue="name" value="{{user.InSchoolStatus}}"></yinput>
@ -29,14 +29,14 @@
</view>
</view>
<view class="btn-list">
<view class="btn-item" aria-role="button" bindtap="uploadHealthCard">
<view class="btn-item" aria-role="button" bindtap="uploadHealthCard">
<image src="/asset/icons/health.png"/>
<text>上传健康码(剩余{{user.HealthCodeUploadTimesRemainInToday}}次)</text>
</view>
<view class="divLine"></view>
<view class="btn-item" aria-role="button" bindtap="uploadTravelCard">
<image src="/asset/icons/trip.png"/>
<text>上传行程(剩余{{user.TravelCardUploadTimesRemainInToday}}次)</text>
<text>上传行程(剩余{{user.TravelCardUploadTimesRemainInToday}}次)</text>
</view>
<view class="divLine"></view>
<view class="btn-item" >

@ -1,261 +0,0 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var constant_1 = __importDefault(require("../../utils/constant"));
var index_1 = __importDefault(require("../../services/index"));
var util_1 = require("../../utils/util");
var recordType = {
GREEN: '绿码',
YELLOW: "黄码",
RED: '红码'
};
// pages/travel-card/travelcard.ts
Page({
/**
* 页面的初始数据
*/
data: {
files: [],
images: [],
uploadImg: "",
base64File: "",
showUpload: true,
user: {},
count: 2,
nomore: false,
recordType: recordType
},
clearImg: function (e) {
this.setData({
uploadImg: "",
base64File: "",
showUpload: true
});
},
chooseBase64Image: function () {
var _this = this;
var that = this;
wx.showLoading({ title: '图片上传中' });
return new Promise(function (resolve, reject) {
wx.chooseImage({
sizeType: ['original', 'compressed'],
count: 1,
sourceType: ['album'],
success: function (res) {
var tempFilePath = res.tempFilePaths[0];
var tempFile = res.tempFiles[0];
console.log(res);
console.log(tempFile);
// 返回选定照片的本地文件路径,tempFilePath可以作为img标签的src属性显示图片
that.setData({
uploadImg: tempFilePath,
});
wx.getImageInfo({
src: tempFilePath,
success: function (imageInfo) {
var imgType = imageInfo.type;
wx.getFileSystemManager().readFile({
filePath: tempFilePath,
encoding: "base64",
success: function (res) {
//返回base64格式
var base64Str = 'data:image/' + imgType + ';base64,' + res.data;
console.log(base64Str);
_this.setData({ base64File: base64Str, showUpload: false });
resolve(base64Str);
wx.hideLoading();
},
fail: function (err) {
console.log(err);
reject(err);
}
});
}
});
},
fail: function (err) {
console.log(err);
}
});
});
},
previewImg: function (e) {
var urls = [];
urls.push(e.currentTarget.dataset.src);
wx.previewImage({
urls: urls,
});
},
loadMore: function () {
return __awaiter(this, void 0, void 0, function () {
var count;
return __generator(this, function (_a) {
if (this.data.nomore) {
wx.showToast({ title: "已经到头了~" });
}
else {
count = this.data.count + 2;
this.setData({ count: count });
//console.log(this.data)
this.getCards(this.data.user);
}
return [2 /*return*/];
});
});
},
getCards: function (user) {
return __awaiter(this, void 0, void 0, function () {
var res, records;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, index_1.default.API.materialUpload.getIORecordsList.request({ userID: user.userID, type: "travel", count: this.data.count })];
case 1:
res = _a.sent();
//console.log(res);
if (res && res.data) {
records = res.data;
if (records.length < this.data.count) {
this.setData({ nomore: true });
}
records.map(function (record) {
var imagePath = record.imagePath;
if (imagePath) {
var url = util_1.BASE_URL + "/api/image/get" + imagePath;
var tempMap = _this.data.images;
tempMap.push(url);
_this.setData({ images: tempMap });
}
});
this.setData({ files: res.data });
}
return [2 /*return*/];
}
});
});
},
onSubmit: function (_a) {
var detail = _a.detail;
return __awaiter(this, void 0, void 0, function () {
var submitRecord, res, reportid;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
// TODO gen order
if (!this.data.teacherID) {
wx.showToast({
title: '提交失败,缺少用户信息',
icon: 'none'
});
}
submitRecord = __assign(__assign({}, detail.value), { ioType: this.data.ioTypesArray.indexOf(this.data.ioType), teacherID: this.data.teacherID, commitTime: this.data.applyDate + ' ' + this.data.applyTime + ":00" });
return [4 /*yield*/, index_1.default.API.iORecords.addIORecord.request(submitRecord)];
case 1:
res = _b.sent();
console.log(res);
if (res && res.data) {
reportid = res.data;
wx.setStorageSync("myReport/myReport", reportid);
}
return [2 /*return*/];
}
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
// wx.removeStorageSync(constant.USER_INFO);
var user = wx.getStorageSync(constant_1.default.USER_INFO);
if (!user) {
wx.navigateTo({ url: "../../index/index" });
}
this.getCards(user);
this.setData(__assign(__assign({}, this.data), user));
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
});

@ -1,66 +0,0 @@
.card-container {
margin: 20rpx;
background-color: var(--color-gray-0);
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
font-size: 17px;
// font-weight: 550;
.card-col-1 {
padding: 24rpx 0;
display: flex;
width: auto;
& yinput:nth-child(1) {
flex: 4 1 50px;
margin: 0 5rpx;
}
& yinput:nth-child(2) {
flex: 7 1 50px;
margin:0 5rpx;
}
}
}
.input-container {
padding-bottom: 80rpx;
.card-col-1 {
display: flex;
margin: 0 2px;
:nth-child(n) {
flex: 1 1 0;
}
}
}
.ui_uploader_item{
padding: 0 20rpx;
display: flex;
justify-content: flex-start;
icon{
flex:1
}
.image{
flex:15;
padding-bottom: 100rpx;
image{
width:500rpx
}
}
.submit-button {
position: fixed;
bottom: 0;
left: 0;
background-color: var(--color-primary);
color: white;
width: 100%;
border-radius: 0;
z-index: 99;
}
}

@ -1,212 +0,0 @@
import constant from "../../utils/constant"
import { IORecords, User } from '../../services/baseClass'
import services from "../../services/index"
import { BASE_URL } from '../../utils/util';
const recordType = {
GREEN: '绿码',
YELLOW: "黄码",
RED:'红码'
}
// pages/travel-card/travelcard.ts
Page({
/**
*
*/
data: {
files:[],
images:[],
uploadImg:"",
base64File:"",
showUpload:true,
user:{},
count:2,
nomore:false,
recordType
},
clearImg(e) {
this.setData({
uploadImg: "",
base64File: "",
showUpload: true
})
},
chooseBase64Image() {
const that = this;
wx.showLoading({ title: '图片上传中' });
return new Promise((resolve, reject) => {
wx.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
count:1,
sourceType: ['album'], // 可以指定来源是相册还是相机,默认二者都有
success: (res)=> {
let tempFilePath = res.tempFilePaths[0];
let tempFile = res.tempFiles[0];
console.log(res);
console.log(tempFile);
// 返回选定照片的本地文件路径,tempFilePath可以作为img标签的src属性显示图片
that.setData({
uploadImg: tempFilePath,
});
wx.getImageInfo({
src:tempFilePath,
success:(imageInfo)=>{
var imgType = imageInfo.type
wx.getFileSystemManager().readFile({
filePath: tempFilePath, //选择图片返回的相对路径
encoding: "base64", //这个是很重要的
success: res => { //成功的回调
//返回base64格式
var base64Str = 'data:image/' + imgType + ';base64,' + res.data
console.log(base64Str)
this.setData({base64File:base64Str,showUpload:false})
resolve(base64Str)
wx.hideLoading();
},
fail: err => {
console.log(err)
reject(err)
}
})
}
})
},
fail: (err) => {
console.log(err)
}
});
})
},
previewImg(e) {
let urls = [];
urls.push(e.currentTarget.dataset.src)
wx.previewImage({
urls: urls, // 需要预览的图片http链接列表
});
},
async loadMore() {
if(this.data.nomore){
wx.showToast({title:"已经到头了~"})
}else{
let count = this.data.count+2;
this.setData({count:count});
//console.log(this.data)
this.getCards(this.data.user)
}
},
async getCards(user:any){
let res = await services.API.materialUpload.getIORecordsList.request({userID:user.userID,type:"travel",count:this.data.count});
//console.log(res);
if(res&&res.data){
let records = res.data
if(records.length<this.data.count){
this.setData({nomore:true})
}
records.map((record)=>{
let imagePath = record.imagePath
if(imagePath){
let url = BASE_URL + "/api/image/get"+imagePath;
let tempMap = this.data.images;
tempMap.push(url);
this.setData({images:tempMap})
}
})
this.setData({files:res.data})
}
},
onSubmit:async function({ detail }: { detail: any}) {
// TODO gen order
if(!this.data.teacherID){
wx.showToast({
title: '提交失败,缺少用户信息',
icon: 'none'
});
}
const submitRecord: IORecords = {
...detail.value,
ioType:this.data.ioTypesArray.indexOf(this.data.ioType),
teacherID:this.data.teacherID,
commitTime: this.data.applyDate + ' ' + this.data.applyTime+":00",
}
let res = await services.API.iORecords.addIORecord.request(submitRecord);
console.log(res);
if(res&&res.data){
let reportid = res.data;
wx.setStorageSync("myReport/myReport", reportid)
}
},
/**
* --
*/
onLoad() {
// wx.removeStorageSync(constant.USER_INFO);
let user = wx.getStorageSync(constant.USER_INFO);
if(!user){
wx.navigateTo({url:"../../index/index"})
}
this.getCards(user);
this.setData({
...this.data,
...(user as User)
})
},
/**
* --
*/
onReady() {
},
/**
* --
*/
onShow() {
},
/**
* --
*/
onHide() {
},
/**
* --
*/
onUnload() {
},
/**
* --
*/
onPullDownRefresh() {
},
/**
*
*/
onReachBottom() {
},
/**
*
*/
onShareAppMessage() {
}
})

@ -1,47 +0,0 @@
<navigationBar title="行程码"></navigationBar>
<view class="card-container">
<view class="card-col-1">
<yinput onlyRead padding="0" label="工号:" bindValue="teacherID" value="{{teacherID}}"></yinput>
<yinput onlyRead padding="0" label="姓名:" bindValue="name" value="{{name}}"></yinput>
</view>
</view>
<view class="page__bd">
<view class="weui-panel__bd" wx:for="{{files}}" wx:key="index">
<view aria-labelledby="js_p1m1_bd" class="weui-media-box weui-media-box_appmsg">
<view aria-hidden="true" class="weui-media-box__hd">
<image class="weui-media-box__thumb" data-src="{{images[index]}}" src="{{images[index]}}" bindtap="previewImg"></image>
</view>
<view aria-hidden="true" id="js_p1m1_bd" class="weui-media-box__bd">
<text class="weui-media-box__title">{{recordType[item.travelStatus]}}</text>
<view class="weui-media-box__desc">上传时间:{{item.uploadTime}}</view>
<view class="weui-media-box__desc">刷新时间:{{item.travelRefreshTime}};</view>
<view class="weui-media-box__desc">七日行程:{{item.travelPlaces}}</view>
</view>
</view>
</view>
<view class="weui-panel__ft">
<view class="weui-cell weui-cell_active weui-cell_access weui-cell_link" wx:if="{{!nomore}}">
<text class="weui-cell__bd" bindtap="loadMore">查看更多</text>
<text class="weui-cell__ft" ></text>
</view>
<view class="weui-cell weui-cell_active weui-cell_access weui-cell_link" wx:if="{{nomore}}" >
<text class="weui-cell__bd" style="text-align: center;" bindtap="loadMore" >到头了~</text>
</view>
</view>
<view class="weui-uploader__input-box" wx:if="{{showUpload}}">
<view aria-role="button" aria-label="上传" class="weui-uploader__input" bindtap="chooseBase64Image" ></view>
</view>
<!-- 根据已选择的图片临时路径数组展示图片 -->
<view class='ui_uploader_item' wx:if="{{!showUpload}}">
<!-- 删除 -->
<icon class='ui_uploader_item_icon' bindtap='clearImg' type="clear" size="30" color="red"/>
<!-- 图片 -->
<view class="image">
<image mode="aspectFit" bindtap='previewImg' data-src="{{uploadImg}}" src='{{uploadImg}}'></image>
</view>
<view class="submit-button">
<ybutton bindtap="onPass" class="button-item" lineHeight="50px" title="确认上传" bgColor="var(--color-primary)" />
</view>
</view>
</view>

@ -206,7 +206,7 @@ export const genToken = (wechatID?:string)=>{
wx.showModal({title:"token生成失败,请联系管理员!",showCancel:false})
}
let token = randomStr.concat(";",nowStr,";",userid);
// console.log("token",token)
console.log("token",token)
let tokenEncode = encrypt(token);
return tokenEncode;

File diff suppressed because it is too large Load Diff

@ -20,6 +20,6 @@ docker run --name redis -p 6380:6379 redis-test --requirepass 123456
4.查看现有的redis密码:config get requirepass
5.设置redis密码config set requirepass 123456(123456为你要设置的密码)
5.设置redis密码config set requirepass redis221024(123456为你要设置的密码)
6.若出现(error) NOAUTH Authentication required.错误,则使用 auth 密码 来认证密码

Binary file not shown.
Loading…
Cancel
Save