......
This commit is contained in:
1 parent
a1f11d317f
commit
93c9df5600
5 files changed
+132
-66
No files matched your search
@@ -6,6 +6,8 @@
|
|||||||
"window": {
|
"window": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
},
|
},
|
||||||
|
"plugins": {
|
||||||
|
},
|
||||||
"style": "v2",
|
"style": "v2",
|
||||||
"sitemapLocation": "sitemap.json"
|
"sitemapLocation": "sitemap.json"
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,8 @@ page{
|
|||||||
|
|
||||||
.text_startPage{
|
.text_startPage{
|
||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
color:var(--text-color)
|
color:var(--text-color);
|
||||||
|
// mix-blend-mode: difference;
|
||||||
}
|
}
|
||||||
|
|
||||||
.buttom_startPage{
|
.buttom_startPage{
|
||||||
@@ -40,6 +41,9 @@ page{
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
.image{
|
||||||
|
mix-blend-mode: difference;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#gotoSearch{
|
#gotoSearch{
|
||||||
|
|||||||
@@ -1047,12 +1047,7 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 检查session是否过期
|
|
||||||
// checkSession() {
|
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// this
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
|
|
||||||
// 上传照片并展示收到的结果
|
// 上传照片并展示收到的结果
|
||||||
uploadImg(tempImagePath: any) {
|
uploadImg(tempImagePath: any) {
|
||||||
@@ -1060,59 +1055,99 @@ Page({
|
|||||||
title: "查询中喵",
|
title: "查询中喵",
|
||||||
mask: true //开启蒙版遮罩
|
mask: true //开启蒙版遮罩
|
||||||
});
|
});
|
||||||
return setTimeout(()=>{
|
// return setTimeout(()=>{
|
||||||
wx.hideLoading();
|
// wx.hideLoading();
|
||||||
var fake_data = {
|
// var fake_data = {
|
||||||
id:70582140,
|
// id:70582140,
|
||||||
imgUrl:"./static/icons/history.svg",
|
// imgUrl:"./static/icons/history.svg",
|
||||||
res:{
|
// res:{
|
||||||
scores: 93,
|
// scores: 93,
|
||||||
arr: ["生牛乳"],
|
// arr: ["生牛乳"],
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
var data = fake_data
|
// var data = fake_data
|
||||||
var nowdate = new Date();
|
// var nowdate = new Date();
|
||||||
var nowyear = nowdate.getFullYear();
|
// var nowyear = nowdate.getFullYear();
|
||||||
var nowmonth = nowdate.getMonth() + 1;
|
// var nowmonth = nowdate.getMonth() + 1;
|
||||||
var nowday = nowdate.getDate();
|
// var nowday = nowdate.getDate();
|
||||||
var dateStr = nowyear + '.' + nowmonth + '.' + nowday
|
// var dateStr = nowyear + '.' + nowmonth + '.' + nowday
|
||||||
if (!this.data.data_history[dateStr]) {
|
// if (!this.data.data_history[dateStr]) {
|
||||||
this.data.data_history[dateStr] = []
|
// this.data.data_history[dateStr] = []
|
||||||
}
|
// }
|
||||||
var historyTemp =
|
// var historyTemp =
|
||||||
{
|
// {
|
||||||
id: data.id,
|
// id: data.id,
|
||||||
imgUrl: data.imgUrl,
|
// imgUrl: data.imgUrl,
|
||||||
res: data.res,
|
// res: data.res,
|
||||||
hasCollect: false,//目前全是false。。。
|
// hasCollect: false,
|
||||||
}
|
// }
|
||||||
this.data.data_history[dateStr].push(historyTemp)
|
// this.data.data_history[dateStr].push(historyTemp)
|
||||||
this.setData({
|
// this.setData({
|
||||||
data_history: this.data.data_history
|
// data_history: this.data.data_history
|
||||||
})
|
// })
|
||||||
this.sortHistory()
|
// this.sortHistory()
|
||||||
this.show_result_byId(data.id)
|
// this.show_result_byId(data.id)
|
||||||
this.save2storage()
|
// this.save2storage()
|
||||||
},3000)
|
// },3000)
|
||||||
wx.getFileSystemManager().readFile({
|
// wx.getFileSystemManager().readFile({
|
||||||
|
// filePath: tempImagePath,
|
||||||
|
// // encoding: 'base64',
|
||||||
|
// success: res => {
|
||||||
|
// // console.log('data:image/png;base64,' + res.data)
|
||||||
|
// const imgBase64 = res.data
|
||||||
|
// wx.request({
|
||||||
|
// url: '' + serverAddr + '/api/ocr', //仅为示例,并非真实的接口地址
|
||||||
|
// data: {
|
||||||
|
// file: imgBase64,
|
||||||
|
// session_key:this.data.session_key
|
||||||
|
// },
|
||||||
|
// method: "POST",
|
||||||
|
// header: {
|
||||||
|
// 'content-type': 'application/json' // 默认值
|
||||||
|
// },
|
||||||
|
// success: res => {
|
||||||
|
// var data = res.data
|
||||||
|
// console.log(res.data)
|
||||||
|
// wx.hideLoading();
|
||||||
|
// var nowdate = new Date();
|
||||||
|
// var nowyear = nowdate.getFullYear();
|
||||||
|
// var nowmonth = nowdate.getMonth() + 1;
|
||||||
|
// var nowday = nowdate.getDate();
|
||||||
|
// var dateStr = nowyear + '.' + nowmonth + '.' + nowday
|
||||||
|
// if (!this.data.data_history[dateStr]) {
|
||||||
|
// this.data.data_history[dateStr] = []
|
||||||
|
// }
|
||||||
|
// var historyTemp =
|
||||||
|
// {
|
||||||
|
// id: data.id,
|
||||||
|
// imgUrl: data.imgUrl,
|
||||||
|
// res: data.res,
|
||||||
|
// hasCollect: false,//目前全是false。。。
|
||||||
|
// }
|
||||||
|
// this.data.data_history[dateStr].push(historyTemp)
|
||||||
|
// this.setData({
|
||||||
|
// data_history: this.data.data_history
|
||||||
|
// })
|
||||||
|
// this.sortHistory()
|
||||||
|
// this.show_result_byId(data.id)
|
||||||
|
// this.save2storage()
|
||||||
|
// },
|
||||||
|
// fail: res => {
|
||||||
|
// console.log(res)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
wx.uploadFile({
|
||||||
|
url: '' + serverAddr + '/api/ocr', //仅为示例,并非真实的接口地址
|
||||||
filePath: tempImagePath,
|
filePath: tempImagePath,
|
||||||
encoding: 'base64',
|
name: 'file',
|
||||||
success: res => {
|
// formData: {
|
||||||
// console.log('data:image/png;base64,' + res.data)
|
// session_key:this.data.session_key
|
||||||
const imgBase64 = res.data
|
// },
|
||||||
wx.request({
|
success:res=>{
|
||||||
url: '' + serverAddr + '/rcvImg', //仅为示例,并非真实的接口地址
|
const data = res.data
|
||||||
data: {
|
wx.hideLoading();
|
||||||
imgBase64: imgBase64,
|
|
||||||
session_key:this.data.session_key
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/json' // 默认值
|
|
||||||
},
|
|
||||||
success: res => {
|
|
||||||
var data = res.data
|
|
||||||
console.log(res.data)
|
|
||||||
var nowdate = new Date();
|
var nowdate = new Date();
|
||||||
var nowyear = nowdate.getFullYear();
|
var nowyear = nowdate.getFullYear();
|
||||||
var nowmonth = nowdate.getMonth() + 1;
|
var nowmonth = nowdate.getMonth() + 1;
|
||||||
@@ -1135,11 +1170,6 @@ Page({
|
|||||||
this.sortHistory()
|
this.sortHistory()
|
||||||
this.show_result_byId(data.id)
|
this.show_result_byId(data.id)
|
||||||
this.save2storage()
|
this.save2storage()
|
||||||
},
|
|
||||||
fail: res => {
|
|
||||||
console.log(res)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -1444,6 +1474,35 @@ Page({
|
|||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 文字转语音
|
||||||
|
text2speech:function(e:any){
|
||||||
|
var str = e.target.dataset.name
|
||||||
|
// console.log(e.target.dataset.name)
|
||||||
|
// 个人小程序做不了
|
||||||
|
var plugin = requirePlugin("WechatSI")
|
||||||
|
// plugin.textToSpeech({
|
||||||
|
// lang: "zh_CN",
|
||||||
|
// tts: true,
|
||||||
|
// content: str,
|
||||||
|
// success: function(res:any) {
|
||||||
|
// console.log("succ tts", res.filename)
|
||||||
|
// const innerAudioContext = wx.createInnerAudioContext()
|
||||||
|
// innerAudioContext.autoplay = true
|
||||||
|
// innerAudioContext.src = res.filename
|
||||||
|
// innerAudioContext.onPlay(() => {
|
||||||
|
// console.log('开始播放')
|
||||||
|
// })
|
||||||
|
// innerAudioContext.onError((res) => {
|
||||||
|
// console.log(res.errMsg)
|
||||||
|
// console.log(res.errCode)
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// fail: function(res:any) {
|
||||||
|
// console.log("fail tts", res)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
|
||||||
// 获取用户code,以给服务端换取openId
|
// 获取用户code,以给服务端换取openId
|
||||||
getCode: async function () {
|
getCode: async function () {
|
||||||
var code
|
var code
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
<view wx:for="{{ data_lib }}" wx:for-item="n">
|
<view wx:for="{{ data_lib }}" wx:for-item="n">
|
||||||
<view class="ingredient_card" hidden="{{ hidden_lib[n.name.zh] }}" style="background-color: {{ n.riskBgColor }};">
|
<view class="ingredient_card" hidden="{{ hidden_lib[n.name.zh] }}" style="background-color: {{ n.riskBgColor }};">
|
||||||
<view class="node_content">
|
<view class="node_content">
|
||||||
<view class="node_name">{{ n.name.zh }}</view>
|
<view class="node_name" bind:tap="text2speech" data-name="{{n.name.zh}}">{{ n.name.zh }}</view>
|
||||||
<view class="node_name node_name_en">{{ n.name.en }}</view>
|
<view class="node_name node_name_en">{{ n.name.en }}</view>
|
||||||
|
|
||||||
<view class="node_adi">
|
<view class="node_adi">
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true,
|
"compileHotReLoad": true,
|
||||||
"urlCheck": false
|
"urlCheck": false
|
||||||
}
|
},
|
||||||
|
"libVersion": "3.2.2"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user