mock方法

This commit is contained in:
2022-11-17 21:09:17 +08:00
parent eec0e5575f
commit 0a8e99c94c
4 changed files with 20 additions and 17 deletions

View File

@@ -1,5 +1,3 @@
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
export interface ActionSheetItem {
label: string;
color?: string;

View File

@@ -8,6 +8,7 @@ Page({
* 页面的初始数据
*/
data: {
tapCheckHandle: undefined,
aIconList: ['check-rectangle', 'star-filled', 'notification', 'info-circle'],
taskList: [{'taskId':'1','title':'标题德外旗舰店1','note':'2022-11-11'},{'taskId':'2','title':'标题德外旗舰店2','note':'2022-11-11'}],
todayList: [{'taskId':'1','title':'标题德外旗舰店1','note':'2022-11-11'},{'taskId':'2','title':'标题德外旗舰店2','note':'2022-11-11'}],
@@ -122,37 +123,36 @@ Page({
this.setCurrentData(currentCur,categoryData);
},
handleAction(e) {
console.log('testade');
console.log(e.detail);
try{
ActionSheet.show({
this.data.tapCheckHandle = ActionSheet.show({
theme: ActionSheetTheme.List,
selector: '#t-action-sheet',
context: this,
items: [
{
label: '默认选项',
label: '详情xxx',
},
{
label: '自定义选项',
label: '截止日期xxx',
color: '#0052D9',
},
{
label: '失效选项',
disabled: true,
label: '配置提醒',
color: '#0052D9',
},
{
label: '警告选项',
label: '删除xxx',
color: '#e34d59',
},
],
});}catch (e){
console.log(e);
}
});
},
handleSelected(e) {
console.log(e.detail);
},
selectCancel() {
this.data.tapCheckHandle.close();
},
onLoad() {
let categoryData = [];
this.data.categoryMenu.forEach(index =>{

View File

@@ -40,7 +40,7 @@
</scroll>
</swiper-item>
</swiper>
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" />
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" bind:cancel="selectCancel"/>
<view>
<foot-tab iconList="{{aIconList}}"/>
</view>

View File

@@ -111,7 +111,6 @@ export function fetchPost(url, params, needToken, multiple) {
// wx.redirectTo({
// url: '/pages/login/index',
// })
isUnLogin();
reject(res);
return;
} else if (res.data.err_code == 30022) {
@@ -176,7 +175,7 @@ export function fetchGet(url, params, needToken) {
resolve(res.data);
} else {
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
isUnLogin();
// isUnLogin();
reject(res);
return;
} else if (res.data.err_code == 20005) {
@@ -228,6 +227,12 @@ export default {
* 任务清单
*/
taskList(params) {
return fetchGet('', params, false);
return new Promise(x => {
let job = {data:'test'};
x(job)
console.log(x + '请求成功');
wx.hideLoading();
})
// return fetchGet('', params, false);
},
}