myClass.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. //index.js
  2. //获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. showMore: false, //更多
  7. show: false,
  8. notice: "通知通知我是通知通知通知我是通知通知通知我是通知通知通知我是通知",
  9. kcArr: [],
  10. // "spxxArr": [{
  11. // "isfinish": "/images/unfinish.png",
  12. // "spfm": "/images/spfm.jpg",
  13. // "iszburl": "/images/zb.png",
  14. // "name": "一期素质教育培训",
  15. // "startdate": "6月9日",
  16. // "starttime": "19:30",
  17. // "isstartstudy": "/images/startstudy.png",
  18. // "isdtxs": "/images/dtxs.png",
  19. // "ispjkc": "/images/pjkc.png"
  20. // }, {
  21. // "isfinish": "/images/finish.png",
  22. // "spfm": "/images/spfm.jpg",
  23. // "iszburl": "/images/db.png",
  24. // "name": "一期素质教育培训",
  25. // "startdate": "6月9日",
  26. // "starttime": "19:30",
  27. // "isstartstudy": "/images/startstudy.png",
  28. // "isdtxs": "/images/dtxs.png",
  29. // "ispjkc": "/images/pjkc.png"
  30. // }, {
  31. // "isfinish": "/images/unstart.png",
  32. // "spfm": "/images/spfm.jpg",
  33. // "iszburl": "/images/db.png",
  34. // "name": "一期素质教育培训",
  35. // "startdate": "6月9日",
  36. // "starttime": "19:30",
  37. // "isstartstudy": "/images/startstudy.png",
  38. // "isdtxs": "/images/dtxs.png",
  39. // "ispjkc": "/images/pjkc.png",
  40. // },
  41. // {
  42. // "isfinish": "/images/unstart.png",
  43. // "spfm": "/images/spfm.jpg",
  44. // "iszburl": "/images/db.png",
  45. // "name": "一期素质教育培训",
  46. // "startdate": "6月9日",
  47. // "starttime": "19:30",
  48. // "isstartstudy": "/images/startstudy.png",
  49. // "isdtxs": "/images/dtxs.png",
  50. // "ispjkc": "/images/pjkc.png"
  51. // },
  52. // {
  53. // "isfinish": "/images/unstart.png",
  54. // "spfm": "/images/spfm.jpg",
  55. // "iszburl": "/images/db.png",
  56. // "name": "一期素质教育培训",
  57. // "startdate": "6月9日",
  58. // "starttime": "19:30",
  59. // "isstartstudy": "/images/startstudy.png",
  60. // "isdtxs": "/images/dtxs.png",
  61. // "ispjkc": "/images/pjkc.png"
  62. // },
  63. // {
  64. // "isfinish": "/images/unstart.png",
  65. // "spfm": "/images/spfm.jpg",
  66. // "iszburl": "/images/db.png",
  67. // "name": "一期素质教育培训",
  68. // "startdate": "6月9日",
  69. // "starttime": "19:30",
  70. // "isstartstudy": "/images/startstudy.png",
  71. // "isdtxs": "/images/dtxs.png",
  72. // "ispjkc": "/images/pjkc.png"
  73. // }
  74. // ],
  75. "myactiveArr": [{
  76. "name": "现场体验:长山花园社区",
  77. "cysj": "2020/06/20 07:09",
  78. "cyry": "全体人员",
  79. },
  80. {
  81. "name": "实战演练:党建工作实务",
  82. "cysj": "2020/06/21 07:09",
  83. "cyry": "全体人员",
  84. }, {
  85. "name": "现场体验:青岛路社区",
  86. "cysj": "2020/06/22 07:09",
  87. "cyry": "全体人员",
  88. }
  89. ]
  90. },
  91. // showPopup() {
  92. // },
  93. // 更多
  94. listToggle: function () {
  95. this.setData({
  96. showMore: !this.data.showMore
  97. })
  98. },
  99. hidePopup() {
  100. this.setData({
  101. show: false
  102. });
  103. var sessionKey = "";
  104. // var _this = this;
  105. wx.checkSession({
  106. success: () => {
  107. console.log("我有缓存")
  108. sessionKey = wx.getStorageSync('sessionKey');
  109. console.log(sessionKey)
  110. wx.request({
  111. url: app.globalData.publicUrl2 + '/education/student/wx/verification?sessionKey=' + sessionKey,
  112. method: "post",
  113. // data:
  114. success: function (res) {
  115. console.log(res, "我成功了")
  116. }
  117. })
  118. },
  119. fail() {
  120. console.log("我没有缓存并去登录请求")
  121. wx.login({
  122. success(res) {
  123. console.log(res);
  124. var code = res.code
  125. wx.request({
  126. url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
  127. method: "get",
  128. data: {
  129. code
  130. },
  131. success: function (res) {
  132. sessionKey = res.data.sessionKey;
  133. wx.setStorageSync('sessionKey', res.data.sessionKey);
  134. }
  135. })
  136. }
  137. })
  138. }
  139. })
  140. },
  141. myactiveMore() {
  142. wx.navigateTo({
  143. url: '../myActive/myActive'
  144. })
  145. },
  146. gokhAnswer() {
  147. wx.navigateTo({
  148. url: '../answerAfterclass/answerAfterclass'
  149. })
  150. },
  151. gopjClass() {
  152. wx.navigateTo({
  153. url: '../evaluationCourse/evaluationCourse'
  154. })
  155. },
  156. goMyPoints() {
  157. wx.navigateTo({
  158. url: '../myPoints/myPoints'
  159. })
  160. },
  161. goactiveDetails() {
  162. wx.navigateTo({
  163. url: '../myactiveDetails/myactiveDetails'
  164. })
  165. },
  166. lq() {
  167. wx.showToast({
  168. title: '领取成功'
  169. })
  170. },
  171. goWrite() {
  172. wx.navigateTo({
  173. url: '../studentRegistration/studentRegistration'
  174. })
  175. },
  176. goWrite2() {
  177. wx.navigateTo({
  178. url: '../feedBack/feedBack'
  179. })
  180. },
  181. onReady: function () {},
  182. onLoad: function () {
  183. var sessionKey = "";
  184. var _this = this;
  185. wx.checkSession({
  186. success: () => {
  187. console.log("我有缓存")
  188. sessionKey = wx.getStorageSync('sessionKey');
  189. console.log(sessionKey)
  190. var enSessionKey = encodeURIComponent(sessionKey)
  191. console.log(enSessionKey,"woshi zhuanyi")
  192. wx.request({
  193. url: app.globalData.publicUrl2 + '/education/student/wx/selStudentSessionKey?sessionKey=' + enSessionKey,
  194. method: "post",
  195. success: function (res) {
  196. console.log(res, "333")
  197. if (res.data.data.isAgree == 0) {
  198. _this.setData({
  199. show: true
  200. });
  201. } else {
  202. _this.setData({
  203. show: false
  204. });
  205. }
  206. }
  207. }),
  208. wx.request({
  209. url: app.globalData.publicUrl + '/wx/course/selectBySessionKey/' + sessionKey,
  210. method: "get",
  211. success: function (res) {
  212. console.log(res)
  213. _this.setData({
  214. kcArr: res.data.list
  215. })
  216. }
  217. })
  218. },
  219. fail() {
  220. console.log("我没有缓存并去登录请求")
  221. wx.login({
  222. success(res) {
  223. console.log(res);
  224. var code = res.code
  225. wx.request({
  226. url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
  227. method: "get",
  228. data: {
  229. code
  230. },
  231. success: function (res) {
  232. sessionKey = res.data.sessionKey;
  233. wx.setStorageSync('sessionKey', res.data.sessionKey);
  234. }
  235. })
  236. }
  237. })
  238. }
  239. })
  240. },
  241. // onShow: function () {
  242. // this.setData({
  243. // show: true
  244. // });
  245. // }
  246. })