Commit de646276 by zhanghaozhe

prettier

parent a9a679cd
......@@ -129,14 +129,16 @@
}
},
"lint-staged": {
"*.js": "prettier --write"
"*.(js|css)": "prettier --write"
},
"eslintConfig": {
"extends": "react-app",
"globals": {
"API": "readonly",
"NoCaptcha": "readonly",
"WeixinJSBridge": "readonly"
"WeixinJSBridge": "readonly",
"_czc": "readonly",
"wx": "readonly"
}
},
"browserslist": {
......
/* global nvcReset, getNC, _nvc_nc */
import React, { Component } from "react"
import Routes from "./router"
import cookie from "js-cookie"
......
/* global initNECaptcha */
import React, { Component } from "react"
import { initCaptcha } from "src/utils"
import { BarLoader } from "react-spinners"
......
......@@ -19,7 +19,7 @@ class HeaderBar extends Component {
if (state.records && state.records.length > 1) {
window.history.go(-1)
} else if (state.from && state.from.pathname) {
location.replace(`${state.from.pathname}${state.from.search}`)
window.location.replace(`${state.from.pathname}${state.from.search}`)
} else {
window.location.href = window.location.origin
}
......@@ -28,7 +28,7 @@ class HeaderBar extends Component {
toLink = () => {
const { toHref } = this.props
// console.log(toHref);
location.replace(toHref)
window.location.replace(toHref)
}
goShop = () => {
......
......@@ -10,8 +10,8 @@ class BindPhone extends Component {
captchaInstance = null
constructor(props) {
super(props),
(this.state = {
super(props)
this.state = {
validate: "",
seconds: 60,
isFirst: true,
......@@ -23,7 +23,7 @@ class BindPhone extends Component {
num: "86",
},
validationData: null,
})
}
}
componentDidMount() {
......
......@@ -161,7 +161,7 @@ class Invitation extends Component {
title: "答题抽华为P40 Pro+",
desc:
"这道题你会吗?答题抽奖,100%有奖的,能不能拿华为P40 Pro+,看你自己了--七月在线",
link: `${API.m}${location.pathname}?team_code=${
link: `${API.m}${window.location.pathname}?team_code=${
this.state.invitationInfo.team_code || getParam("team_code")
}`,
imgUrl:
......
/* global _czc */
import React, { Component } from "react"
import { browser, getParam, http } from "src/utils"
import { Toast } from "antd-mobile"
......
/* global _czc */
import React, { Component } from "react"
import "./give-courses.scss"
import { getParam, http } from "src/utils"
......@@ -96,7 +97,7 @@ class GiveCourses extends Component {
}
isRouter = (param) => {
if (decodeURIComponent(getParam("activename")) != param) {
if (decodeURIComponent(getParam("activename")) !== param) {
this.props.history.push("/")
}
}
......
......@@ -236,7 +236,7 @@ class YearCourse extends Component {
toQQque = () => {
if (!getParam("version")) {
location.href = "http://q.url.cn/s/Vbkup6m?_type=wpa"
window.location.href = "http://q.url.cn/s/Vbkup6m?_type=wpa"
} else {
SendMessageToApp("toQQ", "https://q.url.cn/AB8aue?_type=wpa&qidian=true")
}
......
......@@ -13,13 +13,14 @@ import { connect } from "react-redux"
import { Toast } from "antd-mobile"
import { compose } from "redux"
/*eslint-disable*/
@connect(
(state) => ({
user: state.user,
}),
{ setCurrentUser, startFetchUser }
)
export default class index extends Component {
class index extends Component {
state = {
removable: 0, // 未拆宝箱的数量
currentOpenId: 0, // 当前要拆的宝箱的队伍的ID
......@@ -245,3 +246,5 @@ export default class index extends Component {
)
}
}
export default index
......@@ -5,6 +5,7 @@ import CommonContainer from "./../common/commonContainer/index"
import CourseItem from "../../../blessingPreheat/courseItem/index"
import { withRouter } from "react-router-dom"
import { connect } from "react-redux"
import { Toast } from "antd-mobile"
@connect(({ user }) => ({
user,
......
......@@ -236,7 +236,7 @@ class YearCourse extends Component {
toQQque = () => {
if (!getParam("version")) {
location.href = "http://q.url.cn/s/Vbkup6m?_type=wpa"
window.location.href = "http://q.url.cn/s/Vbkup6m?_type=wpa"
} else {
SendMessageToApp("toQQ", "https://q.url.cn/AB8aue?_type=wpa&qidian=true")
}
......
......@@ -19,7 +19,7 @@ import { compose } from "redux"
}),
{ setCurrentUser, startFetchUser }
)
export default class index extends Component {
class index extends Component {
state = {
removable: 0, // 未拆宝箱的数量
currentOpenId: 0, // 当前要拆的宝箱的队伍的ID
......@@ -239,3 +239,5 @@ export default class index extends Component {
)
}
}
export default index
......@@ -59,7 +59,7 @@ class Assist extends Component {
if (user.hasError) {
if (browser.isWeixin) {
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=${encodeURIComponent(
`${window.location.origin}${location.pathname}?aa=bb`
`${window.location.origin}${window.location.pathname}?aa=bb`
)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
} else {
history.push("/passport")
......
......@@ -99,7 +99,7 @@ class Exam extends Component {
if (state.records && state.records.length > 1) {
window.history.go(-1)
} else if (state.from && state.from.pathname) {
location.replace(`${state.from.pathname}${state.from.search}`)
window.location.replace(`${state.from.pathname}${state.from.search}`)
} else {
window.location.href = window.location.origin
}
......
......@@ -376,7 +376,7 @@ class BargainMiddlePage extends Component {
wxShare({
title: `我发现一门好课,快来帮我砍价吧!`,
desc: `我已经砍了${this.state.bargainData.bargain_price}元,看看你能砍多少`,
link: encodeURI(location.href),
link: encodeURI(window.location.href),
imgUrl: this.state.course.course_img,
})
}
......
......@@ -295,7 +295,7 @@ class CourseList extends Component {
toQQque = () => {
if (!getParam("version")) {
location.href = "https://q.url.cn/AB8aue?_type=wpa&qidian=true"
window.location.href = "https://q.url.cn/AB8aue?_type=wpa&qidian=true"
} else {
SendMessageToApp("toQQ", "https://q.url.cn/AB8aue?_type=wpa&qidian=true")
}
......
......@@ -185,7 +185,7 @@ class FormalDraw extends Component {
} else if (status == 2) {
this.subscribe(id)
} else if (status == 4) {
location.href = `/prize-winner-list?tid=${id}`
window.location.href = `/prize-winner-list?tid=${id}`
}
}
......
/* global _czc */
import React, { Component } from "react"
import "./index.scss"
import { Tabs, Toast } from "antd-mobile"
......
......@@ -28,11 +28,11 @@ export default class RecordPopup extends Component {
e.preventDefault()
const { history } = this.props
if (!getParam("version")) {
location.href = `${API.m}/levelTest/report?id=${id}`
window.location.href = `${API.m}/levelTest/report?id=${id}`
} else {
location.href = `${API.m}/levelTest/report?id=${id}&version=${getParam(
"version"
)}`
window.location.href = `${
API.m
}/levelTest/report?id=${id}&version=${getParam("version")}`
}
}
......
......@@ -91,7 +91,7 @@ class ToAppDemo extends Component {
title: "AI充电节,积福气享1折秒课,超10万元奖品来就送!!",
desc:
"把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线",
link: encodeURI(location.href),
link: encodeURI(window.location.href),
imgUrl:
"https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png",
})
......
......@@ -151,7 +151,7 @@ class UseCoupon extends PureComponent {
const { data: select } = selectCoupons
const { data: expansion } = expansionCoupons
let PzCoupon = Array.isArray(expansion.data) ? expansion.data : []
if (expansion.code == 200) {
if (expansion.code === 200) {
Array.isArray(expansion.data) &&
(expansion.data = expansion.data.map(
(item) => ((item.ctype = 4), item)
......@@ -173,7 +173,7 @@ class UseCoupon extends PureComponent {
selectedCouponId: inuse_coupon.length ? inuse_coupon[0].id : 0,
})
} else {
Toast.info(data.msg)
Toast.info(select.msg)
}
})
}
......@@ -244,7 +244,7 @@ class UseCoupon extends PureComponent {
}
} else {
Toast.info("未知错误")
location.reload()
window.location.reload()
}
}
......
......@@ -34,7 +34,7 @@ class ToGroup extends Component {
wxShare({
title: `【仅剩${number}个名额】我${pdd_price}元拼了《${data.course_title}》`,
desc: data.course_title,
link: location.href + "&is_originator=1",
link: window.location.href + "&is_originator=1",
imgUrl: data.image_name,
})
} else {
......
......@@ -503,7 +503,9 @@ class Detail extends Component {
wxShare({
title: course_info.course_title,
desc: course_info.index_description,
link: encodeURI(location.origin + "/detail?id=" + getParam("id")),
link: encodeURI(
window.location.origin + "/detail?id=" + getParam("id")
),
imgUrl: course_info.image_name,
})
}
......
......@@ -14,8 +14,8 @@ import { Link } from "react-router-dom"
class RedPacket extends PureComponent {
constructor(props) {
super(props),
(this.state = {
super(props)
this.state = {
// 弹窗类型:0: 无弹出,1:非微信,2:微信
type: 0,
isCopy: false,
......@@ -46,7 +46,7 @@ class RedPacket extends PureComponent {
num: "86",
},
validationData: null,
})
}
}
componentDidMount() {
......
......@@ -121,7 +121,7 @@ class IntelligentRecommend extends Component {
if (state.records && state.records.length > 1) {
window.history.go(-1)
} else if (state.from && state.from.pathname) {
location.replace(`${state.from.pathname}${state.from.search}`)
window.location.replace(`${state.from.pathname}${state.from.search}`)
} else {
window.location.href = window.location.origin
}
......
......@@ -90,7 +90,7 @@ class ML extends Component {
if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus)
_this.intervalPayStatus = null
location.href = "/ml?id=" + getParam("id")
window.location.href = "/ml?id=" + getParam("id")
}
})
}, 1000)
......@@ -130,7 +130,7 @@ class ML extends Component {
if (res.data.errno === 401) {
clearInterval(_this.intervalPayStatus)
_this.intervalPayStatus = null
location.href = "/ml?id=" + getParam("id")
window.location.href = "/ml?id=" + getParam("id")
}
})
}, 1000)
......
......@@ -80,7 +80,10 @@ class PythonDes extends Component {
// 微信内部-支付
if (browser.isWeixin) {
let url =
window.location.origin + location.pathname + "?id=" + getParam("id")
window.location.origin +
window.location.pathname +
"?id=" +
getParam("id")
window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" +
encodeURIComponent(url + "&aa=bb&oid=" + orderId).toLowerCase() +
......
......@@ -112,7 +112,10 @@ class PythonStudy extends Component {
// 微信内部-支付
if (browser.isWeixin) {
let url =
window.location.origin + location.pathname + "?id=" + getParam("id")
window.location.origin +
window.location.pathname +
"?id=" +
getParam("id")
window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=" +
encodeURIComponent(url + "&aa=bb&oid=" + orderId).toLowerCase() +
......
......@@ -100,7 +100,7 @@ class MLClass extends Component {
? `我已在【${params.course_name}】上运行了行代码了${params.code_lines}`
: `我在${params.course_name}${this.formatTitle(params)}遇到了困难`,
desc: this.formatTitle(params),
link: encodeURI(location.href),
link: encodeURI(window.location.href),
imgUrl: params.course_img,
})
}
......
......@@ -66,7 +66,7 @@ class MyOrders extends Component {
}
http.post(`${API.home}/m/cancel_order`, data).then((res) => {
if (res.data.code === 200) {
location.reload()
window.location.reload()
} else {
Toast.info(res.data.msg, 2)
}
......
......@@ -178,7 +178,7 @@ const formikConfig = {
localStorage.removeItem("binding_redirect")
history.replace(JSON.parse(redirect))
} else {
location.assign(data.data["jump_url"])
window.location.assign(data.data["jump_url"])
}
}
} else {
......
......@@ -68,7 +68,7 @@ class Problems extends Component {
goBack = () => {
if (document.referrer.includes(API.www)) {
history.go(-1)
window.history.go(-1)
} else {
const { state, hash } = this.props.location
if (hash.includes("goback")) {
......@@ -80,7 +80,7 @@ class Problems extends Component {
if (state.records && state.records.length > 1) {
window.history.go(-1)
} else if (state.from && state.from.pathname) {
location.replace(`${state.from.pathname}${state.from.search}`)
window.location.replace(`${state.from.pathname}${state.from.search}`)
} else {
window.location.href = window.location.origin
}
......
......@@ -101,7 +101,7 @@ class PythonClass extends Component {
? `我已在【${params.course_name}】上运行了行代码了${params.code_lines}`
: `我在${params.course_name}${this.formatTitle(params)}遇到了困难`,
desc: this.formatTitle(params),
link: encodeURI(location.href),
link: encodeURI(window.location.href),
imgUrl: params.course_img,
})
}
......
......@@ -57,7 +57,7 @@ class AistShare extends PureComponent {
title: data.share_title,
desc: data.share_desc,
imgUrl: data.image_name,
link: location.href,
link: window.location.href,
})
}
})
......
......@@ -430,7 +430,7 @@ class Video extends Component {
let reconnect = setTimeout(function () {
clearTimeout(reconnect)
reconnect = null
_this.ws = new WebSocket(PROCESS_URL)
_this.ws = new WebSocket(API["process-api"])
}, 500)
}
}
......
......@@ -10,6 +10,7 @@ const PrivateRoute = ({ component: Component, path, user, ...rest }) => {
useEffect(() => {
let _auth = !user.hasError && user.code != 4040
// eslint-disable-next-line no-unused-expressions
typeof _auth !== "undefined" &&
(setAuthorization(_auth), setLoadingState(false))
}, [user.hasError])
......
/* global AndroidWebViewBridge */
export default function SendMessageToApp() {
let messageName = "nullName"
let params = ""
......
/* global wx */
import { http, browser } from "src/utils"
// const url = `https://res.wx.qq.com/open/js/jweixin-1.4.0.js`
......
/* global wx */
import { getWXObject, getSignature } from "./base"
const shareApiList = [
......
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