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 { export interface ActionSheetItem {
label: string; label: string;
color?: string; color?: string;

View File

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

View File

@@ -40,7 +40,7 @@
</scroll> </scroll>
</swiper-item> </swiper-item>
</swiper> </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> <view>
<foot-tab iconList="{{aIconList}}"/> <foot-tab iconList="{{aIconList}}"/>
</view> </view>

View File

@@ -111,7 +111,6 @@ export function fetchPost(url, params, needToken, multiple) {
// wx.redirectTo({ // wx.redirectTo({
// url: '/pages/login/index', // url: '/pages/login/index',
// }) // })
isUnLogin();
reject(res); reject(res);
return; return;
} else if (res.data.err_code == 30022) { } else if (res.data.err_code == 30022) {
@@ -176,7 +175,7 @@ export function fetchGet(url, params, needToken) {
resolve(res.data); resolve(res.data);
} else { } else {
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) { if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
isUnLogin(); // isUnLogin();
reject(res); reject(res);
return; return;
} else if (res.data.err_code == 20005) { } else if (res.data.err_code == 20005) {
@@ -228,6 +227,12 @@ export default {
* 任务清单 * 任务清单
*/ */
taskList(params) { 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);
}, },
} }