1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import {liveStatus, logicStatus} from "../../model/enum";
- import User from "../../model/user";
- import Api from "../../model/api";
- import {formatYMD, getDataSet} from "../../utils/utils";
- import Route from "../../model/route";
- Page({
- data: {
- liveStatusEnum: liveStatus,
- rows: [],
- messageTemplate: '',
- isFinish: false,
- },
- onLoad: function (options) {
- },
- async onShow(e) {
- const isLogin = User.isLogin();
- this.setData({
- isLogin,
- })
- if (isLogin) {
- const res = await Api.getUserProjects();
- res.data = res.data.map(item => {
- item.teamStart = formatYMD(item.teamStart);
- item.teamEnd = formatYMD(item.teamEnd);
- return item;
- })
- this.setData({
- rows: res.data,
- messageTemplate: res.messageTemplate,
- }, () => {
- if (res.data.length == 1 && !this.data.isFinish) {
- let e = {currentTarget: {dataset: {item: res.data[0]}}};
- this.toEdu(e)
- }
- this.setData({
- isFinish: true,
- })
- })
- }
- },
- onTabItemTap(object) {
- this.setData({
- isFinish: false,
- })
- },
- toLogin(e) {
- Route.toLogin();
- },
- toEdu(e) {
- const item = getDataSet(e, "item");
- if (item.isRegister) {
- wx.requestSubscribeMessage({
- tmplIds: this.data.messageTemplate.split(","),
- })
- Route.toEduDetail(item.teamId, logicStatus.NO)
- } else {
- Route.toStuInfo(item.teamId, item.eduStuId)
- }
- },
- })
|