Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadWXACode() {
const { repo, url } = this.state
const path = '/pages/repo/repo?url=' + encodeURI(url) + '&share=true'
let that = this
Taro.showLoading({title: GLOBAL_CONFIG.LOADING_TEXT})
wx.cloud.callFunction({
// 要调用的云函数名称
name: 'wxacode',
// 传递给云函数的event参数
data: {
path: path,
name: `${repo.owner.login}_${repo.name}`
}
}).then(res => {
console.log('wxacode', res)
if (res.result && res.result.length > 0) {
that.generatePoster(res.result[0].tempFileURL)
} else {
Taro.hideLoading()
}
}).catch(err => {
},()=>{
Taro.showLoading({
title:"加载数据中"
});
Taro.request({
url:`https://m.maoyan.com/ajax/cinemaDetail?cinemaId=${cinemaId}&movieId=${movieId}`,
method:'GET'
}).then(res=>{
if(res.statusCode == 200){
Taro.hideLoading();
res.data.showData.movies.map((item)=>{
const arr = item["img"].split("w.h");
item["img"] = arr[0]+'140.180'+arr[1];
});
self.setState({
movieData:res.data,
bg:res.data.showData.movies[0].img
},()=>{
loadLocalItem() {
Taro.showLoading({title: GLOBAL_CONFIG.LOADING_TEXT})
let that = this
const { item } = this.state
let key = `git_content_${item.item_id}`
Taro.getStorage({
key: key,
success(res) {
console.log(res)
},
complete(res) {
console.log('content complete', res)
if (res.data) {
that.setState({
md: base64_decode(res.data.content)
})
Taro.hideLoading()
} else {
getMoviesOnList(){
let cityId = this.state.id
Taro.showLoading({
title:"加载中"
});
Taro.request({
url:"https://m.maoyan.com/ajax/movieOnInfoList?token=",
method:"GET",
header:{
"Cookie":`_lxsdk_cuid=164b6cae2cac8-02b7b032f571b5-39614706-1fa400-164b6cae2cbc8; v=3; iuuid=1A6E888B4A4B29B16FBA1299108DBE9CA19FF6972813B39CA13A8D9705187374; revrev=76338a29; _lx_utm=utm_source%3DBaidu%26utm_medium%3Dorganic; webp=true; __mta=3463951.1532075108184.1533098338076.1533118040602.20; _lxsdk=1A6E888B4A4B29B16FBA1299108DBE9CA19FF6972813B39CA13A8D9705187374; from=canary; selectci=true; __mta=3463951.1532075108184.1533118040602.1533118773295.21; _lxsdk_s=164f4f4c9e9-45e-d1b-46%7C%7C50; ci=${cityId}`
}
}).then(res=>{
if(res.statusCode == 200){
Taro.hideLoading();
res.data.movieList.forEach((value)=>{
let arr = value["img"].split("w.h");
value["img"] = arr[0]+"128.180"+ arr[1]
});
this.setState({
componentDidMount() {
this.interstitialAd = null
Taro.showLoading({ title: GLOBAL_CONFIG.LOADING_TEXT })
this.loadLanguages()
this.loadItemList()
this.loadNotice()
this.loadinterstitialAd()
let that = this
Taro.getSystemInfo({
success(res) {
that.setState({
windowHeight: res.windowHeight - (res.windowWidth / 750) * 80
})
}
})
}
onChangeGithubParams = value => {
const { githubRange } = this.state
const [category, period, lang] = githubRange
const [categoryIndex, periodIndex, langIndex] = value
Taro.setStorage({
key: 'trendingProps',
data: {
categoryIndex,
periodIndex,
langIndex,
},
})
Taro.showLoading({
title: '加载中···',
mask: true,
})
if (Taro.pageScrollTo) {
Taro.pageScrollTo({
scrollTop: 0,
})
} else {
Taro.showModal({
title: '提示',
content:
'当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
})
}
}, () => {
Taro.showLoading({title: GLOBAL_CONFIG.LOADING_TEXT})
that.searchRepo()
that.searchUsers()
})
}
getContents() {
let that = this
const { repo, path } = this.state
let url = '/repos/' + repo + '/contents'
if (path) {
url = url + '/' + path
}
Taro.showLoading({title: GLOBAL_CONFIG.LOADING_TEXT})
api.get(url).then((res)=>{
that.setState({
dataList: res.data
})
Taro.hideLoading()
})
}
}, () => {
Taro.showLoading({ title: GLOBAL_CONFIG.LOADING_TEXT })
this.loadItemList()
})
}
componentDidMount() {
Taro.showLoading({title: GLOBAL_CONFIG.LOADING_TEXT})
this.getRepo()
}