parent
da974380fb
commit
8bc73d7bd8
File diff suppressed because one or more lines are too long
@ -1,66 +1,238 @@
|
||||
const app = getApp();
|
||||
var locationData;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
eduImgDir:global.config.eduImgDir,
|
||||
locations:[],
|
||||
cities:[],
|
||||
identities:[{value:"teacher", text:"教师"},{value:"student",text:"学生"},{value:"professional", text:"专业人士"}],
|
||||
technicalTitles:{
|
||||
0:["教授","副教授","讲师","助教"],
|
||||
2:["企业管理者","部门管理者","高级工程师","工程师","助理工程师"]
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
refresh(){
|
||||
console.log(locationData);
|
||||
app.api("users.accounts")().then(res=>{
|
||||
this.originInfo = res;
|
||||
res.authen = res.authentication == "certified";
|
||||
res.pro_authen = res.professional_certification == "certified";
|
||||
this.setData(res);
|
||||
if(!locationData)
|
||||
this.readData();
|
||||
this.setInfo(res);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
setInfo(res){
|
||||
let locations = Object.keys(locationData);
|
||||
let location_index = locations.indexOf(res.location);
|
||||
let cities = locationData[res.location] || [];
|
||||
let city_index = cities.indexOf(res.location_city);
|
||||
let identity_index = -1;
|
||||
let { identities } = this.data;
|
||||
for (var i = 0; i < identities.length; i++) {
|
||||
if (identities[i].value == res.identity) {
|
||||
identity_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var technical_index = -1;
|
||||
if (identity_index == 0 || identity_index == 2) {
|
||||
let technicals = this.data.technicalTitles[identity_index];
|
||||
for (var i = 0; i < technicals.length; i++) {
|
||||
if (technicals[i] == res.technical_title) {
|
||||
technical_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setData({ locations, cities, location_index, city_index, identity_index, technical_index });
|
||||
if (res.school_id) {
|
||||
this.changeSchoolDepartment(res);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
updateAccount(data){
|
||||
app.api("users.accounts",{method:"PUT"})(data).then(res=>{
|
||||
app.showMsg(res);
|
||||
setTimeout(res=>{
|
||||
wx.navigateBack({
|
||||
delta:1
|
||||
});
|
||||
},400)
|
||||
}).catch(e=>{
|
||||
this.showError(e);
|
||||
})
|
||||
},
|
||||
onGenderChange({detail:{value}}){
|
||||
console.log("gender change", value);
|
||||
this.setData({gender:value});
|
||||
},
|
||||
onLocationChange(e){
|
||||
console.log(e)
|
||||
let {detail:{value:[location_index, city_index]}} = e;
|
||||
this.setData({location_index, city_index});
|
||||
},
|
||||
onCitiesChange(e){
|
||||
console.log(e);
|
||||
let {detail:{value,column}} = e;
|
||||
if(column==0)
|
||||
this.setData({cities:locationData[this.data.locations[value]],location_index:value ,city_index:0});
|
||||
},
|
||||
onIdentityChange(e){
|
||||
console.log(e);
|
||||
let {detail:{value}} = e;
|
||||
this.setData({identity_index:value, technical_index:-1});
|
||||
},
|
||||
onTechnicalChange(e){
|
||||
console.log(e);
|
||||
let { detail: { value } } = e;
|
||||
this.setData({technical_index: value});
|
||||
},
|
||||
onDepartmentChange(e){
|
||||
console.log(e);
|
||||
let { detail: { value } } = e;
|
||||
this.setData({department_index:value});
|
||||
},
|
||||
changeSchoolDepartment({school_name, school_id,department_id, department_name}){
|
||||
this.setData({departments:[], department_id, department_name, school_id, school_name});
|
||||
app.api("schools.departments.for_option")({school_id})
|
||||
.then(res=>{
|
||||
let {departments} = res;
|
||||
let department_index = -1;
|
||||
for(var i=0; i<departments.length;i++){
|
||||
if(departments[i].id==department_id){
|
||||
department_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.setData({departments, department_index});
|
||||
});
|
||||
},
|
||||
catchAvatar(){
|
||||
app.navigateTo({url:"{image_crop}"});
|
||||
},
|
||||
readData(){
|
||||
let fileManager = wx.getFileSystemManager();
|
||||
let data = fileManager.readFileSync("/account/pages/profile/data.png", "utf-8");
|
||||
locationData = JSON.parse(data);
|
||||
console.log("readData", locationData);
|
||||
},
|
||||
onLoad: function (options) {
|
||||
this.refresh();
|
||||
},
|
||||
onShow: function () {
|
||||
|
||||
if(this.secondShow){
|
||||
app.api("users.accounts")()
|
||||
.then(res=>{
|
||||
let {avatar_url} = res;
|
||||
this.setData({avatar_url});
|
||||
})
|
||||
} //@todo: better solution?
|
||||
this.secondShow = 1;
|
||||
let data = wx.getStorageSync("SET-SCHOOL-DEPARTMENT-KEY");
|
||||
if(data){
|
||||
this.changeSchoolDepartment(data);
|
||||
wx.setStorageSync("SET-SCHOOL-DEPARTMENT-KEY",'');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
checkProInfo(value){
|
||||
let info = this.originInfo;
|
||||
if (info.identity != value.identity)
|
||||
return true;
|
||||
if(info.identity=='student'){
|
||||
if(info.student_id!=info.student_id)
|
||||
return true;
|
||||
}else{
|
||||
if (info.technical_title!=info.technical_title)
|
||||
return true;
|
||||
}
|
||||
if(info.school_id!=value.school_id||info.department_id!=value.department_id)
|
||||
return true
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
onSubmit(e){
|
||||
let {detail:{value}} = e;
|
||||
if(!this.checkInput(value)) return;
|
||||
if(this.data.pro_authen&&this.checkProInfo(value)){
|
||||
wx.showModal({
|
||||
title: '确认修改',
|
||||
content: '您修改了职业信息,保存后认证信息会清空,\n需要重新进行职业认证',
|
||||
confirmText:"保存",
|
||||
success:res=>{
|
||||
if(res.confirm)
|
||||
this.saveInfo(value);
|
||||
}
|
||||
});
|
||||
}else
|
||||
this.saveInfo(value);
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
checkInput(value){
|
||||
var showTip = key=>{
|
||||
this.showError({ message: `请填写${key}`});
|
||||
return false;
|
||||
}
|
||||
if(!value.nickname)
|
||||
return showTip("昵称");
|
||||
if(!value.name)
|
||||
return showTip("姓名");
|
||||
if(value.gender==null)
|
||||
return showTip("性别");
|
||||
if (!value.location)
|
||||
return showTip("所在地");
|
||||
if (!value.location_city)
|
||||
return showTip("所在地");
|
||||
if(!value.identity)
|
||||
return showTip("职业");
|
||||
if(value.identity=='student'){
|
||||
if(!value.student_id)
|
||||
return showTip("学号");
|
||||
}else{
|
||||
if (!value.technical_title)
|
||||
return showTip("职称");
|
||||
}
|
||||
if(!value.school_id)
|
||||
return showTip("学校/单位");
|
||||
if (!value.department_id)
|
||||
return showTip("院系/部门");
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
saveInfo(value){
|
||||
app.api("users.accounts", { method: "PUT" })(value)
|
||||
.then(res => {
|
||||
res.message = "更新成功";
|
||||
app.showMsg(res);
|
||||
console.log("success", res);
|
||||
setTimeout(() => {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 420);
|
||||
}).catch(e => {
|
||||
this.showError(e);
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
onTap(e){
|
||||
console.log(e);
|
||||
let { target: { id } } = e;
|
||||
if (id) {
|
||||
if ((id == 'name' || id == "gender") && this.data.authen)
|
||||
this.showError({ message: `请重新实名认证以更改${id == "name" ? "姓名" : id == 'gender' ? "性别" : '此信息'}`, during: 1400 });
|
||||
this.setData({edited:1});
|
||||
}
|
||||
},
|
||||
showError(e){
|
||||
let {message:error, during=2000} = e;
|
||||
if(error){
|
||||
this.setData({showError:1, error});
|
||||
setTimeout(()=>{
|
||||
this.setData({showError:0});
|
||||
}, during);
|
||||
}
|
||||
},
|
||||
onUnload: function () {
|
||||
|
||||
}
|
||||
})
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": ""
|
||||
}
|
@ -1,2 +1,66 @@
|
||||
<!--miniprogram/account/pages/profile/profile.wxml-->
|
||||
<text>miniprogram/account/pages/profile/profile.wxml</text>
|
||||
<view class="profile">
|
||||
<form bindtap="onTap" bindsubmit="onSubmit" bindreset="refresh">
|
||||
<view class="header">
|
||||
<view class="error {{showError?'show':''}}"><text class="single-line">{{error}}</text></view>
|
||||
<view wx:if="{{!edited}}">点击相应项编辑信息</view>
|
||||
<button wx:else form-type="reset" size="mini" type="main">重置信息</button>
|
||||
<button class="submit" form-type="submit" size="mini" type="main">
|
||||
<icon type="success_no_circle" color="white"></icon>
|
||||
<text>保存</text>
|
||||
</button>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="key">昵称头像</text>
|
||||
<input class="value" id="nickname" placeholder="输入昵称" name="nickname" value="{{nickname}}"></input>
|
||||
<image class="avatar" bindtap="catchAvatar" src="{{eduImgDir}}{{avatar_url}}"></image>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="key">
|
||||
<text>姓名</text>
|
||||
</view>
|
||||
<input class="value" id="name" placeholder="输入姓名" disabled="{{authen}}" name="name" value="{{name}}"></input>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="key">显示姓名
|
||||
<text class="tip">关闭后将展示您的昵称</text>
|
||||
</text>
|
||||
<switch color="#00b0f0" id="show_realname" name="show_realname" checked="{{show_realname}}"></switch>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text>性别</text>
|
||||
<picker class="value" id="gender" name="gender" range="{{['男','女']}}" bindcolumnchange="log" value="{{gender}}" disabled="{{authen}}" bindchange="onGenderChange">{{gender==0?'男':gender==1?'女':'未设置'}}</picker>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<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>
|
||||
<input hidden="1" disabled="1" name="location" value="{{locations[location_index]}}"></input>
|
||||
<input hidden="1" disabled="1" name="location_city" value="{{cities[city_index]}}"></input>
|
||||
</view>
|
||||
<view class="gap"></view>
|
||||
<view class="form-item">
|
||||
<text class="key">职业</text>
|
||||
<picker class="value" id="identity" range="{{identities}}" bindchange="onIdentityChange" range-key="text" value="{{identity_index}}">{{identities[identity_index].text||'请选择'}}</picker>
|
||||
<input hidden="1" name="identity" disabled="1" value="{{identities[identity_index].value}}"/>
|
||||
</view>
|
||||
<view wx:if="{{identity_index==1}}" class="form-item">
|
||||
<text class="key">学号</text>
|
||||
<input class="value" id="school_id" type="number" name="student_id" placeholder="输入学号" cursor-spacing="100" value="{{student_id}}"></input>
|
||||
</view>
|
||||
<view wx:elif="{{identity_index==0||identity_index==2}}" class="form-item">
|
||||
<text class="key">职称</text>
|
||||
<picker class="value" id="technical_title" bindchange="onTechnicalChange" range="{{technicalTitles[identity_index]}}" value="{{technical_index}}">{{technicalTitles[identity_index][technical_index]||'请选择'}}</picker>
|
||||
<input hidden="1" disabled="1" name="technical_title" value="{{technicalTitles[identity_index][technical_index]}}"></input>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="key">学校/单位</text>
|
||||
<input hidden="1" disabled="1" name="school_id" type="number" value="{{school_id}}"></input>
|
||||
<navigator class="value" id="school" hover-class="none" url="/account/pages/profile/school_select/school_select">{{school_name||'请选择'}}</navigator>
|
||||
</view>
|
||||
<view class="form-item" wx:if="{{school_id}}">
|
||||
<text class="key">院系/部门</text>
|
||||
<picker class="value" id="department" range="{{departments}}" range-key="name" bindchange="onDepartmentChange" value="{{department_index}}">{{departments[department_index].name||department_name||'请选择'}}</picker>
|
||||
<input hidden="1" disabled="1" name="department_id" type="number" value="{{departments[department_index].id}}"></input>
|
||||
</view>
|
||||
</form>
|
||||
|
||||
</view>
|
@ -1 +1,71 @@
|
||||
/* miniprogram/account/pages/profile/profile.wxss */
|
||||
.profile,page{
|
||||
background: #eeeeee;
|
||||
height: 100%;
|
||||
}
|
||||
.header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #00b0f0;
|
||||
color: white;
|
||||
padding: 0 8px 0 16px;
|
||||
position: relative;
|
||||
}
|
||||
.header>.error{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
transition: 0.72s all ease;
|
||||
background: orange;
|
||||
color: white;
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
}
|
||||
.error.show{
|
||||
opacity: 1;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.header>button{
|
||||
margin: 2px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.form-item{
|
||||
background: #fefefe;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
.form-item>.value{
|
||||
text-align: right;
|
||||
flex: auto;
|
||||
}
|
||||
.form-item>.key{
|
||||
display: inline-block;
|
||||
flex: none;
|
||||
}
|
||||
.form-item .tip{
|
||||
font-size: 12px;
|
||||
color: dimgray;
|
||||
}
|
||||
.form-item>switch{
|
||||
transform: scale(0.8)
|
||||
}
|
||||
.gap{
|
||||
height: 3px;
|
||||
}
|
||||
.avatar{
|
||||
border-radius: 50%;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
margin: 0 14px;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
const app = getApp();
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
_id: Number,
|
||||
name: String
|
||||
},
|
||||
data: {
|
||||
departments: []
|
||||
},
|
||||
methods: {
|
||||
onTapHeader() {
|
||||
if (!this.data.departments || this.data.departments.length == 0) {
|
||||
app.api("schools.departments.for_option")({
|
||||
school_id: this.data._id
|
||||
})
|
||||
.then(res => {
|
||||
let {
|
||||
departments
|
||||
} = res;
|
||||
this.setData({
|
||||
departments
|
||||
});
|
||||
});
|
||||
}
|
||||
this.setData({ showDepartments: !this.data.showDepartments });
|
||||
},
|
||||
onTapDepartment(e) {
|
||||
console.log(e);
|
||||
let { target: { dataset: { name: department_name, id: department_id } } } = e;
|
||||
if (!department_id) return;
|
||||
let { _id: school_id, name: school_name } = this.data;
|
||||
let data = { school_id, school_name, department_id, department_name };
|
||||
wx.setStorageSync("SET-SCHOOL-DEPARTMENT-KEY", data);
|
||||
wx.navigateBack({
|
||||
delta:1
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<view class="school">
|
||||
<view class="header" bindtap="onTapHeader">
|
||||
<view class="triangle {{showDepartments?'rotate':''}}"></view>
|
||||
<view>{{name}}</view>
|
||||
</view>
|
||||
<view class="departments {{showDepartments?'':'hidden'}}" bindtap="onTapDepartment">
|
||||
<view class="department" wx:for="{{departments}}" data-id="{{item.id}}" data-name="{{item.name}}">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,34 @@
|
||||
.school{
|
||||
background: white;
|
||||
border-radius: 4px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
.header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
.triangle{
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
border-top: solid 4px transparent;
|
||||
border-bottom: solid 4px transparent;
|
||||
border-left: solid 5px #222222;
|
||||
transition: 1s ease all;
|
||||
margin: 2px 7px 2px 5px;
|
||||
}
|
||||
.rotate{
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.departments{
|
||||
overflow: scroll;
|
||||
max-height: 36vh;
|
||||
transition: 1px all ease;
|
||||
}
|
||||
.departments.hidden{
|
||||
max-height: 0px;
|
||||
}
|
||||
.department{
|
||||
padding: 4px;
|
||||
padding-left: 22px;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
schools:[]
|
||||
},
|
||||
onConfirm({detail:{value}}){
|
||||
console.log(value);
|
||||
if(!value) return;
|
||||
this.search({keyword:value});
|
||||
},
|
||||
onSubmit({detail:{value}}){
|
||||
console.log(value);
|
||||
if(!value.keyword) return;
|
||||
this.search({keyword:value.keyword});
|
||||
},
|
||||
search({keyword}){
|
||||
return app.api("schools.for_option")({keyword})
|
||||
.then(res => {
|
||||
let { schools } = res;
|
||||
if (schools.length > 100) {
|
||||
schools = schools.slice(0, 100);
|
||||
}
|
||||
this.setData({ schools });
|
||||
if(schools.length==0)
|
||||
wx.showToast({
|
||||
title:"没有相关单位",icon:"none"
|
||||
})
|
||||
})
|
||||
},
|
||||
clearKeyword(){
|
||||
this.setData({schools:[],_keyword:'',keyword:''});
|
||||
},
|
||||
onInput({detail:{value}}){
|
||||
this.setData({_keyword: value})
|
||||
},
|
||||
onLoad: function (options) {
|
||||
let {keyword} = options;
|
||||
if(keyword){
|
||||
this.setData({keyword, _keyword: keyword});
|
||||
this.search({keyword})
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"school-item": "./school-item/school-item"
|
||||
},
|
||||
"navigationBarTitleText": "选择单位"
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<view class="body">
|
||||
<form bindsubmit="onSubmit">
|
||||
<view class="search">
|
||||
<view class="search-bar">
|
||||
<icon type="search"></icon>
|
||||
<input placeholder="学校/单位" auto-focus="1" name="keyword" bindinput="onInput" value="{{keyword}}" bindconfirm="onConfirm"></input>
|
||||
<icon wx:if="{{_keyword}}" type="clear" bindtap="clearKeyword"></icon>
|
||||
</view>
|
||||
<button form-type="submit" size="mini" type="main">搜索</button>
|
||||
</view>
|
||||
</form>
|
||||
<scroll-view class="schools" scroll-y="1">
|
||||
<view class="school-wrap" wx:for="{{schools}}" wx:key="id">
|
||||
<school-item _id="{{item.id}}" name="{{item.name}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
@ -0,0 +1,34 @@
|
||||
.body{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
.search{
|
||||
display: flex;
|
||||
padding: 0 12px 2px 12px;
|
||||
background: white;
|
||||
flex: none;
|
||||
}
|
||||
.search-bar{
|
||||
display: flex;
|
||||
padding: 0 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #00b0f0;
|
||||
flex: auto;
|
||||
align-items: center;
|
||||
margin-right: 16px;
|
||||
}
|
||||
.search-bar>input{
|
||||
flex: auto;
|
||||
padding: 3px;
|
||||
}
|
||||
.search>button{
|
||||
flex: none;
|
||||
}
|
||||
.schools{
|
||||
flex: 1 1 1px;
|
||||
height: 1px;
|
||||
}
|
||||
.school-wrap{
|
||||
margin-bottom: 1.2px;
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
<import src="/avatar/we-cropper/dist/we-cropper.wxml"/>
|
||||
<view class="cropper-wrapper">
|
||||
<template is="we-cropper" data="{{...cropperOpt}}" />
|
||||
<view class="operation flex-wrap">
|
||||
<button class="upload" bindtap="uploadTap">
|
||||
重新选择
|
||||
<import src="/avatar/we-cropper/dist/we-cropper.wxml" />
|
||||
<block wx:if="{{cropperOpt}}">
|
||||
<view class="cropper-wrapper">
|
||||
<template is="we-cropper" data="{{...cropperOpt}}" />
|
||||
</view>
|
||||
<view class="operations flex-row">
|
||||
<button class="upload" type="main" plain="1" bindtap="uploadTap">
|
||||
重选图片
|
||||
</button>
|
||||
<button type="primary" class="getCropperImage" bindtap="getCropperImage">
|
||||
确定
|
||||
<button type="main" class="getCropperImage" bindtap="getCropperImage">
|
||||
确定
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
@ -1,5 +1,5 @@
|
||||
<scroll-view wx:if="{{list.length>1}}" scroll-x="1" class="navbar {{type}} bar-class" scroll-left="{{scrollLeft}}rpx" scroll-with-animation="1" style="width:{{width}}rpx;background:{{bg}}">
|
||||
<view wx:for="{{list}}" wx:key="index" class="view common {{type}} item-class {{cur == index ?'active':''}}" data-current="{{index}}" bindtap="switchNav" style="margin-right:{{mg}}rpx;{{_itemWidth>0?'width:'+_itemWidth+'rpx':''}} ">
|
||||
<text class="text common {{type}} item-class {{current == index ?'active':''}}">{{item.text}}</text>
|
||||
<text class="text common {{type}} item-class {{cur == index ?'active':''}}">{{item.text}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
@ -0,0 +1,14 @@
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
data:Object
|
||||
},
|
||||
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
}
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<view class="attendance" bindtap="onTap">
|
||||
<view class="header">
|
||||
<text class="title">{{data.name}}</text>
|
||||
<text class="attendance-button" catchtap="onTapButton">签到</text>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<text>签到时间:{{data.start_time}}-{{data.end_time}}</text>
|
||||
<text>{{data.mode=='QUICK'?'快捷签到':data.mode=='QRCODE'?'扫码签到':'数字签到'}}</text>
|
||||
</view>
|
||||
</view>
|
@ -0,0 +1,27 @@
|
||||
.header{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
}
|
||||
.attendance{
|
||||
background: #f4f4f4;
|
||||
box-shadow: 2px 2px 6px #d0d0d0;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
}
|
||||
.attendance-button{
|
||||
background: #00b0f0;
|
||||
border-radius: 3px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
padding: 3px 6px;
|
||||
}
|
||||
.footer{
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
const app = getApp();
|
||||
Component({
|
||||
properties: {
|
||||
course_id: {
|
||||
type: Number
|
||||
},
|
||||
id_: {
|
||||
type: Number
|
||||
},
|
||||
refresh: {
|
||||
type: Boolean,
|
||||
observer: function (v) {
|
||||
if (v) {
|
||||
this.refresh({refresh:1});
|
||||
this.setData({ refresh: false });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
async refresh({refresh=1}){
|
||||
let {course_id} = this.data;
|
||||
let data = await app.api("weapps.courses.attendances.student_attendances")({course_id});
|
||||
this.setData(data);
|
||||
}
|
||||
}
|
||||
})
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"attendance-item":"./attendance-item/attendance-item"
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<view class="module">
|
||||
<view class="info-display">
|
||||
<view class="info nomal">
|
||||
正常签到:{{normal_count}}
|
||||
</view>
|
||||
<view class="info leave">
|
||||
请假:{{leave_count}}
|
||||
</view>
|
||||
<view class="info absence">
|
||||
旷课:{{absence_count}}
|
||||
</view>
|
||||
</view>
|
||||
<nav-bar type="line" list="{{list}}"/>
|
||||
<scroll-view scroll-y="1">
|
||||
<view class="attendance-wrap" wx:for="{{current_attendance}}">
|
||||
<attendance-item data="{{item}}"/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
@ -0,0 +1,27 @@
|
||||
.module{
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: white;
|
||||
}
|
||||
.info-display{
|
||||
display: flex;
|
||||
margin: 16px 4px;
|
||||
}
|
||||
.info{
|
||||
flex: auto;
|
||||
text-align: center;
|
||||
}
|
||||
.nomal{
|
||||
color: rgb(38, 199, 201);
|
||||
}
|
||||
.leave{
|
||||
color:rgb(234, 174, 78);
|
||||
}
|
||||
.absence{
|
||||
color: rgb(255, 131, 92);
|
||||
}
|
||||
|
||||
.attendance-wrap{
|
||||
margin: 12px 8px;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
class Record{
|
||||
|
||||
}
|
||||
|
||||
export default function Api(options){
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue