|
@@ -1,18 +1,34 @@
|
|
|
// 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'},
|
|
|
+ radioList: [{
|
|
|
+ name: '学校不满意',
|
|
|
+ type: 'school'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '课程不满意',
|
|
|
+ type: 'school'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '产品建议/功能优化',
|
|
|
+ type: 'select'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '其他问题',
|
|
|
+ type: 'select'
|
|
|
+ },
|
|
|
],
|
|
|
curRadioIndex: '-1',
|
|
|
- plateList:[
|
|
|
+ plateList: [
|
|
|
'我的课表',
|
|
|
'提交作业',
|
|
|
'课堂点评',
|
|
@@ -23,10 +39,11 @@ Page({
|
|
|
'调课',
|
|
|
],
|
|
|
plateIndex: 0,
|
|
|
- radioType: ''
|
|
|
+ radioType: '',
|
|
|
+ imgList:[]
|
|
|
},
|
|
|
|
|
|
- getRadio:function(e){
|
|
|
+ getRadio: function (e) {
|
|
|
const type = this.data.radioList[e.currentTarget.dataset.index].type
|
|
|
this.setData({
|
|
|
curRadioIndex: e.currentTarget.dataset.index,
|
|
@@ -34,12 +51,56 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- bindPickerChange: function(e) {
|
|
|
+ bindPickerChange: function (e) {
|
|
|
this.setData({
|
|
|
plateIndex: e.detail.value
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ uploadTap: function () {
|
|
|
+ const that = this
|
|
|
+ wx.chooseImage({
|
|
|
+ count: 6,
|
|
|
+ sourceType: ['album', 'camera'],
|
|
|
+ success(res) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: '上传中...',
|
|
|
+ })
|
|
|
+ for (var i in res.tempFilePaths) {console.log(i)
|
|
|
+ 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) => {},
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|