账号左划删除

master
educoder_weapp 5 years ago
parent 57aa083a00
commit b42f4ca2e5

File diff suppressed because one or more lines are too long

@ -3,7 +3,8 @@ const app = getApp();
Page({
data: {
eduImgDir: global.config.eduImgDir
eduImgDir: global.config.eduImgDir,
buttons:[{text:"删除",type:"warn"}]
},
onLoad: function (options) {
@ -58,7 +59,24 @@ Page({
this.setData({ accounts, user: res.user, currentAccountSaved, currentAccount,loading:0});
})
},
removeAccount(e){
deleteAccount({user_id}){
accountManager.removeAccount({user_id});
if(this.data.user.user_id==user_id){
accountManager.clearCurrentAccount();
app.client.session.cookies = "";
app.client.synch = 0;
}
},
removeAccount2(e){
console.log(e);
let { currentTarget: { dataset: { id: user_id } } } = e;
this.deleteAccount({user_id});
setTimeout(()=>{
this.refresh();
},300);
},
removeAccount1(e){
console.log(e);
let { currentTarget: { dataset: { id: user_id } } } = e;
var info = this.data.user.user_id == user_id?'退出登录并移除':"移除此账号";
@ -67,12 +85,7 @@ Page({
success:res=>{
if(res.tapIndex==0){
console.log(user_id);
accountManager.removeAccount({user_id});
if(this.data.user.user_id==user_id){
accountManager.clearCurrentAccount();
app.client.session.cookies = "";
app.client.synch = 0;
}
this.deleteAccount({user_id});
this.refresh();
}
}

@ -1,4 +1,6 @@
{
"usingComponents": {},
"usingComponents": {
"mp-slideview": "/weui-miniprogram/slideview/slideview"
},
"navigationBarTitleText": "切换账号"
}

@ -1,25 +1,28 @@
<page-meta>
<navigation-bar loading="{{loading}}"/>
<navigation-bar loading="{{loading}}" />
</page-meta>
<view>
<view class="message single-line {{showMessage&&message?'':'hidden'}}">
{{message}}
</view>
<view wx:for="{{accounts}}" class="account" data-id="{{item.user_id}}" bindtap="switchAccount" bindlongpress="removeAccount" wx:key="user_id">
<image src="{{eduImgDir}}{{item.image_url}}" class="avatar"></image>
<view class="info">
<view class="name">{{item.name}}</view>
<view class="login">{{item.login}}</view>
</view>
<view class="status" wx:if="{{item.user_id==user.user_id}}">
<icon type="success_no_circle" color="#00b0f0"></icon>
</view>
</view>
<view class="empty" wx:if="{{accounts.length==0}}">
<text>暂无账号</text>
</view>
<button class="addAccount" type="main" bindtap="addAccount">添加账号</button>
<button class="nav-back" type="main" plain="1" bindtap="navBack">返回</button>
<view class="tip">长按移除</view>
<view class="message single-line {{showMessage&&message?'':'hidden'}}">
{{message}}
</view>
<mp-slideview wx:for="{{accounts}}" data-id="{{item.user_id}}" buttons="{{buttons}}"
bindtap="switchAccount" bindlongpress="removeAccount1" bindbuttontap="removeAccount2"
wx:key="user_id">
<view class="account" >
<image src="{{eduImgDir}}{{item.image_url}}" class="avatar"></image>
<view class="info">
<view class="name">{{item.name}}</view>
<view class="login">{{item.login}}</view>
</view>
<view class="status" wx:if="{{item.user_id==user.user_id}}">
<icon type="success_no_circle" color="#00b0f0"></icon>
</view>
</view>
</mp-slideview>
<view class="empty" wx:if="{{accounts.length==0}}">
<text>暂无账号</text>
</view>
<button class="addAccount" type="main" bindtap="addAccount">添加账号</button>
<button class="nav-back" type="main" plain="1" bindtap="navBack">返回</button>
</view>

@ -46,12 +46,6 @@
.nav-back{
margin-top: 8px;
}
.tip{
font-size: 12px;
text-align: center;
margin-top: 8px;
color: dimgray;
}
.empty{
text-align: center;
color: dimgray;

@ -35,7 +35,7 @@ Component({
if(!this.checkInput())
return;
let {remarks, name, school_id} = this.data;
let content = name + remarks?""+remarks:'';
let content = name + (remarks?""+remarks:'');
wx.showLoading({
title: '检查内容中...'
})

@ -22,7 +22,7 @@
}
.departments{
overflow: scroll;
max-height: 36vh;
max-height: 210px;
transition: 1px all ease;
}
.departments.hidden{
@ -31,4 +31,6 @@
.department{
padding: 4px;
padding-left: 22px;
}
line-height: 20px;
height: 20px;
}

@ -1,7 +1,7 @@
const app = getApp();
Page({
data: {
current: 1,
current: 0,
content:"加载中...",
titles: ["任务描述", "代码文件", "测评结果"],
can_use_editor:wx.canIUse("editor")
@ -48,10 +48,11 @@ Page({
this.oldLines = this.lines;
this.lines = this.content.split(/\n/g);
if(this.oldLines.length+1==this.lines.length){
for(var i=this.oldLines.length;i>=0;i--){
for(var i=this.oldLines.length-1;i>=0;i--){
if(this.lines[i+1]!=this.oldLines[i]){
let indent = this.oldLines[i].length - this.oldLines[i].trimStart().length;
this.editor.insertText({text:" ".repeat(indent)});
let match = this.lines[i].match(/^\s+/);
if(match)
this.editor.insertText({text:match[0]});
break;
}
}

@ -30,7 +30,7 @@
"skeletonGenerateFilesWithoutConfirm": true
},
"compileType": "miniprogram",
"libVersion": "2.10.4",
"libVersion": "2.11.0",
"appid": "wxc5c2b711f23f3a1d",
"projectname": "educoder_weapp",
"debugOptions": {
@ -153,6 +153,20 @@
"pathName": "task/pages/task/task",
"query": "identifier=ji2wy8sqkou5",
"scene": null
},
{
"id": -1,
"name": "account/pages/profile/school_select/school_select",
"pathName": "account/pages/profile/school_select/school_select",
"query": "course_id=5876",
"scene": null
},
{
"id": -1,
"name": "account/pages/profile/profile",
"pathName": "account/pages/profile/profile",
"query": "course_id=5876",
"scene": null
}
]
}

Loading…
Cancel
Save