Commit 1635ddd3 authored by sujie@126.com's avatar sujie@126.com

dd

parent e2a031a1
...@@ -13,6 +13,14 @@ Component({ ...@@ -13,6 +13,14 @@ Component({
loginCode: { loginCode: {
type: String, type: String,
value: '' value: ''
},
type:{
type:Number,
value:1
},
sid:{
type:Number,
value: 0
} }
}, },
data: { data: {
...@@ -82,9 +90,15 @@ Component({ ...@@ -82,9 +90,15 @@ Component({
openid: _data.user.open_id, openid: _data.user.open_id,
}); });
LocalStorage.setItem('visitor', visitor); LocalStorage.setItem('visitor', visitor);
wx.reLaunch({ if(this.data.type == 2 && this.data.sid>0){
url: '/ucenter/index' wx.reLaunch({
}); url: `/src/pages/websiteindex/index?sid=${this.data.sid}`,
})
} else{
wx.reLaunch({
url: '/ucenter/index'
});
}
} else { } else {
wxLogin().then((res) => { wxLogin().then((res) => {
this.setData({ this.setData({
......
...@@ -200,14 +200,14 @@ const apis = { ...@@ -200,14 +200,14 @@ const apis = {
websitelikes: `${api}student/website/likes`, //点赞 websitelikes: `${api}student/website/likes`, //点赞
websitecomments: `${api}student/website/comments`, //评论和回复 websitecomments: `${api}student/website/comments`, //评论和回复
websitecommentslist: `${api}student/website/comments`, //获取评论列表 websitecommentslist: `${api}student/website/comments`, //获取评论列表
websiteintros: `${api}student/website/intros`, //学校介绍列表 websiteintros: `${api}common/website/intros`, //学校介绍列表
dataconsumer: `${api}common/data/consumer`, //c端数据埋点 dataconsumer: `${api}common/data/consumer`, //c端数据埋点
websitehome: `${api}student/website/home`, //获取微官网基本数据 websitehome: `${api}common/website/home`, //获取微官网基本数据
commonclock: `${api}common/clock`, //获取打卡记录 commonclock: `${api}common/clock`, //获取打卡记录
websitecourseshow: `${api}student/website/course/show`, //体验课详情 websitecourseshow: `${api}common/website/course/show`, //体验课详情
momentlist: `${api}student/moment`, //C端-课堂瞬间列表 momentlist: `${api}common/moment`, //C端-课堂瞬间列表
momentdetail: `${api}student/moment/detail`, //C端-课堂瞬间详情 momentdetail: `${api}student/moment/detail`, //C端-课堂瞬间详情
newslist: `${api}student/news`, //C端-机构新鲜事列表创 newslist: `${api}common/news`, //C端-机构新鲜事列表创
newsdetail: `${api}student/news/detail`, //C端-机构新鲜详情 newsdetail: `${api}student/news/detail`, //C端-机构新鲜详情
onlinecourseslist: `${api}student/online_courses`, //C端-在线课列表 onlinecourseslist: `${api}student/online_courses`, //C端-在线课列表
onlinecoursesdetail: `${api}student/online_courses/detail`, //C端-在线课列表详情 onlinecoursesdetail: `${api}student/online_courses/detail`, //C端-在线课列表详情
......
...@@ -80,6 +80,7 @@ function newLikeIndex (data) { ...@@ -80,6 +80,7 @@ function newLikeIndex (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function newCommentIndex (data) { function newCommentIndex (data) {
...@@ -88,6 +89,7 @@ function newCommentIndex (data) { ...@@ -88,6 +89,7 @@ function newCommentIndex (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function joinCircle (data) { function joinCircle (data) {
......
...@@ -43,6 +43,7 @@ function websiteintros (data) { ...@@ -43,6 +43,7 @@ function websiteintros (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function dataconsumer (data) { function dataconsumer (data) {
...@@ -59,6 +60,7 @@ function websitehome (data) { ...@@ -59,6 +60,7 @@ function websitehome (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function commonclock (data) { function commonclock (data) {
...@@ -66,6 +68,7 @@ function commonclock (data) { ...@@ -66,6 +68,7 @@ function commonclock (data) {
url: apis.customer.websiteindex.commonclock, url: apis.customer.websiteindex.commonclock,
data, data,
method: 'GET', method: 'GET',
notExactly: true,
errorresolve: 1, errorresolve: 1,
}) })
} }
...@@ -75,6 +78,7 @@ function websitecourseshow (data) { ...@@ -75,6 +78,7 @@ function websitecourseshow (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function momentlistGet (data) { function momentlistGet (data) {
...@@ -83,6 +87,7 @@ function momentlistGet (data) { ...@@ -83,6 +87,7 @@ function momentlistGet (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function momentdetailGet (data) { function momentdetailGet (data) {
...@@ -99,6 +104,7 @@ function newslistGet (data) { ...@@ -99,6 +104,7 @@ function newslistGet (data) {
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function newsdetailGet (data) { function newsdetailGet (data) {
...@@ -148,6 +154,7 @@ function websiteBarrage(data){ ...@@ -148,6 +154,7 @@ function websiteBarrage(data){
data, data,
method: 'GET', method: 'GET',
errorresolve: 1, errorresolve: 1,
notExactly: true
}) })
} }
function websitesubjectGet(data){ function websitesubjectGet(data){
......
...@@ -1444,4 +1444,4 @@ Page({ ...@@ -1444,4 +1444,4 @@ Page({
}) })
} }
}, },
}) })
\ No newline at end of file
...@@ -41,7 +41,8 @@ import { ...@@ -41,7 +41,8 @@ import {
wxAuthorize, wxAuthorize,
wxChooseLocation, wxChooseLocation,
wxOpenSetting, wxOpenSetting,
wxGetImageInfo wxGetImageInfo,
wxLogin
} from '../../../utilities/wxApi.js'; } from '../../../utilities/wxApi.js';
var app = getApp(); var app = getApp();
Page({ Page({
...@@ -148,8 +149,9 @@ Page({ ...@@ -148,8 +149,9 @@ Page({
subjectHasmore: true, subjectHasmore: true,
subjectListLoading: false, subjectListLoading: false,
subjectEmptyPage:false, subjectEmptyPage:false,
subjectTotal:'' subjectTotal:'',
unauthorized: false,
loginCode: '',
}, },
onLoad: function (options) { // Do some initialize when page load. onLoad: function (options) { // Do some initialize when page load.
this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器 this.innerAudioContext = wx.createInnerAudioContext(); // 当前页面唯一的一个音频容器
...@@ -175,10 +177,49 @@ Page({ ...@@ -175,10 +177,49 @@ Page({
if (this.data.sid == 0) { if (this.data.sid == 0) {
return; return;
} }
app.getCurrentSchoolStudentId({ if(LocalStorage.getItem('visitor')){
source_id: this.data.sid, app.getCurrentSchoolStudentId({
source_type: 10, source_id: this.data.sid,
}).then(() => { source_type: 10,
}).then(() => {
this.websitehomeGet()
this.websitecourseshowGet()
this.websiteintrosGet();
this.clockListGet();
this.newslistGet();
this.momentlistGet();
this.onlineCoursesListGet();
this.userShow();
this.websiteBarrage()
this.subjectListGet('init')
const myLocation = LocalStorage.getItem('myLocation');
const that = this;
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
wx.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: 'rgba(255, 255, 255, 0)',
animation: {
duration: 0,
timingFunc: 'linear'
}
});
})
} else{
wxLogin().then((res) => {
this.setData({
loginCode: res.code
})
})
this.setData({
unauthorized: true
})
this.websitehomeGet() this.websitehomeGet()
this.websitecourseshowGet() this.websitecourseshowGet()
this.websiteintrosGet(); this.websiteintrosGet();
...@@ -189,25 +230,8 @@ Page({ ...@@ -189,25 +230,8 @@ Page({
this.userShow(); this.userShow();
this.websiteBarrage() this.websiteBarrage()
this.subjectListGet('init') this.subjectListGet('init')
const myLocation = LocalStorage.getItem('myLocation'); }
const that = this;
wx.login({
success(res) {
const sessionCode = res.code;
that.setData({
sessionCode: sessionCode
})
}
})
wx.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: 'rgba(255, 255, 255, 0)',
animation: {
duration: 0,
timingFunc: 'linear'
}
});
})
const myLocation = LocalStorage.getItem('myLocation'); const myLocation = LocalStorage.getItem('myLocation');
const that = this; const that = this;
...@@ -247,6 +271,11 @@ Page({ ...@@ -247,6 +271,11 @@ Page({
// }) // })
}, },
onShow: function () { // Do something when page show. onShow: function () { // Do something when page show.
wxLogin().then((res) => {
this.setData({
loginCode: res.code
})
})
if (this.data.needRefresh) { if (this.data.needRefresh) {
this.data.clockPage = 1; this.data.clockPage = 1;
this.data.listLoading = false; this.data.listLoading = false;
...@@ -264,6 +293,11 @@ Page({ ...@@ -264,6 +293,11 @@ Page({
} }
this.resetAudiosPlayStatus() this.resetAudiosPlayStatus()
clearInterval(this.data.voiceInterval); clearInterval(this.data.voiceInterval);
wxLogin().then((res) => {
this.setData({
loginCode: res.code
})
})
}, },
onUnload: function () { onUnload: function () {
this.innerAudioContext.pause(); this.innerAudioContext.pause();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"sjd-media-show": "../../../components/sjdmediashow", "sjd-media-show": "../../../components/sjdmediashow",
"scoregetfeedback": "../../../components/scoregetfeedback", "scoregetfeedback": "../../../components/scoregetfeedback",
"guidecollection": "../../../components/guidecollection", "guidecollection": "../../../components/guidecollection",
"brick-layout": "../../../components/brickLayout" "brick-layout": "../../../components/brickLayout",
"loginbtn":"../../../components/loginbtn"
} }
} }
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" /> <wxs src="../../../filter/index.wxs" module="filter" />
<view class="getUserInfo-btn" wx:if="{{unauthorized}}">
<loginbtn loginCode="{{loginCode}}" type="{{2}}" sid="{{sid}}"/>
</view>
<view class="container" style="{{tabIndex == 2 ? 'background: #F7F4F8;' : ''}}"> <view class="container" style="{{tabIndex == 2 ? 'background: #F7F4F8;' : ''}}">
<view class="banner-box" id="banner"> <view class="banner-box" id="banner">
<block wx:if="{{!websitehomeEmpty && !bannerEmpty}}"> <block wx:if="{{!websitehomeEmpty && !bannerEmpty}}">
...@@ -389,4 +392,4 @@ ...@@ -389,4 +392,4 @@
noticecount="{{noticecount}}" noticecount="{{noticecount}}"
> >
</btabbar> </btabbar>
<guidecollection custom="{{1}}"/> <guidecollection custom="{{1}}"/>
\ No newline at end of file
...@@ -28,7 +28,15 @@ page{ ...@@ -28,7 +28,15 @@ page{
/* padding: 0 24rpx; */ /* padding: 0 24rpx; */
z-index: 9; z-index: 9;
} }
.getUserInfo-btn{
width: 100%;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 1000;
opacity: 0;
}
.share-btn-wrapper { .share-btn-wrapper {
position: fixed; position: fixed;
right: 24rpx; right: 24rpx;
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
LocalStorage LocalStorage
} from './index.js'; } from './index.js';
var app = getApp(); var app = getApp();
function wxRequest ({url, data, header, method, dataType, responseType, errorresolve, needToken, role}) { function wxRequest ({url, data, header, method, dataType, responseType, errorresolve, needToken, role, notExactly}) {
let visitor = LocalStorage.getItem('visitor') || {}; let visitor = LocalStorage.getItem('visitor') || {};
let user = LocalStorage.getItem('user') || {}; let user = LocalStorage.getItem('user') || {};
let teacher = LocalStorage.getItem('teacher') || {}; let teacher = LocalStorage.getItem('teacher') || {};
...@@ -11,24 +11,31 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres ...@@ -11,24 +11,31 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres
let _data = data || {}; let _data = data || {};
let _role = role || '2c'; let _role = role || '2c';
let _header = header || { let _header = header || {
'content-type': 'application/x-www-form-urlencoded' 'Content-type': 'application/x-www-form-urlencoded'
}; };
let _method = method || 'GEt'; let _method = method || 'GEt';
let _dataType = dataType || 'json'; let _dataType = dataType || 'json';
let _responseType = responseType || 'text'; let _responseType = responseType || 'text';
let _errorresolve = errorresolve || 1; // 1错误处理通用 2错误处理私用 let _errorresolve = errorresolve || 1; // 1错误处理通用 2错误处理私用
let _needToken = needToken === undefined ? true : needToken; //判断接口是否需要token false 不需要 true 需要 let _needToken = needToken === undefined ? true : needToken; //判断接口是否需要token false 不需要 true 需要
let _notExactly = notExactly; //判断接口不一定需要token
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (_needToken) { if (_needToken) {
if (_role == '2c') { if (_role == '2c') {
if (visitor.token) { if (visitor.token) {
_header.Authorization = visitor.token; _header.Authorization = visitor.token;
} else { // 出现登录窗口或者跳转到登录页面 } else { // 出现登录窗口或者跳转到登录页面
wx.hideLoading(); console.log(_notExactly, '_notExactly_notExactly')
if (_url == 'https://qxapi.qingxiao.online/daka/v3/student/comment' && _method == 'POST') { if(_notExactly){
reject(); // 正常执行
}else{
wx.hideLoading();
if (_url == 'https://qxapi.qingxiao.online/daka/v3/student/comment' && _method == 'POST') {
reject();
}
return
} }
return
} }
} else if (_role == '2b') { } else if (_role == '2b') {
let dakarole = LocalStorage.getItem('dakarole') || 1; let dakarole = LocalStorage.getItem('dakarole') || 1;
...@@ -55,7 +62,6 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres ...@@ -55,7 +62,6 @@ function wxRequest ({url, data, header, method, dataType, responseType, errorres
success (res) { success (res) {
const {statusCode, data} = res; const {statusCode, data} = res;
if(data.code == 40202){ if(data.code == 40202){
console.log( getApp(), ' getApp()')
getApp().globalData.accountExpired = true; getApp().globalData.accountExpired = true;
return false; return false;
}else { }else {
......
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