myMission.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. // pages/learningReport/learningReport.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. showewm: false,
  9. showzs: false,
  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. "isfinish": "/images/unstart.png",
  42. "spfm": "/images/spfm.jpg",
  43. "iszburl": "/images/db.png",
  44. "name": "一期素质教育培训",
  45. "startdate": "6月9日",
  46. "starttime": "19:30",
  47. "isstartstudy": "/images/startstudy.png",
  48. "isdtxs": "/images/dtxs.png",
  49. "ispjkc": "/images/pjkc.png"
  50. }],
  51. },
  52. selectBtn0() {
  53. this.setData({
  54. select: 0
  55. });
  56. },
  57. selectBtn1() {
  58. this.setData({
  59. select: 1
  60. });
  61. },
  62. gokhAnswer() {
  63. wx.navigateTo({
  64. url: '../answerAfterclass/answerAfterclass'
  65. })
  66. },
  67. gopjClass() {
  68. wx.navigateTo({
  69. url: '../evaluationCourse/evaluationCourse'
  70. })
  71. },
  72. startAnswer() {
  73. wx.navigateTo({
  74. url: '/pages/answerAfterclass/answerAfterclass',
  75. })
  76. },
  77. goWrite() {
  78. wx.navigateTo({
  79. url: '../studentRegistration/studentRegistration'
  80. })
  81. },
  82. goWrite2() {
  83. wx.navigateTo({
  84. url: '../feedBack/feedBack'
  85. })
  86. },
  87. lq() {
  88. this.setData({
  89. showzs: true
  90. });
  91. // wx.showToast({
  92. // title: '领取成功'
  93. // })
  94. },
  95. /**
  96. * 生命周期函数--监听页面加载
  97. */
  98. onLoad: function (options) {
  99. },
  100. showEwm() {
  101. var sessionKey = "";
  102. var _this = this;
  103. wx.checkSession({
  104. success: () => {
  105. console.log("我有缓存")
  106. sessionKey = wx.getStorageSync('sessionKey');
  107. console.log(sessionKey)
  108. wx.request({
  109. url: app.globalData.publicUrl2 + '/education/student/wx/selClas?sessionKey=' + sessionKey + '&isActive=1',
  110. method: "post",
  111. success: function (res) {
  112. if (res.data.data.isAgree == 0) {
  113. _this.setData({
  114. show: true
  115. });
  116. } else {
  117. _this.setData({
  118. show: false
  119. });
  120. }
  121. }
  122. })
  123. },
  124. fail() {
  125. console.log("我没有缓存并去登录请求")
  126. wx.login({
  127. success(res) {
  128. console.log(res);
  129. var code = res.code
  130. wx.request({
  131. url: app.globalData.publicUrl2 + '/wx/user/wx7e7a46e129d6cd0f/login',
  132. method: "get",
  133. data: {
  134. code
  135. },
  136. success: function (res) {
  137. sessionKey = res.data.sessionKey;
  138. wx.setStorageSync('sessionKey', res.data.sessionKey);
  139. }
  140. })
  141. }
  142. })
  143. }
  144. })
  145. // this.setData({
  146. // showewm: true
  147. // });
  148. },
  149. // showzs(){
  150. // },
  151. onClose() {
  152. wx.hideLoading()
  153. this.setData({
  154. showewm: false
  155. });
  156. },
  157. onClose1() {
  158. this.setData({
  159. showzs: false
  160. });
  161. },
  162. /**
  163. * 生命周期函数--监听页面初次渲染完成
  164. */
  165. saveImg() {
  166. wx.getSetting({
  167. success(res) {
  168. if (!res.authSetting['scope.writePhotosAlbum']) {
  169. wx.authorize({
  170. scope: 'scope.writePhotosAlbum',
  171. success() {
  172. console.log(res, "我点击同意啦")
  173. wx.showLoading({
  174. title: '保存中...'
  175. })
  176. var imgSrc = "http://yijiao.oss-cn-qingdao.aliyuncs.com/images/http://tmp/wx1b4e5e756cd48af1.o6zAJsws4grEQvYrWTjBigy-6QaU.0llhudiKSF2V955a1c48350d9328ef064b4d36d12746.jpg"
  177. wx.downloadFile({
  178. url: imgSrc,
  179. success: function (res) {
  180. console.log(res, '我下载完成啦');
  181. //图片保存到本地
  182. wx.saveImageToPhotosAlbum({
  183. filePath: res.tempFilePath,
  184. success: function (data) {
  185. console.log(data, '我保存成功啦')
  186. wx.hideLoading();
  187. wx.showToast({
  188. title: '保存成功',
  189. icon: 'success',
  190. duration: 2000
  191. })
  192. },
  193. fail: function (err) {
  194. console.log(err, '我保存失败啦')
  195. wx.hideLoading();
  196. if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
  197. console.log("当初用户拒绝,再次发起授权")
  198. wx.openSetting({
  199. success(settingdata) {
  200. console.log(settingdata)
  201. if (settingdata.authSetting['scope.writePhotosAlbum']) {
  202. console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
  203. } else {
  204. console.log('获取权限失败,给出不给权限就无法正常使用的提示')
  205. }
  206. }
  207. })
  208. }
  209. },
  210. complete(res) {
  211. console.log(res);
  212. }
  213. })
  214. }
  215. })
  216. console.log('授权成功')
  217. }
  218. })
  219. } else {
  220. var imgSrc = "http://yijiao.oss-cn-qingdao.aliyuncs.com/images/http://tmp/wx1b4e5e756cd48af1.o6zAJsws4grEQvYrWTjBigy-6QaU.0llhudiKSF2V955a1c48350d9328ef064b4d36d12746.jpg"
  221. wx.downloadFile({
  222. url: imgSrc,
  223. success: function (res) {
  224. console.log(res, '我下载完成啦');
  225. wx.hideLoading();
  226. //图片保存到本地
  227. wx.saveImageToPhotosAlbum({
  228. filePath: res.tempFilePath,
  229. success: function (data) {
  230. console.log(data, '我保存成功啦')
  231. wx.hideLoading();
  232. wx.showToast({
  233. title: '保存成功',
  234. icon: 'success',
  235. duration: 2000
  236. })
  237. },
  238. fail: function (err) {
  239. console.log(err, '我保存失败啦')
  240. wx.hideLoading();
  241. if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
  242. console.log("当初用户拒绝,再次发起授权")
  243. wx.openSetting({
  244. success(settingdata) {
  245. console.log(settingdata)
  246. if (settingdata.authSetting['scope.writePhotosAlbum']) {
  247. console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
  248. } else {
  249. console.log('获取权限失败,给出不给权限就无法正常使用的提示')
  250. }
  251. }
  252. })
  253. }
  254. },
  255. complete(res) {
  256. console.log(res);
  257. }
  258. })
  259. }
  260. })
  261. }
  262. }
  263. })
  264. // wx.showLoading({
  265. // title: '保存中...'
  266. // })
  267. // wx.getSetting({
  268. // success(res) {
  269. // console.log(res)
  270. // if (res.authSetting['scope.writePhotosAlbum']) {
  271. // wx.authorize({
  272. // scope: 'scope.writePhotosAlbum',
  273. // success() {
  274. // var imgSrc = "http://sqdx.windd.cn/files/21.png"
  275. // wx.downloadFile({
  276. // url: imgSrc,
  277. // success: function (res) {
  278. // console.log(res);
  279. // //图片保存到本地
  280. // wx.saveImageToPhotosAlbum({
  281. // filePath: res.tempFilePath,
  282. // success: function (data) {
  283. // wx.hideLoading();
  284. // wx.showToast({
  285. // title: '保存成功',
  286. // icon: 'success',
  287. // duration: 2000
  288. // })
  289. // },
  290. // fail: function (err) {
  291. // console.log(err);
  292. // if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny") {
  293. // console.log("当初用户拒绝,再次发起授权")
  294. // wx.openSetting({
  295. // success(settingdata) {
  296. // console.log(settingdata)
  297. // if (settingdata.authSetting['scope.writePhotosAlbum']) {
  298. // console.log('获取权限成功,给出再次点击图片保存到相册的提示。')
  299. // } else {
  300. // console.log('获取权限失败,给出不给权限就无法正常使用的提示')
  301. // }
  302. // }
  303. // })
  304. // }
  305. // },
  306. // complete(res) {
  307. // console.log(res);
  308. // }
  309. // })
  310. // }
  311. // })
  312. // }
  313. // })
  314. // }
  315. // }
  316. // })
  317. },
  318. onReady: function () {
  319. },
  320. /**
  321. * 生命周期函数--监听页面显示
  322. */
  323. onShow: function () {
  324. },
  325. /**
  326. * 生命周期函数--监听页面隐藏
  327. */
  328. onHide: function () {
  329. },
  330. /**
  331. * 生命周期函数--监听页面卸载
  332. */
  333. onUnload: function () {
  334. },
  335. /**
  336. * 页面相关事件处理函数--监听用户下拉动作
  337. */
  338. onPullDownRefresh: function () {
  339. },
  340. /**
  341. * 页面上拉触底事件的处理函数
  342. */
  343. onReachBottom: function () {
  344. },
  345. /**
  346. * 用户点击右上角分享
  347. */
  348. onShareAppMessage: function () {
  349. }
  350. })