* A 支持填入微信个人信息

master
educoder_weapp 5 years ago
parent 946a2e57a7
commit deb3c86769

@ -1,3 +1,7 @@
## v0.16.8
* A 支持填入微信个人信息
* F 使用用户名登录时账号判断错误而无法登录
## v0.16.7 ## v0.16.7
* F 用户信息未完善时加入课堂bug * F 用户信息未完善时加入课堂bug

@ -69,7 +69,7 @@ async function getWXACodeUnlimited(data){
const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg' const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
return cloud.uploadFile({ return cloud.uploadFile({
cloudPath: `images/wxacode/${(page+"?"+scene).replace(/[\/?&]/g, "_")}.${fileExtension}`, cloudPath: `images/wxacode/${(page+"?"+scene).replace(/[\/?=&]/g, "_")}.${fileExtension}`,
fileContent: wxacodeResult.buffer, fileContent: wxacodeResult.buffer,
}) })
} }
@ -85,7 +85,7 @@ async function getWXACode(data) {
const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg' const fileExtension = (fileExtensionMatches && fileExtensionMatches[1]) || 'jpg'
return cloud.uploadFile({ return cloud.uploadFile({
cloudPath: `images/wxacode/${path.replace(/[\/?&]/g,"_")}.${fileExtension}`, cloudPath: `images/wxacode/${path.replace(/[\/?=&]/g,"_")}.${fileExtension}`,
fileContent: wxacodeResult.buffer, fileContent: wxacodeResult.buffer,
}); });
} }

@ -22,6 +22,9 @@ Page({
return this.setData({showtip:0}); return this.setData({showtip:0});
} }
let {action} = this.data; let {action} = this.data;
if(action=="login")
// some use login to login, this case judge can be wrong
return this.setData({hasError:0});
let type = action=="register"?1:2; let type = action=="register"?1:2;
if(this.cache.login==login&&this.cache.type==type) return; if(this.cache.login==login&&this.cache.type==type) return;
app.api("accounts.valid_email_and_phone")({ app.api("accounts.valid_email_and_phone")({
@ -32,7 +35,7 @@ Page({
} }
}) })
.then(res=>{ .then(res=>{
this.setData({hasError:0,error:""}); this.setData({hasError:0});
}) })
.catch(e=>{ .catch(e=>{
var hasError = e.message.indexOf("网络")!=-1?2:1; var hasError = e.message.indexOf("网络")!=-1?2:1;

@ -1,6 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"iconfont":"/components/iconfont/iconfont" "iconfont":"/components/iconfont/iconfont",
"mp-toptips":"/weui-miniprogram/toptips/toptips"
}, },
"navigationBarTitleText": "账号", "navigationBarTitleText": "账号",
"navigationBarBackgroundColor": "#ffffff" "navigationBarBackgroundColor": "#ffffff"

@ -1,9 +1,7 @@
<page-meta> <page-meta>
<navigation-bar title="{{action_text[action]}}" /> <navigation-bar title="{{action_text[action]}}" />
</page-meta> </page-meta>
<view class="head-error {{error?'':'hidden'}}"> <mp-toptips msg="{{error}}" type="error" show="{{hasError}}" delay="0"/>
<text class="single-line">{{error}}</text>
</view>
<view class="container"> <view class="container">
<image class="logo {{logoLoaded?'':'hidden'}}" bindlongpress="login_test" src="{{attachDir}}751571" mode="aspectFit" bindload="onLogoLoad"></image> <image class="logo {{logoLoaded?'':'hidden'}}" bindlongpress="login_test" src="{{attachDir}}751571" mode="aspectFit" bindload="onLogoLoad"></image>
<form class="account-form" bindsubmit="onSubmit"> <form class="account-form" bindsubmit="onSubmit">

@ -1,31 +1,14 @@
page{ page{
min-height: 100%; position: relative;
overflow: hidden;
background: white; background: white;
} min-height: 100vh;
.head-error{
position: fixed;
background: #cb3b6a;
color: white;
top: 0;
left: 0;
right: 0;
transition: 0.6s all ease;
height: 28px;
display: flex;
font-size: 14px;
justify-content: center;
align-items: center;
}
view.head-error.hidden{
opacity: 0;
max-height: auto;
} }
.logo{ .logo{
width:64px; width:54px;
height: 64px; height: 54px;
display: block; display: block;
margin: 30px auto 8px auto; padding: 48px 0 4px 0;
margin: 0 auto;
transition: 1s all ease; transition: 1s all ease;
} }
.checkbox-wrap,.input-wrap{ .checkbox-wrap,.input-wrap{
@ -73,7 +56,8 @@ switch.no-login{
} }
.actions{ .actions{
position: relative; position: relative;
margin: 0 26px margin: 0 26px;
height: 160px;
} }
.actions button{ .actions button{
transition: 1s all ease; transition: 1s all ease;
@ -84,18 +68,18 @@ switch.no-login{
transition: 1s all ease; transition: 1s all ease;
} }
.actions>.pos1{ .actions>.pos1{
top: 22px; top: 26px;
} }
.pos1>button{ .pos1>button{
background: #00b0f0; background: #00b0f0;
color:white; color:white;
} }
.pos1>button[disabled]{ .pos1>button[disabled]{
background-color: #00b0f0aa!important; background-color: #00b0f096!important;
color: white!important; color: white!important;
} }
.actions>.pos2{ .actions>.pos2{
top:64px; top:74px;
} }
.pos2>button{ .pos2>button{
color: #00b0f0; color: #00b0f0;
@ -116,7 +100,7 @@ switch.no-login{
border: none!important; border: none!important;
} }
.foot{ .foot{
position: fixed; position: absolute;
bottom:0px; bottom:0px;
width: 100%; width: 100%;
display: flex; display: flex;

@ -53,7 +53,45 @@ Page({
this.throttledMsgSecCheck(this.data); this.throttledMsgSecCheck(this.data);
}, },
onGetUserInfo(e){ onGetUserInfo(e){
// 填入微信个人信息
console.log(e); console.log(e);
let {detail:{userInfo}} = e;
if(!userInfo)
return wx.showToast({
title: '获取信息失败',icon:"none"
})
let {nickName:nickname, gender, province:location, city:location_city, avatarUrl} = userInfo;
if(gender)
gender = 1 - gender;
let location_index = this.data.locations.indexOf(location);
let cities = locationData[location] || locationData['北京'];
let city_index = cities.indexOf(location_city);
this.setData({nickname, gender, cities, location, location_city, city_index, location_index});
avatarUrl = "" //@todo
if(avatarUrl){
wx.showModal({
title:"提示",
content:"是否使用微信头像",
confirmText:"使用",
success: res=>{
if(res.confirm)
this.updateWechatAvatar({avatarUrl});
},
complete: ()=>{
wx.showToast({
title: '填入成功'
});
}
});
}else{
wx.showToast({
title: '填入成功'
});
}
},
updateWechatAvatar({avatarUrl}){
// @todo
}, },
setInfo(res){ setInfo(res){
let locations = Object.keys(locationData); let locations = Object.keys(locationData);
@ -146,6 +184,10 @@ Page({
this.pullDepartments({school_id,department_id}); this.pullDepartments({school_id,department_id});
}, },
catchAvatar(){ catchAvatar(){
/*wx.showActionSheet({
itemList: ["更改头像", "使用微信头像"],
})*/
app.navigateTo({url:"{image_crop}"}); app.navigateTo({url:"{image_crop}"});
}, },
addDepartment(){ addDepartment(){
@ -273,7 +315,7 @@ Page({
let { target: { id } } = e; let { target: { id } } = e;
if (id) { if (id) {
if ((id == 'name' || id == "gender") && this.data.authen) if ((id == 'name' || id == "gender") && this.data.authen)
this.showError({ message: `重新实名认证以更改${id == "name" ? "姓名" : id == 'gender' ? "性别" : '此信息'}`, during: 1400 }); this.showError({ message: `到官网重新实名认证以更改${id == "name" ? "姓名" : id == 'gender' ? "性别" : '此信息'}`, during: 1400 });
this.setData({edited:1}); this.setData({edited:1});
} }
}, },

@ -2,5 +2,5 @@
"usingComponents": { "usingComponents": {
"add-department":"./add-department/add-department" "add-department":"./add-department/add-department"
}, },
"navigationBarTitleText": "基本信息" "navigationBarTitleText": "个人信息"
} }

@ -1,14 +1,17 @@
<view class="profile"> <view class="profile">
<form bindtap="onTap" bindsubmit="onSubmit" bindreset="refresh"> <form bindtap="onTap" bindsubmit="onSubmit" bindreset="refresh">
<view class="sticky">
<view class="header"> <view class="header">
<view class="error {{showError?'show':''}}"><text class="single-line">{{error}}</text></view> <view class="error {{showError?'show':''}}"><text class="single-line">{{error}}</text></view>
<view wx:if="{{!edited}}">点击相应项编辑信息</view> <button wx:if="{{!base_info_completed}}" open-type="getUserInfo" bindgetuserinfo="onGetUserInfo" type="main" size="mini" lang="zh_CN">填入微信个人信息</button>
<button wx:else form-type="reset" size="mini" type="main">重置信息</button> <view wx:elif="{{!edited}}">点击相应项编辑信息</view>
<button wx:else form-type="reset" size="mini" type="main">重置修改</button>
<button class="submit" form-type="submit" size="mini" type="main"> <button class="submit" form-type="submit" size="mini" type="main">
<icon type="success_no_circle" color="white"></icon> <icon type="success_no_circle" color="white"></icon>
<text>保存</text> <text>保存</text>
</button> </button>
</view> </view>
</view>
<view class="form-item"> <view class="form-item">
<text class="key">昵称头像</text> <text class="key">昵称头像</text>
<input class="value" id="nickname" placeholder="输入昵称" name="nickname" value="{{nickname}}" bindinput="updateNickName"></input> <input class="value" id="nickname" placeholder="输入昵称" name="nickname" value="{{nickname}}" bindinput="updateNickName"></input>
@ -32,9 +35,9 @@
</view> </view>
<view class="form-item"> <view class="form-item">
<text>所在地</text> <text>所在地</text>
<picker class="value" id="location-city" bindcolumnchange="onCitiesChange" bindchange="onLocationChange" range="{{[locations,cities]}}" value="{{[location_index, city_index]}}" mode="multiSelector">{{locations[location_index]}} {{cities[city_index]||'请选择'}}</picker> <picker class="value" id="location-city" bindcolumnchange="onCitiesChange" bindchange="onLocationChange" range="{{[locations,cities]}}" value="{{[location_index, city_index]}}" mode="multiSelector">{{locations[location_index]||location||''}} {{cities[city_index]||location_city||'请选择'}}</picker>
<input hidden="1" disabled="1" name="location" value="{{locations[location_index]}}"></input> <input hidden="1" disabled="1" name="location" value="{{locations[location_index]||location||''}}"></input>
<input hidden="1" disabled="1" name="location_city" value="{{cities[city_index]}}"></input> <input hidden="1" disabled="1" name="location_city" value="{{cities[city_index]||location_city||''}}"></input>
</view> </view>
<view class="gap"></view> <view class="gap"></view>
<view class="form-item"> <view class="form-item">
@ -64,7 +67,7 @@
</view> </view>
</form> </form>
<view class="footer"> <view class="footer">
<text>*我们确保您所提供的信息均处于严格保密状态,不会泄露</text> <text>*EduCoder将确保您所提供的信息均处于严格保密状态,不会泄露</text>
</view> </view>
</view> </view>
<button wx:if="{{false}}" open-type="getUserInfo" bindgetuserinfo="onGetUserInfo" lang="zh_CN" type="secondary">使用微信信息</button> <button wx:if="{{false}}" open-type="getUserInfo" bindgetuserinfo="onGetUserInfo" lang="zh_CN" type="secondary">使用微信信息</button>

@ -5,7 +5,11 @@
.profile, page { .profile, page {
height: 100%; height: 100%;
} }
.sticky{
top: 0;
position: sticky;
z-index: 10000;
}
.header { .header {
display: flex; display: flex;
align-items: center; align-items: center;
@ -23,7 +27,7 @@
bottom: 0; bottom: 0;
right: 0; right: 0;
transition: 0.72s all ease; transition: 0.72s all ease;
background: orange; background: #fa5151;
color: white; color: white;
padding: 0 20px; padding: 0 20px;
display: flex; display: flex;
@ -58,6 +62,6 @@
.footer { .footer {
font-size: 24rpx; font-size: 24rpx;
text-align: center; text-align: center;
margin-top: 12px; margin: 12px 0;
color: grey; color: grey;
} }

@ -3,7 +3,9 @@ import { client } from "./js/client";
wx.cloud.init({ wx.cloud.init({
traceUser: true, traceUser: true,
env: "educoder" env: "educoder",
success:console.log,
fail: console.error
}); });
App({ App({
@ -60,7 +62,7 @@ App({
this.globalData.scene = options.scene; this.globalData.scene = options.scene;
if(options.scene==1129){ if(options.scene==1129){
this.globalData.isCrawl = true; this.globalData.isCrawl = true;
this.cloudfunction("login")({mpcrawl: true}); // this.cloudfunction("login")({mpcrawl: true});
this.api("accounts.login")(global.accountManager.testAccount) this.api("accounts.login")(global.accountManager.testAccount)
.then(res=>{ .then(res=>{
let account = { ...res, ...global.accountManager.testAccount}; let account = { ...res, ...global.accountManager.testAccount};

@ -7,6 +7,7 @@
"backgroundColor": "#f5f5f5" "backgroundColor": "#f5f5f5"
}, },
"usingComponents": { "usingComponents": {
"iconfont":"/components/iconfont/iconfont",
"require-login": "/components/require-login/require-login" "require-login": "/components/require-login/require-login"
}, },
"pages": [ "pages": [

@ -1,11 +1,11 @@
@font-face { @font-face {
font-family: 'iconfont'; /* project id 1656783 */ font-family: 'iconfont'; /* project id 1656783 */
src: url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.eot'); src: url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.eot');
src: url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.eot?#iefix') format('embedded-opentype'), src: url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.woff2') format('woff2'), url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.woff2') format('woff2'),
url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.woff') format('woff'), url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.woff') format('woff'),
url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.ttf') format('truetype'), url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.ttf') format('truetype'),
url('//at.alicdn.com/t/font_1656783_1qepxw56cybi.svg#iconfont') format('svg'); url('//at.alicdn.com/t/font_1656783_wv69r0ez2j.svg#iconfont') format('svg');
} }
.iconfont { .iconfont {
display: inline-block; display: inline-block;
@ -121,4 +121,10 @@
} }
.icon-shezhi:before{ .icon-shezhi:before{
content: "\e625"; content: "\e625";
}
.icon-dengji:before{
content: "\e606";
}
.icon-chengyuan:before{
content: "\e62a";
} }

@ -1,6 +1,6 @@
const cloudDir = "cloud://educoder.6564-educoder-1300855313/"; const cloudDir = "cloud://educoder.6564-educoder-1300855313/";
let _version = "0.16.7"; let _version = "0.16.8";
/** /**
*/ */
let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync(); let { miniProgram:{ envVersion="release", version=_version}={}} = wx.getAccountInfoSync();

@ -11,6 +11,7 @@ Component({
type: Array, type: Array,
value: [], value: [],
observer: function observer(newVal) { observer: function observer(newVal) {
console.log("observer list change", newVal)
var _this = this; var _this = this;
if (newVal.length === 0) return; if (newVal.length === 0) return;
@ -30,6 +31,10 @@ Component({
ext:{ ext:{
type:Object type:Object
}, },
key:{
type:String,
value:"user_id"
},
vibrated: { vibrated: {
type: Boolean, type: Boolean,
value: true value: true

@ -12,7 +12,8 @@
<view class="index_list_item" wx:for="{{list}}" wx:key="alpha" id="{{item.letter=='#'?'hash':item.letter}}"> <view class="index_list_item" wx:for="{{list}}" wx:key="alpha" id="{{item.letter=='#'?'hash':item.letter}}">
<view class="index-group__title">{{item.letter}}</view> <view class="index-group__title">{{item.letter}}</view>
<view class="index-group__list"> <view class="index-group__list">
<view wx:for="{{item.items}}" wx:key="name" <!--@todo wx:key-->
<view wx:for="{{item.items}}" wx:key="user_id"
class="index-group__item" class="index-group__item"
data-item="{{item}}" data-item="{{item}}"
bindtap="choose"> bindtap="choose">

@ -35,10 +35,13 @@ Component({
refresh(){ refresh(){
let {course_id, course_identity} = this.data; let {course_id, course_identity} = this.data;
let {sort_type=''} = this; let {sort_type=''} = this;
wx.showLoading({
title: '加载中',
});
if(sort_type!='id') if(sort_type!='id')
app.api("weapps.courses.students")({course_id, limit:1000}).then(res=>{ app.api("weapps.courses.students")({course_id, limit:1000}).then(res=>{
var {students,students_count} = res; var {students,students_count} = res;
this.setData({students,students_count}); this.setData({students,students_count}, wx.hideLoading);
if(!this.imageMap) if(!this.imageMap)
this.imageMap = new Map(); this.imageMap = new Map();
for(var item of students){ for(var item of students){
@ -61,7 +64,7 @@ Component({
else else
students = []; students = [];
var {students_count} = res; var {students_count} = res;
this.setData({ students, students_count}); this.setData({ students, students_count}, wx.hideLoading);
}); });
let ext = {course_id, course_identity}; let ext = {course_id, course_identity};
this.setData({ext}); this.setData({ext});

@ -57,7 +57,7 @@ class Client{
}); });
this.on("success","accounts.login", res=>{ this.on("success","accounts.login", res=>{
this.synch=0; this.synch=0;
this.user = {}; this.user = res;
this.save_cookies(); this.save_cookies();
}); });
this.on("success", "accounts.register", res => { this.on("success", "accounts.register", res => {

@ -136,7 +136,7 @@ class AccountManager{
} }
setCurrentAccount(account,sync=1){ setCurrentAccount(account,sync=1){
this.currentAccount = account; this.currentAccount = account;
this.currentAccount.active = account.active||1; //登录保存 登录不保存 保存不登录 不保存不登录 this.currentAccount.active = account.active||1;
if (sync) if (sync)
this.setStorage(); this.setStorage();
} }
@ -211,7 +211,7 @@ export const accountManager = global.accountManager = new AccountManager();
export function getWXACodeUrl({url, scene}){ export function getWXACodeUrl({url, scene}){
return global.config.imgDir + "wxacode/" + (url + "?" + scene).replace(/[\/?&]/g, "_") + ".jpeg"; return global.config.imgDir + "wxacode/" + (url + "?" + scene).replace(/[\/?=&]/g, "_") + ".jpeg";
} }
//https://www.educoder.net/shixuns/ac46rzbw/challenges/3481 //https://www.educoder.net/shixuns/ac46rzbw/challenges/3481
export function parseUrl({url}){ export function parseUrl({url}){

@ -18,6 +18,10 @@ Component({
key, key,
success: res=>{ success: res=>{
this.setData({_nodes:res.data}); this.setData({_nodes:res.data});
wx.setStorage({
data: {},
key,
})
}, },
}); });
return key; return key;
@ -47,6 +51,7 @@ Component({
methods: { methods: {
handleTap(e){ handleTap(e){
console.log("onTap", e);
var {target:{dataset:{data}},currentTarget:{dataset:{data:_data}}} = e; var {target:{dataset:{data}},currentTarget:{dataset:{data:_data}}} = e;
let {tag, attr} = _data; let {tag, attr} = _data;
if(tag=='navigator'&&attr.href){ if(tag=='navigator'&&attr.href){
@ -63,7 +68,8 @@ Component({
if(data&&data._e.tag=="code") if(data&&data._e.tag=="code")
data={attr:{class:"h2w__pre"},child:[data],tag:"view",type:"tag",_e:{type:"tag",attr:{},tag:"pre", child:[data]}} data={attr:{class:"h2w__pre"},child:[data],tag:"view",type:"tag",_e:{type:"tag",attr:{},tag:"pre", child:[data]}}
if(data&&data._e.tag=='pre'){ if(data&&data._e.tag=='pre'){
data = {theme:'light',child:[data],_e:{child:[data]}} data = {theme:'light',child:[data],_e:{child:[data]}};
var key = "RICH_MD_STORAGE"
wx.setStorage({ wx.setStorage({
key,data,success:res=>{ key,data,success:res=>{
wx.navigateTo({ wx.navigateTo({

@ -260,7 +260,8 @@ Page({
this.checkTime(); this.checkTime();
}, },
onHide: function () { onHide: function () {
this.updateFile(); if(this.content)
this.updateFile();
}, },
onShareAppMessage: function () { onShareAppMessage: function () {

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

@ -2,7 +2,10 @@
<image class="image" lazy-load src="{{eduUrl}}/{{data.pic}}"></image> <image class="image" lazy-load src="{{eduUrl}}/{{data.pic}}"></image>
<view class="detail"> <view class="detail">
<view class="name"><rich-text nodes="{{data.title}}"/></view> <view class="name"><rich-text nodes="{{data.title}}"/></view>
<view class="level">初级</view> <view class="data-detail">
<view class="level"><iconfont type="dengji" size="17" fontsize="14" color="dimgrey"/>{{data.level}}</view>
<view class="level"><iconfont type="chengyuan" size="17" fontsize="14" color="dimgrey"/>{{data.study_count}}</view>
</view>
</view> </view>
<view class="radio-wrp"> <view class="radio-wrp">
<view class="icon-wrp" catchtap="onTapRadio" > <view class="icon-wrp" catchtap="onTapRadio" >

@ -17,8 +17,12 @@
justify-content: space-between; justify-content: space-between;
flex: auto; flex: auto;
} }
.data-detail{
display: flex;
}
.level{ .level{
font-size: 12px; font-size: 12px;
margin-right: 10px;
} }
.highlight{ .highlight{
color: #00b0f0; color: #00b0f0;

@ -2,7 +2,6 @@
"navigationBarTitleText": "个人中心", "navigationBarTitleText": "个人中心",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"usingComponents": { "usingComponents": {
"iconfont":"/components/iconfont/iconfont",
"mp-icon":"/weui-miniprogram/icon/icon" "mp-icon":"/weui-miniprogram/icon/icon"
} }
} }

@ -53,6 +53,7 @@
<button open-type="feedback" class="nav" style="width:auto"> <button open-type="feedback" class="nav" style="width:auto">
<iconfont class="icon" type="fankui" size="21" />小程序反馈 <iconfont class="icon" type="fankui" size="21" />小程序反馈
<text class="tip">有问题,来反馈</text>
<iconfont type="jinru" color="dimgrey" size="15" class="enter"></iconfont> <iconfont type="jinru" color="dimgrey" size="15" class="enter"></iconfont>
</button> </button>
<button open-type="contact" class="nav" style="width:auto"> <button open-type="contact" class="nav" style="width:auto">

@ -1,7 +1,7 @@
<navigator class="bg{{data.id%7}} course" url="/course/pages/course/course?course_id={{data.id}}" bindlongpress="showAction"> <navigator class="bg{{data.id%7}} course" url="/course/pages/course/course?course_id={{data.id}}" bindlongpress="showAction">
<view wx:if="{{data.sticky}}" class="sticky"></view> <view wx:if="{{data.sticky}}" class="sticky"></view>
<view class="header"> <view class="operations" catchtap="showAction">
<mp-icon class="action" icon="more" catchtap="showAction" type="field" color="white"/> <mp-icon icon="more" type="field" color="white"/>
</view> </view>
<view class="body"> <view class="body">
<image class="avatar" src="{{eduImgDir}}{{data.avatar_url}}" /> <image class="avatar" src="{{eduImgDir}}{{data.avatar_url}}" />

@ -19,19 +19,19 @@
.bg6{ .bg6{
background-image: linear-gradient(to bottom right, #3a1c71, #d76d77, #ffaf7b);/*#3a1c71, #d76d77, #ffaf7b*/ background-image: linear-gradient(to bottom right, #3a1c71, #d76d77, #ffaf7b);/*#3a1c71, #d76d77, #ffaf7b*/
} }
.header{ .operations{
text-align: end; position: absolute;
} top: 0;
.action{ right: 0;
width: 22px; height: 30px;
height: 18px; width: 32px;
padding: 1px 9px 0 0; text-align: center;
} }
.course{ .course{
color: white; color: white;
font-size:13px; font-size:13px;
border-radius: 5px; border-radius: 5px;
padding: 0px 2px 12px 8px; padding: 17px 2px 11px 8px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
@ -43,11 +43,12 @@
background: orange; background: orange;
top: -6px; top: -6px;
left: -16px; left: -16px;
border-bottom: #f0f0f0 2px solid; border-bottom: #f0f0f0 3px solid;
} }
.body{ .body{
display: flex; display: flex;
padding-right: 6px; padding-right: 6px;
align-items: center;
} }
.avatar{ .avatar{
@ -56,7 +57,7 @@
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
flex: none; flex: none;
margin: 0 16px 0 8px; margin: 0 16px 4px 8px;
background: #eee; /*for out of network*/ background: #eee; /*for out of network*/
} }
.course-info{ .course-info{

@ -86,7 +86,16 @@ Component({
url: "/course/pages/course/course?course_id=" + id + "&course_name=" + course_name, url: "/course/pages/course/course?course_id=" + id + "&course_name=" + course_name,
}) })
}, },
pullCourses: function ({ refresh = 0, showError=1} = {}) { pullCourses: async function ({ refresh = 0, showError=1} = {}) {
if(refresh&&app.user().user_id==2){
// mock
this.setData({courses:[], status: 401, loading: false});
/*if(showError)
wx.showToast({
title: '请先登录哦',icon:"none"
})*/
return {courses:[]};
}
if (refresh) { if (refresh) {
if (refresh == 1) { if (refresh == 1) {
this.options.page = 1; this.options.page = 1;

@ -7,7 +7,7 @@
</view> </view>
<view wx:if="{{courses.length==0&&!loading}}" class="none-content"> <view wx:if="{{courses.length==0&&!loading}}" class="none-content">
<image class="none-image" src="{{attachDir}}908959" mode="aspectFit"></image> <image class="none-image" src="{{attachDir}}908959" mode="aspectFit"></image>
<text class="none-text">暂时没有课堂</text> <text class="none-text">{{user_id==2?'登陆后查看课堂':'暂时没有课堂'}}</text>
<button bindtap="onTapButton" wx:if="{{user_id==2||current_cate==0}}" type="main" class="login-button">{{user_id==2?'登录':'加入课堂'}}</button> <button bindtap="onTapButton" wx:if="{{user_id==2||current_cate==0}}" type="main" class="login-button">{{user_id==2?'登录':'加入课堂'}}</button>
</view> </view>
<view wx:for="{{courses}}" wx:key="id" class="course-wrap"> <view wx:for="{{courses}}" wx:key="id" class="course-wrap">

@ -189,7 +189,7 @@ Page({
} }
}) })
}, },
initCanvas(src) { initCanvas(src="") {
const { cropperOpt } = this.data; const { cropperOpt } = this.data;
Object.assign(cropperOpt, { src }); Object.assign(cropperOpt, { src });
this.mycropper = new WeCropper(cropperOpt); this.mycropper = new WeCropper(cropperOpt);
@ -225,11 +225,8 @@ Page({
}, },
onLoad(option) { onLoad(option) {
this.setCanvasOptions(); this.setCanvasOptions();
const { src } = option; const { src="" } = option;
if (src) { this.initCanvas(src);
this.initCanvas(src); this.chooseImage({navback:1})
} else {
this.chooseImage({navback:1})
}
} }
}) })
Loading…
Cancel
Save