| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- // pages/actDetail/actDetail.js
- const app = getApp()
- var host = app.globalData.host;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- info: {},
- uid: '',
- zk1: 0,
- zk2: 0,
- sex_array: ['男', '女'],
- sex: -1,
- job_array: ['非中科院单位','中科院单位'],
- job: 0,
- show: 0,
- list:[],
- index:[0,0,0],
- page:1,
- proof_img:'',
- user_id:'', //用户id
- apply_id:'' //报名ID
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- options.id=1;
- var that = this;
- wx.showNavigationBarLoading()
- var that = this;
- wx.getStorage({
- key: 'uid',
- success: res => {
- if (res.data) {
- this.setData({
- user_id: res.data
- })
- }
- },
- })
- wx.request({
- url: host + '/api/detail',
- method: 'GET',
- data: {
- type: 'conference',
- id: options.id
- },
- success: function (res) {
- wx.hideNavigationBarLoading();
- that.setData({
- info: res.data.data
- })
- },
- fail: function () {
- wx.hideLoading();
- wx.showToast({
- title: '服务器开小差啦!',
- icon: 'none'
- })
- }
- })
- //中科院单位
- wx.request({
- url: host + '/api/organization/list',
- method: 'GET',
- success: function (res) {
- wx.hideNavigationBarLoading();
- var list=[];
- list[0] = res.data.data;
- list[1] = list[0][0].children;
- list[2] = list[1][0].children;
-
- that.setData({
- list: list
- })
- },
- })
- },
- upload:function(){
- wx.chooseImage({
- count:0,
- success: res=>{
- wx.showLoading({
- title: '正在上传',
- })
- wx.uploadFile({
- url: host + '/api/uploadfile',
- filePath: res.tempFilePaths[0],
- name: 'file',
- success:response=>{
- wx.hideLoading();
- let data = JSON.parse(response.data);
- this.setData({
- proof_img:data.data
- })
- }
- })
- },
- })
- },
- bindMultiPickerColumnChange:function(e){
- console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
- var list = this.data.list, i = e.detail.value, j = e.detail.column;
- var index=this.data.index;
- index[j] = i
- if (e.detail.column == 0){
- list[1] = list[i][0].children;
- list[2] = list[1][0].children;
- index[1]=0;
- index[2]=0;
- }
- if (e.detail.column == 1) {
- list[1] = list[i][0].children;
- list[2] = list[1][0].children;
- index[2] = 0;
- }
- this.setData({
- list: list,
- index: index
- })
- },
- bindSexChange:function(e){
- this.setData({
- sex: e.detail.value
- })
- },
- bindPickerChange:function(e){
- this.setData({
- job: e.detail.value
- })
- },
- skip:function(){
- this.setData({
- page: this.data.page+2
- })
- },
- sure: function () {
- this.setData({
- page: this.data.page + 1
- })
- },
- close:function(){
- this.setData({
- show: 0
- })
- },
- open: function () {
- this.setData({
- show: 1
- })
- },
- //提交报名信息
- submit: function (e) {
- var form = e.detail.value;
- var list = this.data.list, index=this.data.index;
- form.organizer_unit = list[0][index[0]].value+list[1][index[1]].value+list[2][index[2]].value
- form.uid=this.data.user_id;
- form.conference_id=this.data.info.id;
- form.conference_name = this.data.info.name;
- wx.showLoading({
- title: '正在提交',
- })
- wx.request({
- url: host + '/api/user/signup',
- method:'POST',
- data: form,
- success:(res=>{
- if(res.data.code == 0){
- wx.hideLoading()
- this.setData({
- page: 2,
- apply_id:res.data.data
- })
- }else{
- wx.showToast({
- title: '提交失败',
- icon:'none'
- })
- }
- })
- })
-
- },
- //提交凭证
- submit1:function(e){
- var form = e.detail.value;
- form.id=this.data.apply_id;
- form.proof_img = this.data.proof_img;
- wx.showLoading({
- title: '正在提交',
- })
- wx.request({
- url: host + '/api/user/signup',
- method: 'PUT',
- data: e.detail.value,
- success: (res => {
- wx.hideLoading();
- if (res.data.code == 0) {
- wx.showToast({
- title: '提交成功',
- })
- this.skip();
- }
- }),
- fail:error=>{
- wx.hideLoading()
- }
- })
- },
- home:function(){
- wx.switchTab({
- url: '../mine/mine',
- })
- },
- zk1: function () {
- this.setData({
- zk1: 1
- })
- },
- sq1: function () {
- this.setData({
- zk1: 0
- })
- },
- zk2: function () {
- this.setData({
- zk2: 1
- })
- },
- sq2: function () {
- this.setData({
- zk2: 0
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|