index.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. // index.ts
  2. import { api_schoolAreaDetail, api_schoolAreaList, api_sysAreaQueryAllProvince, api_userBeneficiarySave, api_userBeneficiaryUpdate } from "../../api/new";
  3. import { GRADE_ENUM } from '../../utils/util'
  4. const classList: any = [];
  5. for (let i = 1; i <= 40; i++) {
  6. classList.push({ text: i + '班', value: i });
  7. }
  8. /** 获取年级 */
  9. const getGradeList = (gradeYear?: string, instrumentCode?: string) => {
  10. let tempList: any = [];
  11. const five = [
  12. { text: '一年级', value: 1, instrumentCode },
  13. { text: '二年级', value: 2, instrumentCode },
  14. { text: '三年级', value: 3, instrumentCode },
  15. { text: '四年级', value: 4, instrumentCode },
  16. { text: '五年级', value: 5, instrumentCode }
  17. ];
  18. const one = [{ text: '六年级', value: 6, instrumentCode }];
  19. const three = [
  20. { text: '七年级', value: 7, instrumentCode },
  21. { text: '八年级', value: 8, instrumentCode },
  22. { text: '九年级', value: 9, instrumentCode }
  23. ];
  24. if (gradeYear === 'FIVE_YEAR_SYSTEM') {
  25. tempList.push(...[...five]);
  26. } else if (gradeYear === 'SIX_YEAR_SYSTEM') {
  27. tempList.push(...[...five, ...one]);
  28. } else if (gradeYear === 'THREE_YEAR_SYSTEM') {
  29. tempList.push(...[...three]);
  30. } else if (gradeYear === 'FORE_YEAR_SYSTEM') {
  31. tempList.push(...[...one, ...three]);
  32. } else {
  33. tempList.push(...[...five, ...one, ...three]);
  34. }
  35. return tempList;
  36. };
  37. // 获取应用实例
  38. const app = getApp<IAppOption>()
  39. // pages/orders/orders.ts
  40. Page({
  41. /**
  42. * 页面的初始数据
  43. */
  44. data: {
  45. goodsImgList: [
  46. 'https://oss.dayaedu.com/ktyq/1739524049205.png',
  47. 'https://oss.dayaedu.com/ktyq/1739523564827.png',
  48. 'https://oss.dayaedu.com/ktyq/1739523574402.png',
  49. 'https://oss.dayaedu.com/ktyq/1739523583463.png'
  50. ],
  51. current: 0,
  52. popupShow: false,
  53. showService: false,
  54. isFromPreviewImage: false,
  55. showBuyer: false, // 收益人
  56. },
  57. /**
  58. * 生命周期函数--监听页面加载
  59. */
  60. onLoad() {
  61. // this.onInit()
  62. },
  63. isLogin() {
  64. // 判断是否登录
  65. if (!app.globalData.isLogin) {
  66. wx.navigateTo({
  67. url: '../login/login',
  68. })
  69. return false
  70. }
  71. return true
  72. },
  73. /** 我的订单 */
  74. onOrder() {
  75. // 判断是否登录
  76. if (!this.isLogin()) {
  77. return
  78. }
  79. wx.navigateTo({
  80. url: '../orders/orders',
  81. })
  82. },
  83. /** 申请加入 */
  84. onBuyGoods() {
  85. // 判断是否登录
  86. if (!this.isLogin()) {
  87. return
  88. }
  89. wx.navigateTo({
  90. url: '../select-goods/index',
  91. })
  92. },
  93. /** 客服 */
  94. onService() {
  95. this.setData({
  96. showService: true
  97. })
  98. },
  99. changePop(event: { detail: any }) {
  100. this.setData({
  101. showService: event.detail
  102. })
  103. },
  104. onBuyShop() {
  105. // 判断是否登录
  106. if (!this.isLogin()) {
  107. return
  108. }
  109. this.setData({
  110. popupShow: true
  111. })
  112. },
  113. onClose() {
  114. this.setData({
  115. popupShow: false,
  116. currentIndex: 1,
  117. userBeneficiaryId: '',
  118. userBeneficiaryInfo: {
  119. name: '',
  120. phoneNumber: '',
  121. schoolInfo: ''
  122. }
  123. })
  124. },
  125. onPreivewGoodsImg(e: { currentTarget: { dataset: any } }) {
  126. wx.previewImage({
  127. current: e.currentTarget.dataset.src,
  128. urls: this.data.goodsImgList,
  129. success: () => {
  130. this.setData({
  131. isFromPreviewImage: true
  132. })
  133. }
  134. })
  135. },
  136. onPreivewGoods(e: { currentTarget: { dataset: any } }) {
  137. wx.previewImage({
  138. current: e.currentTarget.dataset.src,
  139. urls: [e.currentTarget.dataset.src],
  140. success: () => {
  141. this.setData({
  142. isFromPreviewImage: true
  143. })
  144. }
  145. })
  146. },
  147. /**
  148. * 生命周期函数--监听页面显示
  149. */
  150. onShow() {
  151. },
  152. onShareAppMessage() {
  153. return {
  154. title: '翼时代器乐数字Ai',
  155. path: '/pages/index/index',
  156. imageUrl: 'https://oss.dayaedu.com/ktyq/1733312164991.png'
  157. }
  158. },
  159. onShareTimeline() {
  160. return {
  161. title: '器乐数字AI工具',
  162. path: '/pages/index/index',
  163. imageUrl: 'https://oss.dayaedu.com/ktyq/1733312164991.png'
  164. }
  165. }
  166. })