Commit 6fb33331 by xuzhenghua

pre

parents fb6c8d86 62c9455f
...@@ -1508,11 +1508,6 @@ ...@@ -1508,11 +1508,6 @@
"minimist": "^1.2.0" "minimist": "^1.2.0"
} }
}, },
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"resolve": { "resolve": {
"version": "1.10.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz",
...@@ -1598,6 +1593,11 @@ ...@@ -1598,6 +1593,11 @@
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
}, },
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"ms": { "ms": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
...@@ -3984,6 +3984,14 @@ ...@@ -3984,6 +3984,14 @@
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
}, },
"copy-to-clipboard": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.2.0.tgz",
"integrity": "sha512-eOZERzvCmxS8HWzugj4Uxl8OJxa7T2k1Gi0X5qavwydHIfuSHq2dTD09LOg/XyGq4Zpb5IsR/2OJ5lbOegz78w==",
"requires": {
"toggle-selection": "^1.0.6"
}
},
"core-js": { "core-js": {
"version": "2.6.5", "version": "2.6.5",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz",
...@@ -5405,9 +5413,12 @@ ...@@ -5405,9 +5413,12 @@
} }
}, },
"eslint-utils": { "eslint-utils": {
"version": "1.3.1", "version": "1.4.2",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz",
"integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==" "integrity": "sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==",
"requires": {
"eslint-visitor-keys": "^1.0.0"
}
}, },
"eslint-visitor-keys": { "eslint-visitor-keys": {
"version": "1.0.0", "version": "1.0.0",
...@@ -9252,9 +9263,9 @@ ...@@ -9252,9 +9263,9 @@
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=" "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
}, },
"lodash.mergewith": { "lodash.mergewith": {
"version": "4.6.1", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz",
"integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==" "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ=="
}, },
"lodash.sortby": { "lodash.sortby": {
"version": "4.7.0", "version": "4.7.0",
...@@ -9736,9 +9747,9 @@ ...@@ -9736,9 +9747,9 @@
} }
}, },
"mixin-deep": { "mixin-deep": {
"version": "1.3.1", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"requires": { "requires": {
"for-in": "^1.0.2", "for-in": "^1.0.2",
"is-extendable": "^1.0.1" "is-extendable": "^1.0.1"
...@@ -12068,6 +12079,15 @@ ...@@ -12068,6 +12079,15 @@
} }
} }
}, },
"react-copy-to-clipboard": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.1.tgz",
"integrity": "sha512-ELKq31/E3zjFs5rDWNCfFL4NvNFQvGRoJdAKReD/rUPA+xxiLPQmZBZBvy2vgH7V0GE9isIQpT9WXbwIVErYdA==",
"requires": {
"copy-to-clipboard": "^3",
"prop-types": "^15.5.8"
}
},
"react-dev-utils": { "react-dev-utils": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz",
...@@ -13325,9 +13345,9 @@ ...@@ -13325,9 +13345,9 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
}, },
"set-value": { "set-value": {
"version": "2.0.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
"integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
"requires": { "requires": {
"extend-shallow": "^2.0.1", "extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1", "is-extendable": "^0.1.1",
...@@ -14472,6 +14492,11 @@ ...@@ -14472,6 +14492,11 @@
"repeat-string": "^1.6.1" "repeat-string": "^1.6.1"
} }
}, },
"toggle-selection": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz",
"integrity": "sha1-bkWxJj8gF/oKzH2J14sVuL932jI="
},
"topo": { "topo": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
...@@ -14657,35 +14682,14 @@ ...@@ -14657,35 +14682,14 @@
} }
}, },
"union-value": { "union-value": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
"integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
"requires": { "requires": {
"arr-union": "^3.1.0", "arr-union": "^3.1.0",
"get-value": "^2.0.6", "get-value": "^2.0.6",
"is-extendable": "^0.1.1", "is-extendable": "^0.1.1",
"set-value": "^0.4.3" "set-value": "^2.0.1"
},
"dependencies": {
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"requires": {
"is-extendable": "^0.1.0"
}
},
"set-value": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz",
"integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=",
"requires": {
"extend-shallow": "^2.0.1",
"is-extendable": "^0.1.1",
"is-plain-object": "^2.0.1",
"to-object-path": "^0.3.0"
}
}
} }
}, },
"uniq": { "uniq": {
......
...@@ -44,6 +44,8 @@ class App extends Component { ...@@ -44,6 +44,8 @@ class App extends Component {
script.language = 'JavaScript'; script.language = 'JavaScript';
document.body.appendChild(script); document.body.appendChild(script);
this.setNavigationRecord(this.props.location)
//平台信息 //平台信息
cookie.set('plat', '5', {domain: '.julyedu.com'}) cookie.set('plat', '5', {domain: '.julyedu.com'})
...@@ -56,8 +58,9 @@ class App extends Component { ...@@ -56,8 +58,9 @@ class App extends Component {
const routeMatchRule = /binding-tel|forgot|set-password/ const routeMatchRule = /binding-tel|forgot|set-password/
const {history} = this.props const {history} = this.props
history.listen(location => { history.listen((location, action) => {
if(cookie.get('uid') && this.props.user.hasError){ this.setNavigationRecord(location)
if (cookie.get('uid') && this.props.user.hasError) {
this.getUser() this.getUser()
} }
const {pathname} = location const {pathname} = location
...@@ -70,9 +73,19 @@ class App extends Component { ...@@ -70,9 +73,19 @@ class App extends Component {
}) })
}
setNavigationRecord = (location) => {
let {location: _location} = this.props
let {state: _state = {}} = _location
let {state = {}} = location
location.state = {
...state, ...{
record: _state.record ?
[..._state.record, {pathname: location.pathname}] :
[{pathname: location.pathname}]
}
}
} }
getUser = () => { getUser = () => {
......
...@@ -9,10 +9,15 @@ class HeaderBar extends Component { ...@@ -9,10 +9,15 @@ class HeaderBar extends Component {
} }
goBack = () => { goBack = () => {
const {state} = this.props.location
if(browser.isWeixin && getParam('code') && getParam('state')){ if(browser.isWeixin && getParam('code') && getParam('state')){
window.history.go(-2) window.history.go(-2)
} }
if(state.record && state.record.length > 1){
window.history.go(-1); window.history.go(-1);
}else{
window.location.href = window.location.origin
}
} }
toLink = () => { toLink = () => {
......
import React, { Component } from 'react';
import { HeaderBar } from '@/common'
import './index.scss';
class Country extends Component {
render() {
const data = [
{
type: '常用',
list: [
{
name: '中国大陆',
num: '86'
},
{
name: '中国澳门',
num: '853'
},
{
name: '中国香港',
num: '852'
},
{
name: '中国台湾',
num: '886'
}
]
},
{
type: 'A',
list: [
{
name: '阿富汗',
num: '93'
},
{
name: '阿尔巴尼亚',
num: '355'
},
{
name: '阿尔及利亚',
num: '213'
},
{
name: '安道尔',
num: '376'
},
{
name: '安哥拉',
num: '244'
},
{
name: '安圭拉',
num: '1264'
},
{
name: '安提瓜和巴布达',
num: '1268'
},
{
name: '阿根廷',
num: '54'
},
{
name: '阿鲁巴',
num: '297'
},
{
name: '阿塞拜疆',
num: '994'
},
{
name: '埃及',
num: '20'
},
{
name: '爱沙尼亚',
num: '372'
},
{
name: '埃塞俄比亚',
num: '251'
},
{
name: '爱尔兰',
num: '353'
},
{
name: '阿曼',
num: '968'
},
{
name: '阿拉伯联合酋长国',
num: '971'
},
{
name: '爱沙尼亚',
num: '372'
},
{
name: '爱沙尼亚',
num: '372'
},
{
name: '爱沙尼亚',
num: '372'
}
]
},
{
type: 'B',
list: [
{
name: '巴哈马',
num: '1242'
},
{
name: '巴林',
num: '973'
},
{
name: '巴巴多斯',
num: '1246'
},
{
name: '白俄罗斯',
num: '375'
},
{
name: '比利时',
num: '32'
},
{
name: '伯利兹',
num: '501'
},
{
name: '贝宁',
num: '229'
},
{
name: '百慕大群岛',
num: '1441'
},
{
name: '不丹',
num: '975'
},
{
name: '玻利维亚',
num: '591'
},
{
name: '波斯尼亚和黑塞哥维那',
num: '387'
},
{
name: '博茨瓦纳',
num: '267'
},
{
name: '巴西',
num: '55'
},
{
name: '保加利亚',
num: '359'
},
{
name: '布基纳法索',
num: '226'
},
{
name: '布隆迪',
num: '257'
},
{
name: '冰岛',
num: '354'
},
{
name: '巴基斯坦',
num: '92'
},
{
name: '巴勒斯坦',
num: '970'
},
{
name: '巴拿马',
num: '507'
},
{
name: '巴布亚新几内亚',
num: '675'
},
{
name: '巴拉圭',
num: '51'
},
{
name: '秘鲁',
num: '354'
},
{
name: '波兰',
num: '48'
},
{
name: '波多黎各',
num: '1787'
}
]
},
{
type: 'C',
list: [
{
name: '赤道几内亚',
num: '240'
}
]
},
{
type: 'D',
list: [
{
name: '丹麦',
num: '45'
},
{
name: '多米尼加',
num: '1767'
},
{
name: '多米尼加共和国',
num: '1809'
},
{
name: '德国',
num: '49'
},
{
name: '东帝汶',
num: '670'
},
{
name: '多哥',
num: '228'
}
]
},
{
type: 'E',
list: [
{
name: '厄瓜多尔',
num: '593'
},
{
name: '厄立特里亚',
num: '291'
},
{
name: '俄罗斯',
num: '7'
}
]
},
{
type: 'F',
list: [
{
name: '法罗群岛',
num: '298'
},
{
name: '斐济',
num: '679'
},
{
name: '芬兰',
num: '358'
},
{
name: '法国',
num: '594'
},
{
name: '法属圭亚那',
num: '45'
},
{
name: '法属波利尼西亚',
num: '689'
},
{
name: '菲律宾',
num: '63'
}
]
},
{
type: 'G',
list: [
{
name: '哥伦比亚',
num: '57'
},
{
name: '哥斯达黎加',
num: '506'
},
{
name: '古巴',
num: '53'
},
{
name: '刚果民主共和国',
num: '243'
},
{
name: '冈比亚',
num: '220'
},
{
name: '格鲁吉亚',
num: '995'
},
{
name: '格陵兰岛',
num: '299'
},
{
name: '格林纳达',
num: '1473'
},
{
name: '瓜德罗普岛',
num: '590'
},
{
name: '关岛',
num: '299'
},
{
name: '瓜地马拉',
num: '502'
},
{
name: '圭亚那',
num: '592'
},
{
name: '刚果共和国',
num: '242'
}
]
},
{
type: 'H',
list: [
{
name: '海地',
num: '509'
},
{
name: '洪都拉斯',
num: '504'
},
{
name: '黑山',
num: '382'
},
{
name: '荷兰',
num: '31'
},
{
name: '韩国',
num: '82'
}
]
},
{
type: 'I',
list: [
{
name: '',
num: ''
}
]
},
{
type: 'J',
list: [
{
name: '加拿大',
num: '1'
},
{
name: '日本',
num: '81'
},
{
name: '柬埔寨',
num: '855'
},
{
name: '捷克',
num: '420'
},
{
name: '吉布提',
num: '253'
},
{
name: '加蓬',
num: '241'
},
{
name: '加纳',
num: '233'
},
{
name: '几内亚',
num: '224'
},
{
name: '几内亚比绍共和国',
num: '245'
},
{
name: '基里巴斯',
num: '686'
},
{
name: '吉尔吉斯斯坦',
num: '996'
},
{
name: '津巴布韦',
num: '263'
}
]
},
{
type: 'K',
list: [
{
name: '喀麦隆',
num: '237'
},
{
name: '开普',
num: '238'
},
{
name: '开曼群岛',
num: '1345'
},
{
name: '科摩罗',
num: '269'
},
{
name: '库克群岛',
num: '682'
},
{
name: '克罗地亚',
num: '385'
},
{
name: '库拉索',
num: '599'
},
{
name: '肯尼亚',
num: '254'
},
{
name: '科威特',
num: '965'
},
{
name: '卡塔尔',
num: '974'
},
{
name: '科特迪瓦',
num: '225'
}
]
},
{
type: 'L',
list: [
{
name: '老挝',
num: '856'
},
{
name: '拉脱维亚',
num: '371'
},
{
name: '黎巴嫩',
num: '961'
},
{
name: '莱索托',
num: '266'
},
{
name: '利比里亚',
num: '231'
},
{
name: '利比亚',
num: '218'
},
{
name: '列支敦士登',
num: '423'
},
{
name: '立陶宛',
num: '370'
},
{
name: '卢森堡',
num: '352'
},
{
name: '留尼汪',
num: '262'
},
{
name: '罗马尼亚',
num: '40'
},
{
name: '卢旺达',
num: '423'
}
]
},
{
type: 'M',
list: [
{
name: '美属萨摩亚',
num: '1684'
},
{
name: '孟加拉国',
num: '880'
},
{
name: '马其顿',
num: '389'
},
{
name: '马达加斯加',
num: '261'
},
{
name: '马拉维',
num: '265'
},
{
name: '马来西亚',
num: '60'
},
{
name: '马尔代夫',
num: '960'
},
{
name: '马里',
num: '223'
},
{
name: '马耳他',
num: '356'
},
{
name: '马提尼克',
num: '596'
},
{
name: '毛里塔尼亚',
num: '222'
},
{
name: '毛里求斯',
num: '230'
},
{
name: '墨西哥',
num: '52'
},
{
name: '摩尔多瓦',
num: '373'
},
{
name: '摩纳哥',
num: '377'
},
{
name: '蒙古',
num: '976'
},
{
name: '蒙特塞拉特岛',
num: '1664'
},
{
name: '摩洛哥',
num: '212'
},
{
name: '莫桑比克',
num: '258'
},
{
name: '缅甸',
num: '95'
},
{
name: '美属维尔京群岛',
num: '1284'
}
]
},
{
type: 'N',
list: [
{
name: '纳米比亚',
num: '264'
},
{
name: '尼泊尔',
num: '977'
},
{
name: '尼加拉瓜',
num: '505'
},
{
name: '尼日尔',
num: '227'
},
{
name: '尼日利亚',
num: '234'
},
{
name: '挪威',
num: '47'
},
{
name: '南非',
num: '27'
}
]
},
{
type: 'O',
list: [
{
name: '澳大利亚',
num: '61'
},
{
name: '奥地利',
num: '43'
},
{
name: '澳大利亚',
num: '61'
},
{
name: '澳大利亚',
num: '61'
},
{
name: '澳大利亚',
num: '61'
},
{
name: '澳大利亚',
num: '61'
},
{
name: '澳大利亚',
num: '61'
}
]
},
{
type: 'P',
list: [
{
name: '帕劳',
num: '680'
},
{
name: '葡萄牙',
num: '351'
}
]
},
{
type: 'Q',
list: [
{
name: '',
num: ''
}
]
},
{
type: 'R',
list: [
{
name: '瑞典',
num: '46'
},
{
name: '瑞士',
num: '41'
}
]
},
{
type: 'S',
list: [
{
name: '塞浦路斯',
num: '357'
},
{
name: '萨尔瓦多',
num: '503'
},
{
name: '圣基茨和尼维斯',
num: '1869'
},
{
name: '圣露西亚',
num: '1758'
},
{
name: '圣皮埃尔岛及密克隆岛',
num: '508'
},
{
name: '圣文森特和格林纳丁斯',
num: '1784'
},
{
name: '萨摩亚',
num: '685'
},
{
name: '圣马力诺',
num: '378'
},
{
name: '圣多美和普林西比',
num: '239'
},
{
name: '沙特阿拉伯',
num: '966'
},
{
name: '塞内加尔',
num: '221'
},
{
name: '塞尔维亚',
num: '381'
},
{
name: '塞舌尔',
num: '248'
},
{
name: '塞拉利昂',
num: '239'
},
{
name: '圣马丁岛(荷兰部分)',
num: '1721'
},
{
name: '斯洛伐克',
num: '421'
},
{
name: '斯洛文尼亚',
num: '386'
},
{
name: '所罗门群岛',
num: '677'
},
{
name: '索马里',
num: '252'
},
{
name: '斯里兰卡',
num: '94'
},
{
name: '苏丹',
num: '249'
},
{
name: '苏里南',
num: '597'
},
{
name: '斯威士兰',
num: '268'
}
]
},
{
type: 'T',
list: [
,
{
name: '塔吉克斯坦',
num: '992'
},
{
name: '坦桑尼亚',
num: '255'
},
{
name: '泰国',
num: '66'
},
{
name: '汤加',
num: '676'
},
{
name: '特立尼达和多巴哥',
num: '1868'
},
{
name: '突尼斯',
num: '216'
},
{
name: '土耳其',
num: '90'
},
{
name: '土库曼斯坦',
num: '993'
},
{
name: '特克斯和凯科斯群岛',
num: '1649'
}
]
},
{
type: 'U',
list: [
{
name: '',
num: ''
}
]
},
{
type: 'V',
list: [
{
name: '',
num: ''
}
]
},
{
type: 'W',
list: [
{
name: '文莱',
num: '673'
},
{
name: '乌干达',
num: '256'
},
{
name: '乌克兰',
num: '380'
},
{
name: '乌拉圭',
num: '598'
},
{
name: '乌兹别克斯坦',
num: '998'
},
{
name: '瓦努阿图',
num: '678'
},
{
name: '委内瑞拉',
num: '58'
}
]
},
{
type: 'X',
list: [
{
name: '新西兰',
num: '64'
},
{
name: '希腊',
num: '30'
},
{
name: '匈牙利',
num: '36'
},
{
name: '新喀里多尼亚',
num: '687'
},
{
name: '新加坡',
num: '65'
},
{
name: '西班牙',
num: '34'
},
{
name: '叙利亚',
num: '963'
},
{
name: '亚美尼亚',
num: '374'
}
]
},
{
type: 'Y',
list: [
{
name: '英国',
num: '44'
},
{
name: '印度',
num: '91'
},,
{
name: '印度尼西亚',
num: '62'
},,
{
name: '伊朗',
num: '98'
},,
{
name: '伊拉克',
num: '964'
},,
{
name: '以色列',
num: '972'
},,
{
name: '意大利',
num: '39'
},,
{
name: '牙买加',
num: '1876'
},,
{
name: '约旦',
num: '962'
},
{
name: '越南',
num: '84'
},
{
name: '英属处女群岛',
num: '1340'
},
{
name: '也门',
num: '967'
}
]
},
{
type: 'Z',
list: [
{
name: '中国',
num: '86'
},
{
name: '中国香港',
num: '852'
},
{
name: '中国澳门',
num: '853'
},
{
name: '中国台湾',
num: '886'
},
{
name: '中非共和国',
num: '236'
},
{
name: '乍得',
num: '235'
},
{
name: '智利',
num: '56'
},
{
name: '直布罗陀',
num: '350'
},
{
name: '赞比亚',
num: '260'
}
]
}
];
return (
<>
<HeaderBar title="选择国家和地区" arrow={true}></HeaderBar>
<div className="letter-nav">
<ul>
<li className="letter-nav__item">A</li>
<li className="letter-nav__item letter-nav__item--active">B</li>
<li className="letter-nav__item">C</li>
<li className="letter-nav__item">D</li>
<li className="letter-nav__item">E</li>
<li className="letter-nav__item">F</li>
<li className="letter-nav__item">G</li>
<li className="letter-nav__item">H</li>
<li className="letter-nav__item">I</li>
<li className="letter-nav__item">J</li>
<li className="letter-nav__item">K</li>
<li className="letter-nav__item">L</li>
<li className="letter-nav__item">M</li>
<li className="letter-nav__item">N</li>
<li className="letter-nav__item">O</li>
<li className="letter-nav__item">P</li>
<li className="letter-nav__item">Q</li>
<li className="letter-nav__item">R</li>
<li className="letter-nav__item">S</li>
<li className="letter-nav__item">T</li>
<li className="letter-nav__item">U</li>
<li className="letter-nav__item">V</li>
<li className="letter-nav__item">W</li>
<li className="letter-nav__item">X</li>
<li className="letter-nav__item">Y</li>
<li className="letter-nav__item">Z</li>
</ul>
</div>
<div className="page-body">
{data.map((itme, index) => {
return (
<>
<h2 className="country-header">{itme.type}</h2>
<ul className="country-list">
{itme.list.map((val, key) => {
return (
<li className="country-item" key={index}>
<a className="country-item__link" href="">
<span className="country-name">{val.name}</span>
<span className="country-num">+{val.num}</span>
</a>
</li>
)
})}
</ul>
</>
)
})}
</div>
</>
)
}
}
export default Country;
\ No newline at end of file
body {
height: 100%;
}
#root {
height: 100%;
// background-color: #F5F5F5;
}
.page-body {
height: 100%;
// background-color: #F5F5F5;
}
.country-header {
margin: 0;
padding: 0 13px;
font-size: 15px;
font-family: Hiragino Sans GB;
font-weight: normal;
color: #3E3E3E;
line-height: 28px;
background-color: #F5F5F5;
}
.country-list {
.country-item {
&:nth-child(n+2) {
border-top: 1px solid #ECECEC;
}
}
}
.country-item {
margin: 0 12px;
}
.country-item__link {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
}
.country-name {
font-size: 15px;
font-family: Hiragino Sans GB;
color: #3E3E3E;
}
.country-num {
font-size: 15px;
font-family: Hiragino Sans GB;
color: #555;
}
// NAV
.letter-nav {
position: fixed;
top: 0;
right: 2px;
}
.letter-nav__item {
width: 12px;
// height: 12px;
margin-bottom: 6px;
font-size: 10px;
font-family: Hiragino Sans GB;
color: #0099FF;
text-align: center;
line-height: 12px;
}
.letter-nav__item--active {
border-radius: 50%;
color: #fff;
background-color: #0099FF;
}
\ No newline at end of file
...@@ -595,7 +595,6 @@ class Detail extends Component { ...@@ -595,7 +595,6 @@ class Detail extends Component {
/> />
} }
{/*砍价*/} {/*砍价*/}
{ {
course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain && course_info.is_baoming === 0 && (!course_info.is_aist) && course_info.is_bargain &&
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import CopyToClipboard from 'react-copy-to-clipboard'; import CopyToClipboard from 'react-copy-to-clipboard';
import classnames from 'classnames'; import classnames from 'classnames';
import { connect } from 'redux';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { browser } from '@/utils'; import { browser } from '@/utils';
import { http, getParam, validateTel } from "@/utils"; import { http, getParam, validateTel } from "@/utils";
import { Formik, withFormik, Form, Field } from 'formik'; import { Formik, Form, Field } from 'formik';
import { Toast } from 'antd-mobile'; import { Toast } from 'antd-mobile';
import Captcha from '@/common/Captcha'; import Captcha from '@/common/Captcha';
import FollowQRcode from './../followQRcode'; import FollowQRcode from './../followQRcode';
...@@ -36,6 +35,7 @@ class RedPacket extends PureComponent { ...@@ -36,6 +35,7 @@ class RedPacket extends PureComponent {
txt: '手机号绑定超时,红包已失效!', txt: '手机号绑定超时,红包已失效!',
// txt: '今日已领取5.6元代金券碎片!', // txt: '今日已领取5.6元代金券碎片!',
// txt: '今日已领取5.6元现金!', // txt: '今日已领取5.6元现金!',
desc: ''
}, },
money: '', // 红包金额, money: '', // 红包金额,
endTime: 10, // 手机绑定时限 endTime: 10, // 手机绑定时限
...@@ -53,20 +53,98 @@ class RedPacket extends PureComponent { ...@@ -53,20 +53,98 @@ class RedPacket extends PureComponent {
const { shareInfo } = this.state; const { shareInfo } = this.state;
if(share_code) { if(share_code) {
this.setState({ this.setState({
type: browser.isWeixin? 2 : 3,
shareInfo: { shareInfo: {
...shareInfo, ...shareInfo,
share_code share_code
} }
}); });
// 检查收否领取过
http.post(
`${API.home}/sys/redPacket/split`,
{
action: 'check',
share_code
}
).then(res => {
const {code, data} = res.data;
if(code === 200) {
// is_overdue 红包是否过期 0-否 1-是
if(data.is_overdue) {
this.setState({
type: 7
});
}else {
// is_receive 是否领取过 0-否 1-是
if(data.is_receive) {
this.judgeReceiveStatus(data);
}else {
this.setState({
type: 3
});
}
}
}
if(code === 4030 || code === 4040) {
this.setState({
type: browser.isWeixin? 2 : 3
});
}
});
} }
} }
// 判断领取状态--领取后
judgeReceiveStatus = (data) => {
// receive_status 领取状态 1-已领取 2-已领取未绑定 3-已失效
if(data.receive_status === 1) {
let txt = '';
let desc = '';
// receive_type 领取类型 1自己 2别人
if(data.receive_type === 1) {
txt = data.red_packet_type === 1? `今日已领取${data.amount}元现金!`: `今日已领取${data.amount}元代金券碎片!`;
desc = '越多好友领取,你所得越多!';
}
if(data.receive_type === 2) {
txt = data.red_packet_type === 1? `您已经领过该红包 ${data.amount}元现金!`: `您已经领过该红包 ${data.amount}元代金券碎片!`;
desc = '每天只能帮好友领取一次哦~';
}
this.setState({
type: 9,
doneInfo: {
status: 1,
txt,
desc
}
});
}else if(data.receive_status === 2) {
this.setState({
type: 4,
money: data.amount,
endTime: data.end_time
});
this.startCountDown();
}else if(data.receive_status === 3) {
this.setState({
type: 9,
doneInfo: {
status: 2,
txt: '手机号绑定超时,红包已失效!',
desc
}
});
}
}
// 绑定时间 // 绑定时间
startCountDown = () => { startCountDown = () => {
if(this.countdownTimer) {
window.clearInterval(this.countdownTimer);
}
const { endTime } = this.state; const { endTime } = this.state;
let time = endTime; let time = endTime;
let minutes = 0; let minutes = 0;
...@@ -87,15 +165,20 @@ class RedPacket extends PureComponent { ...@@ -87,15 +165,20 @@ class RedPacket extends PureComponent {
}, 1000) }, 1000)
} }
// 获取分享信息
handleToShare = () => { handleToShare = () => {
const { history } = this.props; const { history } = this.props;
// 获取分享信息
http.get(`${API.home}/sys/redPacket/shareUrl/${getParam('id')}`).then(res => { http.get(`${API.home}/sys/redPacket/shareUrl/${getParam('id')}`).then(res => {
const { code, data } = res.data; const { code, data } = res.data;
if(code === 4030) { if(code === 4030 || code === 4040) {
if(browser.isWeixin) {
this.setState({
type: 2
});
}else {
history.push('/passport/login'); history.push('/passport/login');
} }
}
if(code === 200) { if(code === 200) {
this.setState({ this.setState({
shareInfo: data, shareInfo: data,
...@@ -117,11 +200,10 @@ class RedPacket extends PureComponent { ...@@ -117,11 +200,10 @@ class RedPacket extends PureComponent {
} }
} }
// 拆红包
handleToOpen = () => { handleToOpen = () => {
const { history } = this.props; const { history } = this.props;
const { shareInfo: { share_code='' } } = this.state; const { shareInfo: { share_code='' } } = this.state;
// 拆红包
http.post( http.post(
`${API.home}/sys/redPacket/split`, `${API.home}/sys/redPacket/split`,
{ {
...@@ -132,56 +214,15 @@ class RedPacket extends PureComponent { ...@@ -132,56 +214,15 @@ class RedPacket extends PureComponent {
const { code, data } = res.data; const { code, data } = res.data;
if(code === 200) { if(code === 200) {
// is_overdue 红包是否过期 0-否 1-是
if(data.is_overdue) {
this.setState({
type: 7
});
}else {
// is_receive 是否领取过 0-否 1-是 // is_receive 是否领取过 0-否 1-是
if(data.is_receive) { if(data.is_receive) {
this.judgeReceiveStatus(data);
// receive_status 领取状态 1-已领取 2-已领取未绑定 3-已失效
if(data.receive_status === 1) {
let txt = '';
// receive_type 领取类型 1自己 2别人
if(data.receive_type === 1) {
txt = data.red_packet_type === 1? `今日已领取${data.amount}元现金!`: `今日已领取${data.amount}元代金券碎片!`;
}
if(data.receive_type === 2) {
txt = data.red_packet_type === 1? `您已经领过该红包 ${data.amount}元现金!`: `您已经领过该红包 ${data.amount}元代金券碎片!`;
}
this.setState({
type: 9,
doneInfo: {
status: 1,
txt
}
});
}else if(data.receive_status === 2) {
this.setState({
type: 4,
money: data.amount,
endTime: data.end_time
});
this.startCountDown();
}else if(data.receive_status === 3) {
this.setState({
type: 9,
doneInfo: {
status: 2,
txt: '手机号绑定超时,红包已失效!'
}
});
}
}else { }else {
// red_packet_type 红包类型 1-现金 2-代金券 // red_packet_type 红包类型 1-现金 2-代金券
if(data.red_packet_type === 2) { if(data.red_packet_type === 2) {
this.setState({ this.setState({
type: 5, type: 6,
money: data.amount money: data.amount
}); });
}else if(data.red_packet_type === 1) { }else if(data.red_packet_type === 1) {
...@@ -211,15 +252,14 @@ class RedPacket extends PureComponent { ...@@ -211,15 +252,14 @@ class RedPacket extends PureComponent {
type: 9, type: 9,
doneInfo: { doneInfo: {
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!' txt: '手机号绑定超时,红包已失效!',
desc: data.receive_type === 1? '越多好友领取,你所得越多!' : data.receive_type === 2? '每天只能帮好友领取一次哦~' : ''
} }
}); });
} }
} }
} }
} }else if(code === 4030 || code === 4040) {
}else if(code === 4030) {
history.push('/passport/login'); history.push('/passport/login');
} }
}) })
...@@ -243,46 +283,13 @@ class RedPacket extends PureComponent { ...@@ -243,46 +283,13 @@ class RedPacket extends PureComponent {
// is_receive 是否领取过 0-否 1-是 // is_receive 是否领取过 0-否 1-是
if(data.is_receive) { if(data.is_receive) {
this.judgeReceiveStatus(data);
// receive_status 领取状态 1-已领取 2-已领取未绑定 3-已失效
if(data.receive_status === 1) {
this.setState({
type: 9,
doneInfo: {
status: 1,
txt: data.red_packet_type === 1? `今日已领取${data.amount}元现金!`: `今日已领取${data.amount}元代金券碎片!`
}
});
}else if(data.receive_status === 2) {
this.setState({
type: 4,
money: data.amount,
endTime: data.end_time
});
this.startCountDown();
}else if(data.receive_status === 3) {
this.setState({
type: 9,
doneInfo: {
status: 2,
txt: '手机号绑定超时,红包已失效!'
}
});
}
}else {
// is_overdue 红包是否过期 0-否 1-是
if(data.is_overdue) {
this.setState({
type: 7
});
}else { }else {
this.setState({ this.setState({
type: 3 type: 3
}); });
} }
} }
}
}); });
}else { }else {
if(isShare) { if(isShare) {
...@@ -295,6 +302,17 @@ class RedPacket extends PureComponent { ...@@ -295,6 +302,17 @@ class RedPacket extends PureComponent {
} }
} }
// 微信内点击蒙层
clickMask = () => {
const { type } = this.state;
if(type === 2) {
this.setState({
type: 0
});
}
}
// 复制口令
handleToCopy = () => { handleToCopy = () => {
this.setState({ this.setState({
isCopy: true isCopy: true
...@@ -407,7 +425,8 @@ class RedPacket extends PureComponent { ...@@ -407,7 +425,8 @@ class RedPacket extends PureComponent {
type: 9, type: 9,
doneInfo: { doneInfo: {
status: 2, status: 2,
txt: '手机号绑定超时,红包已失效!' txt: '手机号绑定超时,红包已失效!',
desc: data.receive_type === 1? '越多好友领取,你所得越多!' : data.receive_type === 2? '每天只能帮好友领取一次哦~' : ''
} }
}); });
} }
...@@ -470,12 +489,10 @@ class RedPacket extends PureComponent { ...@@ -470,12 +489,10 @@ class RedPacket extends PureComponent {
bindInfo bindInfo
} = this.state; } = this.state;
const cls = classnames('popup-mask',{ const cls = classnames('popup-mask',{
'popup-mask--no': type !== 0 'popup-mask--no': type !== 2
}); });
// const isClick =
return ( return (
<> <>
<div className="red-packet"> <div className="red-packet">
<p className="red-packet__title">分享课程给好友,你和好友都可以领红包哦〜</p> <p className="red-packet__title">分享课程给好友,你和好友都可以领红包哦〜</p>
<button className="red-packet__button" onClick={this.handleToShare}>分享领红包</button> <button className="red-packet__button" onClick={this.handleToShare}>分享领红包</button>
...@@ -484,7 +501,7 @@ class RedPacket extends PureComponent { ...@@ -484,7 +501,7 @@ class RedPacket extends PureComponent {
{/* popup */} {/* popup */}
{ {
type !== 0 && type !== 0 &&
<div className={cls}> <div className={cls} onClick={this.clickMask}>
{/* wechat */} {/* wechat */}
{ {
...@@ -763,7 +780,7 @@ class RedPacket extends PureComponent { ...@@ -763,7 +780,7 @@ class RedPacket extends PureComponent {
} }
{doneInfo.txt} {doneInfo.txt}
</h4> </h4>
<p className="popup-done__desc">每天只能帮好友领取一次哦~</p> <p className="popup-done__desc">{doneInfo.desc}</p>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
data-status="do" data-status="do"
...@@ -805,7 +822,7 @@ class RedPacket extends PureComponent { ...@@ -805,7 +822,7 @@ class RedPacket extends PureComponent {
<li className="popup-bind__account"> <li className="popup-bind__account">
{/* wechat */} {/* wechat */}
<i className="iconfont iconweixinzhifu"></i> <i className="icon-wachat"></i>
<p className="popup-bind__account--name">{bindInfo['wechat_nickname']}</p> <p className="popup-bind__account--name">{bindInfo['wechat_nickname']}</p>
</li> </li>
} }
......
...@@ -496,7 +496,8 @@ ...@@ -496,7 +496,8 @@
.popup-bind__title { .popup-bind__title {
margin: 0; margin: 0;
font-size: 14px; font-size: 16px;
font-weight: 500;
color: #333; color: #333;
text-align: center; text-align: center;
line-height: 1; line-height: 1;
...@@ -505,7 +506,7 @@ ...@@ -505,7 +506,7 @@
.popup-bind__desc { .popup-bind__desc {
margin: 0; margin: 0;
padding: 0 20px; padding: 0 20px;
font-size: 12px; font-size: 14px;
color: #666; color: #666;
text-align: left; text-align: left;
} }
...@@ -519,15 +520,22 @@ ...@@ -519,15 +520,22 @@
align-items: center; align-items: center;
height: 30px; height: 30px;
margin: 0 52px; margin: 0 52px;
padding: 0 4px;
text-align: left; text-align: left;
&:nth-child(n+2) { &:nth-child(n+2) {
border-top: 1px solid #E5E5E5; border-top: 1px solid #E5E5E5;
} }
.iconfont {
font-size: 22px;
color: #999;
}
} }
.popup-bind__account--name { .popup-bind__account--name {
margin: 0; margin: 0;
padding-left: 7px;
font-size: 12px; font-size: 12px;
color: #999; color: #999;
} }
...@@ -546,7 +554,17 @@ ...@@ -546,7 +554,17 @@
display: inline-block; display: inline-block;
width: 22px; width: 22px;
height: 22px; height: 22px;
background-image: url('./qq.png'); background-image: url('./QQicon.png');
background-size: auto 100%;
background-repeat: no-repeat;
background-position: center;
}
.icon-wachat {
display: inline-block;
width: 22px;
height: 22px;
background-image: url('./wechat.png');
background-size: 100% auto; background-size: 100% auto;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
......
src/components/detail/redPacket/wechat.png

791 Bytes | W: | H:

src/components/detail/redPacket/wechat.png

782 Bytes | W: | H:

src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
src/components/detail/redPacket/wechat.png
  • 2-up
  • Swipe
  • Onion skin
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import {connect} from 'react-redux';
import SearchHeader from './searchHead' import SearchHeader from './searchHead'
import VList from '@/common/VList' import VList from '@/common/VList'
import { http, getParam } from '@/utils' import { http, getParam } from '@/utils'
import './search-result.scss' import './search-result.scss'
import Recommendation from './recommendation' import Recommendation from './recommendation'
import {getCourses} from './../detail/actions'; import throttle from 'lodash/throttle'
const ForwardRefSearchHead = React.forwardRef((props, ref) => {
return <SearchHeader {...props} forwardedRef={ref}/>
})
const Bottom = ({item}) => { const Bottom = ({item}) => {
return ( return (
...@@ -16,17 +20,28 @@ const Bottom = ({item}) => { ...@@ -16,17 +20,28 @@ const Bottom = ({item}) => {
) )
} }
@connect()
class SearchResult extends PureComponent { class SearchResult extends PureComponent {
prevScrollY = 0
searchHead = React.createRef()
swipeUp = 'up'
swipeDown = 'down'
state = { state = {
courseList: [], courseList: [],
value: '', value: decodeURIComponent(getParam('word')) || '',
searchHistory: JSON.parse(localStorage.getItem('searchHistory')) || [] searchHistory: JSON.parse(localStorage.getItem('searchHistory')) || [],
fixedHeader: false,
searchHeadStyle: {top: 0},
swipeDirection: this.swipeUp
} }
componentDidMount() { componentDidMount() {
this.getCourses(getParam('word')) this.getCourses(getParam('word'))
document.addEventListener('scroll', this.handleScroll)
}
componentWillUnmount() {
document.removeEventListener('scroll', this.handleScroll)
} }
...@@ -56,22 +71,65 @@ class SearchResult extends PureComponent { ...@@ -56,22 +71,65 @@ class SearchResult extends PureComponent {
} }
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const {history} = this.props;
// dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
// }));
} }
handleScroll = throttle(() => {
let y = window.scrollY, headY = this.searchHead.current.offsetTop
if (y < this.prevScrollY) {
if (this.state.swipeDirection === this.swipeDown) {
y <= headY && this.state.searchHeadStyle.position !== 'fixed' && this.setState({
searchHeadStyle: {
top: `0`,
position: 'fixed'
}
})
} else {
this.setState({
swipeDirection: this.swipeDown
}, () => {
if (this.state.swipeDirection === this.swipeDown) {
this.setState({
searchHeadStyle: {
top: `${y > headY ? y - 44 : y}px`
}
})
}
})
}
} else {
this.state.swipeDirection !== this.swipeUp &&
this.setState({
swipeDirection: this.swipeUp,
searchHeadStyle: {
position: 'absolute',
top: `${y}px`
}
})
}
this.prevScrollY = y
}, 0)
render() { render() {
const {courseList} = this.state const {courseList} = this.state
return ( return (
<div className='search-result'> <div
<SearchHeader className={'search-result'}>
<ForwardRefSearchHead
handleSearch={this.handleSearch} handleSearch={this.handleSearch}
value={this.state.value} value={this.state.value}
handleChange={this.handleChange} handleChange={this.handleChange}
searchHistory={this.state.searchHistory} searchHistory={this.state.searchHistory}
style={this.state.searchHeadStyle}
ref={this.searchHead}
/> />
{ {
...@@ -115,7 +173,8 @@ class SearchResult extends PureComponent { ...@@ -115,7 +173,8 @@ class SearchResult extends PureComponent {
抱歉!没有搜到相关内容 抱歉!没有搜到相关内容
</div> </div>
} }
<Recommendation /> <Recommendation/>
</div> </div>
); );
} }
......
.search-result { .search-result {
padding-top: 44px;
.search-head{
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 10;
}
ul { ul {
list-style: none; list-style: none;
} }
......
...@@ -38,9 +38,8 @@ class SearchHead extends PureComponent { ...@@ -38,9 +38,8 @@ class SearchHead extends PureComponent {
render() { render() {
const { isFocus } = this.state; const { isFocus } = this.state;
const cls = classnames('submit-btn', {'submit-btn--active': isFocus}) const cls = classnames('submit-btn', {'submit-btn--active': isFocus})
console.log(isFocus);
return ( return (
<div className="search-head"> <div className="search-head" style={this.props.style} ref={this.props.forwardedRef}>
<div className="left" onClick={this.returnPage}> <div className="left" onClick={this.returnPage}>
<i className="iconfont iconiconfront-68"/> <i className="iconfont iconiconfront-68"/>
...@@ -57,6 +56,7 @@ class SearchHead extends PureComponent { ...@@ -57,6 +56,7 @@ class SearchHead extends PureComponent {
placeholder="搜索课程" placeholder="搜索课程"
onFocus={() => this.changeFontColor(true)} onFocus={() => this.changeFontColor(true)}
onBlur={() => this.changeFontColor(false)} onBlur={() => this.changeFontColor(false)}
onSubmit={this.search}
/> />
</div> </div>
<div className="right right-btn" onClick={this.search}> <div className="right right-btn" onClick={this.search}>
......
...@@ -88,7 +88,7 @@ class Video extends Component { ...@@ -88,7 +88,7 @@ class Video extends Component {
currentVideoSrc: '', currentVideoSrc: '',
activeIndex: 0, activeIndex: 0,
isAuth: true, isAuth: true,
course: {}, course: {}, // course.course_id 为 0 或 '' 时 为免费课程
salePrice: null, salePrice: null,
vCourseId: null, vCourseId: null,
isLoading: true, isLoading: true,
...@@ -369,9 +369,6 @@ class Video extends Component { ...@@ -369,9 +369,6 @@ class Video extends Component {
this.ws = new WebSocket(API["process-api"]); this.ws = new WebSocket(API["process-api"]);
this.ws.addEventListener('error', () => { this.ws.addEventListener('error', () => {
this.ws = null this.ws = null
/*setTimeout(() => {
this.setupWS();
}, 1000)*/
}) })
this.ws.addEventListener('close', () => { this.ws.addEventListener('close', () => {
if (this.reconnect) { if (this.reconnect) {
...@@ -403,21 +400,53 @@ class Video extends Component { ...@@ -403,21 +400,53 @@ class Video extends Component {
}) })
} }
//告诉服务端切换视频 //告诉服务端计算进度 普通课程不发送
countSchedule = () => { countSchedule = () => {
const {videoList, activeIndex, vCourseId, course={}} = this.state
if(Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
return;
}
if(course.is_aist) {
// 返现课程
this.sendMessage({ this.sendMessage({
mtype: 'count_schedule', mtype: 'count_schedule',
uid: this.props.user.data.uid, uid: this.props.user.data.uid,
token: this.token, token: this.token,
platform: 5 platform: 5
}) })
}else{
// 普通课程
this.sendMessage({
mtype: 'c_count_schedule',
uid: this.props.user.data.uid,
token: this.token,
platform: 5,
video_id: videoList[activeIndex]['id'],
course_id: this.courseID,
v_course_id: vCourseId,
})
} }
}
// 发送时间消息
sendWatchTime = (sec, rate) => { sendWatchTime = (sec, rate) => {
const {videoList, activeIndex, vCourseId} = this.state const {videoList, activeIndex, vCourseId, course = {}} = this.state
// 免费课程不发送
if(Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
return;
}
// 时间为0 不发送消息
if(Number(sec) === 0) {
return;
}
let info_type = 'c_watch_time';
if(course.is_aist) {
info_type = 'watch_time';
}
this.sendMessage({ this.sendMessage({
mtype: 'watch_time', mtype: info_type,
rate, rate,
time: sec, time: sec,
video_id: videoList[activeIndex]['id'], video_id: videoList[activeIndex]['id'],
...@@ -473,6 +502,7 @@ class Video extends Component { ...@@ -473,6 +502,7 @@ class Video extends Component {
}) })
this.player.on('ended', () => { this.player.on('ended', () => {
this.sendWatchTime(this.watchSec, this.currentPlaybackRate) this.sendWatchTime(this.watchSec, this.currentPlaybackRate)
this.countSchedule(); // 计算进度
this.getShareProgressInfo() this.getShareProgressInfo()
clearInterval(this.timer) clearInterval(this.timer)
}) })
...@@ -505,7 +535,7 @@ class Video extends Component { ...@@ -505,7 +535,7 @@ class Video extends Component {
return return
} }
this.countSchedule() this.countSchedule(); // 计算进度
this.setState( this.setState(
{ {
...@@ -559,9 +589,12 @@ class Video extends Component { ...@@ -559,9 +589,12 @@ class Video extends Component {
playSetup = () => { playSetup = () => {
// is_aist,是否AI特训营 // is_aist,是否AI特训营
const { course={} } = this.state; const { course={} } = this.state;
if (course.is_aist) { if (Number(course.course_id) === 0 || course.course_id === '') {
console.log('免费课程 拦截');
}else{
this.setupWS(); this.setupWS();
this.setupTimer(); this.setupTimer();
this.countSchedule();
} }
let index = this.getLastVideoIndex(course.last_video_id); let index = this.getLastVideoIndex(course.last_video_id);
index = index >= 0 ? index : 0; index = index >= 0 ? index : 0;
......
...@@ -30,6 +30,7 @@ const Classify = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/compo ...@@ -30,6 +30,7 @@ const Classify = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/compo
const CampTest = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campTest')) const CampTest = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campTest'))
const CampResolve = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campResolve')) const CampResolve = loadable(() => import(/* webpackChunkName: 'Classify'*/'@/components/video/camp/campResolve'))
const ShareCourse = loadable(() => import('@/components/ShareCourse/index')) const ShareCourse = loadable(() => import('@/components/ShareCourse/index'))
const Country = loadable(() => import('@/components/country/index'))
export default [ export default [
{ {
path: '/', path: '/',
...@@ -154,6 +155,12 @@ export default [ ...@@ -154,6 +155,12 @@ export default [
path: '/ShareCourse', path: '/ShareCourse',
component: ShareCourse component: ShareCourse
}, },
// 区号
{
path: '/country',
component: Country
},
{ {
path: '/togroup', path: '/togroup',
component: ToGroup component: ToGroup
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment