F 课堂邀请页面小程序码获取失败 F 每日签到完后按钮没有变灰

master
educoder_weapp 4 years ago
parent ffbea46001
commit 80b7d665e4

@ -1,3 +1,7 @@
## v0.19.2
* F 课堂邀请页面小程序码获取失败
* F 每日签到完后按钮没有变灰
## v0.19.1
* U 个人中心界面优化
* U 主题色加深

@ -137,36 +137,10 @@ exports.main = async (event, context) => {
sceneDesc: sceneDescMap[data.scene],
time: now,
timestamp: Date.now(),
openid: wxContext.OPENID
openid: wxContext.OPENID,
_openid: wxContext.OPENID
}
});
try{
console.log(sceneDescMap[data.scene].slice(0,31),now.toLocaleTimeString());
let result = await cloud.openapi.subscribeMessage.send({
touser: 'oqugK431bepFwW6TGrHpQTerPkI0',
page: 'admin/pages/page_history/page_history',
lang: 'zh_CN',
templateId: 'atZ4ZFfGIPxTiFGTCtkwvnfqjBA-fM7o1p5OiJQA_0Y',
miniprogramState: 'trial',
data: {
character_string1:{
value:"pageHistory" //服务器
},
character_string2:{
value: (data.route||data.page).match(/\/([^\/]*$)/)[1] //数据类型
},
thing4:{
value:sceneDescMap[data.scene].slice(0,20) //添加内容
},
date3:{
value:getFormatTime(now)
}
}
})
console.log(result);
}catch(e){
console.error(e);
}
return res;
}

@ -19,7 +19,9 @@ const collectionNameMap = {
const PagePathMap = {
shixun:"markdown/shixun/shixun/shixun",
path:"markdown/path/path/path"
path:"markdown/path/path/path",
mooc_case:"markdown/mooc_case/mooc_case/mooc_case",
competition:"markdown/competition/competition/competition"
}
@ -40,75 +42,48 @@ exports.main = async (event, context) => {
}
}
async function submitPages({Time}){
console.log("start submitPages");
async function submitPage({route, timeStart, timeEnd}){
const db = cloud.database();
const _ = db.command;
const pageHistoryCollection = db.collection(collectionNameMap.pageHistory);
let shixunPath = PagePathMap.shixun;
let pathPath = PagePathMap.path;
let timeEnd = new Date(Time);
let timeStart = new Date(timeEnd.getTime() - config.submitPagesGapDay*milliSecondsPerDay);
let shixunResult = await pageHistoryCollection.where({
page: shixunPath,
let data = await pageHistoryCollection.aggregate()
.match({
page: route,
status: 200,
isCrawl: false,
time: _.lt(timeEnd).and(_.gte(timeStart))
}).get();
})
.group({
_id:"$options"
})
.end();
let pathResult = await pageHistoryCollection.where({
page: pathPath,
status: 200,
isCrawl: false,
time:_.lt(timeEnd).and(_.gte(timeStart))
}).get();
let shixunQueries = shixunResult.data.reduce(function(arr, v){
var query = Object.keys(v.options).map(k=>`${k}=${v.options[k]}`).join("&");
if(arr.indexOf(query)==-1)
arr.push(query);
return arr
},[]);
let pathQueries = pathResult.data.reduce(function(arr, v){
var query = Object.keys(v.options).map(k=>`${k}=${v.options[k]}`).join("&");
if(arr.indexOf(query)==-1)
arr.push(query);
return arr
},[]);
console.info("shixunQueries", shixunQueries.length, shixunQueries);
console.info("pathQueries", pathQueries.length, pathQueries);
if(shixunQueries.length>0){
var pages = shixunQueries.map(i=>{
if(data.list.length==0)
return "empty history: " + route;
let pages = data.list.map(i=>{
let query = Object.keys(i._id).map(k=>`${k}=${i._id[k]}`).join("&");
return {
path: shixunPath,
query: i
path: route,
query
}
});
var res = await cloud.openapi.search.submitPages({pages});
console.log("submit shixun pages",pages.length, res);
console.info("arguments", pages);
}else{
console.warn("no shixun history");
}
if(pathQueries.length>0){
var pages = pathQueries.map(i=>{
return {
path: pathPath,
query: i
}
});
var res = await cloud.openapi.search.submitPages({pages});
console.log("submit path pages success", pages.length, res);
console.info("arguments", pages);
}else{
console.warn("no path history");
})
let res = await cloud.openapi.search.submitPages({pages});
console.log("submit pages success", route, pages.length, res, pages);
return "submit success: " + route + " " + pages.length;
}
return {code:0, message:"success"};
async function submitPages({Time}){
let timeEnd = new Date(Time);
let timeStart = new Date(timeEnd.getTime() - config.submitPagesGapDay*milliSecondsPerDay);
// pages to be submitted
let routes = [
"shixun", "path", "mooc_case", "competition"
]
let promises = routes.map(i=>{
return submitPage({route: PagePathMap[i], timeStart, timeEnd})
})
return Promise.all(promises)
}
async function clearPageHistory({Time}){

@ -1,4 +1,5 @@
<navigator class="item-container" hover-class="none" url="/markdown/competition/competition/competition?identifier={{data.identifier}}">
<navigator class="item-container" hover-class="none"
url="/markdown/competition/competition/competition?identifier={{data.identifier}}">
<view class="image-wrp" catchtap="previewImage">
<image class="item-image" lazy-load mode="heightFix" src="{{eduUrl}}/{{data.image}}"></image>
</view>

@ -0,0 +1,23 @@
// components/home-notice/home-notice.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

@ -0,0 +1,2 @@
<!--components/home-notice/home-notice.wxml-->
<text>components/home-notice/home-notice.wxml</text>

@ -0,0 +1 @@
/* components/home-notice/home-notice.wxss */

@ -1,6 +1,6 @@
const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
let _version = "0.19.1";
let _version = "0.19.2";
let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync();
version = version||_version;
@ -19,7 +19,7 @@ export function switchEnv(env) {
}
else if (env == "trial") {
eduUrl = trialUrl;
config.version = "体验版 " + version;
config.version = version+" 体验版";
}
else {
eduUrl = releaseUrl;

@ -17,6 +17,7 @@ Page({
eduImgDir:global.config.eduImgDir
},
onImgLoad(e){
console.log("imageload", e);
this.setData({code_loaded:1});
},
onImgError(e){
@ -24,8 +25,14 @@ Page({
let scene = this.getScene();
wx.cloud.callFunction({ name: "openapi", data: { name:"wxacode.getUnlimited", data:{page, scene}}})
.then(res=>{
this.setData({invite_code_url:""});
this.setData({invite_code_url: res.result.fileID||res.result})
let t = new Date().getTime();
wx.cloud.getTempFileURL({
fileList:[res.result.fileID],
success:res=>{
console.log(res)
this.setData({invite_code_url: res.fileList[0].tempFileURL+"?t="+t})
}
})
});
},
login:function(){
@ -119,6 +126,9 @@ Page({
if(this.data.status==-1)
this.pull_course()
},
onReady(){
app.reportPageHistory();
},
onShareAppMessage(){
let {course} = this.data;
return app.shareApp({

@ -79,15 +79,7 @@ Page({
wx.setNavigationBarTitle({
title:"实践课程-"+res[0].name
})
app.cloudapi("reportPageHistory")({
page: this.route,
options: this.options,
status: 200,
scene: app.globalData.scene
}).catch(e=>{
global.realTimeLog.error("report history error", e);
wx.reportMonitor('2', 1);
})
app.reportPageHistory()
return res;
}).catch(e=>{
if(e.code==403)

@ -98,15 +98,7 @@ Page({
let current = cateTypes[cate_type];
this.setData({identifier, current});
this.pullShixun().then(res=>{
app.cloudapi("reportPageHistory")({
page: this.route,
options: this.options,
status: 200,
scene: app.globalData.scene
}).catch(e=>{
global.realTimeLog.error("report history error", e);
wx.reportMonitor('2', 1);
})
app.reportPageHistory();
}).catch(e=>{
app.showError(e);
wx.hideShareMenu();

@ -1,4 +1,5 @@
<navigator class="item-container" hover-class="none" url="/markdown/mooc_case/mooc_case/mooc_case?mooc_case_id={{data.id}}">
<navigator class="item-container" hover-class="none"
url="/markdown/mooc_case/mooc_case/mooc_case?mooc_case_id={{data.id}}">
<image class="item-image" lazy-load mode="aspectFill" src="{{eduUrl}}{{data.cover_url||default_cover}}"></image>
<view class="item-detail">
<view>{{data.title}}<text wx:for="{{data.tags}}" class="tag {{item.id==1?'award':''}}">{{item.name}}</text></view>

@ -180,7 +180,7 @@ Page({
data: this.data.auto_attendance,
});
},
updateGold({gold, duration}){
updateGold({gold, duration=2500}){
let {grade} = this.data.user;
if(grade >= gold)
return console.log(new Date().getTime())
@ -199,12 +199,28 @@ Page({
attendance({ show = 1 }={}) {
if(!app.checkLogin({content:"您需要登陆后才能签到获取金币"}))
return;
if(this.data.user.attendance_signed){
if(show)
wx.showToast({
title: '您已经签到过了',icon:"none"
});
return;
}
app.api("users.attendance")()
.then(res => {
res.message = "签到成功";
if (show)
app.showMsg(res);
let {grade} = res;
var db = wx.cloud.database();
db.collection("res").add({
data:{
...res,
name: "users.attendance",
createAt: db.serverDate()
}
})
this.setData({"user.attendance_signed": true});
this.updateGold({gold: grade})
}).catch(e=>{
if(show)

@ -29,10 +29,10 @@
</view>
<view class="flex-col experience-item">
<view class="key" bindtap="attendance">金币</view>
<view class="value" bindtap="attendance">
<view class="key attendance" bindtap="attendance">金币</view>
<view class="value attendance" bindtap="attendance">
{{user.grade||0}}
<iconfont type="qiandao" color="{{user.attendance_signed?'#ffffff77':'#FEB532'}}" />
<iconfont class="attendance-icon" type="qiandao" color="{{user.attendance_signed?'#ffffff77':'#FEB532'}}" />
</view>
</view>
</view>
@ -136,8 +136,9 @@
<iconfont class="icon" color="#0080f0" type="kefu" size="21" />小程序客服
<iconfont type="jinru" color="lightgrey" size="15" class="enter"></iconfont>
</button>
<navigator class="nav gap" url="/setting/pages/setting/setting">
<navigator bindlongpress="onTapVersion" class="nav gap" url="/setting/pages/setting/setting">
<iconfont type="shezhi" color="#0080f0" class="icon" size="21"/>设置
<text class="tip">v{{version}}</text>
<iconfont type="jinru" color="lightgrey" size="15" class="enter"/>
</navigator>
<!--navigator url="/markdown/account/about/about" class="nav about gap">
@ -157,7 +158,7 @@
</view>
<view class="version-wrp">
<view bindtap="enterGitrepo" bindlongpress="onTapVersion" class="git-repo">
<iconfont class="icon" type="git" size="20" fontsize="14"/>点击参与开源 {{version}}
<view bindtap="enterGitrepo" class="git-repo">
<iconfont class="icon" type="git" size="14"/>参与开源
</view>
</view>

@ -67,6 +67,9 @@
.experience-item>.value{
font-size: 15px;
}
.attendance-icon{
transition: all 0.6s ease;
}
/*经验展示结束*/
@ -93,7 +96,7 @@
width: 100%;
height: 50%;
z-index: -100;
border-radius: 0 0 24% 24%;
border-radius: 0 0 20% 20%;
}
.whitebox{
width: 94%;
@ -102,7 +105,7 @@
justify-content: space-between;
border-radius: 20rpx;
box-shadow: #e0e0e0 0px 0px 5px;
padding: 25rpx 0rpx;
padding: 24rpx 0rpx;
}
.box_context{
display: flex;

@ -1,6 +1,22 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [
{
"action":"allow",
"page":"markdown/mooc_case/mooc_case",
"params":[
"mooc_case_id"
],
"matching":"inclusive"
},
{
"action":"allow",
"page":"markdown/competition/competition",
"params":[
"identifier"
],
"matching":"inclusive"
},
{
"action":"allow",
"page":"markdown/path/path/path",

@ -225,7 +225,7 @@
"id": 22,
"name": "course_invite",
"pathName": "course/pages/course_invite/course_invite",
"query": "course_id=7845",
"query": "course_id=8275",
"scene": null
},
{

Loading…
Cancel
Save