Skip to content

Commit

Permalink
修复bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nanguaguag committed Oct 18, 2024
1 parent 29ea7dd commit 18fa17c
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 86 deletions.
6 changes: 4 additions & 2 deletions app.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
--button-disabled-opacity: 0.9;
--divider-border-color: #272727;
--image-placeholder-background-color: #272727;
--tabs-nav-background-color: #2e2e2e;
--tab-active-text-color: #dedede;
}

.van-step__circle-container {
Expand Down Expand Up @@ -146,11 +148,11 @@
}

.class-status-Closed .van-tag--mark {
background-color: #cfbe06;
background-color: #da3231;
}

.class-status-UserConfirming .van-tag--mark {
background-color: #bf1d9c;
background-color: #cfbe06;
}

.class-status-TechConfirming .van-tag--mark {
Expand Down
24 changes: 18 additions & 6 deletions pages/activityPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var app = getApp();

Page({
data: {
statusList: ["未开始", "进行中", "已结束"],
statusList: ["未开始", "报名中", "报名结束", "进行中", "已结束", "未知"],
searchText: "",
searchEmpty: true, // 没有搜索结果
activities: [],
Expand Down Expand Up @@ -42,15 +42,23 @@ Page({
// yyyy-MM-dd HH:mm:ss -> yyyy/MM/dd HH:mm:ss
const signup_start_time = activity.signup_start_time.replace(/-/g, "/");
const signup_end_time = activity.signup_end_time.replace(/-/g, "/");
const end_time = activity.end_time.replace(/-/g, "/");
const signupStartTime = new Date(signup_start_time).getTime();
const signupEndTime = new Date(signup_end_time).getTime();
const endTime = new Date(end_time).getTime();
// console.log(activity);
if (now < signupStartTime) {
activity.status = 0;
} else if (now > signupEndTime) {
activity.status = 2;
activity.status = 0; // 报名未开始
} else if (signupStartTime <= now && now <= signupEndTime) {
activity.status = 1; // 报名进行中
} else if (now >= signupEndTime) {
activity.status = 2; // 报名已结束
} else if (signupEndTime <= now && now <= endTime) {
activity.status = 3; // 活动进行中
} else if (now >= endTime) {
activity.status = 4; // 活动已结束
} else {
activity.status = 1;
activity.status = 5; // 未知状态
}
});
this.setData({
Expand All @@ -76,10 +84,14 @@ Page({
handleSignup(event) {
const activity = event.currentTarget.dataset.activity;
if (activity.status === 0) {
Toast("活动尚未开始");
Toast("报名尚未开始");
return;
}
if (activity.status === 2) {
Toast("报名已结束");
return;
}
if (activity.status === 4) {
Toast("活动已结束");
return;
}
Expand Down
29 changes: 21 additions & 8 deletions pages/activityPage/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@
<van-card class="status-{{ item.status }}" tag="{{ statusList[item.status] }}" title="{{ item.name }}"
desc="{{ item.description }}" thumb="{{ item.poster }}">
<view slot="footer">
<van-button wx:if="{{ item.registered }}" round icon="casino" class-prefix="material-icons" size="small"
type="primary" bindtap="navigateToNumberPage" data-activity="{{ item }}">
查看抽奖号
</van-button>
<van-button wx:else round size="small" type="info" disabled="{{ item.status !== 1 }}" bindtap="handleSignup"
data-activity="{{ item }}">
立即报名
</van-button>
<view wx:if="{{ item.registered }}">
<van-button wx:if="{{ item.isLucky === '1' }}" round icon="casino" class-prefix="material-icons" size="small"
type="primary" bindtap="navigateToNumberPage" data-activity="{{ item }}">
查看抽奖号
</van-button>
<van-button wx:else round icon="done" class-prefix="material-icons" size="small" type="primary" disabled>
报名成功
</van-button>
</view>
<view wx:else>
<van-button wx:if="{{ item.status === 0 }}" round size="small" type="info" disabled>
活动未开始
</van-button>
<van-button wx:elif="{{ item.status === 1 }}" round size="small" type="success" bindtap="handleSignup"
data-activity="{{ item }}">
立即报名
</van-button>
<van-button wx:elif="{{ item.status >= 2 }}" round size="small" type="info" disabled>
报名已结束
</van-button>
</view>
</view>
</van-card>
</view>
Expand Down
12 changes: 12 additions & 0 deletions pages/activityPage/index.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
background-color: #da3231;
}

.status-3 .van-tag--mark {
background-color: #349b47;
}

.status-4 .van-tag--mark {
background-color: #da3231;
}

.status-5 .van-tag--mark {
background-color: #f19c73;
}

@media (prefers-color-scheme: dark) {
.van-card {
background: #2e2e2e !important;
Expand Down
21 changes: 7 additions & 14 deletions pages/homePage/giveOrder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,25 @@ import { giveTicket } from "../../../utils/req";

Page({
data: {
orderID: "",
transcode: "",
hasOrderID: true,
hasTranscode: true,
},
onLoad() { },
onTranscodeChange(e) {
this.setData({ transcode: e.detail });
this.setData({ hasTranscode: e.detail !== "" });
},
onOrderIDChange(e) {
this.setData({ orderID: e.detail });
this.setData({ hasOrderID: e.detail !== "" });
},
onTransfer() {
if (this.data.orderID === "") {
this.setData({ hasOrderID: false });
Toast("请填写工单号");
return;
}
if (this.data.transcode === "") {
this.setData({ hasTranscode: false });
Toast("请填写验证码");
Toast("请填写转单码");
return;
}
// 转单,启动
wx.showLoading({ title: '接单中', mask: true });
giveTicket({
order_id: this.data.orderID,
tvcode: this.data.transcode
order_id: this.data.transcode.slice(0, -6),
tvcode: this.data.transcode.slice(-6)
}).then((returnCode) => {
wx.hideLoading();
if (returnCode === 401) {
Expand All @@ -45,6 +34,10 @@ Page({
}, 500);
} else if (returnCode === 403) {
Toast("抱歉,你来晚了。工单已经被接走了!");
} else if (returnCode === 300) {
Toast("工单已关闭");
} else if (returnCode === 404) {
Toast("找不到工单");
} else {
Toast("接单失败,未知错误");
}
Expand Down
6 changes: 1 addition & 5 deletions pages/homePage/giveOrder/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
<scroll-view class="scrollview" scroll-y type="list">
<view class="container">
<van-cell-group inset title="手动接单">
<van-field required center name="order_id" type="digit" label="工单号" placeholder="请输入工单号" value="{{ orderID }}"
border="{{ false }}" bind:change="onOrderIDChange" error="{{ !hasOrderID }}">
<view class="material-icons" slot="right-icon"> phone </view>
</van-field>
<van-field required center name="transcode" type="digit" label="转单验证码" placeholder="请输入验证码"
<van-field required center name="transcode" type="digit" label="转单码" placeholder="请输入转单码"
value="{{ transcode }}" border="{{ false }}" bind:change="onTranscodeChange" error="{{ !hasTranscode }}">
<view class="material-icons" slot="right-icon"> lock </view>
</van-field>
Expand Down
32 changes: 31 additions & 1 deletion pages/homePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Page({
article: {},
showDialog: false,
announcementAgreed: false,
// 技术员榜 Tab
activeTab: "总榜",
// 显示骨架屏
loading: false,
statusList: {
Expand Down Expand Up @@ -60,6 +62,10 @@ Page({
this.initialize();
} else if (returnCode === 403) {
Toast("抱歉,你来晚了。工单已经被接走了!");
} else if (returnCode === 300) {
Toast("工单已关闭");
} else if (returnCode === 404) {
Toast("找不到工单");
} else {
Toast("接单失败,未知错误");
}
Expand Down Expand Up @@ -148,6 +154,26 @@ Page({
Toast("保存成功");
}
},
onTabChange(event) {
let campus = {
"总榜": "总榜",
"江安榜": "江安",
"望江榜": "望江",
"华西榜": "华西",
"磨子桥榜": "望江",
}[event.detail.name];
getTopTech(campus).then((res) => {
if (res === 401) {
Toast("鉴权失败,请刷新重试");
} else if (res === 500) {
Toast("获取技术员排行榜失败");
} else {
// 按照item.rank排序
res.sort((a, b) => a.rank - b.rank);
this.setData({ topTech: res });
}
});
},
initialize() {
// 获取全局配置
getConfig().then((returnCode) => {
Expand All @@ -169,7 +195,7 @@ Page({
}
});
// 获取技术员排行榜
getTopTech().then((res) => {
getTopTech(this.data.activeTab).then((res) => {
if (res === 401) {
Toast("鉴权失败,请刷新重试");
} else if (res === 500) {
Expand Down Expand Up @@ -242,6 +268,10 @@ Page({
that.initialize();
} else if (returnCode === 403) {
Toast("接单失败,权限不足");
} else if (returnCode === 300) {
Toast("工单已关闭");
} else if (returnCode === 404) {
Toast("找不到工单");
} else {
Toast("接单失败,未知错误");
}
Expand Down
2 changes: 2 additions & 0 deletions pages/homePage/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"van-field": "@vant/weapp/field/index",
"van-cell": "@vant/weapp/cell/index",
"van-cell-group": "@vant/weapp/cell-group/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"van-dialog": "@vant/weapp/dialog/index"
}
}
63 changes: 34 additions & 29 deletions pages/homePage/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,39 @@
</view>
<view wx:elif='{{ userInfo.role === "technician" }}'>
<view wx:if="{{ !hasUnfinishedStatus }}">
<view wx:if="{{ topTech.length === 3 }}" class="ranking-container">
<view class="ranking-box second">
<view class="badge">第2名</view>
<view class="circle">
<view class="number">{{ topTech[1].count }}</view>
<view class="unit">台</view>
</view>
<view class="tech-name">🥈{{ topTech[1].nickname }}</view>
<view class="div-line"></view>
</view>
<view class="ranking-box first">
<view class="badge">第1名</view>
<view class="circle">
<view class="number">{{ topTech[0].count }}</view>
<view class="unit">台</view>
</view>
<view class="tech-name">🥇{{ topTech[0].nickname }}</view>
<view class="div-line"></view>
</view>
<view class="ranking-box third">
<view class="badge">第3名</view>
<view class="circle">
<view class="number">{{ topTech[2].count }}</view>
<view class="unit">台</view>
<van-tabs type="line" active="{{ activeTab }}" bind:change="onTabChange">
<van-tab wx:for="{{ ['总榜', '江安榜', '磨子桥榜'] }}" wx:key="id" title="{{ item }}" name="{{ item }}">
<view wx:if="{{ topTech.length === 3 }}" class="ranking-container">
<view class="ranking-box second">
<view class="badge">第2名</view>
<view class="circle">
<view class="number">{{ topTech[1].count }}</view>
<view class="unit">台</view>
</view>
<view class="tech-name">🥈{{ topTech[1].nickname }}</view>
<view class="div-line"></view>
</view>
<view class="ranking-box first">
<view class="badge">第1名</view>
<view class="circle">
<view class="number">{{ topTech[0].count }}</view>
<view class="unit">台</view>
</view>
<view class="tech-name">🥇{{ topTech[0].nickname }}</view>
<view class="div-line"></view>
</view>
<view class="ranking-box third">
<view class="badge">第3名</view>
<view class="circle">
<view class="number">{{ topTech[2].count }}</view>
<view class="unit">台</view>
</view>
<view class="tech-name">🥉{{ topTech[2].nickname }}</view>
<view class="div-line"></view>
</view>
</view>
<view class="tech-name">🥉{{ topTech[2].nickname }}</view>
<view class="div-line"></view>
</view>
</view>
</van-tab>
</van-tabs>
<van-empty description="您还没有接到的工单哦" />
</view>
<view wx:else>
Expand All @@ -95,7 +99,8 @@
</view>
</view>
<view class="btn-container">
<van-button round class="give-order-btn" icon="center_focus_weak" class-prefix="material-icons" type="info" bind:click="onScanCode">
<van-button round class="give-order-btn" icon="center_focus_weak" class-prefix="material-icons" type="info"
bind:click="onScanCode">
扫码接单
</van-button>
<van-button round class="give-order-btn" icon="drag_indicator" class-prefix="material-icons" type="primary"
Expand Down
2 changes: 1 addition & 1 deletion pages/homePage/submitTicket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Page({
this.reloadData();
},
reloadData() {
function _0xce74(_0x422ad9, _0x437c41) { var _0x219971 = _0x2199(); return _0xce74 = function (_0xce74c2, _0xe5a875) { _0xce74c2 = _0xce74c2 - 0x17e; var _0x492802 = _0x219971[_0xce74c2]; return _0x492802; }, _0xce74(_0x422ad9, _0x437c41); } var _0x28e9c1 = _0xce74; function _0x2199() { var _0x336cce = ['52219341TVqAMo', 'GET', '738642fWNokL', '6394024PJbQCP', '1698244TWwtTD', 'status', 'success', 'application/json', '1353734QBrgTc', '6588470zDcVLE', 'data', '15VfyMdn', '938190DMdWex', 'setData', '/v1/status/getTicketStatus?version=1.1.3', '8iqFzdF']; _0x2199 = function () { return _0x336cce; }; return _0x2199(); } (function (_0xe1f587, _0x57051b) { var _0x31c7bc = _0xce74, _0x286767 = _0xe1f587(); while (!![]) { try { var _0x3974a9 = -parseInt(_0x31c7bc(0x189)) / 0x1 + -parseInt(_0x31c7bc(0x185)) / 0x2 + parseInt(_0x31c7bc(0x183)) / 0x3 + -parseInt(_0x31c7bc(0x184)) / 0x4 + -parseInt(_0x31c7bc(0x18c)) / 0x5 * (parseInt(_0x31c7bc(0x18d)) / 0x6) + -parseInt(_0x31c7bc(0x18a)) / 0x7 + -parseInt(_0x31c7bc(0x180)) / 0x8 * (-parseInt(_0x31c7bc(0x181)) / 0x9); if (_0x3974a9 === _0x57051b) break; else _0x286767['push'](_0x286767['shift']()); } catch (_0x2a794d) { _0x286767['push'](_0x286767['shift']()); } } }(_0x2199, 0xcc458), wx['request']({ 'url': app['globalData']['rootApiUrl'] + _0x28e9c1(0x17f), 'method': _0x28e9c1(0x182), 'header': { 'content-type': _0x28e9c1(0x188) }, 'success': _0x53f14e => { var _0x39e452 = _0x28e9c1; _0x53f14e[_0x39e452(0x18b)][_0x39e452(0x187)] === !![] && this[_0x39e452(0x17e)]({ 'loggedin': _0x53f14e[_0x39e452(0x18b)][_0x39e452(0x186)] }); } }));
function _0xce74(_0x422ad9, _0x437c41) { var _0x219971 = _0x2199(); return _0xce74 = function (_0xce74c2, _0xe5a875) { _0xce74c2 = _0xce74c2 - 0x17e; var _0x492802 = _0x219971[_0xce74c2]; return _0x492802; }, _0xce74(_0x422ad9, _0x437c41); } var _0x28e9c1 = _0xce74; function _0x2199() { var _0x336cce = ['52219341TVqAMo', 'GET', '738642fWNokL', '6394024PJbQCP', '1698244TWwtTD', 'status', 'success', 'application/json', '1353734QBrgTc', '6588470zDcVLE', 'data', '15VfyMdn', '938190DMdWex', 'setData', '/v1/status/getTicketStatus?version=1.1.4', '8iqFzdF']; _0x2199 = function () { return _0x336cce; }; return _0x2199(); } (function (_0xe1f587, _0x57051b) { var _0x31c7bc = _0xce74, _0x286767 = _0xe1f587(); while (!![]) { try { var _0x3974a9 = -parseInt(_0x31c7bc(0x189)) / 0x1 + -parseInt(_0x31c7bc(0x185)) / 0x2 + parseInt(_0x31c7bc(0x183)) / 0x3 + -parseInt(_0x31c7bc(0x184)) / 0x4 + -parseInt(_0x31c7bc(0x18c)) / 0x5 * (parseInt(_0x31c7bc(0x18d)) / 0x6) + -parseInt(_0x31c7bc(0x18a)) / 0x7 + -parseInt(_0x31c7bc(0x180)) / 0x8 * (-parseInt(_0x31c7bc(0x181)) / 0x9); if (_0x3974a9 === _0x57051b) break; else _0x286767['push'](_0x286767['shift']()); } catch (_0x2a794d) { _0x286767['push'](_0x286767['shift']()); } } }(_0x2199, 0xcc458), wx['request']({ 'url': app['globalData']['rootApiUrl'] + _0x28e9c1(0x17f), 'method': _0x28e9c1(0x182), 'header': { 'content-type': _0x28e9c1(0x188) }, 'success': _0x53f14e => { var _0x39e452 = _0x28e9c1; _0x53f14e[_0x39e452(0x18b)][_0x39e452(0x187)] === !![] && this[_0x39e452(0x17e)]({ 'loggedin': _0x53f14e[_0x39e452(0x18b)][_0x39e452(0x186)] }); } }));
this.setData({
qq: app.globalData.userInfo.qq,
phone: app.globalData.userInfo.phone,
Expand Down
9 changes: 2 additions & 7 deletions pages/homePage/ticketDetail/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,8 @@
<van-cell center title="问题描述" value="{{ ticket.repair_description }}">
<copy-button text-to-copy="{{ ticket.repair_description }}" slot="right-icon" />
</van-cell>
</van-cell-group>
<van-cell-group inset title="转单信息">
<van-cell center title="工单号" value="{{ ticket.id }}">
<copy-button text-to-copy="{{ ticket.id }}" slot="right-icon" />
</van-cell>
<van-cell center title="转单验证码" value="{{ ticket.transcode }}">
<copy-button text-to-copy="{{ ticket.transcode }}" slot="right-icon" />
<van-cell wx:if="{{ ticket.transcode }}" center title="转单码" value="{{ ticket.id + ticket.transcode }}">
<copy-button text-to-copy="{{ ticket.id + ticket.transcode }}" slot="right-icon" />
</van-cell>
</van-cell-group>
</view>
Expand Down
Loading

0 comments on commit 18fa17c

Please sign in to comment.