提交 90b925ec authored 作者: 常超凡's avatar 常超凡

初始化

上级
# Auto detect text files and perform LF normalization
* text=auto
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/
# WX_takePhoto
小程序框内拍照
简书:https://www.jianshu.com/p/e22fba276e52
// app.ts
App({
globalDate: {
global: 1,
userLocationAuth: false,
cameraAuth: false,
extraData:null
},
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
this.ctx = wx.createCameraContext();
// 登录
wx.login({
success(res) {
var openid = res.code
console.log('openid', openid)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
wx.setStorage({
key: 'openid',
data: openid
})
wx.navigateTo({
url: '../miniprogram/pages/upload/upload'
})
}
})
},
onShow(options) {
// wx.clearStorageSync(); // 清空本地缓存数据
// console.log('options', options)
if (options.referrerInfo.extraData) {
console.log('进来了')
let extraData = options.referrerInfo.extraData;
console.log('extraData', extraData)
if (typeof (extraData) === 'string') {
extraData = JSON.parse(options.referrerInfo.extraData)
}
// console.log('到这里extraData',extraData)
wx.setStorage({
key: 'extraData',
data: extraData,
})
// 启动摄像头预览
// this.ctx.startPreview();
// console.log('labelInfoUrl.success', labelInfoUrl.success)
}else{
console.log('options.referrerInfo.extraData',options.referrerInfo.extraData)
console.log('options.extraData',options.extraData)
console.log('没有获取到数据')
wx.setStorage({
key: 'extraData',
data: extraData,
})
}
},
})
\ No newline at end of file
{
"pages": [
"pages/index/index",
"pages/attention/attention",
"pages/cameraTakePhoto/cameraTakePhoto",
"pages/upload/upload"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "AI验证",
"navigationBarTextStyle": "black",
"backgroundColor": "#fff",
"backgroundColorTop": "#Afff",
"backgroundColorBottom": "#Afff"
},
"sitemapLocation": "sitemap.json",
"permission":{
"scope.userLocation": {
"desc": "位置信息将用于定位"
}
},
"requiredPrivateInfos": [
"getLocation"
]
}
\ No newline at end of file
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
// componets/loading/index.js.js
let styleList = []
let bg = '#edf0f7'
for (var i = 0; i <= 35; i++) {
if (i <= 8) {
bg = '#edf0f7'
} else if (i > 8 && i <= 16) {
bg = '#d5dbe9'
} else if (i > 16 && i <= 24) {
bg = '#677ab4'
} else if (i > 24 && i <= 35) {
bg = '#304999'
}
styleList.push({
'transform': i * 10 + 'deg',
'bg': bg
})
}
let timer
Component({
/**
* 组件的属性列表
*/
properties: {
show: {
type: Boolean,
default: false
},
msg: {
type: String,
default: ''
},
speed: {
type: Number,
default: 1000
}
},
/**
* 组件的初始数据
*/
data: {
styleList: styleList
},
created() {
this.setData({
styleList: styleList
})
this.loading()
},
attached() {},
/**
* 组件的方法列表
*/
methods: {
loading() {
// console.log(this.properties.speed)
let index = 0
timer = setInterval(() => {
var item = 'styleList[' + index + '].bg'
if (index <= 36) {
this.setData({
[item]: 'white'
})
index += 1
} else {
clearInterval(timer)
}
}, 100);
},
stop() {
clearInterval(timer)
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="loading-row">
<view class="loading-cell">
<view class="circle-line" id='box'>
<image class="msg" src="/assets/imgs/checking/chengkingText.png"></image>
<view class="line-box" wx:for="{{styleList}}" style="transform:rotate({{item.transform}});">
<text class="line" style="background-color:{{item.bg}};"></text>
</view>
</view>
</view>
<!-- <button bindtap="loading">点击执行</button>
<button bindtap="stop">点击停止</button> -->
</view>
\ No newline at end of file
.loading-row {
width: 100%;
display: flex;
justify-content: space-around;
}
.loading-cell {
width: 100%;
text-align: center;
}
.circle-line {
width: 500rpx;
height: 500rpx;
/* padding-top: 150rpx; */
display: inline-block;
position: relative;
}
.msg {
display: block;
width: 227rpx;
height: 53rpx;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 38rpx;
}
.circle-line .line-box {
display: block;
width: 50%;
height: 5px;
opacity: .7;
position: absolute;
top: calc(50% - 2.5px);
left: 0px;
transform-origin: center right;
animation: circle 1.5s linear infinite;
}
.circle-line .line {
content: '';
display: block;
width: 15px;
height: 5px;
position: absolute;
top: 0;
/* 中心距离 */
right: 70px;
}
/* 第二个 */
.circle-line-spin {
width: 100px;
height: 100px;
display: inline-block;
position: relative;
animation: circle-line 1.5s linear infinite;
}
.circle-line-spin text {
display: block;
width: 50%;
height: 5px;
opacity: .7;
position: absolute;
top: calc(50% - 2.5px);
left: 0px;
transform-origin: center right;
}
@keyframes circle-line {
from {
transform: rotate(-360deg);
}
to {
transform: rotate(10deg);
}
}
.circle-line-spin text::before {
content: '';
display: block;
width: 15px;
height: 5px;
position: absolute;
top: 0;
right: 10px;
background-color: #a8c992;
}
.circle-line-spin text:nth-child(1) {
transform: rotate(0deg);
animation-delay: 0.2s;
}
.circle-line-spin text:nth-child(2) {
transform: rotate(45deg);
animation-delay: 0.4s;
}
.circle-line-spin text:nth-child(3) {
transform: rotate(90deg);
animation-delay: 0.6s;
}
.circle-line-spin text:nth-child(4) {
transform: rotate(135deg);
animation-delay: 0.8s;
}
.circle-line-spin text:nth-child(5) {
transform: rotate(180deg);
animation-delay: 1s;
}
.circle-line-spin text:nth-child(6) {
transform: rotate(225deg);
animation-delay: 1.2s;
}
.circle-line-spin text:nth-child(7) {
transform: rotate(270deg);
animation-delay: 1.4s;
}
.circle-line-spin text:nth-child(8) {
transform: rotate(315deg);
animation-delay: 1.6s;
}
\ No newline at end of file
Page({
data:{
notice:''
},
bindViewTaptype() {
wx.reLaunch({
url: '../index/index',
})
},
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class="page">
<view class="background">
<text class="text1">\n\n
1、将整个结构三维码放到识别框中,等待认证(认证过程中保持一定的距离,码的清晰完整)\n\n</text>
<text>2、确保标签与背景保持在同一平面内,便于聚焦\n\n</text>
<text>3、在正常的灯光下进行认证(不能过于黑暗,刻意曝光导致模型识别不到码)\n\n</text>
<text>4、认证时避免剧烈晃动(晃动后拍出来的图像会模糊,不易识别)\n\n</text>
<text>5、认证过程中请保持稳定,等待认证结果显示时移动手机\n\n</text>
<text>6、每次只能认证微信扫描进入主页的一枚(否则会提示码不同)\n\n</text>
<text>祝您使用愉快!\n</text>
</view>
<view class="button2" style="background-color: rgb(165, 165, 165);">
<button bindtap="bindViewTaptype">返回认证</button>
</view>
</view>
\ No newline at end of file
.background{
/* font-size: large; */
color:whitesmoke;
margin: .5rem;
}
.button2{
margin-top: 20%;
margin-left: auto;
margin-right: auto;
width: 184px;
line-height: 0;
}
.page{
background-color: rgb(158, 158, 158);
width: 100%;
height: 100vh;
}
\ No newline at end of file
// 获取全局应用程序实例对象
// const app = getApp();
var util = require('../../utils/util')
var Counter = 0;
var take_Count = 0;
// 创建页面实例对象
Page({
// 页面的初始数据
data: {
image: '',
windowWidth: '',
windowHeight: '',
notice: '',
src: '',
userInfo: {},
hasUserInfo: false,
mybase64: '',
temfilePath: "",
tag: false,
datajson: '',
labelCode: '',
left: '',
right: '',
on: '',
down: '',
state: '',
state_x: '',
takephoto_count: '',
once_takephoto: '',
frame: {},
kongfileimage: '',
bigfileimage: '',
text_succes: '',
snsMsgWait: 7,
camera_state: '',
snsMsgWait_1: 4,
// time_state: false,
singe_state: false,
take_state: '',
longtime_state: false,
take_photo_1: '',
dongtaishuju_chuan: 0,
snsMsgWait_one: 7,
snsMsgWait_twotime: 8,
snsMsgWait_three: 10,
takephoto2_state: '',
all_state: false,
hint_phone: false,
res_errMsg: '',
icon: '',
sameCodeState: 0,
result_zoom: 0,
labelInfo: null,
one_zoom: 0,
yuan_file: '',
longTimeOnce: false,
longTimeTwo: false,
longTimeThree: false,
longTimeTakephoto: false,
all_finish: false,
small_finish: false,
// status_zhi:''
},
onLoad: function () {
var that = this
this.Sounds();
// const status_zhi = (wx.getStorageSync('status_zhi') || '')
// this.setData({
// status_zhi
// })
// console.log('status_zhi',status_zhi)
const dongtaishuju_chuan = wx.getStorageSync('dongtaishuju')
// console.log('dongtaishuju_chuan', dongtaishuju_chuan)
switch (dongtaishuju_chuan) {
case 1:
this.Countone_Time();
break;
case 2:
this.Counttwo_Time();
break;
case 3:
this.Countthree_Time();
break;
default:
console.log('不等于1,2,3次')
this.setData({
longtime_state: true
})
}
var nCounter = 0
const labelInfo = wx.getStorageSync('extraData')
// console.log('labelInfo', labelInfo)
if (labelInfo) {
const labelCode = labelInfo.cpid_jm || labelInfo.cpid
this.setData({
labelCode,
dongtaishuju_chuan
})
// console.log('labelCode', labelCode)
}
var that = this
const {
screenWidth,
screenHeight
} = wx.getSystemInfoSync()
const windowWidth = 750
const windowHeight = screenHeight / screenWidth * windowWidth
this.setData({
windowWidth,
windowHeight,
})
// console.log('wind', windowWidth, 'height', windowHeight)
this.ctx = wx.createCameraContext()
this.listener = this.ctx.onCameraFrame((frame) => {
if (nCounter == 25) {
if (this.data.tag) return
this.data.tag = true
setTimeout(() => {
this.data.tag = false
}, 1000)
this.setData({
['frame.width']: frame.width,
['frame.height']: frame.height,
})
var data = new Uint8Array(frame.data);
// console.log('data', data)
var clamped = new Uint8ClampedArray(data);
// console.log('clamped', clamped)
// 实时帧数据添加到Canvas上
// console.log('===========')
wx.canvasPutImageData({
canvasId: 'myCanvas',
x: 0,
y: 0,
width: frame.width, //288 288
height: frame.height, //512 381
data: clamped,
success: (res) => {
var inter = setInterval(function () {
that.setData({
smsFlag: true,
sendTime: that.data.snsMsgWait,
snsMsgWait: that.data.snsMsgWait - 1
});
if (that.data.snsMsgWait === -6 && !that.data.take_state && that.data.longtime_state === true) {
let fail_text = '长时间不拍照1'
// console.log('fail_text', fail_text)
that.setData({
longTimeTakephoto: true
})
// console.log('that.data.takephoto',that.data.takephoto)
if (fail_text !== '' && that.data.takephoto !== 'succes') {
// console.log('进行第一次拍照')
that.takePhoto()
let take_photo_1 = '长时间不拍照2'
let takephoto = 'succes'
that.setData({
take_photo_1,
takephoto
});
}
// console.log('that.data.takephoto',that.data.takephoto)
if (fail_text !== '' && that.data.takephoto === 'succes' && that.data.all_state !== true) {
setTimeout(() => {
// console.log('进行第二次拍照')
that.takePhoto2()
}, 3500)
let take_state = true
that.setData({
take_state,
all_state: true
});
}
}
if (that.data.snsMsgWait < 0) {
clearInterval(inter)
that.setData({
snsMsgWait: -5,
snsFlag: false
})
}
}, 1000);
// 转换临时文件
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
x: 0,
y: (frame.height - frame.width) / 2,
width: frame.width, //288
height: frame.width, //352
fileType: 'jpg',
destWidth: frame.width,
destHeight: frame.width,
// 精度修改
quality: 'high',
success: (res) => {
// console.log('成功成功成功')
//进行编码
const base = wx.getFileSystemManager().readFileSync(res.tempFilePath, 'base64')
// console.log('base',base)
that.setData({
src: res.tempFilePath
});
wx.request({
url: 'https://ai.tj5.cc:35437/object/',
// url: 'https://tj5.cc:4433/object/',
// url:'https://ai.china315net.com:35437/object/',
method: "POST",
data: {
base
},
success: (res) => {
var result = res.data.result;
var minindex = -1;
var mindistance = 2;
for (var i = 0; i < result.length; i++) {
var sublist = result[i];
var distance = Math.abs(sublist[0] - 0.5) + Math.abs(sublist[1] - 0.5);
if (distance < mindistance) {
mindistance = distance;
minindex = i;
}
}
var result_zy = result[minindex][0]
var result_sx = result[minindex][1]
var result_w = result[minindex][2]
var result_zoom = parseFloat((0.85 / result_w).toFixed(1))
that.setData({
result_zoom: result_zoom
})
let state = ''
let status = ''
let state_x = ''
if (result_zy > 0.588) { //0.568
state = 'left'
} else if (result_zy < 0.405) { //0.425
state = 'right'
} else if (result_sx > 0.577) { //0.547
state = 'on'
} else if (result_sx < 0.401) { //0.411
state = 'down'
} else {
let text = '大框参数已经完善'
var take_Count = 0;
// console.log('大框参数已经完善', text)
let singe_state = true
take_Count++,
wx.removeStorageSync('singe_state')
that.setData({
singe_state,
small_finish: true
})
status = 'true'
// console.log('that.data.takephoto', that.data.takephoto)
if (text == text && that.data.takephoto !== 'succes' && that.data.take_photo_1 === '') {
// console.log('大框参数完成进行拍照')
that.takePhoto();
let takephoto = 'succes'
let d_takephoto = '大框拍照完成'
// console.log('d_takephoto', d_takephoto)
that.setData({
takephoto,
text,
d_takephoto,
})
// console.log('that.data.takephoto', that.data.takephoto)
// console.log('that.data.all_state', that.data.all_state)
}
//新修改
else if (that.data.takephoto === 'succes' && that.data.all_state === false) {
// console.log('进入小框判断')
var result = res.data.result;
var d_result_zy = result[minindex][0];
var d_result_sx = result[minindex][1];
if (d_result_zy > 0.546) { //0.546
state_x = 'left'
} else if (d_result_zy < 0.445) { //0.445
state_x = 'right'
} else if (d_result_sx > 0.571) { //0.531
state_x = 'on'
} else if (d_result_sx < 0.450) { //0.410
state_x = 'down'
} else {
// console.log('全部完成')
// console.log('this.data.all_state', this.data.all_state)
this.setData({
all_finish: true
});
that.takePhoto2()
that.setData({
all_state: true
})
that.listener.stop()
// if (this.data.all_state === false) {
// console.log('全部完成后进行放大拍照')
// that.takePhoto2()
// that.setData({
// all_state: true
// })
// that.listener.stop()
// }
}
} else {
console.log('拍照失败')
// that.takePhoto2()
}
}
that.setData({
state: state,
status: status,
state_x: state_x
})
},
fail: (error) => {
console.log('目标检测失败', error)
}
})
},
fail: (error) => {
console.log('转换临时文件失败:', error);
}
}, that)
},
fail: (error) => {
console.log('绘制图像数据失败', error)
}
})
}
nCounter++
if (nCounter >= 50) {
nCounter = 0
}
}, 100)
this.listener.start()
},
//获取相机请求
onShow: function () {
// wx.authorize({
// scope: 'scope.camera',
// success: function (res) {
// that.setData({
// isShowCamera: true,
// })
// console.log('走权限1')
// console.log('that.data.isShowCamera', that.data.isShowCamera)
// let res_errMsg = res.errMsg
// that.setData({
// res_errMsg: res_errMsg
// })
// wx.removeStorageSync('res_errMsg')
// //倒计时
// var inter = setInterval(function () {
// that.setData({
// smsFlag: true,
// sendTime: that.data.snsMsgWait_1,
// snsMsgWait_1: that.data.snsMsgWait_1 - 1
// });
// console.log('this.data.snsMsgWait_1', that.data.snsMsgWait_1)
// console.log('res_errMsg', res_errMsg)
// if (that.data.snsMsgWait_1 === -6 && res_errMsg != '') {
// console.log('长时间未响应')
// setTimeout(() => {
// that.takePhoto2()
// }, 2500)
// that.setData({
// longtime_state: true
// })
// }
// if (that.data.snsMsgWait_1 < 0) {
// clearInterval(inter)
// that.setData({
// snsMsgWait_1: -5,
// snsFlag: false
// })
// console.log('that.data.snsMsgWait_2', that.data.snsMsgWait_1)
// }
// }.bind(that), 1000);
// let camera_state = res.errMsg
// that.setData({
// camera_state
// })
// },
// fail: function (res) {
// console.log("" + res);
// console.log('走权限2')
// wx.showModal({
// title: '请求授权您的摄像头',
// content: '如需正常使用此小程序功能,请您按确定并在设置页面授权用户信息',
// confirmText: '确定',
// success: function (res) {
// if (res.confirm) {
// wx.openSetting({
// success: function (res) {
// if (res.authSetting['scope.camera']) { //设置允许获取摄像头
// console.log('设置允许获取摄像头')
// wx.showToast({
// title: '授权成功',
// icon: 'success',
// duration: 1000
// })
// that.setData({
// isShowCamera: true,
// icon: icon
// })
// } else { //不允许
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.navigateBack({
// delta: 1
// })
// }
// }
// })
// } else { //取消
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.navigateBack({
// delta: 1
// })
// }
// }
// })
// },
// })
var that = this
wx.authorize({
scope: 'scope.camera',
success: function (res) {
that.setData({
isShowCamera: true,
})
// console.log('走权限1')
let res_errMsg = res.errMsg
that.setData({
res_errMsg: res_errMsg
})
wx.removeStorageSync('res_errMsg')
//倒计时
var inter = setInterval(function () {
that.setData({
smsFlag: true,
sendTime: that.data.snsMsgWait_1,
snsMsgWait_1: that.data.snsMsgWait_1 - 1
});
if (that.data.snsMsgWait_1 === -6 && res_errMsg != '') {
// console.log('长时间未响应')
setTimeout(() => {
that.takePhoto2()
}, 2500)
that.setData({
longtime_state: true
})
}
if (that.data.snsMsgWait_1 < 0) {
clearInterval(inter)
that.setData({
snsMsgWait_1: -5,
snsFlag: false
})
// console.log('that.data.snsMsgWait_2', that.data.snsMsgWait_1)
}
}.bind(that), 1000);
let camera_state = res.errMsg
that.setData({
camera_state
})
},
fail: function (res) {
console.log("" + res);
// console.log('走权限2')
wx.showModal({
title: '请求授权您的摄像头',
content: '如需正常使用此小程序功能,请您按确定并在设置页面授权用户信息',
confirmText: '确定',
success: function (res) {
if (res.confirm) {
wx.openSetting({
success: function (res) {
if (res.authSetting['scope.camera']) { //设置允许获取摄像头
// console.log('设置允许获取摄像头')
wx.showToast({
title: '授权成功',
icon: 'success',
duration: 1000
})
that.setData({
isShowCamera: true,
icon: icon
})
} else { //不允许
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 1000
})
wx.navigateBack({
delta: 1
})
}
}
})
} else { //取消
wx.showToast({
title: '授权失败',
icon: 'none',
duration: 1000
})
wx.navigateBack({
delta: 1
})
}
}
})
},
fail: function (res) {
console.log('获取相机失败', res)
onShow();
}
})
},
/**
* 拍照
*/
takePhoto: function () {
// console.log('takePhoto')
var that = this
Counter++;
that.ctx.setZoom({
zoom: 1.0,
success: (res) => {
setTimeout(() => {
that.ctx.takePhoto({
quality: 'high', //高质量
flash: 'off',
success: (res) => {
/*储存 */
wx.setStorage({
key: 'res.tempImagePath',
data: res.tempImagePath,
})
// console.log('res.tempImagePath', res.tempImagePath)
const base = wx.getFileSystemManager().readFileSync(res.tempImagePath, 'base64')
// console.log('base', base)
this.setData({
kongfileimage: res.tempImagePath
})
// console.log('开始解析')
//解码API
wx.request({
// url:'https://ai.china315net.com:35437/api/upload/',
// url: 'https://ai.tj5.cc:35437/api/upload/',
// url:'https://tj5.cc:4433/api/upload/',
url: 'https://ai.tj5.cc:35437/api/small_upload/',
// url:'https://tj5.cc:4433/api/small_upload/',
method: 'POST',
data: {
base,
'labelCodejson': this.data.labelCode
},
success: (res) => {
// console.log('base', base)
// console.log('res.statusCode ', res.statusCode)
// console.log('接口访问')
var dtime = util.formatTime(new Date)
wx.setStorage({
key: 'dtime',
data: dtime
})
// console.log('当前时间', dtime)
var res_data = res.data
// console.log('res_data', res_data)
var succes_data = res_data.succes
// console.log('succes_data', succes_data)
if (res_data === '码解析失败' || succes_data === 'loser' || res.statusCode !== 200) {
// console.log('计算res_data长度',res_data.length)
// console.log('网络请求值不等于200 ')
const datajson = '码解析失败'
// console.log('datajson1',datajson)
wx.setStorage({
key: 'datajson',
data: datajson
})
} else {
var img_reader = res_data.img_reader
// console.log('img_reader', img_reader)
wx.setStorage({
key: 'img_reader',
data: img_reader
})
var img_method = res_data.img_method
// console.log('img_method', img_method)
wx.setStorage({
key: 'img_method',
data: img_method
})
var points = res_data.points
// console.log('points', points)
wx.setStorage({
key: 'points',
data: points
})
var datajson = res_data.codeinfo;
// console.log('原图解析内容datajson', datajson)
wx.setStorage({
key: 'datajson',
data: datajson
})
}
},
fail: (res) => {
// console.log('调用upload接口超时', res)
if (res.errMsg.indexOf('timeout') !== -1) {
// console.log('请求超时')
const datajson = '码解析失败'
// console.log('datajson1',datajson)
wx.setStorage({
key: 'datajson',
data: datajson
})
}
},
complete: (res) => {
if (!res.data) {
// console.log('网络请求没有返回任何数据')
const datajson = '码解析失败'
// console.log('datajson1',datajson)
wx.setStorage({
key: 'datajson',
data: datajson
})
}
},
timeout: 3000
})
//新增请求接口
wx.request({
url: 'https://ai.tj5.cc:35437/classify16/',
// url: 'https://tj5.cc:4433/classify16/',
method: "POST",
data: {
'image_type': 20,
'base': base,
},
success: (res) => {
let result_value = res.data.result
let yuan_file = res.data.image_path
// console.log('yuan_file', yuan_file)
wx.setStorage({
key: 'yuan_file',
data: yuan_file
})
if (result_value == 14) {
// console.log('等于14分类')
let hint_phone = result_value
this.setData({
hint_phone
})
wx.setStorage({
key: 'hint_phone',
data: hint_phone
})
// console.log('hint_phone', hint_phone)
} else {
// console.log('不等于14分类')
let hint_phone = result_value
wx.setStorage({
key: 'hint_phone',
data: hint_phone
})
// console.log('hint_phone', hint_phone)
}
},
fail: error => {
console.log('调用upload失败', error)
}
});
var dtime_2 = util.formatTime(new Date)
wx.setStorage({
key: 'dtime_2',
data: dtime_2
})
}
})
}, 350);
}
})
let once_takephoto = 'true'
this.setData({
takephoto_count: Counter,
once_takephoto: once_takephoto
})
},
//源代码
// takePhoto2: function () {
// var that = this
// that.ctx.setZoom({
// // flash: 'on',
// zoom: 4.0,
// success: (res) => {
// console.log('setZoom 成功', res)
// const takephoto2_state = res.errMsg
// this.setData({
// takephoto2_state
// })
// console.log('takephoto2_state', takephoto2_state)
// setTimeout(() => {
// that.ctx.takePhoto({
// quality: 'high', //高质量
// success: (res) => {
// console.log('到相机里面')
// console.log('res.data', res)
// console.log('res.tempfile', res.tempImagePath)
// /*储存 */
// wx.setStorage({
// key: 'originalImagePath',
// data: res.tempImagePath,
// })
// console.log('image', res.tempImagePath)
// this.setData({
// bigfileimage: res.tempImagePath
// })
// let file = res.tempImagePath
// const base = wx.getFileSystemManager().readFileSync(file, 'base64')
// console.log('file', file)
// console.log('base', base)
// wx.navigateTo({
// url: '../upload/upload?path=' + that.data.bigfileimage + '&char=0'
// })
// console.log('传值成功')
// console.log('res.tempImagePath', that.data.bigfileimage)
// }
// })
// },350);
// }
// })
// },
//新增代码
takePhoto2: function () {
// console.log('takePhoto2')
const that = this;
function isIOS() {
let system = wx.getSystemInfoSync().system
return system.indexOf('iOS') !== -1
}
if (isIOS()) {
// console.log('当前设备是ios')
// console.log('this.data.result_zoom', this.data.result_zoom)
if (this.data.result_zoom === 0) {
this.setData({
result_zoom: 4
})
}
// console.log('this.data.result_zoom', this.data.result_zoom)
that.ctx.setZoom({
zoom: this.data.result_zoom,
success: res => {
// console.log('setZoom成功', res);
const takephoto2_state = res.errMsg;
this.setData({
takephoto2_state
});
// console.log('takephoto2_state', takephoto2_state);
setTimeout(() => {
that.ctx.takePhoto({
quality: 'high',
flash: 'on',
success: res => {
// console.log('到相机里面');
// console.log('res.data', res);
// console.log('res.tempfile', res.tempImagePath);
/*储存 */
wx.setStorage({
key: 'originalImagePath',
data: res.tempImagePath,
});
// console.log('image', res.tempImagePath);
this.setData({
bigfileimage: res.tempImagePath,
result_zoom: this.data.result_zoom
});
// const file = res.tempImagePath;
// const base = wx.getFileSystemManager().readFileSync(file, 'base64');
// console.log('file', file);
// console.log('base', base);
wx.navigateTo({
url: '../upload/upload?path=' + that.data.bigfileimage + '&char=0'
});
// console.log('传值成功');
// console.log('res.tempImagePath', that.data.bigfileimage);
},
fail: err => {
console.error('拍照失败', err);
that.takePhoto2()
// console.log('拍照完成')
}
});
})
},
fail: err => {
console.error('设置缩放失败', err);
}
});
} else {
// console.log('当前设备是安卓')
// console.log('this.data.result_zoom', this.data.result_zoom)
if (this.data.result_zoom === 0) {
this.setData({
result_zoom: 6
})
}
// const one_zoom = Math.floor(this.data.result_zoom * 0.85)
const one_zoom = parseFloat((this.data.result_zoom * 0.82).toFixed(1));
// console.log('one_zoom', one_zoom)
const benchmarkLevel = (wx.getStorageSync('benchmarkLevel') || 0)
const phone_model = (wx.getStorageSync('phone_model') || '')
// wx.removeStorageSync(String(benchmarkLevel));
// console.log('benchmarkLevel', benchmarkLevel)
// console.log('phone_model', phone_model)
let timeS;
// if(){
// }
// console.log('手机型号',phone_model)
let phone_list= ['NOH-AN00','NOH-AN01','OCE-AN10','JAD-AL00','LNA-AL00','NOP-AN00','NOH-AL10','ABR-AL80','MNA-AL00','JAD-AL50','ABR-AL00','ABR-AL90','ABR-AL60','ABR-AL60','NOH-AN50']
if(phone_list.includes(phone_model)){
// console.log('特殊手机型号')
timeS = 750
}
else if (benchmarkLevel > 40) {
timeS = 350;
} else if (benchmarkLevel > 30) {
timeS = 380;
} else if (benchmarkLevel > 20) {
timeS = 410
} else if (benchmarkLevel > 10) {
timeS = 450;
} else {
timeS = 450;
}
this.takePhotoZoom(one_zoom, timeS)
}
},
takePhotoZoom: function (one_zoom,timeS) {
console.log('one_zoom',one_zoom)
console.log('timeS',timeS)
var that = this
that.ctx.setZoom({
zoom: one_zoom,
success: (res) => {
console.log('res.zoom 成功', res.zoom)
setTimeout(() => {
that.ctx.takePhoto({
quality: 'high', //高质量
flash: 'off',
success: (res) => {
console.log('放大拍照日志res', res)
/*储存 */
wx.setStorage({
key: 'originalImagePath',
data: res.tempImagePath,
})
wx.setStorage({
key: 'one_zoom',
data: one_zoom
});
this.setData({
bigfileimage: res.tempImagePath,
result_zoom: this.data.result_zoom
})
wx.navigateTo({
url: '../upload/upload?path=' + that.data.bigfileimage + '&char=0'
})
},
fail: (err) => {
console.error('拍照失败2', err);
that.takePhoto2()
}
})
}, timeS);
},
fail: err => {
console.error('设置缩放失败', err);
}
})
},
// getUserInfo: function () {
// wx.getUserInfo({
// desc: '获取用户信息',
// success: (res) => {
// // console.log('resresres', res.userInfo.nickName);
// this.setData({
// hasUserInfo: true,
// userInfo: res.userInfo.nickName
// })
// // console.log('userInfo', userInfo.nickName)
// }
// })
// },
Sounds: function () {
const innerAudioContext = wx.createInnerAudioContext()
innerAudioContext.src = 'https://ai.tj5.cc:35437/static/out(2).mp3'
innerAudioContext.play()
innerAudioContext.onEnded(() => {
console.log('播放结束')
})
},
Countone_Time: function () {
console.log('1')
var inter = setInterval(function () {
this.setData({
smsFlag: true,
snsMsgWait_one: this.data.snsMsgWait_one - 1
});
// console.log('this.data.snsMsgWait_one', this.data.snsMsgWait_one)
if (this.data.snsMsgWait_one == 0) {
this.setData({
longTimeOnce: true
})
clearInterval(inter)
// console.log('this.data.all_state', this.data.all_state)
// console.log('this.data.singe_state', this.data.singe_state)
// console.log('longTimeOnce',this.data.longTimeOnce)
if (this.data.singe_state === true && this.data.all_state === false && this.data.longTimeOnce === true) {
console.log('倒计时0拍照one')
setTimeout(() => {
this.takePhoto2();
this.setData({
all_state: true
})
// console.log('all_state', this.data.all_state)
}, 350);
}
}
}.bind(this), 1200);
},
Counttwo_Time: function () {
console.log('2')
var inter = setInterval(function () {
this.setData({
smsFlag: true,
snsMsgWait_twotime: this.data.snsMsgWait_twotime - 1
});
// console.log('this.data.snsMsgWait_twotime', this.data.snsMsgWait_twotime)
if (this.data.snsMsgWait_twotime == 0) {
clearInterval(inter)
// console.log('this.data.all_state', this.data.all_state)
// console.log('this.data.singe_state', this.data.singe_state)
this.setData({
longTimeTwo: true
})
// console.log('this.data.singe_state',this.data.singe_state)
// console.log('this.data.all_state',this.data.all_state)
// console.log('this.data.longtimeTwo',this.data.longTimeTwo)
if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeTwo === true) {
console.log('倒计时0拍照two')
setTimeout(() => {
// console.log('this.data.take_state', this.data.take_state)
if (this.data.take_state == true) {
// console.log('不进行拍照')
} else {
this.takePhoto2();
this.setData({
all_state: true
})
}
// console.log('倒计时0拍照twoall_state', this.data.all_state)
}, 350);
}
}
}.bind(this), 1200);
},
Countthree_Time: function () {
console.log('3')
var inter = setInterval(function () {
this.setData({
smsFlag: true,
snsMsgWait_three: this.data.snsMsgWait_three - 1
});
// console.log('this.data.snsMsgWait_three', this.data.snsMsgWait_three)
if (this.data.snsMsgWait_three == 0) {
clearInterval(inter)
this.setData({
longTimeThree: true
})
// console.log('this.data.singe_state',this.data.singe_state)
// console.log('this.data.all_state',this.data.all_state)
// console.log('this.data.longtimeThree',this.data.longTimeThree)
if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeThree === true) {
console.log('倒计时0拍照three')
setTimeout(() => {
// console.log('this.data.take_state', this.data.take_state)
if (this.data.take_state == true) {
console.log('不进行拍照')
} else {
this.takePhoto2();
this.setData({
all_state: true
})
}
// console.log('all_state', this.data.all_state)
}, 350);
}
}
}.bind(this), 1200);
}
})
\ No newline at end of file
<view style='width:{{windowWidth}}px; height:{{windowHeight}}px; overflow:auto;'>
<camera wx:if='{{isShowCamera}}' flash="on" class="camera-box" devic-position="back" frame-size="large">
<view class="daojishi">
<view wx:if="{{dongtaishuju_chuan == 1}}">
<text style="font-size: xx-large;">{{snsMsgWait_one}}</text>
<view class="text_hint">
</view>
</view>
<view wx:if="{{dongtaishuju_chuan == 2}}">
<text style="font-size: xx-large;">{{snsMsgWait_twotime}}</text>
<!-- <view class="text_hint">
<text>\n加油,你可以的!</text>
</view> -->
</view>
<view wx:if="{{dongtaishuju_chuan == 3}}">
<text style="font-size: xx-large;">{{snsMsgWait_three}}</text>
<!-- <view class="text_hint">
<text>\n加油,相信自己!</text>
</view> -->
</view>
</view>
<cover-view class='camerabgImage'>
<cover-view class="active">
<view style="height: 100%;width: 100%;">
<!-- <cover-view wx:if="{{status_zhi}}">
<cover-view wx:if="{{status == 'true' }}" class="text_bext" style="width: 600rpx;height: 20%;">请继续等待拍照进行二次认证</cover-view>
<cover-view wx:else=" " class="text_bext" style="width: 600rpx;height: 20%;">请将整个结构三维码置于识别框内</cover-view>
</cover-view> -->
<!-- <cover-view wx:else=""> -->
<cover-image wx:if="{{status == 'true'}}" class="text_2" style="width:600rpx;height: 80rpx; " src="/assets/imgs/等待动图2.gif"></cover-image>
<cover-view wx:else=" " class="text" style="width: 600rpx;height: 20%;">请将整个结构三维码置于识别框内</cover-view>
<!-- </cover-view> -->
<cover-image wx:if="{{status == 'true' }}" class="active-image" src="/assets/imgs/shanshuo.gif"></cover-image>
<cover-image wx:if="{{status == 'true' }}" class="active-image2-2 " src="/assets/imgs/ding.png"></cover-image>
<cover-image wx:else=" " class="active-image2" src="/assets/imgs/shanshuo.gif"></cover-image>
</view>
<view class="advision" style="display:{{isShowads}};">
<image class="" src=""></image>
<view class="" bindtap="cancelAd"></view>
</view>
</cover-view>
</cover-view>
<cover-view class="singboard" style="margin-top: -350px;">
<cover-image wx:if="{{state=='left' || state_x =='left'}}" src="/assets/imgs/jtright.gif"></cover-image>
<cover-image wx:if="{{state=='right' || state_x =='right'}}" src="/assets/imgs/jtleft.gif"></cover-image>
<cover-image wx:if="{{state=='on' || state_x =='on'}}" src="/assets/imgs/jtdown.gif"></cover-image>
<cover-image wx:if="{{state=='down' || state_x =='down'}}" src="/assets/imgs/jton.gif"></cover-image>
<!-- <cover-image wx:if="{{state_x =='left'}}" src="/assets/imgs/jtright.gif"></cover-image>
<cover-image wx:if="{{ state_x =='right'}}" src="/assets/imgs/jtleft.gif"></cover-image>
<cover-image wx:if="{{state_x =='on'}}" src="/assets/imgs/jtdown.gif"></cover-image>
<cover-image wx:if="{{ state_x =='down'}}" src="/assets/imgs/jton.gif"></cover-image> -->
<cover-image wx:else=""></cover-image>
</cover-view>
</camera>
<!-- <image src="{{mybase64}}"></image> -->
</view>
<view style="position:fixed; top: 999999999px;">
<!-- <camera frame-size="small" resolution="high"> -->
<canvas canvas-id="myCanvas" style='width:{{frame.width}}px; height:{{frame.height}}px;'></canvas>
<image src="{{src}}" mode="widthFix" style='width: {{windowWidth}}px; height: {{windowWidth}}px;border: 1px solid red; '></image>
<!-- <image src="{{kongfileimage}}" mode="widthFix" style='width: {{windowWidth}}px; height: {{windowWidth}}px;border: 1px solid red; '></image> -->
<!-- <image src="{{bigfileimage}}" mode="widthFix" style='width: {{windowWidth}}px; height: {{windowWidth}}px;border: 1px solid red; '></image> -->
<!-- </camera> -->
</view>
\ No newline at end of file
.camera-box {
width: 100vw;
height: 100vh;
}
.camera-box .camerabgImage .active {
/* position: absolute; */
margin-top: 58%;
/* width: 60%; */
width: 100%;
margin-left: auto;
margin-right: auto;
}
.active-image {
display: block;
width: 240rpx;
height: 240rpx;
margin-top: 45px;
position: absolute;
margin-left: 260rpx;
margin-right: auto;
background-position: center;
background-repeat: repeat-x;
z-index: 1;
}
.camera-box .camerabgImage .active-image2 {
width: 350rpx;
height: 350rpx;
margin: 25px 25px;
/* position: absolute; */
margin-left: auto;
margin-right: auto;
}
.active-image2_small{
width: 240rpx;
height: 240rpx;
margin: 45px 80px;
position: absolute;
}
.active-image2-2 {
width: 350rpx;
height: 350rpx;
margin: 20px 25px;
position: relative;
margin-right: auto;
margin-left: auto;
}
.text {
font-size: 38rpx;
font-weight: 00rpx;
color:#6309f5;
line-height: 99rpx;
/* margin: auto; */
width: 100%;
margin-right: auto;
margin-left: auto;
text-align: center;
}
.text_bext{
font-size: 36rpx;
font-weight: 00rpx;
/* color:#6309f5; */
line-height: 76rpx;
/* margin: auto; */
width: 100%;
margin-right: auto;
margin-left: auto;
text-align: center;
border: 2rpx;
border-radius: 68rpx;
background-color: rgb(237, 239, 247);
}
.text_2 {
/* font-size: 25rpx; */
/* height: 100%; */
font-weight: 00rpx;
color:#6309f5;
margin: auto;
/* line-height: 40rpx; */
}
.bexit{
width: 450rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
/* margin-top: 15%; */
font-size: 36rpx;
/* color: aliceblue; */
margin: 100rpx auto;
border:2rpx;
border-radius: 70rpx;
background-color: rgb(237, 239, 247);
}
.camera-box .camerabgImage .btn {
width: 108rpx;
height: 110rpx;
border-radius: 50%;
background: #fff;
border: 6rpx solid#fff;
/* margin: 0 auto */
margin-top: 320rpx;
margin-left: 100rpx;
}
.camera-box .camerabgImage .btn .button {
width: 102rpx;
height: 102rpx;
border-radius: 50%;
border: 4rpx solid#000
}
.indicate{
margin-left: auto;
margin-top: -350rpx;
position: absolute;
}
.div{
width: 100%;
margin: auto;
}
.daojishi{
text-align: center;
width: 100%;
position: fixed;
margin-top:100px;
font-weight: 00rpx;
color:rgb(218, 13, 13);
font-size: x-large;
}
.text_hint{
height: 100%;
margin-top: 83%;
}
//index.js
//获取应用实例
const app = getApp()
var counter = 0;
Page({
/**
* 页面的初始数据
*/
data: {
userInfo: {},
src: "../../assets/imgs/takephoto.jpg",
takephoto_txt: "点击图标开始认证识别",
dongtaishuju: 0,
phone_model: '',
benchmarkLevel: 0,
content: "1.识别时请将整个结构三维码放到识别框中,保持画面清晰稳定直到显示认证结果\r\n2.确保标签与背景保持在同一平面内,便于手机相机聚焦\r\n3.AI验证的标签需要与扫描进入主页的这枚标签一致(否则会提示码不同)",
showCover: true,
status_zhi: '',
extraData: '',
all_info: '',
cpid: '',
showmodel:true,
zhongfen:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('options.cpid', options.cpid)
// 使用正则表达式来匹配数字和字母
var reg = /^[0-9a-zA-Z]+$/;
// const labelcode = extraData.cpid
if (options.cpid && options.cpid.length > 14 && reg.test(options.cpid)) {
console.log('中汾页面');
this.setData({
zhongfen:true,
showmodel:false
})
console.log('this.data.zhongfen',this.data.zhongfen)
this.setData({
webviewUrl: `https://tjfnew.china315net.com/dist/zhongfen/route.ashx?cpid=${options.cpid}`,
});
}
// wx.clearStorageSync(); // 清空本地缓存数据
wx.getSystemInfo({
success: (res) => {
console.log('获取用户信息res', res)
let all_info = res
// console.log('all_info',all_info)
wx.setStorage({
key: 'all_info',
data: all_info
});
let phone_model = res.model;
let benchmarkLevel = res.benchmarkLevel;
// console.log('benchmarkLevel',benchmarkLevel)
// console.log('phone_model',phone_model)
wx.setStorage({
key: 'phone_model',
data: phone_model
});
wx.setStorage({
key: 'benchmarkLevel',
data: benchmarkLevel
})
},
})
},
webviewError: function (e) {
console.log('webview 加载错误', e);
},
webviewMessage: function (e) {
console.log('webview 收到消息', e);
},
/**
* 生命周期函数--监听被展示时调用
*/
onShow: function (options) {
const extraData = wx.getStorageSync('extraData')
// this.setData('extraData',extraData)
// console.log('extraData', extraData)
// console.log('extraData.success', extraData.success)
if (typeof extraData.success !== 'undefined') {
console.log('盛意标签');
var status_zhi = ''
wx.setStorage({
'key': 'status_zhi',
data: status_zhi
})
// console.log('status_zhi',status_zhi)
} else {
console.log('不是盛意标签')
var status_zhi = true
wx.setStorage({
'key': 'status_zhi',
data: status_zhi
})
// console.log('status_zhi',status_zhi)
}
if(this.data.showmodel === true){
wx.showModal({
title: '注意事项:',
content: this.data.content,
showCancel: false, // 是否显示取消按钮,默认值 true
// cancelText: '非常自信', // 取消按钮的文字,默认值 '取消'
confirmText: '我已知晓', // 确定按钮的文字,默认值 '确定'
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
}
},
fail: function (res) {
console.log(res)
}
})
}
},
/**ss
* 跳转到拍照界面
*/
takePhoto: function (e) {
wx.navigateTo({
// url: '../takePhoto/takePhoto'
url: '../cameraTakePhoto/cameraTakePhoto',
})
counter++;
this.setData({
dongtaishuju: counter
});
if (this.data.dongtaishuju > 3) {
this.setData({
dongtaishuju: 0
})
}
wx.setStorage({
'key': 'dongtaishuju',
'data': this.data.dongtaishuju
})
// console.log('this.data.dongtaishuju',this.data.dongtaishuju)
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
attention() {
wx.reLaunch({
url: '../attention/attention',
})
},
})
\ No newline at end of file
{}
\ No newline at end of file
<!--index.wxml-->
<web-view wx:if="{{zhongfen}}" src="{{webviewUrl}}" binderror="webviewError" bindmessage="webviewMessage"></web-view>
<veiw class="page">
<image class="background" src="../../assets/imgs/index/backgtound.png"></image>
<image class="carmera" src='../../assets/imgs/index/takephotob.png' class='takephotoe' bindtap='takePhoto'></image>
<image class='takephoto_txt' src="../../assets/imgs/index/begintakephoto.png" bindtap="takePhoto" mode="widthFix"></image>
<!-- <view >
<button bindtap="attention" class="attention_wxss" >注意事项</button>
</view> -->
<view class="{{showCover ? 'cover' : ''}}"></view>
</veiw>
\ No newline at end of file
/**index.wxss**/
.page {
height: 100vh;
/* border-top: 1rpx solid white; */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.takephotoe {
display: block;
width: 350rpx;
height: 350rpx;
border-radius: 999px;
margin-bottom: 15%;
/* box-shadow: 0 0 50rpx #ffd8a2; */
/* position: absolute; left: 50%; top: 50%;
margin-left: -177rpx; margin-top: -335rpx; */
}
.takephoto_txt {
/* display: block; */
width: 275rpx;
height: 84rpx;
margin-bottom: 305rpx;
}
.background {
height: 100vh;
width: 100%;
position: absolute;
z-index: -1;
}
.attention_wxss{
background-color: rgb(165, 165,165);
margin-left:auto;
}
.text-container {
width: 200rpx;
height: 120rpx;
background-color: #fff;
padding: 10rpx;
border-radius: 4rpx;
}
\ No newline at end of file
// 获取全局应用程序实例对象
var util = require('../../utils/util')
var Count = 0;
var fail_Count = 0
// 创建页面实例对象
Page({
// 页面的初始数据
data: {
notice: '',
tempFilePath: "",
width: 0,
height: 0,
score: '',
hasTakePhoto: false,
data: '',
datemill: '',
dtime: '',
dtime1: '',
dtime2: '',
bg: 'white',
isLoading: true,
recognizeLabelCode: '',
labelCode: '',
labelInfo: null,
openid: '',
aiState: 0,
sameCodeState: 0,
filePath: '',
datajson: '',
labelCodejson: '',
labelCodejson_len: '',
imagefile: '',
image_file: '',
phone_score: '',
max_score: '',
if_fileimage: '',
cha_zhi: '',
img_method: '',
img_reader: '',
points: '',
image_file_myapi: '',
userid: '',
userimage: '',
userinfo_name: '',
img_method_chuan: '',
img_reader_chuan: '',
points_chuan: '',
isShowads: 'None',
snsMsgWait: 3,
snsMsgWait_1: 2,
windowWidth: '',
windowHeight: '',
people_zhi: false,
ammeterInfo: '',
people_reply: 0,
state_2: '',
people_isloading: false,
peo_state: 0,
result_state: '',
true_state: false,
fail_state: false,
people_time: '',
people_replytime: '',
people_wait: 7,
zidong_fuzhi: false,
hint_phone: '',
yuan_file: '',
max_score_value: '',
Score_list_value: '',
upload_state: '',
jupload_state: '',
phone_model: '',
timeout_indexOf: 0,
latitude: '',
longitude: '',
res_data: '',
exit: false,
cpid: '',
address: '',
province: '',
city: '',
county: '',
labelInfoUrl: '',
reason: '',
extraData:'',
all_info:'',
zoom_number:''
},
onLoad: function (options) {
this.onHide();
const openid = wx.getStorageSync('openid')
const extraData = wx.getStorageSync('extraData')
let labelInfo = extraData
console.log('labelInfo', labelInfo)
var userid = labelInfo.uid
// console.log('userid', userid)
var cpid = labelInfo.cpid
// console.log('cpid', cpid)
this.setData({
userid,
cpid
})
if (labelInfo === '') {
console.log('id为空')
this.setData({
userid: false,
cpid: false
})
} else {
this.setData({
'userid': userid,
'cpid': cpid
})
}
if (labelInfo.os === 'davis') {
console.log('云平台')
wx.request({
url: 'https://davis.china315net.com/wx/ajax/consumer/info?consumer_id=' + userid,
method: 'GET',
success: (res) => {
if (res.data.e !== '') {
console.log('获取用户失败eeeee')
this.setData({
userimage: '获取失败',
userinfo_name: '获取失败'
})
} else {
var userinfo = res.data
var userimage = userinfo.headimg
var userinfo_name = userinfo.nickname
this.setData({
userimage,
userinfo_name
})
}
},
fail: (error) => {
console.log('获取用户失败', error)
}
})
} else {
console.log('不走云平台')
wx.request({
url: 'https://tjfnew.china315net.com/api/MiniProgram/requestUserData.ashx?uid=' + userid,
method: 'POST',
success: (res) => {
if (res.statusCode !== 200) {
console.log('获取用户失败!=200')
this.setData({
userimage: '获取失败',
userinfo_name: '获取失败'
})
} else {
var userinfo = res.data
var userimage = userinfo.headimg
var userinfo_name = userinfo.nickname
this.setData({
userimage,
userinfo_name
})
}
},
fail: (error) => {
console.log('获取用户失败', error)
}
})
//获取地理位置信息
wx.request({
url: `https://tjfnew.china315net.com/api/MiniProgram/getAddressByCpid.ashx?cpid=${cpid}&uid=${userid}`,
method: 'GET',
success: (res) => {
console.log('获取地理位置信息')
console.log('res.statusCode', res.statusCode)
if (res.statusCode !== 200) {
console.log('获取地理位置失败!=200')
this.setData({
address: '获取失败',
province: '获取失败',
city: '获取失败',
county: '获取失败'
})
} else {
var locationinfo = res.data;
var address = locationinfo.address;
// console.log('address', address);
var province = locationinfo.province
// console.log('province', province)
var city = locationinfo.city
// console.log('city', city)
var county = locationinfo.county
// console.log('county', county)
this.setData({
address,
province,
city,
county
})
}
},
fail: (error) => {
console.log('获取地理位置失败', error)
}
})
}
// if (cpid.length === 16) {
// console.log('种子')
// wx.request({
// url: 'http://315ys.cn/zq/web/getOutCodeInfo.do?c=' + cpid,
// method: 'POST',
// success: (res) => {
// // console.log('获取用户信息', res.data)
// // console.log('res.statusCode ', res.statusCode)
// if (res.data.e !== '') {
// console.log('获取用户失败eeeee')
// this.setData({
// userlat: '获取失败',
// userlon: '获取失败',
// address: '获取失败',
// MSG:'获取失败',
// CUSTOMERNAME:'获取失败',
// BILLDATEL:'获取失败'
// })
// } else {
// var userinfo = res.data
// var userlat = userinfo.qryAddr.LAT
// var userlon = userinfo.qryAddr.LNG
// var address = userinfo.qryAddr.ADDR
// var MSG = userinfo.outList.MSG //出库内容
// var CUSTOMERNAME = userinfo.outList.CUSTOMERNAME //经销商
// var BILLDATE = userinfo.outList.BILLDATE //出库时间
// this.setData({
// userlat,
// userlon,
// address,
// MSG,
// CUSTOMERNAME,
// BILLDATE
// })
// }
// },
// fail: (error) => {
// console.log('获取接口信息失败', error)
// }
// })
// }
let SCREEN_WIDTH = 750
let RATE = wx.getSystemInfoSync().screenHeight / wx.getSystemInfoSync().screenWidth
let {
windowWidth = SCREEN_WIDTH,
windowHeight = SCREEN_WIDTH * RATE
} = wx.getSystemInfoSync()
this.setData({
windowWidth,
windowHeight
})
const datajson = wx.getStorageSync('datajson')
wx.removeStorageSync('datajson')
// console.log('datajson原图解析内容', datajson)
const img_reader_chuan = wx.getStorageSync('img_reader')
const img_method_chuan = wx.getStorageSync('img_method')
const points_chuan = wx.getStorageSync('points')
const hint_phone = wx.getStorageSync('hint_phone')
wx.removeStorageSync('hint_phone')
// console.log('hint_phone', hint_phone)
const yuan_file = wx.getStorageSync('yuan_file')
wx.removeStorageSync('yuan_file')
// console.log('yuan_file', yuan_file)
const phone_model = (wx.getStorageSync('phone_model') || [])
wx.removeStorageSync(phone_model)
// console.log('phone_model', phone_model)
const latitude = wx.getStorageSync('latitude') || '获取失败'
wx.removeStorageSync('latitude')
// console.log('latitude',latitude)
const longitude = wx.getStorageSync('longitude') || '获取失败'
wx.removeStorageSync('longitude')
// console.log('longitude',longitude)
var timesc = new Date().getTime();
let all_info = wx.getStorageSync('all_info') || '获取失败'
// console.log('all_info',all_info)
let zoom_number = wx.getStorageSync('one_zoom') || '获取失败'
// console.log('zoom_number',zoom_number)
this.setData({
img_reader_chuan,
img_method_chuan,
points_chuan,
hint_phone,
yuan_file,
phone_model,
timesc,
latitude,
longitude,
all_info,
zoom_number
})
if (labelInfo) {
console.log('获取标签号labelInfo',labelInfo)
const labelCode = labelInfo.cpid_jm || labelInfo.cpid
this.setData({
labelCode,
labelInfo,
openid,
filePath: options.path,
datajson
})
}else{
console.log('标签号为空')
this.setData({
filePath:options.path
})
}
this.uploadImg()
},
uploadImg() {
console.log('this.data.filePath', this.data.filePath)
const base = wx.getFileSystemManager().readFileSync(this.data.filePath, 'base64')
// console.log('base', base)
if (this.data.labelCode) {
// console.log('开始检查标签相似')
this.checkIsSameCode(base, (state) => {
this.setData({
sameCodeState: state
})
if (state === 1) {
this.checkAiResult(base);
} else {
this.setData({
isLoading: false,
})
}
})
console.log("sameCodeState", this.data.sameCodeState)
} else {
console.log('进入不需要检查标签相似')
this.setData({
sameCodeState: 1,
userimage: false,
userinfo_name: false
})
this.checkAiResult(base);
}
},
//检查标签是否相同
checkIsSameCode(base, cb) {
// console.log('this.data.labelCode', this.data.labelCode)
// console.log('this.data.labelCode.length', this.data.labelCode.length)
const requestData = {
'base': base,
'labelCodejson': this.data.labelCode
};
wx.request({
// url: 'https://tj5.cc:4433/api/upload/',
// url: 'https://ai.china315net.com:35437/api/upload/',
// url:'https://www.7856.work:4433/api/upload/',
url: 'https://ai.tj5.cc:35437/api/upload/',
method: "POST",
data: requestData,
success: (res) => {
const res_data = res.data;
// console.log("res_data", res_data);
const recognize_LabelCode = res_data.codeinfo;
// console.log('recognizeLabelCode放大解析内容', recognize_LabelCode)
const recognize_labelimage = res_data.image_file;
const succes_data = res_data.succes;
const img_method = res_data.img_method;
const img_reader = res_data.img_reader;
const points = res_data.points;
var image_file_myapi = res_data.image_file;
this.setData({
image_file_myapi,
img_reader,
img_method,
points,
recognize_labelimage,
recognize_LabelCode
});
const labelCode = this.data.labelCode;
const labelCodejson = labelCode.substring(-12);
let recognizeLabelCode = '';
let datajson = '';
if (res_data === '码解析失败' || succes_data === 'loser' || res.statusCode !== 200) {
// console.log('网络请求值不等于200')
recognizeLabelCode = '码解析失败'
} else {
recognizeLabelCode = recognize_LabelCode;
}
if (!this.data.datajson || this.data.value === 'false') {
datajson = '码解析失败';
} else {
datajson = this.data.datajson;
}
this.setData({
recognizeLabelCode,
datajson,
labelCodejson,
labelCodejson_len: labelCodejson.length
});
console.log('this.data.recognizeLabelCode放大解析内容', this.data.recognizeLabelCode)
console.log('this.data.datajson1111原图解析内容', this.data.datajson)
console.log('labelcodejson111标签号', labelCodejson)
//判断放大解析与原图解析内容是否与标签号一致
if (this.data.recognizeLabelCode === labelCodejson || this.data.datajson === labelCodejson) {
console.log('一致')
cb(1);
}
else if (this.data.recognizeLabelCode === '码解析失败' && this.data.datajson === '码解析失败') {
console.log('解析失败')
cb(2);
this.setData({
aiState: 3
})
const dtime1 = util.formatTime(new Date());
wx.request({
url: 'https://ai.tj5.cc:35437/api/all/',
// url: 'https://ai.china315net.com:35437/api/all/',
// url: 'https://tj5.cc:4433/api/all/',
// url:'https://www.7856.work:4433/api/all/',
method: "POST",
data: {
'result': '码解析失败',
'score': '0',
'imagefile': recognize_labelimage,
'classs': this.data.hint_phone,
'usetime': '0',
'datetime': dtime1,
'openid': this.data.openid,
'userip': '',
'userlat': this.data.latitude,
'userlon': this.data.longitude,
'recognizelabelcode': this.data.recognizeLabelCode,
'artwork': this.data.datajson,
'labelcode': this.data.labelCode,
'scorelist': '',
'img_method': '',
'img_reader': '',
'points': '',
'userid': this.data.userid || '',
'userimage': this.data.userimage,
'userinfo_name': this.data.userinfo_name,
'yuan_file': this.data.yuan_file,
'phone_model': this.data.phone_model,
'cpid': this.data.cpid || '',
'address': this.data.address || '',
'province': this.data.province || '',
'city': this.data.city || '',
'county': this.data.county || '',
'all_info':this.data.all_info || '',
'zoom_number':this.data.zoom_number || ''
},
success: (res) => {
console.log('all入库成功', res);
},
fail: (error) => {
console.log('入库失败', error);
}
});
} else {
console.log('码不同')
cb(0);
// console.log('码不同', this.data.sameCodeState)
const dtime2 = util.formatTime(new Date());
wx.request({
url: 'https://ai.tj5.cc:35437/api/all/',
// url: 'https://tj5.cc:4433/api/all/',
// url:'https://www.7856.work:4433/api/all/',
// url: 'https://ai.china315net.com:35437/api/all/',
method: "POST",
data: {
'result': '码不同',
'score': '0',
'imagefile': recognize_labelimage,
'classs': '',
'usetime': '0',
'datetime': dtime2,
'openid': this.data.openid,
'userip': '',
'userlat': this.data.latitude,
'userlon': this.data.longitude,
'recognizelabelcode': this.data.recognizeLabelCode,
'artwork': this.data.datajson,
'labelcode': this.data.labelCode,
'scorelist': '',
'img_method': '',
'img_reader': '',
'points': '',
'userid': this.data.userid || '',
'userimage': this.data.userimage || '',
'userinfo_name': this.data.userinfo_name || '',
'yuan_file': this.data.yuan_file || '',
'phone_model': this.data.phone_model || '',
'cpid': this.data.cpid || '',
'address': this.data.address || '',
'province': this.data.province || '',
'city': this.data.city || '',
'county': this.data.county || '',
'all_info':this.data.all_info || '',
'zoom_number':this.data.zoom_number || ''
},
success: (res) => {
console.log('all入库成功', res);
},
fail: (error) => {
console.log('入库失败', error);
}
});
}
},
fail: (error) => {
console.log('调用upload接口超时', error)
cb(2);
wx.request({
url: 'https://ai.tj5.cc:35437/api/all/',
// url: 'https://tj5.cc:4433/api/all/',
// url:'https://www.7856.work:4433/api/all/',
method: "POST",
data: {
'result': '调用upload接口超时',
'score': '0',
'imagefile': '',
'classs': this.data.hint_phone,
'usetime': '0',
'datetime': dtime2,
'openid': this.data.openid,
'userip': '',
'userlat': this.data.latitude,
'userlon': this.data.longitude,
'recognizelabelcode': '码解析失败',
'artwork': this.data.datajson,
'labelcode': this.data.labelCode,
'scorelist': '',
'img_method': '',
'img_reader': '',
'points': '',
'userid': this.data.userid || '',
'userimage': this.data.userimage,
'userinfo_name': this.data.userinfo_name,
'yuan_file': this.data.yuan_file,
'phone_model': this.data.phone_model,
'cpid': this.data.cpid || '',
'address': this.data.address || '',
'province': this.data.province || '',
'city': this.data.city || '',
'county': this.data.county || '',
'all_info':this.data.all_info || '',
'zoom_number':this.data.zoom_number || ''
},
success: (res) => {
console.log('success,调用upload接口超时', res)
},
fail: (error) => {
console.log('fail,调用upload接口超时', error);
}
});
//判断手机型号 开始注释
// let timeoutIndex = -1;
// if (wx.getSystemInfoSync().platform === 'ios') {
// timeoutIndex = res.errMsg.indexOf('timeout');
// // console.log('timeoutIndex', timeoutIndex)
// } else if (wx.getSystemInfoSync().platform === 'android') {
// timeoutIndex = res.errMsg.indexOf('time out');
// // console.log('timeoutIndex', timeoutIndex)
// }
// if (timeoutIndex !== -1) {
// console.log('请求超时1')
// // console.log('this.data.datajson', this.data.datajson)
// if (this.data.datajson === this.data.labelCode) {
// console.log('到这里')
// cb(1);
// } else if ((this.data.datajson !== '' && this.data.datajson !== '码解析失败') && (this.data.datajson !== this.data.labelCode)) {
// cb(0);
// const dtime2 = util.formatTime(new Date());
// // console.log('dtime2', dtime2)
// // console.log('this.data.recognizeLabelCode',this.data.recognizeLabelCode)
// wx.request({
// url: 'https://ai.tj5.cc:35437/api/all/',
// // url: 'https://tj5.cc:4433/api/all/',
// // url:'https://www.7856.work:4433/api/all/',
// // url: 'https://ai.china315net.com:35437/api/all/',
// method: "POST",
// data: {
// 'result': '码不同',
// 'score': '0',
// 'imagefile': '',
// 'classs': '',
// 'usetime': '0',
// 'datetime': dtime2,
// 'openid': this.data.openid,
// 'userip': '',
// 'userlat': this.data.latitude,
// 'userlon': this.data.longitude,
// 'recognizelabelcode': '',
// 'artwork': this.data.datajson,
// 'labelcode': this.data.labelCode,
// 'scorelist': '',
// 'img_method': '',
// 'img_reader': '',
// 'points': '',
// 'userid': this.data.userid || '',
// 'userimage': this.data.userimage,
// 'userinfo_name': this.data.userinfo_name,
// 'yuan_file': this.data.yuan_file,
// 'phone_model': this.data.phone_model,
// 'cpid': this.data.cpid || '',
// 'address': this.data.address || '',
// 'province': this.data.province || '',
// 'city': this.data.city || '',
// 'county': this.data.county || '',
// },
// success: (res) => {
// console.log('success,码不同', res);
// },
// fail: (error) => {
// console.log('fail,码不同', error)
// }
// });
// } else {
// console.log('res.data', !res.data)
// if (!res.data) {
// // console.log('网络请求没有返回任何数据')
// console.log('请求超时2');
// const dtime2 = util.formatTime(new Date());
// // console.log('dtime2_2', dtime2)
// cb(2);
// wx.request({
// url: 'https://ai.tj5.cc:35437/api/all/',
// // url: 'https://tj5.cc:4433/api/all/',
// // url:'https://www.7856.work:4433/api/all/',
// method: "POST",
// data: {
// 'result': '接口超时',
// 'score': '0',
// 'imagefile': '',
// 'classs': this.data.hint_phone,
// 'usetime': '0',
// 'datetime': dtime2,
// 'openid': this.data.openid,
// 'userip': '',
// 'userlat': this.data.latitude,
// 'userlon': this.data.longitude,
// 'recognizelabelcode': '解析超时',
// 'artwork': this.data.datajson,
// 'labelcode': this.data.labelCode,
// 'scorelist': '',
// 'img_method': '',
// 'img_reader': '',
// 'points': '',
// 'userid': this.data.userid || '',
// 'userimage': this.data.userimage,
// 'userinfo_name': this.data.userinfo_name,
// 'yuan_file': this.data.yuan_file,
// 'phone_model': this.data.phone_model,
// 'cpid': this.data.cpid || '',
// 'address': this.data.address || '',
// 'province': this.data.province || '',
// 'city': this.data.city || '',
// 'county': this.data.county || '',
// },
// success: (res) => {
// console.log('success,调用接口超时成功', res);
// },
// fail: (error) => {
// console.log('fail,调用接口超时失败', error)
// }
// });
// }
// }
// } else {
// console.log('网络请求发生错误')
// const dtime2 = util.formatTime(new Date());
// // console.log('dtime2_2', dtime2)
// cb(2);
// wx.request({
// url: 'https://ai.tj5.cc:35437/api/all/',
// // url: 'https://tj5.cc:4433/api/all/',
// // url:'https://www.7856.work:4433/api/all/',
// method: "POST",
// data: {
// 'result': '网络请求发生错误',
// 'score': '0',
// 'imagefile': '',
// 'classs': this.data.hint_phone,
// 'usetime': '0',
// 'datetime': dtime2,
// 'openid': this.data.openid,
// 'userip': '',
// 'userlat': this.data.latitude,
// 'userlon': this.data.longitude,
// 'recognizelabelcode': '码解析失败',
// 'artwork': this.data.datajson,
// 'labelcode': this.data.labelCode,
// 'scorelist': '',
// 'img_method': '',
// 'img_reader': '',
// 'points': '',
// 'userid': this.data.userid || '',
// 'userimage': this.data.userimage,
// 'userinfo_name': this.data.userinfo_name,
// 'yuan_file': this.data.yuan_file,
// 'phone_model': this.data.phone_model,
// 'cpid': this.data.cpid || '',
// 'address': this.data.address || '',
// 'province': this.data.province || '',
// 'city': this.data.city || '',
// 'county': this.data.county || '',
// },
// success: (res) => {
// console.log('success,网络请求发生错误', res)
// },
// fail: (error) => {
// console.log('fail,网络请求发生错误', error);
// }
// });
// }
//一直注释到这里
},
timeout: 3000
})
},
//检查ai识别结果
checkAiResult(base) {
wx.request({
//线上服务器
// url: 'https://ai.china315net.com:35437/classify/',
// url: 'https://ai.tj5.cc:35437/classify16/',
url: 'https://ai.tj5.cc:35437/classify16/',
// url: 'https://ai.china315net.com:35437/classify16/',
// 测试服务器
// url: 'https://tj5.cc:4433/objectclass/',
// url: 'https://tj5.cc:4433/classify16/',
// url:'https://www.7856.work:4433/api/classify16/',
method: 'POST',
data: {
'image_type': 20,
'base': base,
},
success: (res) => {
console.log('打印分类接口返回数据res.data', res.data)
let imagefile = res.data.image_path
const classScore = res.data.result
const max_score = Math.max.apply(null, res.data.confidence)
const max_score_value = max_score.toFixed(3)
const Score_list = res.data.confidence
// console.log('Score_list', Score_list)
for (var i = 0; i < Score_list.length; i++) {
Score_list[i] = Score_list[i].toFixed(3);
}
var floatList = []; // 存放转换后的浮点型数据
for (var i = 0; i < Score_list.length; i++) {
var num = parseFloat(Score_list[i]);
if (!isNaN(num)) { // 如果转换结果不是NaN,则表示转换成功
floatList.push(num); // 将转换结果添加到列表中
}
}
const phone_score = res.data.confidence[4]
function mysort(a) {
var n = a.length;
var newa = [];
var temp;
for (var i = 0; i < n; i++) {
for (var j = i; j < n; j++) {
if (a[i] > a[j]) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
newa.push(a[i]);
}
return newa;
}
const class_score_sor = mysort(Score_list)
// console.log('class_score_sor', class_score_sor)
const second_score = class_score_sor[14]
// console.log('second_score', second_score)
const cha_zhi = max_score - second_score
// console.log('cha_zhi', cha_zhi)
let notice = ''
// let score = res.data.confidence
let succ = ''
// ai通过状态
let aiState = 0;
this.setData({
isLoading: false,
imagefile: imagefile,
phone_score: phone_score,
})
// console.log('classScore_11111', classScore)
if (this.data.hint_phone == 14) {
notice = '手机边框'
// notice = '请拍摄结构三维码'
} else if (max_score < 0.85 || cha_zhi < 0.3) {
notice = '算法不确定具体分类'
} else if (classScore == 0) {
// console.log(1)
notice = '结构三维码'
succ = 'lightgreen'
aiState = 1
} else if (classScore == 1) {
notice = '拍摄模糊,请重新拍照'
succ = 'rgb(245, 12, 12)'
aiState = 2
} else if (classScore == 2) {
// notice = '太小'
// console.log(2)
notice = '请拍摄结构三维码'
succ = 'rgb(245, 12, 12)'
} else if (classScore == 3) {
// notice = '复印'
// console.log(3)
notice = '请拍摄结构三维码'
succ = 'rgb(245, 12, 12)'
} else if (classScore == 4) {
// console.log(4)
notice = '请拍摄结构三维码'
succ = 'rgb(245, 12, 12)'
} else if (classScore == 5) {
// notice = '没有识别到结构三维码'
// console.log(5)
notice = '请拍摄结构三维码'
succ = 'rgb(245, 12, 12)'
// } else if (classScore == 6 && this.data.attention_chuan === 0 ) {
} else if (classScore == 6) {
// console.log(6)
notice = '多层纸结构三维码'
succ = 'lightgreen'
aiState = 1
// } else if (classScore == 7 && this.data.attention_chuan === 0){
} else if (classScore == 7) {
// console.log(7)
notice = '烫金三维码'
succ = 'lightgreen'
aiState = 1
} else if (res.data.result == 8) {
// console.log(8)
// notice = '屏幕(烫金三维码)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 9) {
// console.log(9)
// notice = '复印(烫金三维码)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 10) {
// console.log(10)
// notice ='模糊(烫金三维码)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 11) {
// console.log(11)
// notice= '屏幕(反光)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 12) {
// console.log(12)
// notice = '屏幕(干涉条纹)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 13) {
// console.log(13)
// notice = '屏幕(像素点)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 14) {
// console.log(14)
// notice ='屏幕(手机边框,太小)'
notice = '请拍摄结构三维码'
} else if (res.data.result == 15) {
// console.log(15)
// notice = '立体三维码'
notice = '请拍摄结构三维码'
} else if (res.data.result == 16) {
// console.log('铆钉三维码')
notice = '铆钉三维码'
aiState = 1
} else if (res.data.result == 17) {
// console.log('高分子三维码')
notice = '高分子三维码'
aiState = 1
} else if (res.data.result == 18) {
// console.log('护照烫金三维码')
notice = '护照烫金三维码'
aiState = 1
} else if (res.data.result == 19) {
// console.log('烫金三维码(小尺寸)')
notice = '烫金三维码(小尺寸)'
} else if (res.data.result == 20) {
// console.log('立方体三维码')
notice = '立方体三维码'
} else if (res.data.result == 21) {
// console.log('墙上三维码')
notice = '墙上三维码'
} else if (res.data.result == 22) {
// console.log('车牌三维码')
notice = '车牌三维码'
} else if (res.data.result == 23) {
// console.log('中国结三维码')
notice = '中国结三维码'
} else {
notice = '算法不确定具体分类'
}
console.log('最终结果', notice)
//更新数据
this.setData({
isLoading: false,
imagefile: imagefile,
phone_score: phone_score,
succ: succ,
notice: notice,
aiState: aiState,
});
wx.setStorage({
key: 'notice',
data: notice
})
if (notice != '手机边框') {
if (aiState !== 1) {
Count++;
} else {
Count = 0;
}
if (Count >= 3) {
// console.log('Count', Count)
console.log('三次未通过调用人工')
var people_time = util.formatTime(new Date)
var timessc = new Date().getTime();
this.setData({
isLoading: true,
people_time
})
Count = 0;
console.log('三次请拍摄结构三维码调用人工')
wx.request({
header: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
},
// url: 'https://tj5.cc:4433/bg/swmrecognizeproject/apis/miniprogram/uploadimg.ashx',
url: 'https://www.7856.work:4433/bg/swmrecognizeproject/apis/miniprogram/uploadimg.ashx',
// url: 'https://192.168.8.8:4433/bg/swmrecognizeproject/apis/miniprogram/uploadimg.ashx',
// url: 'https://tj5.cc:4433/bg/swmrecognizeproject/apis/miniprogram/uploadimg',
method: 'POST',
data: {
base: base,
image_file: this.data.yuan_file
},
success: (res) => {
console.log('三次拍照未通过人工回复倒计时')
// console.log('获取返回信息', res.data)
let upload_state = res.data.length
// console.log('upload_state', upload_state)
if (upload_state > 500) {
console.log('人工调用接口失败')
this.setData({
fail_state: true,
isLoading: false,
sameCodeState: 1
})
// console.log('this.data.sameCodeState', this.data.sameCodeState)
} else {
var inter = setInterval(function () {
this.setData({
smsFlag: true,
sendTime: this.data.people_wait,
people_wait: this.data.people_wait - 1
});
// console.log('this.data.people_wait', this.data.people_wait)
if (this.data.people_wait < 0) {
this.setData({
zidong_fuzhi: true
});
// console.log('this.data.zidong_fuzhi', this.data.zidong_fuzhi)
clearInterval(inter)
}
}.bind(this), 1000);
// let people_statu = res.data.success
let people_id = res.data.id
let people_image = res.data.image
if (people_id != '') {
this.data.setInter = setInterval(() => {
console.log('每隔1s执行一次')
wx.request({
// url: 'https://tj5.cc:4433/api/getstate/',
url: 'https://www.7856.work:4433/api/getstate/',
// url: 'https://192.168.8.8:4433/api/getstate/',
method: 'POST',
data: {
people_image: people_image
},
success: (res) => {
// console.log('res.data', res.data)
let peo_state = res.data.state[0]
// console.log('peo_state', peo_state)
if (peo_state !== '') {
console.log('状态值不为空')
this.setData({
sameCodeState: 3
})
// console.log('this.data.sameCodeState3', this.data.sameCodeState)
if (peo_state == 1) {
console.log('人工回复真品')
this.setData({
peo_state: peo_state,
true_state: true,
isLoading: false,
aiState: 1,
})
// console.log('this.data.peo_state', this.data.peo_state)
// console.log('this.data.aiState', this.data.aiState)
clearInterval(this.data.setInter)
var timeec = new Date().getTime();
var people_replytime = timeec - timessc
// console.log('本次认证时间people_replytime', people_replytime / 1000)
this.setData({
people_replytime
})
// console.log('people_replytime', people_replytime)
}
if (peo_state !== 0 && peo_state !== 1 || this.data.zidong_fuzhi) {
console.log('人工回复不是真品')
this.setData({
peo_state: peo_state,
fail_state: true,
isLoading: false,
sameCodeState: 1
})
// console.log('this.data.peo_state', this.data.peo_state)
// console.log('this.data.fail_state', this.data.fail_state)
// console.log('this.data.sameCodeState', this.data.sameCodeState)
clearInterval(this.data.setInter)
var timeec = new Date().getTime();
var people_replytime = timeec - timessc
this.setData({
people_replytime
})
// console.log('people_replytime', people_replytime)
} else {
console.log('没有进行回复')
var timeec = new Date().getTime();
var people_replytime = timeec - timessc
this.setData({
people_replytime
})
// console.log('people_replytime', people_replytime)
}
}
},
})
}, 2500)
}
}
},
fail: (err) => {
console.log('err', err)
},
complete: (res) => {
if (!res.data) {
console.log('调用人工回复接口失败')
this.setData({
fail_state: true,
isLoading: false,
sameCodeState: 1
})
}
},
timeout: 5000
})
}
this.setData({
Count
})
}
var timeec = new Date().getTime();
var datemill = timeec - this.data.timesc
// console.log('本次认证时间', datemill / 1000)
var dtime = util.formatTime(new Date)
this.setData({
notice,
datemill,
dtime,
succ,
aiState,
})
if (this.data.recognizeLabelCode === '码解析失败') {
console.log('判断条件成功,使用原图的')
const img_method = this.data.img_method_chuan;
const img_reader = this.data.img_reader_chuan;
const points = this.data.points_chuan;
this.setData({
img_method,
img_reader,
points
})
} else {
console.log('使用放大的')
const img_method = this.data.img_method;
const img_reader = this.data.img_reader;
const points = this.data.points;
this.setData({
img_reader,
img_method,
points
})
}
let state = 0;
if (notice === '结构三维码' || notice === '烫金三维码' || notice === '多层纸结构三维码' || notice === '高分子三维码' || notice === '铆钉三维码' || notice === '护照烫金三维码') {
state = 1;
this.setData({
sameCodeState: 3
})
console.log('走这里')
// this.popup()
} else {
this.setData({
sameCodeState: 2
})
}
// console.log('this.data.sameCodeState', this.data.sameCodeState)
if (state == 1) {
console.log('倒计时')
var inter = setInterval(function () {
this.setData({
smsFlag: true,
sendTime: this.data.snsMsgWait_1,
snsMsgWait_1: this.data.snsMsgWait_1 - 1
});
// console.log('this.data.snsMsgWait_1', this.data.snsMsgWait_1)
if (this.data.snsMsgWait_1 === -1) {
this.popup()
}
if (this.data.snsMsgWait_1 < 0) {
clearInterval(inter)
this.setData({
snsMsgWait_1: 2,
smsFlag: false
});
}
}.bind(this), 1000);
}
this.callBackAIStatus(state)
const postdata = {
'result': notice,
'score': max_score_value,
'imagefile': this.data.image_file_myapi || imagefile,
'classs': classScore,
'usetime': datemill / 1000,
'datetime': dtime,
'openid': this.data.openid,
'userip': '',
'userlat': this.data.latitude,
'userlon': this.data.longitude,
'recognizelabelcode': this.data.recognizeLabelCode,
'artwork': this.data.datajson,
'labelcode': this.data.labelCode || '',
'scorelist': floatList,
'img_method': this.data.img_method,
'img_reader': this.data.img_reader,
'points': this.data.points,
'userid': this.data.userid || '',
'userimage': this.data.userimage,
'userinfo_name': this.data.userinfo_name,
'yuan_file': this.data.yuan_file,
'phone_model': this.data.phone_model,
'cpid': this.data.cpid || '',
'address': this.data.address || '',
'province': this.data.province || '',
'city': this.data.city || '',
'county': this.data.county || '',
'all_info':this.data.all_info || '',
'zoom_number':this.data.zoom_number || ''
}
console.log('this.data.image_file_myapi',)
wx.request({
// url: 'https://ai.china315net.com:35437/api/all/',
url: 'https://ai.tj5.cc:35437/api/all/',
// url: 'https://tj5.cc:4433/api/all/',
// url:'https://www.7856.work:4433/api/all/',
method: "POST",
data: {
...postdata
},
success: (res1) => {
this.setData({
success: res1.data.log
})
},
complete: () => {}
})
wx.removeStorage({
'artwork': this.data.datajson,
succes(res) {
console.log('resresres', res)
}
})
try {
wx.removeStorageSync('artwork')
} catch (e) {
console.log('eee', e)
}
},
fail: (res) => {
console.log('分类接口报错', res)
}
})
},
back() {
wx.reLaunch({
url: '/pages/index/index',
})
},
// old() {
// wx.getSystemInfo({
// success: function (res) {
// var width = res.windowWidth
// var height = res.windowHeight
// var gap = 20
// that.setData({
// width: width,
// height: height,
// gpa: gap
// }),
// wx.getImageInfo({
// src: that.path,
// success: function (res) {
// console.log('src', that.path)
// that.canvas = wx.createCanvasContext('image_id', that)
// console.log('that.canvas', that.canvas)
// that.canvas.drawImage(that.path, 0, 0, width, height)
// // wx.showLoading({
// // title: '数据处理中',
// // mask: true
// // })
// that.canvas.draw()
// setTimeout(function () {
// wx.canvasToTempFilePath({
// canvasId: 'image_id',
// x: 75,
// y: 0,
// width: 450,
// height: 450,
// destWidth: 659,
// destHeight: 1280,
// fileType: 'jpg',
// canvasId: 'image_id',
// quality: 1,
// success: (res) => {
// // console.log('destwidth',304*wx.getSystemInfoSync().pixelRatio)
// // console.log('destwidth',304*wx.getSystemInfoSync().pixelRatio)
// let openid = openid
// console.log('openid', openid)
// let image = res.tempFilePath
// console.log('image11111', image)
// that.filePath = res.tempFilePath
// console.log('file', that.filepath)
// const base = wx.getFileSystemManager().readFileSync(that.filePath, 'base64')
// console.log('base', base)
// var timesc = new Date().getTime();
// wx.request({
// //线上服务器
// url: 'https://ai.china315net.com:35437/classify/',
// // 测试服务器
// // url: 'http://236.123nat.com:5050/',
// method: 'POST',
// data: {
// base
// },
// success: (res) => {
// console.log(res)
// console.log('data', res.data.result)
// let notice = ''
// let score = ''
// that.setData({
// isLoading: false
// })
// if (res.data.result == 0) {
// notice = '结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'lightgreen'
// })
// } else if (res.data.result == 1) {
// notice = '拍摄模糊,请重新拍照'
// score = res.data.confidence
// that.setData({
// succ: 'rgb(245, 12, 12)'
// })
// } else if (res.data.result == 2) {
// notice = '请拍摄结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'rgb(245, 12, 12)'
// })
// } else if (res.data.result == 3) {
// notice = '请拍摄结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'rgb(245, 12, 12)'
// })
// } else if (res.data.result == 4) {
// notice = '请拍摄结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'rgb(245, 12, 12)'
// })
// } else if (res.data.result == 5) {
// notice = '请拍摄结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'rgb(245, 12, 12)'
// })
// } else if (res.data.result == 6) {
// notice = '结构三维码'
// score = res.data.confidence
// that.setData({
// succ: 'lightgreen'
// })
// } else if (res.data.result == 7) {
// notice = '烫金三维码'
// score = res.data.confidence
// that.setData({
// succ: 'lightgreen'
// })
// }
// var timeec = new Date().getTime();
// var datemill = timeec - timesc
// var dtime = util.formatTime(new Date)
// console.log('当前时间', dtime)
// console.log('datemi', datemill)
// that.setData({
// notice,
// score,
// datemill,
// dtime
// })
// console.log('data', this.data, 'score', score)
// }
// })
// }
// });
// }, 1000);
// },
// next_calculator: function () {
// wx.reLaunch({
// url: '../index/index',
// })
// },
// next_calculatorin: function () {
// wx.reLaunch({
// url: '../index/index',
// })
// },
// back() {
// wx.reLaunch({
// url: '/pages/index/index',
// })
// }
// })
// }
// })
// },
// 回调AI结果
callBackAIStatus(state) {
const labelInfo = this.data.labelInfo;
console.log('labelInfo', labelInfo)
if (!labelInfo) {
return;
}
labelInfo.state = state
// console.log('state', state)
// console.log('labelInfo.state', labelInfo.state)
// const uuid = labelInfo.uuid
// console.log('uuid', uuid)
// console.log('labelInfo.os',labelInfo.os)
//调用云平台接口
if (labelInfo.os === 'davis') {
wx.request({
url: 'https://davis.china315net.com/wx/ajax/get_ai_status/',
method: 'GET',
data: {
"label_code": labelInfo.cpid,
"consumer_id": labelInfo.uid,
"uuid": labelInfo.uuid,
"state": labelInfo.state,
},
success: (res) => {
console.log('回调成功davis')
}
})
} else {
console.log('没有davis')
// console.log('labelInfo', labelInfo)
wx.request({
url: 'https://tjfnew.china315net.com/ajax/requestMiniprogramAIStatus.ashx',
method: 'GET',
data: {
...labelInfo
},
success: (res) => {
console.log('回调成功')
// console.log('labelInfo.success', labelInfo.success);
// console.log('this.data.notice')
}
})
}
},
//点击按钮显示
popup: function (e) {
this.setData({
showModal: true
})
// console.log('popup_showModal', this.data.showModal);
//实现倒计时
var inter = setInterval(function () {
this.setData({
smsFlag: true,
sendTime: this.data.snsMsgWait,
snsMsgWait: this.data.snsMsgWait - 1
});
// console.log('this.data.snsMsgWait', this.data.snsMsgWait)
if (this.data.snsMsgWait === -1) {
this.hidepopup()
}
if (this.data.snsMsgWait < 0) {
clearInterval(inter)
this.setData({
snsMsgWait: 3,
smsFlag: false
});
}
}.bind(this), 1000);
},
//点击隐藏图标
hidepopup: function () {
this.setData({
showModal: false
})
//在需要退出小程序的地方调用添加下面代码即可(js文件中)
// wx.exitMiniProgram({success: (res) => {}})
},
Exit: function () {
wx.exitMiniProgram({
success: (res) => {
console.log('用户点击退出小城序')
}
})
},
CleanData: function () {
//修改 清除缓存
},
onHide: function () {
const innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.stop();
innerAudioContext.destroy();
},
})
\ No newline at end of file
{
"usingComponents": {
"loading": "/componets/loading/index.js"
}
}
<view class="page">
<image class="bg" src="/assets/imgs/wating/loadingbg.jpg"></image>
<view wx:if="{{isLoading }}" speed="{{180}}">
<image class="loadings" src="/assets/imgs/wating/loadingg.gif" style="width:420rpx; height: 420rpx;"></image>
<image class="loadingtrue" src="/assets/imgs/wating/truee.png" style="width: 260rpx; height: 50rpx;"></image>
</view>
<view class="res" wx:if="{{!isLoading}}">
<!-- 认证通过 -->
<!-- <block wx:if="{{aiState === 1 || (true_state === true && peo_state === 1 )}}"> -->
<!-- <image class="img" src="/assets/imgs/success/truee.png" bindtap="popup"></image> -->
<!-- <view class="modal-mask" bindtap="" wx:if="{{showModal}}"></view> -->
<!-- <image class="msg-img" src="/assets/imgs/success/successmag.png" bindtap="back"></image> -->
<!-- <view class="detail">
<view class="left">
<view class="title">
本次认证时间
</view>
<view class="value">{{dtime || people_time}}</view>
</view>
<view class="right">
<view class="title">
本次认证耗时
</view>
<view class="value">{{datemill/1000 || peeople_replytime/1000}}s</view>
</view>
</view> -->
<!-- 倒计时出现 -->
<!-- <view class="modal-dialog" wx:if="{{showModal}}" >
<p class="gunabi" bindtap="hidepopup" mode="widthFix,heightFix">关闭</p>
<text class="seconds">{{sendTime}}s</text>
<image class="img_on" src="https://ai.tj5.cc:35437/static/succes_on.gif"></image>
<image class="img_down" src="https://ai.tj5.cc:35437/static/succes_down.gif"></image>
</view> -->
<!-- <navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator> -->
<!-- </block> -->
<!-- 码不同 -->
<!-- <block wx:if="{{recognizeLabelCode !== labelCode&& recognizeLabelCode!=='码解析失败' || datajson !== labelCode && datajson!=='码解析失败' }}"> -->
<!-- <block wx:if="{{sameCodeState ===0 }}"> -->
<!-- <image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image> -->
<!-- <image class="msg-img" src="/assets/imgs/fail/fialmsgjson.png" bindtap="back"></image> -->
<!-- <view class="text_text" style="color: aliceblue;" ><text>点击拍照按钮重新认证</text></view> -->
<!-- <navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator> -->
<!-- <text style="color: aliceblue;"> 码不同</text>
<text style="color: aliceblue;">\n解析号码labelcode:{{recognizeLabelCode}}</text>
<text style="color: aliceblue;">\n解析号码datajson:{{datajson}}</text>
<text style="color: aliceblue;">\n标签号码:{{labelCodejson}}</text> -->
<!-- <image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<image class="msg-img" src="/assets/imgs/different/different.png" bindtap="back"></image>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator> -->
<!-- </block> -->
<!-- 认证未通过 -->
<!-- <block wx:if="{{ sameCodeState === 1 && aiState === 0 || recognizeLabelCode ==='码解析失败' && datajson==='码解析失败'}}"> -->
<!-- <block wx:if="{{ sameCodeState === 2 }}">
<image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<image class="msg-img" src="/assets/imgs/fail/ffailmsg.png" bindtap="back"></image>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block> -->
<!-- <block wx:if="{{ (sameCodeState === 1 && aiState === 0 ) || (fail_state === true && sameCodeState === 0 ) }}">
<image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<image class="msg-img" src="/assets/imgs/fail/ffailmsg.png" bindtap="back"></image>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block> -->
<!-- 优化 -->
<!-- 码不同 -->
<block wx:if="{{sameCodeState ===0 }}">
<image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<image class="msg-img" src="/assets/imgs/different/different.png" bindtap="back"></image>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block>
<!-- 未通过 -->
<!-- <block wx:if="{{sameCodeState === 2 || (sameCodeState === 1 && aiState === 0) || (fail_state === true && sameCodeState === 0)}}">
<image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<image class="msg-img" src="/assets/imgs/fail/ffailmsg.png" bindtap="back"></image>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block> -->
<!-- 新增 -->
<block wx:if="{{sameCodeState === 2 || (fail_state === true && sameCodeState === 1) }}">
<image class="img" src="/assets/imgs/fail/takephotoo.png" bindtap="back"></image>
<block wx:if="{{aiState === 0 || (fail_state === true && sameCodeState === 0 ) }}">
<image class="msg-img" src="/assets/imgs/fail/ffailmsg.png" bindtap="back"></image>
</block>
<block wx:if="{{aiState === 2}}">
<image class="msg-img" src="/assets/imgs/fail/slur.png" bindtap="back"></image>
</block>
<block wx:if="{{aiState === 3}}">
<image class="msg-img" src="/assets/imgs/fail/incomplete.png" bindtap="back"></image>
</block>
<view class="text_text" style="color: aliceblue;"><text>点击拍照按钮重新认证</text></view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block>
<!-- 通过 -->
<block wx:if="{{aiState ===1 || (true_state === true && peo_state === 1) }}">
<!-- <view wx:if="{{labelInfoUrl === true}}">
<web-view src="{{h5url}}"></web-view>
</view> -->
<image class="img" src="/assets/imgs/success/truee.png" bindtap="popup"></image>
<image class="msg-img" src="/assets/imgs/success/successmag.png" bindtap="back"></image>
<view class="detail">
<view class="left">
<view class="title">本次认证时间</view>
<view class="value">{{dtime || people_time}}</view>
</view>
<view class="right">
<view class="title">本次认证耗时</view>
<view class="value">{{ people_replytime/1000 || datemill/1000}}s</view>
</view>
</view>
<navigator class="bexit" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</block>
</view>
</view>
<!-- <image src="{{filePath}}" mode="widthFix" style='width: {{windowWidth}}px; height: {{windowWidth}}px;border: 1px solid red; '></image> -->
/* pages/upload/upload.wxss */
.page{
height: 100vh;
position: relative;
overflow: hidden;
}
.bg{
width: 100%;
height: 100vh;
position: absolute;
z-index: -1;
}
.sfbg{
width: 100%;
height: 100vh;
position: absolute;
z-index: -1;
}
.loading{
position: absolute;
top: 150rpx;
left: 50%;
transform: translateX(-50%);
}
.loadings{
position: absolute;
margin-top: 300rpx;
left: 24%;
/* transform: translateX(-50%); */
}
.loadingtrue{
position: absolute;
margin-top: 840rpx;
left: 33%;
}
.loadingfk{
position: absolute;
margin-top: 55rpx;
left: 260rpx;
}
.loadingtext{
position: absolute;
margin-top: 185rpx;
left: 295rpx;
}
.img{
display: block;
width: 280rpx;
height: 280rpx;
margin: 150rpx auto 30rpx;
}
.msg-img{
display: block;
width: 462rpx;
height: 102rpx;
margin: auto;
margin-top: 150rpx;
}
.detail{
width: 70%;
margin:30rpx auto 0rpx;
display: flex;
text-align: center;
color: gray;
}
.left,
.right{
flex: 1;
}
.detail .title{
font-size: 34rpx;
font-weight: 600;
line-height: 2;
}
.detail .value{
line-height: 1.5;
font-size: 34rpx;
}
.text_text{
margin-left: 225rpx;
margin-top: 5%;
font-size: 32rpx;
}
.texit{
width: 400rpx;
height: 70rpx;
margin-top: 15%;
font-size: 36rpx;
margin-left: 215rpx;
color: aliceblue;
border: 2rpx;
text-align: center;
border-radius: 15%;
background-color: rgb(42,84,244);
}
.bexit{
width: 450rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
margin-top: 15%;
font-size: 36rpx;
color: aliceblue;
margin: 100rpx auto;
border:2rpx;
border-radius: 70rpx;
background-color: rgb(42,84,244);
}
.gunabi{
position:absolute;
width: 120rpx;
height:80rpx;
background-size:100%;
text-align: center;
top: 10px;
right: 50px;
font-size: 22px;
line-height: 50rpx;
color:#ffff ;
}
.modal-mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: #000;
opacity: 0.5;
z-index: 1;
}
.modal-dialog{
overflow: hidden;
position: fixed;
top: 5%;
background: rgb(4,4,4);
border-radius: 30rpx;
right: 5%;
height: 1200rpx;
width:90%;
z-index: 2;
}
.img_on{
/* margin: auto; */
margin-top: 180rpx;
margin-left: 140rpx;
margin-right: auto;
width:200px;
height: 100px;
}
.img_down{
/* margin: auto; */
margin-left: 60rpx;
margin-right: auto;
margin-top: 70rpx;
}
.seconds{
color: #ffff;
position:absolute;
width: 120rpx;
height:80rpx;
background-size:100%;
text-align: center;
top: 10px;
right: 10px;
font-size: 22px;
line-height: 50rpx;
}
{
"description": "项目配置文件。",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false
},
"compileType": "miniprogram",
"libVersion": "2.25.3",
"appid": "wx70052f70b0eb4bff",
"projectname": "lezhi",
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"condition": {
"miniprogram": {
"list": [
{
"name": "小",
"pathName": "pages/index/index",
"query": "scene=4e50",
"scene": "1047"
}
]
}
}
}
\ No newline at end of file
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "online",
"setting": {
"compileHotReLoad": true,
"urlCheck": false
},
"condition": {
"miniprogram": {
"list": [
{
"name": "小",
"pathName": "pages/index/index",
"query": "scene=4e50",
"scene": "1047"
},
{
"name": "",
"pathName": "pages/upload/upload",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/cameraTakePhoto/cameraTakePhoto",
"query": "status_zhi=true",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/app/app",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/index/index",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
}
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
const millisecond = date.getMilliseconds()
// return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second,millisecond].map(formatNumber).join(':')
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime,
formatDate: formatDate
}
const formatDate = date =>{
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return hour*60+60*minute+second
}
\ No newline at end of file
const data = worker.getCameraFrameData()
console.log('data',data)
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论