Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
c29e05e6
Commit
c29e05e6
authored
Aug 10, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx javaapp/weapp: 更新
1. weapp前端, javaapp后端联调, 完成竞答答题及结果入库流程
parent
32cfc084
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
266 行增加
和
131 行删除
+266
-131
增值产品-小程序及app/doc/create_table_sql/key/create_table_match.sql
+9
-8
增值产品-小程序及app/doc/create_table_sql/流程及数据测试.sql
+13
-12
增值产品-小程序及app/nyx-master/pages/activity/activity.js
+8
-3
增值产品-小程序及app/nyx-master/pages/activity/quiz-info/quiz-info.js
+27
-2
增值产品-小程序及app/nyx-master/pages/activity/quiz-result/quiz-result.js
+40
-6
增值产品-小程序及app/nyx-master/pages/activity/quiz-result/quiz-result.wxml
+7
-20
增值产品-小程序及app/nyx-master/pages/key/matchTest/matchTest.js
+111
-54
增值产品-小程序及app/nyx-master/pages/key/matchTest/matchTest.wxml
+4
-4
增值产品-小程序及app/nyx-master/pages/my/my.js
+1
-4
增值产品-小程序及app/nyx-master/utils/date.wxs
+24
-8
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/domain/Rockwell_keyT_match.java
+2
-1
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
+2
-2
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
+10
-2
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java
+5
-3
增值产品-小程序及app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
+3
-2
没有找到文件。
增值产品-小程序及app/doc/create_table_sql/key/create_table_match.sql
查看文件 @
c29e05e6
USE
r
ockwell_key
;
USE
r
ockwell_key
;
...
...
@@ -19,20 +19,21 @@ USE rockwell_key;
DROP
TABLE
IF
EXISTS
tbl_match
;
CREATE
TABLE
tbl_match
(
`match_id`
VARCHAR
(
100
)
COMMENT
'竞答的id, uuid format, mid_001'
,
`activity_id`
VARCHAR
(
100
)
COMMENT
'活动的id, uuid format,
m
id_001'
,
`activity_id`
VARCHAR
(
100
)
COMMENT
'活动的id, uuid format,
a
id_001'
,
`user_id`
VARCHAR
(
100
)
COMMENT
'用户的id, uuid format, uid_001'
,
`match_status`
VARCHAR
(
2
)
COMMENT
'(可用|不可用): 01|00; 为什么00,因为所有RequestParam参数的defaultValue都设为0值, 会被认为是空或者null'
,
`match_point`
double
(
10
,
2
)
COMMENT
'得分: 4.5 or 5.0'
,
`match_result`
VARCHAR
(
20
)
COMMENT
'结果: 9/10'
,
`member_id`
VARCHAR
(
100
)
COMMENT
'商家的id, uuid format, mid_001'
,
`qrcode_url`
VARCHAR
(
200
)
COMMENT
'qrcode的二维码url'
,
`create_datetime`
DATETIME
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
,
`update_datetime`
DATETIME
DEFAULT
NULL
,
PRIMARY
KEY
(
`match_id`
),
KEY
`query_key`
(
`activity_id`
,
`user_id`
,
`match_status`
))
KEY
`query_key`
(
`activity_id`
,
`
member_id`
,
`
user_id`
,
`match_status`
))
ENGINE
=
INNODB
DEFAULT
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
COMMENT
=
'竞答结果'
;
INSERT
INTO
`tbl_match`
(
`match_id`
,
`activity_id`
,
`user_id`
,
`match_status`
,
`match_point`
,
`match_result`
,
`qrcode_url`
,
`create_datetime`
,
`update_datetime`
)
INSERT
INTO
`tbl_match`
(
`match_id`
,
`activity_id`
,
`user_id`
,
`match_status`
,
`match_point`
,
`match_result`
,
`
member_id`
,
`
qrcode_url`
,
`create_datetime`
,
`update_datetime`
)
VALUES
(
'mid_001'
,
'aid_001'
,
'uid_030e7057-e6b5-4fb0-bcbf-d8bf055e38d9'
,
'00'
,
4
.
0
,
'4/5'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
),
(
'mid_002'
,
'aid_001'
,
'uid_030e7057-e6b5-4fb0-bcbf-d8bf055e38d9'
,
'01'
,
3
.
0
,
'3/5'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
),
(
'mid_003'
,
'aid_002'
,
'uid_088a957b-78e9-49cd-980b-ce8bc47b4e11'
,
'01'
,
4
.
0
,
'8/10'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
);
\ No newline at end of file
(
'mid_001'
,
'aid_001'
,
'uid_030e7057-e6b5-4fb0-bcbf-d8bf055e38d9'
,
'00'
,
4
.
0
,
'4/5'
,
'mid_123'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
),
(
'mid_002'
,
'aid_001'
,
'uid_030e7057-e6b5-4fb0-bcbf-d8bf055e38d9'
,
'01'
,
3
.
0
,
'3/5'
,
'mid_123'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
),
(
'mid_003'
,
'aid_002'
,
'uid_088a957b-78e9-49cd-980b-ce8bc47b4e11'
,
'01'
,
4
.
0
,
'8/10'
,
'mid_123'
,
'https://930-test-sh.oss-cn-shanghai.aliyuncs.com/qrcode-dir/mid_11235813.png'
,
'2019-11-20 11:24:45'
,
'2019-11-20 11:24:45'
);
\ No newline at end of file
增值产品-小程序及app/doc/create_table_sql/流程及数据测试.sql
查看文件 @
c29e05e6
/*
/*
...
...
@@ -67,25 +67,24 @@
-- 创建完毕 -> 发布 releaseActivity()
-- 我的活动 -> 发布 releaseActivity()
三. 商家活动参与流程
三. 商家活动参与流程
三. 商家活动参与流程 activity -> quiz-info -> matchTest -> quiz-result -> my-points
1. 竞答
--311 进入竞答, weapp activity.wxml
--312 点击进入竞答详情页面 weapp activity.wxml <navigator>
--311
done
进入竞答, weapp activity.wxml
--312
done
点击进入竞答详情页面 weapp activity.wxml <navigator>
--313 回到首页 weapp quiz-info.wxml bindtap="toHome"
--314 页面分享 weapp quiz-info.js options.from == 'button'
--315 右上角分享 weapp quiz-info.js onShareAppMessage()
--316 立即参与 weapp quiz-info.wxml bindtap="toGame"
--317 转到竞答页 weapp quiz-info.js wx.navigateTo(/matchTest)
--318 下一题 weapp matchTest.wxml bindtap="onTypeNext"
--319 完成测试 weapp matchTest.js doneDaily()
--316
done
立即参与 weapp quiz-info.wxml bindtap="toGame"
--317
done
转到竞答页 weapp quiz-info.js wx.navigateTo(/matchTest)
--318
done
下一题 weapp matchTest.wxml bindtap="onTypeNext"
--319
done
完成测试 weapp matchTest.js doneDaily()
--3110 转到结果页 weapp quiz-info.js wx.navigateTo(/quiz-result)
--3111 查看积分 weapp quiz-result.wxml bindtap="onCheckPoints"
--3111 查看积分 weapp quiz-result.wxml bindtap="onCheckPoints"
to my-points.wxml
--3112 分享战绩 weapp quiz-result.wxml open-type="share"
--3113 返回首页 weapp quiz-result.wxml bindtap="toHome"
2. 活动
--321 进入活动, weapp activity.wxml
--321
done
进入活动, weapp activity.wxml
图片 note_image
标题 title
价格 unit_price
...
...
@@ -94,7 +93,9 @@
where 1=1
and tag='活动'
--322 点击进入活动详情页面 weapp activity_info.wxml todo 新增 activity_info.wxml todo-1:1的image
--322 点击进入活动详情页面 weapp activity_info.wxml todo 新增 activity_info.wxml todo-1:1的image
tips: 需要通过activity_id重新获取数据, 因为unit_price/product_desc 这个阶段不知道
图片 note_image
价格 unit_price1/unit_price2
标题 title
...
...
增值产品-小程序及app/nyx-master/pages/activity/activity.js
查看文件 @
c29e05e6
// pa
ges/activity/activity.js
// pa
ges/activity/activity.js
...
...
@@ -218,15 +218,20 @@ Page({
result
[
"product_desc"
]
=
res
.
data
.
data
[
i
].
productDesc
result
[
"price"
]
=
res
.
data
.
data
[
i
].
price
result
[
"note_image"
]
=
res
.
data
.
data
[
i
].
noteImage
.
split
(
"::"
)
var
url
=
"../activity/quiz-info/quiz-info?"
var
url_quiz
=
"../activity/quiz-info/quiz-info?"
+
"&activity_id="
+
result
[
"activity_id"
]
+
"¬e_image="
+
res
.
data
.
data
[
i
].
noteImage
//传递原始string数据, List不正确
+
"&title="
+
result
[
"title"
]
+
"&content="
+
result
[
"content"
]
+
"&like="
+
result
[
"num_like"
]
+
"&quiz="
+
result
[
"quiz"
]
+
"&point="
+
result
[
"point"
]
+
"&member_id="
+
result
[
"member_id"
]
+
"&member_name="
+
result
[
"member_name"
]
+
"&member_slogan="
+
result
[
"member_slogan"
]
result
[
"url"
]
=
url
var
url_activity
=
"../activity/activity-info/quiz-info?"
+
"&activity_id="
+
result
[
"activity_id"
]
result
[
"url"
]
=
result
[
"tag"
]
==
'竞答'
?
url_quiz
:
url_activity
list
.
push
(
result
)
}
...
...
增值产品-小程序及app/nyx-master/pages/activity/quiz-info/quiz-info.js
查看文件 @
c29e05e6
// pa
ges/index/note-info/note-info.js
// pa
ges/index/note-info/note-info.js
...
...
@@ -6,6 +6,11 @@ Page({
*/
data
:
{
/* 用于判断是否已经登陆 */
nyxCode
:
""
,
authStatus
:
"0"
,
userInfo
:
{},
windowHeight
:
""
,
windowWidth
:
""
,
contentHeight
:
""
,
...
...
@@ -28,14 +33,26 @@ Page({
contentHeight
:
windowHeight
*
0.675
,
})
//初始化数据
if
(
wx
.
getStorageSync
(
'nyxCode'
))
{
_this
.
setData
({
nyxCode
:
wx
.
getStorageSync
(
'nyxCode'
),
userInfo
:
wx
.
getStorageSync
(
'userInfo'
),
authStatus
:
wx
.
getStorageSync
(
'authStatus'
),
})
}
var
quiz
=
_this
.
__data__
.
quiz
if
(
Object
.
keys
(
quiz
).
length
==
0
&&
options
.
title
!=
""
)
{
quiz
[
'activity_id'
]
=
options
.
activity_id
;
quiz
[
'note_image'
]
=
options
.
note_image
.
split
(
"::"
);
quiz
[
'title'
]
=
options
.
title
;
quiz
[
'content'
]
=
options
.
content
.
split
(
"::"
);
quiz
[
'like'
]
=
options
.
like
;
quiz
[
'quiz'
]
=
options
.
quiz
;
quiz
[
'point'
]
=
options
.
point
;
quiz
[
'member_id'
]
=
options
.
member_id
;
quiz
[
'member_name'
]
=
options
.
member_name
;
quiz
[
'member_slogan'
]
=
options
.
member_slogan
;
quiz
[
'writer_name'
]
=
options
.
writer_name
==
"null"
?
"匿名用户"
:
options
.
writer_name
;
...
...
@@ -146,8 +163,16 @@ Page({
//跳转到知识竞答页面
toGame
:
function
(
e
)
{
var
_this
=
this
;
var
url
=
"/pages/key/matchTest/matchTest?"
+
"&activity_id="
+
_this
.
__data__
.
quiz
[
"activity_id"
]
+
"&quiz="
+
_this
.
__data__
.
quiz
[
"quiz"
]
+
"&point="
+
_this
.
__data__
.
quiz
[
"point"
]
+
"&member_id="
+
_this
.
__data__
.
quiz
[
"member_id"
]
+
"&member_name="
+
_this
.
__data__
.
quiz
[
"member_name"
]
+
"&title="
+
_this
.
__data__
.
quiz
[
"title"
]
wx
.
navigateTo
({
url
:
"/pages/key/matchTest/matchTest"
url
:
url
});
},
...
...
增值产品-小程序及app/nyx-master/pages/activity/quiz-result/quiz-result.js
查看文件 @
c29e05e6
// pages/index/note-info/note-info.js
// pages/index/quiz-result/quiz-result.js
// pages/index/note-info/note-info.js
// pages/index/quiz-result/quiz-result.js
var
config
=
wx
.
getStorageSync
(
"config"
);
var
app
=
getApp
();
var
util
=
require
(
'./../../../utils/util.js'
)
Page
({
/**
* 页面的初始数据
*/
data
:
{
/* 用于判断是否已经登陆 */
nyxCode
:
""
,
authStatus
:
"0"
,
userInfo
:
{},
// nickName, avartarUrl, gender, province, city, country
windowHeight
:
""
,
windowWidth
:
""
,
contentHeight
:
""
,
scrollLeft
:
0
,
//切换栏的滚动条位置
curIndex
:
0
,
notes
:
{},
//竞答结果: match_id, member_name, title, num_valid, num_total, points
matchInfo
:
{},
//当前时间
nowDate
:
""
,
},
...
...
@@ -20,15 +32,37 @@ Page({
*/
onLoad
:
function
(
options
)
{
var
_this
=
this
;
//初始化数据
if
(
wx
.
getStorageSync
(
'nyxCode'
))
{
_this
.
setData
({
nyxCode
:
wx
.
getStorageSync
(
'nyxCode'
),
userInfo
:
wx
.
getStorageSync
(
'userInfo'
),
authStatus
:
wx
.
getStorageSync
(
'authStatus'
),
})
}
var
matchInfo
=
_this
.
__data__
.
matchInfo
if
(
Object
.
keys
(
matchInfo
).
length
==
0
&&
options
.
match_id
!=
""
)
{
matchInfo
[
'match_id'
]
=
options
.
match_id
;
matchInfo
[
'member_name'
]
=
options
.
member_name
;
matchInfo
[
'title'
]
=
options
.
title
;
matchInfo
[
'num_valid'
]
=
options
.
num_valid
;
matchInfo
[
'num_total'
]
=
options
.
num_total
;
matchInfo
[
'points'
]
=
options
.
points
;
}
var
windowHeight
=
wx
.
getSystemInfoSync
().
windowHeight
;
//获取设备高度,小程序自带的方法
var
windowWidth
=
wx
.
getSystemInfoSync
().
windowWidth
;
//获取设备高度,小程序自带的方法
this
.
setData
({
windowHeight
:
windowHeight
,
windowWidth
:
windowWidth
,
contentHeight
:
windowHeight
*
0.675
,
matchInfo
:
matchInfo
,
nowDate
:
util
.
formatTime
(
new
Date
())
})
wx
.
setNavigationBarTitle
({
title
:
'活动结果'
,
})
...
...
增值产品-小程序及app/nyx-master/pages/activity/quiz-result/quiz-result.wxml
查看文件 @
c29e05e6
<view class="page">
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
<wxs module="tutil" src="./../../../utils/date.wxs"></wxs>
<view class="page">
<!-- Tab: 酒肆风云 + 头像 -->
...
...
@@ -13,9 +15,9 @@
</view>
</view>
<view class="t3 justify align">
<view class="t3-left">
2020年7月27日 星期一
</view>
<view class="t3-left">
{{tutil.formatDate_ymdw_today(nowDate)}}
</view>
<view class="t3-right" bindtap="onClickPoints">
<view style="line-height:1; font-size:14px">
张三丰
</view>
<view style="line-height:1; font-size:14px">
{{userInfo.nickName}}
</view>
</view>
</view>
</view>
...
...
@@ -26,10 +28,10 @@
<!-- 文字内容 -->
<view class="note">
<view class="note-title" style="font-weight: bold">
Renaissance Bar知识竞答
{{matchInfo.member_name}} {{matchInfo.title}}
</view>
<view class="note-content">
张三丰 10题答对9题 喜提4.5
积分
{{userInfo.nickName}} {{matchInfo.num_total}}题答对{{matchInfo.num_valid}}题 喜提{{matchInfo.points}}
积分
</view>
<view class="note-content">
战胜99%玩家
...
...
@@ -68,19 +70,4 @@
</view>
<!-- end bottom-->
<!-- start bottom-->
<!-- refer to https://www.jb51.net/article/129438.htm -->
<!-- <view class="bottom_total">
<view class="bottom_line"></view>
<view class="weui-flex" style="height: 180rpx;">
<view class="weui-flex__item weui-flex justify align"><view class="placeholder">
<button class="button-brown" bindtap="toBuy" formType="submit">查看积分</button>
</view></view>
<view class="weui-flex__item weui-flex justify align"><view class="placeholder">
<button class="button-red" bindtap="toGame">分享战绩</button>
</view></view>
</view>
</view> -->
<!-- end bottom-->
</view>
增值产品-小程序及app/nyx-master/pages/key/matchTest/matchTest.js
查看文件 @
c29e05e6
// pa
ges/key/matchTest/matchTest.js
// pa
ges/key/matchTest/matchTest.js
...
...
@@ -20,7 +20,6 @@ Page({
nyxCode
:
""
,
authStatus
:
""
,
userInfo
:
{},
matchSeason
:
""
,
// 学习赛季
matchType
:
""
,
// 学习类别
isStudyDone
:
false
,
//是否已经完成该项学习
...
...
@@ -50,7 +49,12 @@ Page({
// questionName: "",
// choiceString: []
quizResult
:
{},
// 接受从quiz-info来的参数
quizParam
:
{},
// activity_id, member_id, quiz, point, member_name, title
// 从tbl_quiz来的参数
quizInfo
:
{},
// questionId, questionName, answer
// 最后生成的结果
quizResult
:
{},
// num_valid, num_total, points
/* 评论 */
bGetCommentOp
:
false
,
...
...
@@ -69,7 +73,6 @@ Page({
/* 模态框 */
showModal
:
false
,
},
/**
...
...
@@ -84,11 +87,23 @@ Page({
nyxCode
:
wx
.
getStorageSync
(
'nyxCode'
),
userInfo
:
wx
.
getStorageSync
(
'userInfo'
),
authStatus
:
wx
.
getStorageSync
(
'authStatus'
),
matchSeason
:
wx
.
getStorageSync
(
'matchSeason'
),
matchType
:
"daily"
,
// 学习类型
})
}
var
quizParam
=
_this
.
__data__
.
quizParam
var
quiz_string
=
""
if
(
Object
.
keys
(
quizParam
).
length
==
0
&&
options
.
activity_id
!=
""
)
{
quizParam
[
'activity_id'
]
=
options
.
activity_id
;
quizParam
[
'quiz'
]
=
options
.
quiz
;
quizParam
[
'point'
]
=
options
.
point
;
quizParam
[
'member_id'
]
=
options
.
member_id
;
quizParam
[
'member_name'
]
=
options
.
member_name
;
quizParam
[
'title'
]
=
options
.
title
;
quiz_string
=
options
.
quiz
;
}
//随机获取10条数据的id
/**
* 系统配置:主要用于置底页面设置 step2
...
...
@@ -96,12 +111,20 @@ Page({
var
windowHeight
=
wx
.
getSystemInfoSync
().
windowHeight
;
//获取设备高度,小程序自带的方法
this
.
setData
({
windowHeight
:
windowHeight
,
quizParam
:
quizParam
})
/* end */
if
(
_this
.
__data__
.
item_list
.
length
==
0
)
{
_this
.
getRand
();
if
(
quiz_string
!=
""
)
{
_this
.
getQuiz
(
quiz_string
);
}
else
{
_this
.
getRand
();
}
_this
.
setData
({
isStudyDone
:
false
,
//每次进来从新操作
})
...
...
@@ -187,7 +210,7 @@ Page({
let
cuu
=
e
.
target
.
id
;
//获取index值
console
.
log
(
cuu
);
var
operateResult
=
""
;
var
answer
=
_this
.
__data__
.
quiz
Result
.
answer
;
var
answer
=
_this
.
__data__
.
quiz
Info
.
answer
;
var
score
=
_this
.
__data__
.
score
;
//拿到已经回答的题目数
var
item_index_done
=
_this
.
__data__
.
item_index_done
;
...
...
@@ -235,6 +258,7 @@ Page({
//拿到下一个item_index
var
current_index
=
_this
.
__data__
.
item_index
;
//指向下一题, 获取数据
current_index
=
current_index
+
1
/*
...
...
@@ -260,10 +284,10 @@ Page({
//功能实现
//逻辑判断
//超过了10题
,溢出了,直接进入doneDaily
if
(
current_index
>=
1
)
//超过了10题
(或者指定数量的题目),溢出了,直接进入doneTest
if
(
current_index
>=
_this
.
__data__
.
item_list
.
length
)
{
_this
.
done
Daily
()
_this
.
done
Test
()
}
else
{
...
...
@@ -306,6 +330,20 @@ Page({
})
},
// 获取指定quiz_string数据
getQuiz
:
function
(
quiz_string
)
{
var
_this
=
this
;
var
itemList
=
quiz_string
.
split
(
"::"
)
_this
.
setData
({
item_list
:
itemList
,
item_index
:
0
//初始化item_index
})
var
wid
=
itemList
[
0
]
_this
.
getData
(
wid
)
},
// 获取真实数据
getData
:
function
(
questionId
)
{
...
...
@@ -332,7 +370,7 @@ Page({
}
result
[
"choiceString"
]
=
list
_this
.
setData
({
quiz
Result
:
result
,
quiz
Info
:
result
,
questionId
:
questionId
,
})
}
...
...
@@ -340,35 +378,33 @@ Page({
})
},
// 如果完成了10道题
doneDaily
:
function
(
res
)
{
/*
如果完成了指定的题目
1. 结算成绩
2. 存入数据库 tbl_match
3. 跳转到 /quiz-result.wxml 页面
*/
doneTest
:
function
(
res
)
{
var
_this
=
this
wx
.
navigateTo
({
url
:
"/pages/activity/quiz-result/quiz-result"
})
// this.setData({
// showModal: true
// })
// wx.showModal({
// title: '恭喜你完成本次活动',
// content: '获得'+_this.__data__.score + '积分,打败80%的玩家',
// showCancel: false, // 将cancel按钮disable掉
// confirmText: '谢谢老师',
// success(res) {
// if (res.confirm) {
// // 用户点击了确定属性的按钮,于是跳转到tabbar /pages/key/key
// // wx.navigateTo 和 wx.redirectto都无法跳转到tabbar
// _this.setData({
// isStudyDone: true,
// item_index : 9,
// })
// // 基于用户交互原则,不直接跳转到/pages/key/key页面, 让用户自主选择
// // wx.switchTab({
// // url: '/pages/key/key'
// // });
// }
// }
// })
// 1. 结算成绩
var
quizResult
=
{}
var
num_valid
=
_this
.
__data__
.
score
var
num_total
=
_this
.
__data__
.
item_list
.
length
var
points
=
num_valid
/
num_total
var
scores
=
parseFloat
(
_this
.
__data__
.
quizParam
[
"point"
])
var
match_point
=
parseFloat
(
points
*
scores
).
toFixed
(
1
)
// var match_result = num_valid + "/" + num_total
// 2. 存入数据库 tbl_match, 并且拿到 match_id
_this
.
uploadMatch
(
match_point
,
num_valid
,
num_total
);
// 3. 跳转到 /quiz-result.wxml 页面
// matchId
// 成绩 quizResult
// 信息 quizParam, member_name, title
// _this.toResult()
},
...
...
@@ -562,7 +598,7 @@ Page({
onSubmitComment
:
function
(
e
)
{
var
_this
=
this
;
var
objectId
=
_this
.
__data__
.
questionId
//获取index值
var
objectName
=
_this
.
__data__
.
quiz
Result
.
questionName
//获取index值
var
objectName
=
_this
.
__data__
.
quiz
Info
.
questionName
//获取index值
let
content
=
e
.
detail
.
value
.
content
;
//获取评论内容
var
useridFrom
=
_this
.
__data__
.
nyxCode
;
//获取userid
var
useridTo
=
e
.
detail
.
value
.
useridTo
;
//获取reply id
...
...
@@ -656,26 +692,21 @@ Page({
},
/*
更新
daily
的记录到tbl_match表
更新
test
的记录到tbl_match表
*/
upload
Daily
:
function
(
e
){
upload
Match
(
match_point
,
num_valid
,
num_total
){
var
_this
=
this
;
var
strUrl
=
config
.
match_add_item_url
var
quizIndex
=
_this
.
data
.
item_index_done
var
score
=
_this
.
data
.
score
config
.
debug
==
1
?
console
.
log
(
"===upload strUrl "
+
strUrl
+
"_quizIndex_"
+
quizIndex
+
"_socre_"
+
score
):
""
config
.
debug
==
1
?
console
.
log
(
"===uploadMatch strUrl "
+
strUrl
+
"_point_"
+
match_point
):
""
wx
.
request
({
url
:
strUrl
,
method
:
'POST'
,
data
:
{
matchSeason
:
_this
.
data
.
matchSeason
,
matchType
:
_this
.
data
.
matchType
,
matchTeam
:
_this
.
data
.
nyxCode
,
matchScore
:
_this
.
data
.
score
,
teamType
:
"blue"
,
matchResult
:
_this
.
data
.
item_index_done
==
10
?
1
:
0
,
//item_index永远指向下一题
quizIndex
:
_this
.
data
.
item_index_done
,
//已完成的quiz数目, 范围是1...10
rankScore
:
_this
.
data
.
score
,
activityId
:
_this
.
__data__
.
quizParam
[
"activity_id"
],
memberId
:
_this
.
__data__
.
quizParam
[
"member_id"
],
userId
:
_this
.
data
.
nyxCode
,
matchPoint
:
match_point
,
matchResult
:
num_valid
+
"/"
+
num_total
,
},
header
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
...
...
@@ -683,9 +714,13 @@ Page({
},
dataType
:
"json"
,
success
:
function
(
res
)
{
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
data
.
resultCode
==
200
)
{
//表示提交成功
console
.
log
(
"成绩记录成功"
);
//得到matchId
var
matchList
=
res
.
data
.
data
;
var
match_id
=
matchList
.
length
>=
1
?
matchList
[
0
].
matchId
:
""
_this
.
toResultPage
(
match_id
,
num_valid
,
num_total
,
match_point
)
}
}
})
...
...
@@ -717,6 +752,27 @@ Page({
})
},
//跳转到竞答结果页 quiz-result.wxml
toResultPage
(
match_id
,
num_valid
,
num_total
,
match_point
)
{
// matchId
// 成绩 quizResult
// 信息 quizParam, member_name, title
// toResult
var
_this
=
this
;
var
url
=
"/pages/activity/quiz-result/quiz-result?"
+
"&match_id="
+
match_id
+
"&member_name="
+
_this
.
__data__
.
quizParam
[
"member_name"
]
+
"&title="
+
_this
.
__data__
.
quizParam
[
"title"
]
+
"&num_total="
+
num_total
+
"&num_valid="
+
num_valid
+
"&points="
+
match_point
wx
.
navigateTo
({
url
:
url
})
},
})
\ No newline at end of file
增值产品-小程序及app/nyx-master/pages/key/matchTest/matchTest.wxml
查看文件 @
c29e05e6
<!--p
ages/key/matchTest/matchTest.wxml-->
<!--p
ages/key/matchTest/matchTest.wxml-->
...
...
@@ -49,10 +49,10 @@
<view hidden="{{isStudyDone}}"> <!-- start of isStudyDone flag -->
<view class="page__hd">
<!-- 标题 -->
<view class="page__desc">{{quiz
Result
.questionName}}</view>
<view class="page__desc">{{quiz
Info
.questionName}}</view>
</view>
<view class="page__bd " wx:for-items="{{quiz
Result
.choiceString}}" >
<view class="page__bd " wx:for-items="{{quiz
Info
.choiceString}}" >
<button class="weui-btn button-sp-area {{current_item == index?'btn-selected':'btn-not-selected'}}" bind:tap="onClick" disabled="{{button_disabled==1?true:false}}" id="{{index}}">
<image src="{{operateResult}}" style="vertical-align:middle;width:60rpx;height:60rpx" hidden="{{hidden_type==1?true:(current_item == index?false:true)}}" />
{{item}}
...
...
@@ -61,7 +61,7 @@
<view class="page__hd" hidden="{{button_disabled==0}}">
<!-- 优化: 直接显示正确答案 -->
<view class="page__desc">推荐答案: {{tutil.formatAnswer(quiz
Result
.answer)}}</view>
<view class="page__desc">推荐答案: {{tutil.formatAnswer(quiz
Info
.answer)}}</view>
</view>
<!-- <text>\n</text> -->
<view class="weui-flex">
...
...
增值产品-小程序及app/nyx-master/pages/my/my.js
查看文件 @
c29e05e6
// pa
ges/my/my.js
// pa
ges/my/my.js
...
...
@@ -14,7 +14,6 @@ Page({
nyxCode
:
""
,
authStatus
:
"0"
,
userInfo
:
{},
matchSeason
:
""
,
bGetUserInfo
:
false
,
bUpdateUserData
:
false
,
...
...
@@ -32,7 +31,6 @@ Page({
nyxCode
:
wx
.
getStorageSync
(
'nyxCode'
),
userInfo
:
wx
.
getStorageSync
(
'userInfo'
),
authStatus
:
wx
.
getStorageSync
(
'authStatus'
),
matchSeason
:
wx
.
getStorageSync
(
'matchSeason'
),
})
}
...
...
@@ -42,7 +40,6 @@ Page({
log
.
info
(
"my_onLoad_nyxCode"
,
_this
.
data
.
nyxCode
)
log
.
info
(
"my_onLoad_authStatus"
,
_this
.
data
.
authStatus
)
log
.
info
(
"my_onLoad_userInfo"
,
_this
.
data
.
userInfo
)
log
.
info
(
"my_onLoad_matchSeason"
,
_this
.
data
.
matchSeason
)
},
...
...
增值产品-小程序及app/nyx-master/utils/date.wxs
查看文件 @
c29e05e6
var f
ormatTime = function (date) {
var f
ormatTime = function (date) {
...
...
@@ -19,14 +19,33 @@ var formatDate_md = function (date) {
var formatDate_ymd = function (date) {
// 输入 2020-02-04 19:33:00
// 返回 02-04
// 返回
2020-
02-04
var str = date.toString().substring(0, 10)
return str
}
var formatDate_ymdw_today = function (date) {
// 输入 2020-02-04 19:33:00
// 返回 2020年02月04日
var date = getDate(date);
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var week = getWeekByDate_today(date)
return year +"年" + month + "月" + day + "日" + " " + week
}
var getWeekByDate_today = function (date) {
//数日
var show_day = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
var date = getDate(date);
var day = date.getDay();
return show_day[day];
}
var formatNumber = function(n) {
n = n.toString()
console.log(n)
return n[1] ? n : '0' + n
}
...
...
@@ -40,31 +59,28 @@ var formatAnswer = function (n) {
switch (n) {
case "1":
answer = "A"
console.log("input is 1")
break;
case "2":
answer = "B"
console.log("input is 2")
break;
case "3":
answer = "C"
console.log("input is 3")
break;
case "4":
answer = "D"
console.log("input is 4")
break;
case "5":
answer = "E"
break;
default:
console.log("input is n")
break;
}
return answer
}
module.exports = {
formatDate_ymd: formatDate_ymd,
formatDate_ymdw_today: formatDate_ymdw_today,
formatDate_md: formatDate_md,
formatTime: formatTime,
formatNumber: formatNumber,
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/domain/Rockwell_keyT_match.java
查看文件 @
c29e05e6
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
domain
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
domain
;
...
...
@@ -16,6 +16,7 @@ import java.util.Date;
public
class
Rockwell_keyT_match
{
private
String
matchId
;
// 竞答的id uuid format
private
String
activityId
;
// 活动id uuid format
private
String
memberId
;
// 商家的id uuid format
private
String
userId
;
// 用户的id uuid format
private
String
matchStatus
;
// (可用|不可用): 01|00
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
查看文件 @
c29e05e6
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
;
...
...
@@ -30,7 +30,7 @@ public interface Rockwell_keyService {
JSONResult
Rockwell_keyServiceGetT_match_by_matchid
(
String
matchId
);
JSONResult
Rockwell_keyServiceGetT_match_by_page
(
String
memberId
,
String
userId
,
String
matchStatus
);
void
Rockwell_keyServiceAddT_matchList
(
List
<
Rockwell_keyT_match
>
listRockwell_keyT_match
);
void
Rockwell_keyServiceAddT_matchItem
(
String
match
Id
,
String
memberId
,
String
userId
,
JSONResult
Rockwell_keyServiceAddT_matchItem
(
String
matchId
,
String
activity
Id
,
String
memberId
,
String
userId
,
Double
matchPoint
,
String
matchResult
,
String
qrcodeUrl
);
void
Rockwell_keyServiceUpdateT_match_status
(
String
matchId
);
void
Rockwell_keyServiceAddT_match_bonusItem
(
String
matchId
,
String
userId
,
String
userName
,
Double
bonusPoint
);
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
查看文件 @
c29e05e6
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
.
impl
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
service
.
impl
;
...
...
@@ -178,13 +178,14 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
rockwell_keyMapper
.
addT_matchList
(
rockwell_keyT_matchQuery
);
}
public
void
Rockwell_keyServiceAddT_matchItem
(
String
match
Id
,
String
memberId
,
String
userId
,
public
JSONResult
Rockwell_keyServiceAddT_matchItem
(
String
matchId
,
String
activity
Id
,
String
memberId
,
String
userId
,
Double
matchPoint
,
String
matchResult
,
String
qrcodeUrl
)
{
LOGGER
.
debug
(
"find Rockwell_keyServiceAddT_matchItem"
);
Rockwell_keyT_match
rockwell_keyT_match
=
new
Rockwell_keyT_match
();
rockwell_keyT_match
.
setMatchId
(
matchId
);
rockwell_keyT_match
.
setMatchStatus
(
"01"
);
rockwell_keyT_match
.
setActivityId
(
activityId
);
rockwell_keyT_match
.
setMemberId
(
memberId
);
rockwell_keyT_match
.
setUserId
(
userId
);
rockwell_keyT_match
.
setMatchPoint
(
matchPoint
);
...
...
@@ -193,6 +194,13 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
rockwell_keyT_match
.
setCreateDatetime
(
new
Date
());
rockwell_keyT_match
.
setUpdateDatetime
(
new
Date
());
rockwell_keyMapper
.
addT_matchItem
(
rockwell_keyT_match
);
List
<
Rockwell_keyT_match
>
listRockwell_keyT_match
=
new
ArrayList
<
Rockwell_keyT_match
>();
listRockwell_keyT_match
.
add
(
rockwell_keyT_match
);
int
totalCount
=
listRockwell_keyT_match
.
size
();
JSONResult
jsonResult
=
new
JSONResult
(
totalCount
,
listRockwell_keyT_match
);
return
jsonResult
;
}
/*
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java
查看文件 @
c29e05e6
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
web
.
controller
;
packa
ge
cn
.
com
.
fun
.
nyxkey
.
api
.
web
.
controller
;
...
...
@@ -129,6 +129,7 @@ public class NyxApiController {
*/
@ApiOperation
(
value
=
"为t_match添加match,对应tbl_match"
,
notes
=
"为t_match添加match,对应tbl_match"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"activityId"
,
value
=
"活动的id"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"memberId"
,
value
=
"商户的id"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户的id"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"matchPoint"
,
value
=
"得分: 4.5 or 5.0"
,
required
=
true
,
dataType
=
"String"
),
...
...
@@ -136,7 +137,8 @@ public class NyxApiController {
})
@RequestMapping
(
value
=
"/nyx/match/add/item"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
void
RockwellAddMatchItem
(
public
JSONResult
RockwellAddMatchItem
(
@RequestParam
(
value
=
"activityId"
,
required
=
false
,
defaultValue
=
"0"
)
String
activityId
,
@RequestParam
(
value
=
"memberId"
,
required
=
false
,
defaultValue
=
"0"
)
String
memberId
,
@RequestParam
(
value
=
"userId"
,
required
=
false
,
defaultValue
=
"0"
)
String
userId
,
@RequestParam
(
value
=
"matchPoint"
,
required
=
false
,
defaultValue
=
"0.0"
)
Double
matchPoint
,
...
...
@@ -146,7 +148,7 @@ public class NyxApiController {
String
matchId
=
"mid_"
+
UUID
.
randomUUID
().
toString
();
//生成qrcode, 上传oss,得到qrcode_url
String
qrcodeUrl
=
ossService
.
Rockwell_ossServiceGetQrcodeUrl
(
matchId
);
keyService
.
Rockwell_keyServiceAddT_matchItem
(
match
Id
,
memberId
,
userId
,
matchPoint
,
matchResult
,
qrcodeUrl
);
return
keyService
.
Rockwell_keyServiceAddT_matchItem
(
matchId
,
activity
Id
,
memberId
,
userId
,
matchPoint
,
matchResult
,
qrcodeUrl
);
}
// APi2 t_match接口 jscat 20200731
...
...
增值产品-小程序及app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
查看文件 @
c29e05e6
<?xml
version="1.0" encoding="UTF-8"?>
<?xml
version="1.0" encoding="UTF-8"?>
...
...
@@ -119,10 +119,11 @@ limitations under the License.
<!-- match api1-2 新增一条 tbl_match 记录 update jscat 20200731 -->
<insert
id=
"addT_matchItem"
parameterType=
"cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match"
>
insert into tbl_match(match_id, member_id, user_id, match_status, match_point, match_result, qrcode_url, create_datetime,update_datetime)
insert into tbl_match(match_id,
activity_id,
member_id, user_id, match_status, match_point, match_result, qrcode_url, create_datetime,update_datetime)
values
(
#{matchId},
#{activityId},
#{memberId},
#{userId},
#{matchStatus},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论