Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
X
xinya_mini
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xwq
xinya_mini
Commits
8ff0b38d
Commit
8ff0b38d
authored
Apr 25, 2021
by
xwq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
continue
parent
69d9b41c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
109 additions
and
23 deletions
+109
-23
app.js
app.js
+64
-9
UploadFileManager.js
jade/UploadFileManager.js
+1
-0
index.js
jade/index.js
+5
-3
request.js
jade/request.js
+1
-1
displayAnswers.js
pages/displayAnswers/displayAnswers.js
+19
-6
displayAnswers.json
pages/displayAnswers/displayAnswers.json
+2
-0
displayAnswers.wxml
pages/displayAnswers/displayAnswers.wxml
+2
-3
photo.js
pages/photo/photo.js
+11
-1
photo.json
pages/photo/photo.json
+2
-0
takePhoto.json
pages/takePhoto/takePhoto.json
+2
-0
No files found.
app.js
View file @
8ff0b38d
import
{
Jade
}
from
"
./jade/index
"
// const getUrl = require("./request").getUrl
App
({
onLaunch
(){
const
logs
=
wx
.
getStorageSync
(
'
logs
'
)
||
{}
if
(
logs
){
console
.
log
(
"
---------已登录
"
);
const
userCode
=
wx
.
getAccountInfoSync
()
||
{}
const
userInfo
=
wx
.
getStorageSync
(
'
userInfo
'
)
||
{}
if
(
logs
&&
userCode
&&
false
){
console
.
log
(
userInfo
,
"
---------已登录
"
,
userCode
);
}
else
{
wx
.
login
({
// timeout: 0,
success
:(
res
)
=>
{
console
.
log
(
"
-----------
"
,
res
);
// wx.setStorage({
// data: res,
// key: 'userInfo',
// })
success
:
res
=>
{
var
code
=
res
.
code
wx
.
getUserInfo
({
withCredentials
:
true
,
success
:
res
=>
{
console
.
log
(
'
getUserInfo
'
)
wx
.
request
({
url
:
Jade
.
getUrl
(
"
users/sign_in.json
"
),
method
:
'
POST
'
,
data
:
{
code
:
code
,
user_info
:
res
.
userInfo
,
encrypted_data
:
res
.
encryptedData
,
iv
:
res
.
iv
},
success
:
res
=>
{
const
data
=
res
.
data
;
wx
.
setStorageSync
(
'
user
'
,
data
)
wx
.
setStorageSync
(
'
user_token
'
,
data
.
token
)
// Jade.UserManager.setUser(data)
// Jade.UserManager.setToken(data.token)
Jade
.
UserManager
.
authRequest
({
url
:
Jade
.
getUrl
(
"
babies.json
"
),
success
:
(
result
)
=>
{
if
(
typeof
result
.
data
===
"
object
"
)
{
wx
.
setStorageSync
(
'
baby
'
,
result
.
data
)
}
else
{
wx
.
setStorageSync
(
'
baby
'
,
null
)
}
// if (options && options.success) {
// options.success(result)
// }
},
fail
:
err
=>
{
// if (options && options.success) {
// options.success(result)
// }
}
})
}
})
},
fail
:
err
=>
{
var
pages
=
getCurrentPages
()
var
currentPage
=
pages
[
pages
.
length
-
1
]
if
(
currentPage
.
route
==
'
pages/study_package_activities/studyPackageActivityList
'
||
currentPage
.
route
==
'
pages/webView/webView
'
)
{
console
.
log
(
'
authorizeDialog NavigateTo
'
)
wx
.
navigateTo
({
url
:
`/pages/AuthorizeDialog/AuthorizeDialog?code=
${
code
}
&objc=UserManager`
})
}
else
{
console
.
log
(
'
authorizeDialog redirectTo
'
)
wx
.
redirectTo
({
url
:
`/pages/AuthorizeDialog/AuthorizeDialog?code=
${
code
}
&objc=UserManager`
})
}
}
})
}
})
}
...
...
jade/UploadFileManager.js
View file @
8ff0b38d
...
...
@@ -43,6 +43,7 @@ Jade.UploadFileManager = class extends Jade.Object {
Jade
.
UserManager
.
authRequest
({
url
:
request
.
getUrlAbs
(
"
/api/qiniu/token.json
"
),
method
:
"
GET
"
,
header
:
{
'
content-type
'
:
'
application/json
'
},
data
:
{
type
:
params
.
type
},
...
...
jade/index.js
View file @
8ff0b38d
...
...
@@ -15,15 +15,17 @@ const Jade = {
// Component: require("./Component"),
// BasePage: require('./BasePage'),
// UserManager: UserManager,
UserManager
:
UserManager
,
// setUser:UserManager.setUser,
// setToken:UserManager.setToken,
// executeAfterAuthenticated: executeAfterAuthenticated,
// BabyManager: require("./BabyManager"),
// checkUser: require("./checkUser"),
request
:
UserManager
.
authRequest
,
//
getUrl: request.getUrl,
//
getUrlAbs: request.getUrlAbs,
getUrl
:
request
.
getUrl
,
getUrlAbs
:
request
.
getUrlAbs
,
UploadFileManager
:
require
(
"
UploadFileManager
"
),
// XYDownload: request.XYDownload,
...
...
jade/request.js
View file @
8ff0b38d
...
...
@@ -180,7 +180,7 @@ var XYSequencedBatchFetch = function (paramsArr) {
return
sequencedTask
(
paramsArr
)
}
const
HOST
=
"
https://xinya.me
"
const
HOST
=
"
https://
test.
xinya.me
"
const
API_URL
=
HOST
+
"
/mp/
"
const
getUrl
=
(
relative_path
,
params
=
{})
=>
{
...
...
pages/displayAnswers/displayAnswers.js
View file @
8ff0b38d
...
...
@@ -49,13 +49,13 @@ Page({
true
)
.
then
((
res
)
=>
{
// console.log("detectAnswer", res
);
const
ret
=
JSON
.
parse
(
wx
.
getStorageSync
(
"
result
"
));
console
.
log
(
"
detectAnswer
"
,
res
,
"
=============
"
,
wx
.
getStorageSync
(
"
result
"
)
);
//
const ret = JSON.parse(wx.getStorageSync("result"));
const
baby
=
wx
.
getStorageSync
(
"
baby
"
);
const
exerciseBookId
=
ret
.
exerciseBookId
;
//
const exerciseBookId = ret.exerciseBookId;
return
{
baby_id
:
baby
.
id
,
exercise_book_id
:
exerciseBookId
,
//
exercise_book_id: exerciseBookId,
photo_id
:
JSON
.
parse
(
res
.
data
).
id
,
};
})
...
...
@@ -63,7 +63,7 @@ Page({
(
params
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
request
({
url
:
`https://xinya.me/api/arithmetic_ocr`
,
url
:
`https://
test.
xinya.me/api/arithmetic_ocr`
,
method
:
"
POST
"
,
data
:
params
,
success
:
(
res
)
=>
{
...
...
@@ -77,7 +77,9 @@ Page({
)
.
then
(
(
res
)
=>
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
"
]]]]]]]
"
,
res
)
wx
.
request
({
url
:
"
https://ocr.tencentcloudapi.com
"
,
method
:
"
POST
"
,
...
...
@@ -90,7 +92,7 @@ Page({
ocrRes
.
data
.
Response
&&
ocrRes
.
data
.
Response
.
Error
)
{
reject
(
ret
.
Response
.
Error
);
reject
(
ocrRes
.
data
.
Response
.
Error
);
}
else
{
resolve
({
...
ocrRes
.
data
,
...
...
@@ -120,6 +122,17 @@ Page({
const
r
=
Object
.
keys
(
ret
).
reduce
((
acc
,
key
)
=>
{
return
acc
+
key
+
"
=
"
+
ret
[
key
]
+
"
&
"
;
},
""
);
// const opts = {
// ctitle: options.ctitle,
// answerSrc: options.answerSrc,
// spendTime: options.spendTime,
// errorItems: options.errors != null ? options.errors : null,
// seconds: options.seconds,
// exerciseBookId: options.exerciseBookId,
// name: options.name,
// position: options.position
// }
// wx.setStorageSync('result', JSON.stringify(ret))
// console.log(r);
wx
.
redirectTo
({
url
:
`/pages/photo/photo`
,
...
...
pages/displayAnswers/displayAnswers.json
View file @
8ff0b38d
{
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"心芽学堂"
,
"usingComponents"
:
{}
}
\ No newline at end of file
pages/displayAnswers/displayAnswers.wxml
View file @
8ff0b38d
<!--pages/displayAnswers/displayAnswers.wxml-->
<!--pages/calculate_training/displayAnswers.wxml-->
<view style="height: 100vh; width: 100vw">
<canvas canvas-id='photo_answer' style="width:100%;height:calc(100% - 100px)"></canvas>
<view style="width: 100%; height:100px;">
...
...
@@ -9,8 +8,8 @@
</view>
</block>
<view style="display: flex; justify-content: center; margin: 10px 0">
<view style="padding: 4px 34px;border: 1px solid #FF
4466;border-radius: 21px; display: flex; align-items: center;
" bindtap="reTake">重拍</view>
<view style="padding: 4px 34px; background: #FF
4466
;border-radius: 21px; margin-left: 20px; display: flex; align-items: center; color: white" bindtap="confirm">确定</view>
<view style="padding: 4px 34px;border: 1px solid #FF
B12C;border-radius: 21px; display: flex; align-items: center;color:#FFB12C
" bindtap="reTake">重拍</view>
<view style="padding: 4px 34px; background: #FF
B12C
;border-radius: 21px; margin-left: 20px; display: flex; align-items: center; color: white" bindtap="confirm">确定</view>
</view>
</view>
</view>
...
...
pages/photo/photo.js
View file @
8ff0b38d
...
...
@@ -16,7 +16,17 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
// let userInfo=wx.getStorageSync('userInfo')
// console.log(userInfo,"---------");
// if(!userInfo){
// wx.getUserProfile({
// desc:"授权并使用",
// lang: "zh_CN",
// success:(res)=>{
// console.log("123",res);
// }
// })
// }
},
/**
...
...
pages/photo/photo.json
View file @
8ff0b38d
{
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"心芽学堂口算检查"
,
"usingComponents"
:
{}
}
\ No newline at end of file
pages/takePhoto/takePhoto.json
View file @
8ff0b38d
{
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"心芽学堂口算检查"
,
"usingComponents"
:
{}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment