123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- // pages/forBack/forBack.js
- const app = getApp()
- const util = require("../../utils/util")
- const urlDef = require("../../utils/urls")
- const urls = urlDef.urls;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- radioList: [{
- name: '学校不满意',
- type: 'school'
- },
- {
- name: '课程不满意',
- type: 'school'
- },
- {
- name: '产品建议/功能优化',
- type: 'select'
- },
- {
- name: '其他问题',
- type: 'select'
- },
- ],
- curRadioIndex: '0',
- plateList: [
- '我的课表',
- '提交作业',
- '课堂点评',
- '成长足迹',
- '请假',
- '补课',
- '加课',
- '调课',
- ],
- plateIndex: 0,
- radioType: 'school',
- imgList:[]
- },
- getRadio: function (e) {
- const type = this.data.radioList[e.currentTarget.dataset.index].type
- this.setData({
- curRadioIndex: e.currentTarget.dataset.index,
- radioType: type
- })
- },
- bindPickerChange: function (e) {
- this.setData({
- plateIndex: e.detail.value
- })
- },
- uploadTap: function () {
- const that = this
- if(that.data.imgList.length>=6){
- wx.showToast({
- title: '最多上传6张图片',
- icon: 'none'
- })
- return false
- }
- wx.chooseImage({
- count: 6,
- sourceType: ['album', 'camera'],
- success(res) {
- wx.showLoading({
- title: '上传中...',
- })
- for (var i in res.tempFilePaths) {
- wx.uploadFile({
- filePath: res.tempFilePaths[i],
- name: 'name',
- url: urls.file_upload,
- header: util.getHeaders(),
- success(res) {
- wx.showToast({
- title: '上传成功',
- })
- const rs = JSON.parse(JSON.parse(JSON.stringify(res.data)))
- const list = [{
- url: rs.data[0].url
- }]
- that.setData({
- imgList: that.data.imgList.concat(list)
- })
- },
- fail(res) {
- wx.showToast({
- title: '上传失败',
- icon: none
- })
- },
- complete(res) {
- wx.hideLoading({
- success: (res) => {},
- })
- }
- })
- }
- }
- })
- },
- delImg:function(e){
- const index = e.currentTarget.dataset.index
- this.data.imgList.splice(index,1)
- this.setData({
- imgList: this.data.imgList
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|