dev_tj
杨树林 5 years ago
commit 412e0e3427

@ -21,6 +21,8 @@ class Weapps::CodeSessionsController < Weapps::BaseController
Rails.logger.info("[Weapp] code: #{params[:code]}") Rails.logger.info("[Weapp] code: #{params[:code]}")
user_info = Wechat::Weapp.decrypt(result['session_key'], params[:encrypted_data], params[:iv]) user_info = Wechat::Weapp.decrypt(result['session_key'], params[:encrypted_data], params[:iv])
# user_info.delete(:nickName)
# 老用户,已绑定 # 老用户,已绑定
open_user = OpenUsers::Wechat.find_by(uid: user_info['unionId']) open_user = OpenUsers::Wechat.find_by(uid: user_info['unionId'])
if open_user.present? && open_user.user if open_user.present? && open_user.user
@ -29,7 +31,7 @@ class Weapps::CodeSessionsController < Weapps::BaseController
end end
set_session_unionid(user_info['unionId']) set_session_unionid(user_info['unionId'])
user_info['nickname'] = user_info['nickName'] # user_info['nickname'] = user_info['nickName']
session[:wechat_user_extra] = user_info session[:wechat_user_extra] = user_info
end end

@ -15,8 +15,9 @@ class Weapps::SessionsController < Weapps::BaseController
return return
end end
# session[:wechat_user_extra].delete(:nickName)
# 绑定微信号 # 绑定微信号
OpenUsers::Wechat.create!(user: user, uid: session_unionid, extra: session[:wechat_user_extra]) if user.wechat_open_user.blank? OpenUsers::Wechat.create!(user: user, uid: session_unionid) if user.wechat_open_user.blank?
successful_authentication(user) successful_authentication(user)
end end

@ -0,0 +1,13 @@
class Modify1WechatSupportForShixuns < ActiveRecord::Migration[5.2]
def change
shixuns = Shixun.joins(:challenges).where(is_wechat_support: true, status: 2)
.select("shixuns.*, challenges.path path")
shixuns.each do |shixun|
if shixun.path && shixun.path.split("").count > 1
shixun.update_attribute(:is_wechat_support, false)
end
end
Shixun.joins(:challenges).where(challenges: {st: 1}).update_all(is_wechat_support: false)
end
end

@ -1134,6 +1134,12 @@
<div class="code-name">&amp;#xe7f9;</div> <div class="code-name">&amp;#xe7f9;</div>
</li> </li>
<li class="dib">
<span class="icon iconfont">&#xe71b;</span>
<div class="name">过滤器</div>
<div class="code-name">&amp;#xe71b;</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont">&#xe6ee;</span> <span class="icon iconfont">&#xe6ee;</span>
<div class="name">20从属连接</div> <div class="name">20从属连接</div>
@ -3572,6 +3578,15 @@
</div> </div>
</li> </li>
<li class="dib">
<span class="icon iconfont icon-guolvqi"></span>
<div class="name">
过滤器
</div>
<div class="code-name">.icon-guolvqi
</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont icon-congshulianjie"></span> <span class="icon iconfont icon-congshulianjie"></span>
<div class="name"> <div class="name">
@ -6171,6 +6186,14 @@
<div class="code-name">#icon-gengduo1</div> <div class="code-name">#icon-gengduo1</div>
</li> </li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-guolvqi"></use>
</svg>
<div class="name">过滤器</div>
<div class="code-name">#icon-guolvqi</div>
</li>
<li class="dib"> <li class="dib">
<svg class="icon svg-icon" aria-hidden="true"> <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-congshulianjie"></use> <use xlink:href="#icon-congshulianjie"></use>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1293,6 +1293,13 @@
"unicode": "e7f9", "unicode": "e7f9",
"unicode_decimal": 59385 "unicode_decimal": 59385
}, },
{
"icon_id": "5327531",
"name": "过滤器",
"font_class": "guolvqi",
"unicode": "e71b",
"unicode_decimal": 59163
},
{ {
"icon_id": "5379378", "icon_id": "5379378",
"name": "20从属连接", "name": "20从属连接",

@ -572,6 +572,9 @@ Created by iconfont
<glyph glyph-name="gengduo1" unicode="&#59385;" d="M104 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM920 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM512 384m-160 0a160 160 0 1 1 320 0 160 160 0 1 1-320 0Z" horiz-adv-x="1024" /> <glyph glyph-name="gengduo1" unicode="&#59385;" d="M104 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM920 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM512 384m-160 0a160 160 0 1 1 320 0 160 160 0 1 1-320 0Z" horiz-adv-x="1024" />
<glyph glyph-name="guolvqi" unicode="&#59163;" d="M908.6 761.3c6.5-15.5 3.8-28.8-8-39.7L620.9 441.9V21c0-15.8-7.4-27.1-22.1-33.5-4.9-2-9.7-2.9-14.2-2.9-10.3 0-18.7 3.6-25.5 10.7L413.8 140.8c-7.2 7.2-10.7 15.7-10.7 25.5V441.9L123.4 721.6c-11.7 11-14.3 24.2-8 39.7 6.5 14.8 17.5 22.1 33.5 22.1H875c16 0.1 27.2-7.3 33.6-22.1z" horiz-adv-x="1024" />
<glyph glyph-name="congshulianjie" unicode="&#59118;" d="M844.8 230.4a128 128 0 0 1-125.44-102.4H358.4a102.4 102.4 0 0 0 0 204.8h307.2a153.6 153.6 0 0 1 0 307.2H304.64a128 128 0 1 1 0-51.2H665.6a102.4 102.4 0 0 0 0-204.8H358.4a153.6 153.6 0 0 1 0-307.2h360.96a128 128 0 1 1 125.44 153.6z m0-204.8a76.8 76.8 0 1 0 76.8 76.8 76.8 76.8 0 0 0-76.8-76.8z" horiz-adv-x="1024" /> <glyph glyph-name="congshulianjie" unicode="&#59118;" d="M844.8 230.4a128 128 0 0 1-125.44-102.4H358.4a102.4 102.4 0 0 0 0 204.8h307.2a153.6 153.6 0 0 1 0 307.2H304.64a128 128 0 1 1 0-51.2H665.6a102.4 102.4 0 0 0 0-204.8H358.4a153.6 153.6 0 0 1 0-307.2h360.96a128 128 0 1 1 125.44 153.6z m0-204.8a76.8 76.8 0 1 0 76.8 76.8 76.8 76.8 0 0 0-76.8-76.8z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 381 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2020-01-15 09:56:34 * @Date: 2020-01-15 09:56:34
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-17 15:34:40 * @LastEditTime : 2020-01-17 21:10:23
*/ */
import './index.scss'; import './index.scss';
import React, {useState, useEffect, useRef} from 'react'; import React, {useState, useEffect, useRef} from 'react';
@ -22,6 +22,10 @@ const App = (props) => {
wxCode, wxCode,
path, path,
showLoading, showLoading,
showDialog,
gold,
experience,
next_game,
// userCode, // userCode,
testCase = [], testCase = [],
getWXCode, getWXCode,
@ -34,7 +38,8 @@ const App = (props) => {
updateWXCodeForInterval, updateWXCodeForInterval,
evaluateWxCode, evaluateWxCode,
showWXCodeTextCase, showWXCodeTextCase,
changeWXCodeEvaluateLoading changeWXCodeEvaluateLoading,
changeWXCodeEvaluateDialog
} = props; } = props;
const {identifier} = props.match.params; const {identifier} = props.match.params;
@ -51,7 +56,10 @@ const App = (props) => {
path: '/', path: '/',
domain: '.educoder.net' domain: '.educoder.net'
}); });
cookie.save(_arr[0], _arr[1], { domain: '.educoder.net', path: '/'}); cookie.save(_arr[0], _arr[1], {
path: '/',
domain: '.educoder.net'
});
}); });
} }
} }
@ -60,11 +68,10 @@ const App = (props) => {
// const [isVisible, setIsVisible] = useState(false); // const [isVisible, setIsVisible] = useState(false);
const editorRef = useRef(null); const editorRef = useRef(null);
let timer = null; let timer = null;
useEffect(() => {
setTimeout(() => { const loadResult = (identifier) => {
setCookier();
// 加载代码块内容 // 加载代码块内容
getWXCode(identifier, ); getWXCode(identifier);
// 加载测试集 // 加载测试集
const params = { const params = {
path, path,
@ -72,6 +79,11 @@ const App = (props) => {
retry: 1 retry: 1
}; };
getWXCodeTestCase(identifier, params); getWXCodeTestCase(identifier, params);
}
useEffect(() => {
setTimeout(() => {
setCookier();
loadResult(identifier);
}, 0); }, 0);
}, []); }, []);
// 关闭 // 关闭
@ -106,7 +118,7 @@ const App = (props) => {
timer = null; timer = null;
// 调用更新代码 // 调用更新代码
updateWXCodeForInterval(identifier, path); updateWXCodeForInterval(identifier, path);
}, 10000); }, 5000);
} }
} }
@ -128,11 +140,29 @@ const App = (props) => {
evaluateWxCode(identifier, path); evaluateWxCode(identifier, path);
} }
// 关闭弹框
const handleCloseDialog = () => {
changeWXCodeEvaluateDialog(false);
}
// 查看测试集
const handleClickShowResult = () => {
showWXCodeTextCase(true);
changeWXCodeEvaluateDialog(false);
}
// 下一关
const handleClickNext = () => {
changeWXCodeEvaluateDialog(false);
loadResult(next_game);
}
const tcclasses = isShow ? `wx-code-test-case active` : 'wx-code-test-case'; const tcclasses = isShow ? `wx-code-test-case active` : 'wx-code-test-case';
const loading = showLoading ? 'code-evaluate-loading active' : 'code-evaluate-loading'; const loading = showLoading ? 'code-evaluate-loading active' : 'code-evaluate-loading';
const _val = sets_error_count === 0; const dialog = showDialog ? 'pass-dialog active' : 'pass-dialog';
const _val = +sets_error_count === 0;
let resultTxt = (_val) ? '全部通过' : `${sets_error_count}组测试结果不匹配`; let resultTxt = (_val) ? '全部通过' : `${sets_error_count}组测试结果不匹配`;
const iclasses = _val ? 'iconfont icon-tishi1 icon success' : 'iconfont icon-tishi1 icon fail'; const iclasses = _val ? 'iconfont icon-wancheng icon success' : 'iconfont icon-tishi1 icon fail';
const tclasses = _val ? 'result-txt success' : 'result-txt fail'; const tclasses = _val ? 'result-txt success' : 'result-txt fail';
const ulClasses = last_compile_output ? 'case-list hasResult' : 'case-list'; const ulClasses = last_compile_output ? 'case-list hasResult' : 'case-list';
return ( return (
@ -147,7 +177,7 @@ const App = (props) => {
options={{ options={{
selectOnLineNumbers: true, selectOnLineNumbers: true,
automaticLayout: true, automaticLayout: true,
fontSize: `32px` fontSize: `36px`
}} }}
theme='dark' theme='dark'
editorDidMount={handleEditorChange} editorDidMount={handleEditorChange}
@ -196,7 +226,7 @@ const App = (props) => {
测试集{i + 1} 测试集{i + 1}
</h2> </h2>
{ {
is_public is_public && last_compile_output
? (result ? (result
? <span className="iconfont icon-wancheng case_item_success"></span> ? <span className="iconfont icon-wancheng case_item_success"></span>
: <span className="iconfont icon-jinggao1 case_item_fail"></span>) : <span className="iconfont icon-jinggao1 case_item_fail"></span>)
@ -246,6 +276,34 @@ const App = (props) => {
<span className="loading-txt">测评中...</span> <span className="loading-txt">测评中...</span>
</span> </span>
</div> </div>
{/* 通过弹框 */}
<div className={dialog}>
<div className="pass-box">
<div className="pass-img"></div>
<div className="pass-ctx">
<div className="pass-title">{next_game ? '评测通过' : '恭喜通关'}</div>
<p className="pass-value">
金币 <span className="value_color">{gold > 0 ? `+${gold}` : 0}</span>,
经验值 <span className="value_color">{experience > 0 ? `+${experience}` : 0}</span>
</p>
{
next_game
? (
<div className="pass-btn">
<button className="btn btn-first" onClick={handleClickShowResult}>评测结果</button>
<button className="btn btn-second" onClick={handleClickNext}>下一关</button>
</div>
)
: (
<div className="pass-btn-all">
<button className="btn btn-second" onClick={handleClickShowResult}>评测结果</button>
</div>
)
}
</div>
</div>
<i className="iconfont icon-roundclose icon_close" onClick={handleCloseDialog}></i>
</div>
</div> </div>
); );
} }
@ -256,8 +314,12 @@ const mapStateToProps = (state) => {
isShow, isShow,
wxCode, wxCode,
userCode, userCode,
gold,
experience,
next_game,
testCase, testCase,
showLoading, showLoading,
showDialog,
last_compile_output, last_compile_output,
test_sets_count, test_sets_count,
sets_error_count sets_error_count
@ -268,8 +330,12 @@ const mapStateToProps = (state) => {
isShow, isShow,
wxCode, wxCode,
userCode, userCode,
gold,
experience,
next_game,
testCase, testCase,
showLoading, showLoading,
showDialog,
last_compile_output, last_compile_output,
test_sets_count, test_sets_count,
sets_error_count sets_error_count
@ -284,7 +350,8 @@ const mapDispatchToProps = (dispatch) => ({
updateWXCodeForInterval: (identifier, path) => dispatch(actions.updateWXCodeForInterval(identifier, path)), updateWXCodeForInterval: (identifier, path) => dispatch(actions.updateWXCodeForInterval(identifier, path)),
evaluateWxCode: (identifier, path) => dispatch(actions.evaluateWxCode(identifier, path)), evaluateWxCode: (identifier, path) => dispatch(actions.evaluateWxCode(identifier, path)),
showWXCodeTextCase: (flag) => dispatch(actions.showWXCodeTextCase(flag)), showWXCodeTextCase: (flag) => dispatch(actions.showWXCodeTextCase(flag)),
changeWXCodeEvaluateLoading: (flag) => dispatch(actions.changeWXCodeEvaluateLoading(flag)) changeWXCodeEvaluateLoading: (flag) => dispatch(actions.changeWXCodeEvaluateLoading(flag)),
changeWXCodeEvaluateDialog: (flag) => dispatch(actions.changeWXCodeEvaluateDialog(flag))
}); });
export default connect( export default connect(

@ -28,12 +28,16 @@
align-items: center; align-items: center;
.icon{ .icon{
// font-size: 24px !important; // font-size: 24px !important;
// transform: scale(2.4);
// line-height: 2;
font-size: 32px !important;
transform: scale(2); transform: scale(2);
line-height: 2; position: relative;
} top: 10px;
.icon-reset{
transform: scale(2.4);
} }
// .icon-reset{
// transform: scale(2.4);
// }
// .icon:first-child{ // .icon:first-child{
// transform: scale((3)); // transform: scale((3));
// } // }
@ -42,7 +46,7 @@
margin-left: 50px; margin-left: 50px;
} }
.icon-txt{ .icon-txt{
font-size: 24px; font-size: 32px;
} }
} }
} }
@ -53,7 +57,7 @@
border-radius: 9999px; border-radius: 9999px;
padding: 0 40px; padding: 0 40px;
line-height: 72px; line-height: 72px;
font-size: 32px; font-size: 36px;
color: #fff; color: #fff;
background:#2EA4FF; background:#2EA4FF;
} }
@ -99,10 +103,12 @@
border-bottom: 2px solid #213857; border-bottom: 2px solid #213857;
.header-title{ .header-title{
color:#637DA6; color:#637DA6;
font-size: 24px; // font-size: 24px;
font-size: 36px;
} }
.header-close{ .header-close{
font-size: 28px; // font-size: 28px;
font-size: 36px;
color: #2EA4FF; color: #2EA4FF;
} }
} }
@ -126,7 +132,8 @@
margin-right: 10px; margin-right: 10px;
} }
.result-txt{ .result-txt{
font-size: 34px; // font-size: 34px;
font-size: 36px;
} }
.result-txt-desc{ .result-txt-desc{
max-width: 500px; max-width: 500px;
@ -185,14 +192,14 @@
} }
.item-header-desc{ .item-header-desc{
font-size: 32px; font-size: 36px;
color: #405D8C; color: #405D8C;
line-height: 1.5; line-height: 1.5;
// background: gold; // background: gold;
.icon{ .icon{
position: relative; position: relative;
top: -4px; top: -4px;
font-size: 32px !important; font-size: 36px !important;
margin-right: 10px; margin-right: 10px;
} }
&.active{ &.active{
@ -234,7 +241,8 @@
// } // }
} }
} }
.code-evaluate-loading{ .code-evaluate-loading,
.pass-dialog{
display: none; display: none;
position: fixed; position: fixed;
left: 0; left: 0;
@ -250,7 +258,12 @@
content: ''; content: '';
background: rgba(0,0,0,.5); background: rgba(0,0,0,.5);
} }
&.active{
display: flex;
}
}
.code-evaluate-loading{
// display: none;
.loading-flex{ .loading-flex{
display: flex; display: flex;
position: absolute; position: absolute;
@ -264,12 +277,84 @@
font-size: 100px !important; font-size: 100px !important;
} }
.loading-txt{ .loading-txt{
font-size: 32px; font-size: 36px;
} }
} }
}
&.active{ .pass-dialog{
flex-direction: column;
.pass-box{
position: relative;
z-index: 10;
background: #fff;
border-radius: 15px;
width: 490px;
height: 490px;
overflow: hidden;
}
.pass-img{
height: 200px;
background: url(../../images/wx-head.png) center center no-repeat;
// background: url(../../../public/images/wx-head.png) center center no-repeat;
}
.pass-ctx{
display: flex; display: flex;
flex-direction: column;
// justify-content: center;
justify-content: space-between;
align-items: center;
height: 290px;
padding: 40px 0;
.pass-title,
.pass-value,
.pass-btn .btn,
.pass-btn-all .btn{
font-size: 36px;
line-height: 1.5;
}
.pass-value{
color: #888888;
.value_color{
color: rgb(234, 185, 35);
}
}
.pass-btn,
.pass-btn-all{
display: flex;
justify-content: space-between;
// background: gold;
padding: 0 40px;
width: 100%;
margin-top: 10px;
}
.pass-btn-all{
justify-content: center;
} }
.btn{
outline: none;
border-radius: 999px;
padding: 0 30px;
height: 70px;
&.btn-first{
border: 1px solid #2EA4FF;
color: #2EA4FF;
}
&.btn-second{
background-color: #2EA4FF;
color: #fff;
}
}
.pass-title{
color: #2EA4FF;
}
}
}
.icon_close{
display: block;
position: relative;
z-index: 10;
color: #555;
font-size: 100px!important;
} }
} }

@ -99,7 +99,9 @@ const types = {
UPDATE_WXCODE_BY_IDENTIFIER: 'UPDATE_WXCODE_BY_IDENTIFIER', UPDATE_WXCODE_BY_IDENTIFIER: 'UPDATE_WXCODE_BY_IDENTIFIER',
UPDATE_WXCODE_FOR_EDITOR: 'UPDATE_WXCODE_FOR_EDITOR', UPDATE_WXCODE_FOR_EDITOR: 'UPDATE_WXCODE_FOR_EDITOR',
IS_SHOW_WXCODE_TEST_CASES: 'IS_SHOW_WXCODE_TEST_CASES', IS_SHOW_WXCODE_TEST_CASES: 'IS_SHOW_WXCODE_TEST_CASES',
SHOW_WX_CODE_LOADING: 'SHOW_WX_CODE_LOADING' SHOW_WX_CODE_LOADING: 'SHOW_WX_CODE_LOADING',
SHOW_WX_CODE_DIALOG: 'SHOW_WX_CODE_DIALOG',
SET_GOLD_AND_EXPERIENCE: 'SET_GOLD_AND_EXPERIENCE'
} }
export default types; export default types;

@ -118,7 +118,8 @@ import {
updateWXCodeForInterval, updateWXCodeForInterval,
evaluateWxCode, evaluateWxCode,
showWXCodeTextCase, showWXCodeTextCase,
changeWXCodeEvaluateLoading changeWXCodeEvaluateLoading,
changeWXCodeEvaluateDialog
} from './wxCode'; } from './wxCode';
export default { export default {
toggleTodo, toggleTodo,
@ -211,5 +212,6 @@ export default {
updateWXCodeForInterval, updateWXCodeForInterval,
evaluateWxCode, evaluateWxCode,
showWXCodeTextCase, showWXCodeTextCase,
changeWXCodeEvaluateLoading changeWXCodeEvaluateLoading,
changeWXCodeEvaluateDialog
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2020-01-15 15:41:10 * @Date: 2020-01-15 15:41:10
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-16 15:25:25 * @LastEditTime : 2020-01-17 21:06:46
*/ */
import types from './actionTypes.js'; import types from './actionTypes.js';
import { import {
@ -38,6 +38,7 @@ export const getWXCodeTestCase = (identifier, params) => {
try{ try{
const {data = {}} = res; const {data = {}} = res;
console.log(data.test_sets); console.log(data.test_sets);
const _path = data.challenge.path;
dispatch({ dispatch({
type: types.GET_WXCODE_TEST_CASE, type: types.GET_WXCODE_TEST_CASE,
payload: { payload: {
@ -45,7 +46,7 @@ export const getWXCodeTestCase = (identifier, params) => {
game_id: data.game && data.game.id, game_id: data.game && data.game.id,
myIdentifier: data.myshixun.identifier, myIdentifier: data.myshixun.identifier,
exec_time: data.challenge.exec_time, exec_time: data.challenge.exec_time,
path: data.challenge.path, path: _path.split('')[0] || _path.split(';')[0],
last_compile_output: data.last_compile_output, last_compile_output: data.last_compile_output,
test_sets_count: data.test_sets_count, test_sets_count: data.test_sets_count,
sets_error_count: data.sets_error_count sets_error_count: data.sets_error_count
@ -103,6 +104,7 @@ export const evaluateWxCode = (identifier, path) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const { const {
userCode, userCode,
wxCode,
game_id, game_id,
myIdentifier, myIdentifier,
exec_time, exec_time,
@ -115,21 +117,27 @@ export const evaluateWxCode = (identifier, path) => {
// build // build
// const {} = res; // const {} = res;
console.log(res); console.log(res);
const _resubmit = res.data.resubmit;
const params = { const params = {
content_modified: 1, first: 1,
sec_key: res.data.sec_key content_modified: userCode !== wxCode ? 1 : 0,
sec_key: res.data.sec_key,
resubmit: _resubmit
} }
console.log(params);
setTimeout(() => {
// console.log(params);
fetchWxCodeGameBuild(identifier, params).then(res => { fetchWxCodeGameBuild(identifier, params).then(res => {
if (res.data.status === 1) { const {status} = res.data;
if (status === 1) {
// 定时调用 game_status fetchWxCodeGameStatus // 定时调用 game_status fetchWxCodeGameStatus
let count = 1; let count = 1;
const intervalTime = 500; const intervalTime = 500;
function wxCodeGameStatus (intervalTime, finalTime, count, timer) { function wxCodeGameStatus (intervalTime, finalTime, count, timer) {
const excuteTime = (count++) * intervalTime; // 当前执行时间 const excuteTime = (count++) * intervalTime; // 当前执行时间
console.log(finalTime, count, excuteTime); console.log(finalTime, count, excuteTime);
fetchWxCodeGameStatus(identifier).then(r => { fetchWxCodeGameStatus(identifier, {resubmit: _resubmit}).then(r => {
const { status, test_sets = [] } = r.data; const { status, test_sets = [], gold, experience, next_game, sets_error_count } = r.data;
if (+status > -1 || ((excuteTime / 1000) > (finalTime + 1))) { if (+status > -1 || ((excuteTime / 1000) > (finalTime + 1))) {
clearInterval(timer); clearInterval(timer);
timer = null; timer = null;
@ -139,10 +147,31 @@ export const evaluateWxCode = (identifier, path) => {
}); });
setTimeout(() => { setTimeout(() => {
// 显示测试集弹框 // 显示测试集弹框
// dispatch({
// type: types.IS_SHOW_WXCODE_TEST_CASES,
// payload: true
// });
// 评测是否通过, 通过 弹通过,否则 弹测试集
if (status === 2 && sets_error_count === 0) {
dispatch({
type: types.SET_GOLD_AND_EXPERIENCE,
payload: {
gold,
experience,
next_game
}
});
dispatch({
type: types.SHOW_WX_CODE_DIALOG,
payload: true
});
} else {
dispatch({ dispatch({
type: types.IS_SHOW_WXCODE_TEST_CASES, type: types.IS_SHOW_WXCODE_TEST_CASES,
payload: true payload: true
}); });
}
dispatch({ dispatch({
type: types.GET_WXCODE_TEST_CASE, type: types.GET_WXCODE_TEST_CASE,
payload: { payload: {
@ -170,6 +199,8 @@ export const evaluateWxCode = (identifier, path) => {
}, intervalTime); }, intervalTime);
} }
}) })
}, 50);
}).catch(err => { }).catch(err => {
dispatch({ dispatch({
type: types.SHOW_WX_CODE_LOADING, type: types.SHOW_WX_CODE_LOADING,
@ -194,3 +225,11 @@ export const changeWXCodeEvaluateLoading = (flag) => {
payload: flag payload: flag
} }
} }
// 关闭对话框
export const changeWXCodeEvaluateDialog = (flag) => {
return {
type: types.SHOW_WX_CODE_DIALOG,
payload: flag
}
}

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2020-01-15 15:37:44 * @Date: 2020-01-15 15:37:44
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-16 15:22:37 * @LastEditTime : 2020-01-17 19:50:00
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
const initialState = { const initialState = {
@ -19,7 +19,11 @@ const initialState = {
sets_error_count: 0, sets_error_count: 0,
path: '', path: '',
isShow: false, isShow: false,
showLoading: false showLoading: false,
showDialog: false,
gold: 0,
experience: 0,
next_game: ''
}; };
const wxcodeReducer = (state = initialState, action) => { const wxcodeReducer = (state = initialState, action) => {
@ -58,6 +62,18 @@ const wxcodeReducer = (state = initialState, action) => {
...state, ...state,
showLoading: payload showLoading: payload
} }
case types.SHOW_WX_CODE_DIALOG:
return {
...state,
showDialog: payload
}
case types.SET_GOLD_AND_EXPERIENCE:
return {
...state,
gold: payload.gold,
experience: payload.experience,
next_game: payload.next_game
}
default: default:
return { return {
...state ...state

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2020-01-15 15:44:36 * @Date: 2020-01-15 15:44:36
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-17 16:40:03 * @LastEditTime : 2020-01-17 20:39:13
*/ */
import axios from 'axios'; import axios from 'axios';
import cookie from 'react-cookies' import cookie from 'react-cookies'
@ -66,9 +66,9 @@ export async function fetchWxCodeGameBuild (identifier, params) {
return axios.get(url, {params}); return axios.get(url, {params});
} }
export async function fetchWxCodeGameStatus (identifier) { export async function fetchWxCodeGameStatus (identifier, params) {
setCookier(); setCookier();
const url = `/tasks/${identifier}/game_status.json`; const url = `/tasks/${identifier}/game_status.json`;
const params = Object.assign({}, {withCredentials: true}); params = Object.assign({}, params, {withCredentials: true});
return axios.get(url, {params}); return axios.get(url, {params});
} }

@ -1134,6 +1134,12 @@
<div class="code-name">&amp;#xe7f9;</div> <div class="code-name">&amp;#xe7f9;</div>
</li> </li>
<li class="dib">
<span class="icon iconfont">&#xe71b;</span>
<div class="name">过滤器</div>
<div class="code-name">&amp;#xe71b;</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont">&#xe6ee;</span> <span class="icon iconfont">&#xe6ee;</span>
<div class="name">20从属连接</div> <div class="name">20从属连接</div>
@ -3572,6 +3578,15 @@
</div> </div>
</li> </li>
<li class="dib">
<span class="icon iconfont icon-guolvqi"></span>
<div class="name">
过滤器
</div>
<div class="code-name">.icon-guolvqi
</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont icon-congshulianjie"></span> <span class="icon iconfont icon-congshulianjie"></span>
<div class="name"> <div class="name">
@ -6171,6 +6186,14 @@
<div class="code-name">#icon-gengduo1</div> <div class="code-name">#icon-gengduo1</div>
</li> </li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-guolvqi"></use>
</svg>
<div class="name">过滤器</div>
<div class="code-name">#icon-guolvqi</div>
</li>
<li class="dib"> <li class="dib">
<svg class="icon svg-icon" aria-hidden="true"> <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-congshulianjie"></use> <use xlink:href="#icon-congshulianjie"></use>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1293,6 +1293,13 @@
"unicode": "e7f9", "unicode": "e7f9",
"unicode_decimal": 59385 "unicode_decimal": 59385
}, },
{
"icon_id": "5327531",
"name": "过滤器",
"font_class": "guolvqi",
"unicode": "e71b",
"unicode_decimal": 59163
},
{ {
"icon_id": "5379378", "icon_id": "5379378",
"name": "20从属连接", "name": "20从属连接",

@ -572,6 +572,9 @@ Created by iconfont
<glyph glyph-name="gengduo1" unicode="&#59385;" d="M104 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM920 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM512 384m-160 0a160 160 0 1 1 320 0 160 160 0 1 1-320 0Z" horiz-adv-x="1024" /> <glyph glyph-name="gengduo1" unicode="&#59385;" d="M104 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM920 376m-104 0a104 104 0 1 1 208 0 104 104 0 1 1-208 0ZM512 384m-160 0a160 160 0 1 1 320 0 160 160 0 1 1-320 0Z" horiz-adv-x="1024" />
<glyph glyph-name="guolvqi" unicode="&#59163;" d="M908.6 761.3c6.5-15.5 3.8-28.8-8-39.7L620.9 441.9V21c0-15.8-7.4-27.1-22.1-33.5-4.9-2-9.7-2.9-14.2-2.9-10.3 0-18.7 3.6-25.5 10.7L413.8 140.8c-7.2 7.2-10.7 15.7-10.7 25.5V441.9L123.4 721.6c-11.7 11-14.3 24.2-8 39.7 6.5 14.8 17.5 22.1 33.5 22.1H875c16 0.1 27.2-7.3 33.6-22.1z" horiz-adv-x="1024" />
<glyph glyph-name="congshulianjie" unicode="&#59118;" d="M844.8 230.4a128 128 0 0 1-125.44-102.4H358.4a102.4 102.4 0 0 0 0 204.8h307.2a153.6 153.6 0 0 1 0 307.2H304.64a128 128 0 1 1 0-51.2H665.6a102.4 102.4 0 0 0 0-204.8H358.4a153.6 153.6 0 0 1 0-307.2h360.96a128 128 0 1 1 125.44 153.6z m0-204.8a76.8 76.8 0 1 0 76.8 76.8 76.8 76.8 0 0 0-76.8-76.8z" horiz-adv-x="1024" /> <glyph glyph-name="congshulianjie" unicode="&#59118;" d="M844.8 230.4a128 128 0 0 1-125.44-102.4H358.4a102.4 102.4 0 0 0 0 204.8h307.2a153.6 153.6 0 0 1 0 307.2H304.64a128 128 0 1 1 0-51.2H665.6a102.4 102.4 0 0 0 0-204.8H358.4a153.6 153.6 0 0 1 0-307.2h360.96a128 128 0 1 1 125.44 153.6z m0-204.8a76.8 76.8 0 1 0 76.8 76.8 76.8 76.8 0 0 0-76.8-76.8z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 381 KiB

Loading…
Cancel
Save