Commit fc88089a authored by wangxuelai's avatar wangxuelai

''

parent da60e5d0
......@@ -8,6 +8,8 @@ import {
import {
studentidentity
} from './service/customer/signup.js'
import definePage from './js/definePage.js';
definePage();
// import tracker from './js/tracker_es.min.js'
// tracker({
// token: "c92deb3f301e16682ecf598120083403",
......@@ -34,22 +36,22 @@ App({
if (path != 'wechatinfoget/index' && path.indexOf('business/') == -1) {
this.globalData.fromUrl = path;
this.globalData.query = query;
if(query && (query.sid != undefined && query.sid != 0)){
studentidentity({
school_id: query.sid
}).then((res) => {
const {data, code} = res;
if(code == 200 && data){
const visitor = LocalStorage.getItem('visitor');
Object.assign(visitor, {
studentId:data.student.id
});
LocalStorage.setItem('visitor', visitor);
}else{
}
}).catch((err)=>{
})
}
// if(query && (query.sid != undefined && query.sid != 0)){
// studentidentity({
// school_id: query.sid
// }).then((res) => {
// const {data, code} = res;
// if(code == 200 && data){
// const visitor = LocalStorage.getItem('visitor');
// Object.assign(visitor, {
// studentId:data.student.id
// });
// LocalStorage.setItem('visitor', visitor);
// }else{
// }
// }).catch((err)=>{
// })
// }
} else {
this.globalData.fromUrl = 'ucenter/index';
this.globalData.query = {};
......@@ -88,7 +90,8 @@ App({
visitor: LocalStorage.getItem('visitor') || null,
imageVersion: constants.imageVersion,
accountExpired: false,
myDevice: null
myDevice: null,
currentSchoolStudentId: 0,
},
needAuth () { // 需要授权
......@@ -178,5 +181,5 @@ App({
} catch (err){
console.log(err)
}
}
},
})
export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/',
host: 'https://qxapi.qingxiao.online/daka',
host2: 'https://wx.m.shangjiadao.cn',
// host: 'https://qxapi.qingxiao.online/daka',
// host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '4.0',
imageVersion: '20191104',
// host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn',
host: 'https://clock.wp53.cn',
host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785',
miniProgram: {
clock: 'wxdeee20e52a1fd7ee'
......
This diff is collapsed.
/**
* slice() reference.
*/
var slice = Array.prototype.slice;
/**
* Expose `co`.
*/
module.exports = co['default'] = co.co = co;
/**
* Wrap the given generator `fn` into a
* function that returns a promise.
* This is a separate function so that
* every `co()` call doesn't create a new,
* unnecessary closure.
*
* @param {GeneratorFunction} fn
* @return {Function}
* @api public
*/
co.wrap = function (fn) {
createPromise.__generatorFunction__ = fn;
return createPromise;
function createPromise() {
return co.call(this, fn.apply(this, arguments));
}
};
/**
* Execute the generator function or a generator
* and return a promise.
*
* @param {Function} fn
* @return {Promise}
* @api public
*/
function co(gen) {
var ctx = this;
var args = slice.call(arguments, 1)
// we wrap everything in a promise to avoid promise chaining,
// which leads to memory leak errors.
// see https://github.com/tj/co/issues/180
return new Promise(function(resolve, reject) {
if (typeof gen === 'function') gen = gen.apply(ctx, args);
if (!gen || typeof gen.next !== 'function') return resolve(gen);
onFulfilled();
/**
* @param {Mixed} res
* @return {Promise}
* @api private
*/
function onFulfilled(res) {
var ret;
try {
ret = gen.next(res);
} catch (e) {
return reject(e);
}
next(ret);
}
/**
* @param {Error} err
* @return {Promise}
* @api private
*/
function onRejected(err) {
var ret;
try {
ret = gen.throw(err);
} catch (e) {
return reject(e);
}
next(ret);
}
/**
* Get the next value in the generator,
* return a promise.
*
* @param {Object} ret
* @return {Promise}
* @api private
*/
function next(ret) {
if (ret.done) return resolve(ret.value);
var value = toPromise.call(ctx, ret.value);
if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
+ 'but the following object was passed: "' + String(ret.value) + '"'));
}
});
}
/**
* Convert a `yield`ed value into a promise.
*
* @param {Mixed} obj
* @return {Promise}
* @api private
*/
function toPromise(obj) {
if (!obj) return obj;
if (isPromise(obj)) return obj;
if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
if ('function' == typeof obj) return thunkToPromise.call(this, obj);
if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
if (isObject(obj)) return objectToPromise.call(this, obj);
return obj;
}
/**
* Convert a thunk to a promise.
*
* @param {Function}
* @return {Promise}
* @api private
*/
function thunkToPromise(fn) {
var ctx = this;
return new Promise(function (resolve, reject) {
fn.call(ctx, function (err, res) {
if (err) return reject(err);
if (arguments.length > 2) res = slice.call(arguments, 1);
resolve(res);
});
});
}
/**
* Convert an array of "yieldables" to a promise.
* Uses `Promise.all()` internally.
*
* @param {Array} obj
* @return {Promise}
* @api private
*/
function arrayToPromise(obj) {
return Promise.all(obj.map(toPromise, this));
}
/**
* Convert an object of "yieldables" to a promise.
* Uses `Promise.all()` internally.
*
* @param {Object} obj
* @return {Promise}
* @api private
*/
function objectToPromise(obj){
var results = new obj.constructor();
var keys = Object.keys(obj);
var promises = [];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var promise = toPromise.call(this, obj[key]);
if (promise && isPromise(promise)) defer(promise, key);
else results[key] = obj[key];
}
return Promise.all(promises).then(function () {
return results;
});
function defer(promise, key) {
// predefine the key in the result
results[key] = undefined;
promises.push(promise.then(function (res) {
results[key] = res;
}));
}
}
/**
* Check if `obj` is a promise.
*
* @param {Object} obj
* @return {Boolean}
* @api private
*/
function isPromise(obj) {
return 'function' == typeof obj.then;
}
/**
* Check if `obj` is a generator.
*
* @param {Mixed} obj
* @return {Boolean}
* @api private
*/
function isGenerator(obj) {
return 'function' == typeof obj.next && 'function' == typeof obj.throw;
}
/**
* Check if `obj` is a generator function.
*
* @param {Mixed} obj
* @return {Boolean}
* @api private
*/
function isGeneratorFunction(obj) {
var constructor = obj.constructor;
if (!constructor) return false;
if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
return isGenerator(constructor.prototype);
}
/**
* Check for plain object.
*
* @param {Mixed} val
* @return {Boolean}
* @api private
*/
function isObject(val) {
return Object == val.constructor;
}
import {
studentidentity
} from '../service/customer/signup.js';
import regeneratorRuntime from './regenerator-runtime.js';
import parameter from '../constants/parameter.js';
import co from './co.js';
import {
scenQueryGet
} from '../utilities/index.js';
const definePage = function () {
const originApp = App // 保存原对象
App = function(app) {
originApp(app);
let e = arguments;
let onLaunch = e[0].onLaunch;
let onShow = e[0].onShow;
let onHide = e[0].onHide;
let onError = e[0].onError;
app.onLaunch = function(options) {
onLaunch && onLaunch.apply(this, [].slice.call(arguments))
}
app.onShow = function(options) {
onShow && onShow.apply(this, [].slice.call(arguments))
}
app.onHide = function(options) {
onHide && onHide.apply(this, [].slice.call(arguments))
}
app.onError = function(options) {
onError && onError.apply(this, [].slice.call(arguments))
}
}
const originPage = Page;
function a(params) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 5000);
})
}
function getForQueryStudentId (path, query) {
let returnObj = {};
const pageObj = parameter.find(ele => ele.root == path) || null;
let queryParams = {};
if (!pageObj || (pageObj && !pageObj.forQueryStudentId)) {
return {
needQuery: false,
}
}
if (query.scene) { // 二维码进来的情况
queryParams = scenQueryGet(query.scene);
returnObj = {
needQuery: true,
source_id: queryParams[pageObj.forQueryStudentId.qrcode_source_id],
source_type: pageObj.forQueryStudentId.source_type,
}
} else { // 除了二维码进来的情况
queryParams = query;
returnObj = {
needQuery: true,
source_id: queryParams[pageObj.forQueryStudentId.sharer_source_id],
source_type: pageObj.forQueryStudentId.source_type,
}
}
return returnObj;
}
Page = function () {
let e = arguments,
r = e[0].onShow,
t = e[0].onHide,
j = e[0].onLoad;
e[0].onLoad = function (options) {
const that = this;
const newarguments = arguments;
const globalData = getApp().globalData;
const pages = getCurrentPages();
const currentPath = pages[pages.length - 1] && pages[pages.length - 1].route || '';
const { path, query, scene } = wx.getLaunchOptionsSync();
const getDate = getForQueryStudentId(path, query);
co(function* () {
if (getDate.needQuery) {
const studentInfo = yield studentidentity({
method: 2,
source_type: getDate.source_type,
source_id: getDate.source_id,
});
globalData.currentSchoolStudentId = studentInfo.data.student_id;
}
j && j.apply(that, [].slice.call(newarguments));
})
};
e[0].onShow = function (options) {
const that = this;
const newarguments = arguments;
const globalData = getApp().globalData;
let currentPages = getCurrentPages();
let currentPage = currentPages.length > 0
? currentPages[currentPages.length - 1].route
: "";
const { path, query, scene } = wx.getLaunchOptionsSync();
const getDate = getForQueryStudentId(path, query);
co(function* () {
if (getDate.needQuery) {
const studentInfo = yield studentidentity({
method: 2,
source_type: getDate.source_type,
source_id: getDate.source_id,
});
globalData.currentSchoolStudentId = studentInfo.data.student_id;
}
r && r.apply(that, [].slice.call(newarguments));
})
};
e[0].onHide = function (options) {
t && t.apply(this, [].slice.call(arguments));
};
originPage.apply(null, [].slice.call(arguments));
};
}
export default definePage;
\ No newline at end of file
This diff is collapsed.
......@@ -3,6 +3,7 @@ import {
} from '../../utilities/request.js';
import apis from '../../constants/api.js';
function clockDetail (data) {
console.log(data, 'datadatadata');
return wxRequest({
url: apis.customer.clockDetail.detailGet,
data,
......@@ -17,7 +18,8 @@ function randomstudents (data) {
method: 'GET',
errorresolve: 1,
})
}function oddjobschools (data) {
}
function oddjobschools (data) {
return wxRequest({
url: apis.customer.clockDetail.oddjobschools,
data,
......
......@@ -934,7 +934,6 @@ Page({
// 视频播放相关代码
playvideo(e) {
const that = this;
console.log(e)
const {
src,
from,
......@@ -948,7 +947,6 @@ Page({
'videostatus.src': mysrc,
'videostatus.mode': mode || 'mp4',
})
console.log(mysrc,'src')
setTimeout(() => {
that.videoContext = wx.createVideoContext(mysrc);
that.videoContext.play();
......@@ -1614,7 +1612,6 @@ Page({
if(this.data.barrageIndex>=_randomstudents.length){
this.data.barrageIndex = 0;
}
console.log(_randomstudents[this.data.barrageIndex].nickname,'(_randomstudents[this.data.barrageIndex]');
setTimeout(()=>{
this.setData({
//barrageText:(_randomstudents[this.data.barrageIndex].nickname?_randomstudents[this.data.barrageIndex].nickname:'')+textmap[_randomstudents[this.data.barrageIndex].get_time]+'领取了体验课'
......
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