mp_sqljc_inp.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <!-- 2026-09-24 升旗礼检查小程序专用页面。样式与 mp_ssnwjc_inp.html 保持一致。 -->
  5. <meta charset="UTF-8"/>
  6. <meta name="viewport"
  7. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  8. <title>升旗礼检查</title>
  9. <script src="/js/mp_base/base.js?v=20261127-auth-refresh-v1"></script>
  10. <style>
  11. [v-cloak] {
  12. display: none !important;
  13. }
  14. :root {
  15. --line: #e5e7eb;
  16. --text: #222222;
  17. --muted: #8b95a5;
  18. --soft: #f7f8fa;
  19. --green: #19a463;
  20. --green-soft: #eaf8f1;
  21. --danger: #e5484d;
  22. --danger-soft: #fff0f0;
  23. }
  24. * {
  25. box-sizing: border-box;
  26. }
  27. body {
  28. margin: 0;
  29. color: var(--text);
  30. background: #f3f4f6;
  31. font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
  32. "Microsoft YaHei", sans-serif;
  33. }
  34. #app {
  35. min-height: 100vh;
  36. padding-bottom: 86px;
  37. }
  38. .loading-container {
  39. display: flex;
  40. flex-direction: column;
  41. align-items: center;
  42. justify-content: center;
  43. min-height: 65vh;
  44. color: var(--muted);
  45. }
  46. .loading-spinner {
  47. width: 38px;
  48. height: 38px;
  49. margin-bottom: 12px;
  50. border: 4px solid #e6e8ec;
  51. border-top-color: var(--green);
  52. border-radius: 50%;
  53. animation: spin 0.9s linear infinite;
  54. }
  55. @keyframes spin {
  56. to {
  57. transform: rotate(360deg);
  58. }
  59. }
  60. .error-box {
  61. margin: 18px 14px;
  62. padding: 18px;
  63. color: var(--danger);
  64. background: var(--danger-soft);
  65. border: 1px solid #ffd0d0;
  66. border-radius: 6px;
  67. line-height: 1.6;
  68. }
  69. .page-content {
  70. padding: 12px 14px 0;
  71. }
  72. .info-table,
  73. .score-table {
  74. overflow: hidden;
  75. background: #fff;
  76. border: 1px solid var(--line);
  77. border-radius: 6px;
  78. }
  79. .info-row {
  80. display: grid;
  81. grid-template-columns: 92px 1fr;
  82. min-height: 58px;
  83. border-bottom: 1px solid var(--line);
  84. }
  85. .info-row:last-child {
  86. border-bottom: none;
  87. }
  88. .info-label {
  89. display: flex;
  90. align-items: center;
  91. justify-content: flex-end;
  92. padding: 12px 14px;
  93. color: var(--muted);
  94. background: #fbfbfc;
  95. border-right: 1px solid var(--line);
  96. font-size: 15px;
  97. }
  98. .info-value {
  99. display: flex;
  100. align-items: center;
  101. min-width: 0;
  102. padding: 11px 12px;
  103. font-size: 15px;
  104. }
  105. .select-cell {
  106. width: 100%;
  107. min-width: 0;
  108. }
  109. .select-cell > .ss-select-container {
  110. width: 100%;
  111. min-width: 0;
  112. }
  113. .info-text {
  114. align-items: flex-start;
  115. line-height: 1.55;
  116. overflow-wrap: anywhere;
  117. }
  118. .clickable {
  119. justify-content: space-between;
  120. gap: 10px;
  121. cursor: pointer;
  122. }
  123. .clickable-text {
  124. min-width: 0;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. white-space: nowrap;
  128. }
  129. .chevron {
  130. flex: 0 0 auto;
  131. color: #9aa3b2;
  132. font-size: 25px;
  133. line-height: 1;
  134. }
  135. .score-value {
  136. color: var(--green);
  137. font-weight: 700;
  138. font-size: 18px;
  139. }
  140. .veto-value {
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-between;
  144. gap: 12px;
  145. width: 100%;
  146. }
  147. .native-input {
  148. width: 100%;
  149. height: 38px;
  150. padding: 0 10px;
  151. color: var(--text);
  152. background: #fff;
  153. border: 0;
  154. outline: none;
  155. font: inherit;
  156. }
  157. .native-input::placeholder {
  158. color: #b4bbc6;
  159. }
  160. .score-table {
  161. margin-top: 12px;
  162. }
  163. .score-row {
  164. display: grid;
  165. grid-template-columns: minmax(0, 1fr) 132px;
  166. min-height: 68px;
  167. overflow: visible;
  168. border-bottom: 1px solid var(--line);
  169. }
  170. .score-row:last-child {
  171. border-bottom: none;
  172. }
  173. .score-name {
  174. display: flex;
  175. align-items: center;
  176. padding: 10px 12px;
  177. line-height: 1.45;
  178. font-size: 15px;
  179. }
  180. .score-max {
  181. display: flex;
  182. align-items: center;
  183. justify-content: center;
  184. color: var(--muted);
  185. border-left: 1px solid var(--line);
  186. font-size: 16px;
  187. }
  188. .stepper {
  189. display: grid;
  190. grid-template-columns: 48px minmax(0, 1fr) 40px;
  191. align-items: center;
  192. width: auto;
  193. min-width: 0;
  194. margin: 10px 7px;
  195. background: #fff;
  196. border: 1px solid #cfd4dc;
  197. border-radius: 5px;
  198. overflow: hidden;
  199. }
  200. .stepper-btn {
  201. display: inline-flex;
  202. align-items: center;
  203. justify-content: center;
  204. gap: 1px;
  205. height: 44px;
  206. padding: 0;
  207. color: #596273;
  208. background: #f3f4f6;
  209. border: 0;
  210. font-size: 24px;
  211. line-height: 1;
  212. appearance: none;
  213. }
  214. .stepper-btn:disabled {
  215. color: #c8cdd5;
  216. background: #eceff2;
  217. }
  218. .stepper-deduct-num {
  219. font-size: 15px;
  220. font-weight: 400;
  221. line-height: 1;
  222. }
  223. .stepper-btn-symbol {
  224. line-height: 1;
  225. }
  226. .stepper-value {
  227. width: 100%;
  228. min-width: 0;
  229. height: 44px;
  230. padding: 0 4px;
  231. text-align: center;
  232. background: #fff;
  233. border: 0;
  234. border-left: 1px solid #e1e4e9;
  235. border-right: 1px solid #e1e4e9;
  236. outline: none;
  237. font: inherit;
  238. font-size: 15px;
  239. font-weight: 400;
  240. }
  241. .score-total {
  242. display: flex;
  243. align-items: center;
  244. justify-content: space-between;
  245. padding: 14px 4px 0;
  246. color: var(--muted);
  247. font-size: 14px;
  248. }
  249. .score-total strong {
  250. color: var(--green);
  251. font-size: 18px;
  252. }
  253. .formula-note {
  254. padding: 4px 4px 0;
  255. color: var(--muted);
  256. text-align: right;
  257. font-size: 13px;
  258. }
  259. .empty-tip {
  260. padding: 16px 12px;
  261. color: var(--muted);
  262. text-align: center;
  263. font-size: 14px;
  264. }
  265. .warning-bar {
  266. margin: 12px 14px 0;
  267. padding: 11px 12px;
  268. color: #9a6700;
  269. background: #fff8e6;
  270. border: 1px solid #ffe8a3;
  271. border-radius: 6px;
  272. line-height: 1.5;
  273. font-size: 14px;
  274. }
  275. .submit-hint {
  276. margin: 12px 14px 0;
  277. padding: 11px 12px;
  278. color: var(--danger);
  279. background: var(--danger-soft);
  280. border: 1px solid #ffd0d0;
  281. border-radius: 6px;
  282. line-height: 1.5;
  283. font-size: 14px;
  284. }
  285. .bottom-spacer {
  286. height: 16px;
  287. }
  288. </style>
  289. </head>
  290. <body>
  291. <div id="app" v-cloak>
  292. <div v-if="loading" class="loading-container">
  293. <div class="loading-spinner"></div>
  294. <div>加载中...</div>
  295. </div>
  296. <div v-else-if="errorMsg" class="error-box">
  297. {{ errorMsg }}
  298. </div>
  299. <template v-else>
  300. <div v-if="warnMsg" class="warning-bar">{{ warnMsg }}</div>
  301. <div v-if="submitHint" class="submit-hint">{{ submitHint }}</div>
  302. <div class="page-content">
  303. <div class="info-table">
  304. <div class="info-row">
  305. <div class="info-label">检查人</div>
  306. <div class="info-value">{{ jcryxm || '—' }}</div>
  307. </div>
  308. <div class="info-row">
  309. <div class="info-label">检查日期</div>
  310. <div class="info-value">{{ inspectionDate }}</div>
  311. </div>
  312. <div class="info-row">
  313. <div class="info-label">入学年度</div>
  314. <div class="info-value">
  315. <div class="select-cell">
  316. <ss-select
  317. v-model="form.rxnd"
  318. cb="rxnd"
  319. placeholder=""
  320. @change="onRxndChange"
  321. />
  322. </div>
  323. </div>
  324. </div>
  325. <div class="info-row">
  326. <div class="info-label">班级</div>
  327. <div class="info-value">
  328. <div class="select-cell">
  329. <ss-select
  330. :key="'bj-' + form.rxnd"
  331. v-model="form.bjid"
  332. :cb="form.rxnd ? 'bjByRxnd' : ''"
  333. :url="bjUrl"
  334. :filter="{cascadingLevel: 'rxnd,bjid'}"
  335. :disabled="!form.rxnd"
  336. placeholder=""
  337. @change="onBjChange"
  338. />
  339. </div>
  340. </div>
  341. </div>
  342. <div class="info-row">
  343. <div class="info-label">说明</div>
  344. <div class="info-value">
  345. <input
  346. v-model="form.ms"
  347. class="native-input"
  348. maxlength="500"
  349. placeholder="请输入"
  350. />
  351. </div>
  352. </div>
  353. </div>
  354. <div class="score-table">
  355. <div v-if="!jcxmList.length" class="empty-tip">暂无检查项目</div>
  356. <div v-for="item in jcxmList" :key="item.sqljcxmm" class="score-row">
  357. <div class="score-name">
  358. {{ item.mc }}<span v-if="isScoreItem(item)"> ({{ item.mfz }})</span>
  359. </div>
  360. <div class="stepper">
  361. <button
  362. class="stepper-btn"
  363. type="button"
  364. :disabled="Number(item.value) <= 0"
  365. @click="changeStep(item, -1)"
  366. >
  367. <span class="stepper-btn-symbol">-</span><span
  368. v-if="deductedFs(item) > 0"
  369. class="stepper-deduct-num">{{ deductedFs(item) }}</span>
  370. </button>
  371. <input
  372. class="stepper-value"
  373. inputmode="numeric"
  374. :value="item.value"
  375. :min="0"
  376. :max="isScoreItem(item) ? item.mfz : null"
  377. @input="onStepInput(item, $event)"
  378. @blur="normalizeStep(item, $event)"
  379. />
  380. <button
  381. class="stepper-btn"
  382. type="button"
  383. :disabled="isScoreItem(item) && Number(item.value) >= Number(item.mfz)"
  384. @click="changeStep(item, 1)"
  385. >
  386. +
  387. </button>
  388. </div>
  389. </div>
  390. </div>
  391. <div class="score-total">
  392. <span>升旗礼总分</span>
  393. <strong>{{ totalFs }}</strong>
  394. </div>
  395. <div class="formula-note">{{ formulaNote }}</div>
  396. <div class="bottom-spacer"></div>
  397. </div>
  398. <ss-bottom
  399. :show-shyj="false"
  400. :buttons="submitting ? [{ text: '提交中...', action: 'submit' }] : bottomButtons"
  401. @button-click="handleBottomAction"
  402. :disabled="submitting"
  403. />
  404. </template>
  405. </div>
  406. <script>
  407. window.SS.ready(function () {
  408. window.SS.dom.initializeFormApp({
  409. el: "#app",
  410. data() {
  411. return {
  412. loading: true,
  413. submitting: false,
  414. fromList: false,
  415. errorMsg: "",
  416. warnMsg: "",
  417. submitHint: "",
  418. recordsToday: 0,
  419. bmmc: "",
  420. jcryxm: "",
  421. inspectionDate: "",
  422. formulaNote: "出勤率×25% + 队列分×20% + 风貌分×40% + 纪律分×15%",
  423. jcxmList: [],
  424. form: {
  425. rxnd: "",
  426. bjid: "",
  427. ms: ""
  428. },
  429. bottomButtons: [
  430. { text: "取消", action: "cancel" },
  431. { text: "保存并提交", action: "submit" }
  432. ]
  433. };
  434. },
  435. computed: {
  436. bjUrl() {
  437. const base = "/service?ssServ=loadObjpOpt&objectpickerdropdown1=1";
  438. const year = String(this.form.rxnd || "").trim();
  439. return year ? base + "&upperValue=" + encodeURIComponent(year) : base;
  440. },
  441. expectedStudents() {
  442. const countCodes = [3, 4, 5, 6, 7, 8];
  443. const exempt = countCodes.reduce(
  444. (sum, code) => sum + this.valueOfCode(code), 0);
  445. return Math.max(0, this.valueOfCode(1) - exempt);
  446. },
  447. attendanceRate() {
  448. if (this.expectedStudents <= 0)
  449. return 0;
  450. return Math.min(100, this.round2(
  451. this.valueOfCode(2) * 100 / this.expectedStudents));
  452. },
  453. totalFs() {
  454. const queueScore = this.valueOfCode(11);
  455. const demeanorScore = this.valueOfCode(21) + this.valueOfCode(22);
  456. const disciplineScore = this.valueOfCode(31);
  457. return this.round2(
  458. this.attendanceRate * 0.25
  459. + queueScore * 0.20
  460. + demeanorScore * 0.40
  461. + disciplineScore * 0.15);
  462. },
  463. },
  464. async mounted() {
  465. this.inspectionDate = this.formatLocalDate(new Date());
  466. // 从列表页「新增」进来时带 ?from=list:提交后直接回列表。Lin
  467. try {
  468. const params = new URLSearchParams(window.location.search);
  469. this.fromList = String(params.get("from") || "") === "list";
  470. } catch (_) {
  471. this.fromList = false;
  472. }
  473. try {
  474. const sessionOk = await this.ensureSession();
  475. if (!sessionOk)
  476. return;
  477. await this.loadInit();
  478. } catch (error) {
  479. console.error("[mp_sqljc_inp] 初始化失败", error);
  480. this.errorMsg = error && error.message ? error.message : "页面初始化失败";
  481. } finally {
  482. this.loading = false;
  483. }
  484. },
  485. methods: {
  486. getUrlParams() {
  487. const params = {};
  488. const search = new URLSearchParams(window.location.search);
  489. for (const [key, value] of search) {
  490. params[key] = decodeURIComponent(value);
  491. }
  492. return params;
  493. },
  494. getRequest() {
  495. return (window && window.request) || request;
  496. },
  497. // 小程序切换账号后,旧 H5 会话会写到别人名下,必须先刷新会话。Lin
  498. async ensureSession() {
  499. if (typeof window.ensureMiniProgramSessionFresh !== "function")
  500. return true;
  501. try {
  502. await window.ensureMiniProgramSessionFresh({
  503. page: "mp_sqljc_inp",
  504. service: "sqljc_mpInit",
  505. force: true
  506. });
  507. return true;
  508. } catch (error) {
  509. this.errorMsg = "登录状态刷新失败,请返回小程序重新进入";
  510. return false;
  511. }
  512. },
  513. async loadInit() {
  514. const data = await this.postService(
  515. "/service?ssServ=sqljc_mpInit&ssDest=data", {});
  516. this.bmmc = (data && data.bmmc) || "";
  517. this.jcryxm = (data && data.jcryxm) || "";
  518. this.jcxmList = ((data && data.jcxmList) || []).map((item) => {
  519. const mfz = item.mfz === null || item.mfz === undefined || item.mfz === ""
  520. ? null : Number(item.mfz);
  521. return {
  522. sqljcxmm: Number(item.sqljcxmm),
  523. mc: item.mc,
  524. mfz: mfz,
  525. defaultValue: item.defaultValue === null
  526. || item.defaultValue === undefined
  527. ? (mfz === null ? 0 : mfz)
  528. : Number(item.defaultValue),
  529. value: item.defaultValue === null
  530. || item.defaultValue === undefined
  531. ? (mfz === null ? 0 : mfz)
  532. : Number(item.defaultValue)
  533. };
  534. });
  535. },
  536. valueOfCode(code) {
  537. const item = this.jcxmList.find(
  538. (row) => Number(row.sqljcxmm) === Number(code));
  539. return item ? Number(item.value || 0) : 0;
  540. },
  541. round2(value) {
  542. const number = Number(value || 0);
  543. return Math.round(number * 100) / 100;
  544. },
  545. isScoreItem(item) {
  546. return item.mfz !== null && item.mfz !== undefined;
  547. },
  548. onRxndChange(value) {
  549. this.form.rxnd = value || "";
  550. this.form.bjid = "";
  551. },
  552. onBjChange(value) {
  553. this.form.bjid = value || "";
  554. },
  555. async postService(url, data) {
  556. const req = this.getRequest();
  557. if (!req || typeof req.post !== "function")
  558. throw new Error("请求组件未加载");
  559. const response = await req.post(url, data, {
  560. loading: false,
  561. formData: true
  562. });
  563. const raw = response && response.data !== undefined ? response.data : response;
  564. if (raw && raw.ssCode !== undefined && Number(raw.ssCode) !== 0)
  565. throw new Error(raw.ssMsg || "请求失败");
  566. return raw && raw.ssData !== undefined ? raw.ssData : raw;
  567. },
  568. // 打分项显示累计扣分;人数项没有满分,不显示扣分。Lin
  569. deductedFs(item) {
  570. if (!this.isScoreItem(item))
  571. return 0;
  572. const mfz = Number(item.mfz || 0);
  573. return Math.max(0, mfz - Number(item.value || 0));
  574. },
  575. // 所有数字项左右都可加减:打分项限 0..MFZ,人数项只限 >= 0。Lin
  576. changeStep(item, step) {
  577. let value = Number(item.value || 0) + step;
  578. if (value < 0)
  579. value = 0;
  580. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  581. value = Number(item.mfz || 0);
  582. item.value = value;
  583. },
  584. onStepInput(item, event) {
  585. const raw = String(event.target.value || "").replace(/[^0-9]/g, "");
  586. item.value = raw === "" ? "" : Number(raw);
  587. },
  588. normalizeStep(item, event) {
  589. let value = Number(String(event.target.value || "").replace(/[^0-9]/g, ""));
  590. if (!Number.isFinite(value) || value < 0)
  591. value = 0;
  592. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  593. value = Number(item.mfz || 0);
  594. item.value = value;
  595. },
  596. validateForm() {
  597. if (!this.form.rxnd)
  598. return "请选择入学年度";
  599. if (!this.form.bjid)
  600. return "请选择班级";
  601. if (!this.jcxmList.length)
  602. return "检查项目未配置";
  603. if (this.valueOfCode(1) <= 0)
  604. return "学员总人数必须大于0";
  605. if (this.expectedStudents <= 0)
  606. return "有效应到人数必须大于0";
  607. if (this.valueOfCode(2) > this.expectedStudents)
  608. return "队列人数不能大于有效应到人数";
  609. for (const item of this.jcxmList) {
  610. const value = Number(item.value || 0);
  611. if (value < 0)
  612. return item.mc + " 不能为负数";
  613. if (this.isScoreItem(item) && value > Number(item.mfz || 0))
  614. return item.mc + " 分值超出满分";
  615. }
  616. return "";
  617. },
  618. async submit() {
  619. if (this.submitting)
  620. return;
  621. const message = this.validateForm();
  622. if (message) {
  623. this.submitHint = message;
  624. this.warnMsg = "";
  625. this.showToast(message, "fail");
  626. return;
  627. }
  628. try {
  629. this.submitting = true;
  630. this.warnMsg = "";
  631. this.submitHint = "";
  632. const payload = {
  633. bjid: this.form.bjid,
  634. ms: this.form.ms
  635. };
  636. this.jcxmList.forEach((item) => {
  637. payload["sqljcxmm" + item.sqljcxmm] =
  638. item.value === "" ? 0 : Number(item.value);
  639. });
  640. const result = await this.postService(
  641. "/service?ssServ=sqljc_mpSubm&ssDest=data", payload);
  642. this.recordsToday = Number(result && result.recordsToday || this.recordsToday + 1);
  643. this.markListRefresh();
  644. if (this.fromList) {
  645. this.resetAfterSubmit();
  646. this.warnMsg = "";
  647. this.showToast("提交成功", "success");
  648. setTimeout(() => this.goBack(), 900);
  649. return;
  650. }
  651. this.resetAfterSubmit();
  652. this.warnMsg = "已提交,可继续录入下一个班级(今天已录入 "
  653. + this.recordsToday + " 条)";
  654. this.showToast("提交成功", "success");
  655. } catch (error) {
  656. console.error("[mp_sqljc_inp] 提交失败", error);
  657. this.submitHint = error && error.message ? error.message : "提交失败";
  658. this.showToast(this.submitHint, "fail");
  659. } finally {
  660. this.submitting = false;
  661. }
  662. },
  663. resetAfterSubmit() {
  664. this.form.bjid = "";
  665. this.form.ms = "";
  666. this.jcxmList.forEach((item) => {
  667. item.value = Number(item.defaultValue || 0);
  668. });
  669. },
  670. // 通知列表页刷新(回到列表时由 mp_sqljc_list.html 的 pageshow 处理读取)。Lin
  671. markListRefresh() {
  672. try {
  673. sessionStorage.setItem("mp_sqljc_list_refresh", "1");
  674. sessionStorage.setItem("mp_sqljc_list_date", this.formatLocalDate(new Date()));
  675. } catch (_) {
  676. }
  677. },
  678. formatLocalDate(date) {
  679. const d = date instanceof Date ? date : new Date(date);
  680. const pad = (v) => String(v).padStart(2, "0");
  681. return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
  682. },
  683. handleBottomAction(data) {
  684. if (data && data.action === "cancel")
  685. this.goBack();
  686. else if (data && data.action === "submit")
  687. this.submit();
  688. },
  689. goBack() {
  690. if (window.wx && window.wx.miniProgram) {
  691. window.wx.miniProgram.navigateBack({ delta: 1 });
  692. } else if (window.history.length > 1) {
  693. window.history.back();
  694. }
  695. },
  696. showToast(message, type) {
  697. const toastType = type === "success" ? "success" : "error";
  698. if (window.wx && window.wx.miniProgram && window.wx.miniProgram.showToast) {
  699. window.wx.miniProgram.showToast({ title: message, icon: toastType });
  700. } else if (window.SS && window.SS.dom && typeof window.SS.dom.showToast === "function") {
  701. window.SS.dom.showToast({ message: message, type: toastType });
  702. }
  703. }
  704. }
  705. });
  706. });
  707. </script>
  708. </body>
  709. </html>