|
@@ -1,5 +1,6 @@
|
|
|
// pages/index-guest/index-guest.js
|
|
|
const app = getApp();
|
|
|
+const util = require('../../utils/util.js');
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -8,16 +9,82 @@ Page({
|
|
|
data: {
|
|
|
imgPath: app.globalData.imgPath,
|
|
|
path: app.globalData.path,
|
|
|
- username: '李海东',
|
|
|
- role_name: '嘉宾',
|
|
|
- app_bottom: '大城细管·大城众管·大城智管'
|
|
|
+ username: app.globalData.userInfo.usernameShow,
|
|
|
+ role_name: app.globalData.roleInfo.name,
|
|
|
+ app_bottom: '大城细管·大城众管·大城智管',
|
|
|
+ nowTime: util.formatDate('', 'yyyy.MM.dd'),
|
|
|
+ nextMeeting: {}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
-
|
|
|
+ let that = this;
|
|
|
+ if (!app.globalData.userInfo.usernameShow || !app.globalData.userInfo.nickName || !app.globalData.userInfo.headImgUrl) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '轻应用需要取您的用户信息',
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '确定',
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '提供优质服务',
|
|
|
+ success: (res) => {
|
|
|
+ console.info(res.userInfo)
|
|
|
+ app.globalData.userInfo.usernameShow = res.userInfo.nickName;
|
|
|
+ app.globalData.userInfo.nickName = res.userInfo.nickName;
|
|
|
+ app.globalData.userInfo.headImgUrl = res.userInfo.avatarUrl;
|
|
|
+ that.setData({
|
|
|
+ username: app.globalData.userInfo.usernameShow,
|
|
|
+ role_name: app.globalData.roleInfo.name
|
|
|
+ });
|
|
|
+ util.post({
|
|
|
+ url: '/sys/user/updateNoAuth',
|
|
|
+ data: {
|
|
|
+ id: app.globalData.userInfo.id,
|
|
|
+ nickName: res.userInfo.nickName,
|
|
|
+ usernameShow: res.userInfo.nickName,
|
|
|
+ headImgUrl: res.userInfo.avatarUrl
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (res) => {
|
|
|
+ util.toast('拒绝授权将影响您的体验感');
|
|
|
+ that.setData({
|
|
|
+ username: '未知用户',
|
|
|
+ role_name: app.globalData.roleInfo.name
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.setData({
|
|
|
+ username: app.globalData.userInfo.usernameShow,
|
|
|
+ role_name: app.globalData.roleInfo.name
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 下一场会议
|
|
|
+ util.get({
|
|
|
+ url: '/api/meeting/info/getNextMeeting',
|
|
|
+ success: (res) => {
|
|
|
+ wx.hideLoading();
|
|
|
+ if (res.data.code != 200) {
|
|
|
+ util.toast(res.data.msg);
|
|
|
+ } else {
|
|
|
+ let datas = res.data.data;
|
|
|
+ that.setData({
|
|
|
+ nextMeeting: datas,
|
|
|
+ nextTitle: datas.title,
|
|
|
+ nextTime: util.formatDate(datas.receptionTime),
|
|
|
+ nextUnit: datas.receptionObject
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -68,26 +135,71 @@ Page({
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
},
|
|
|
+
|
|
|
changeRole: function () {
|
|
|
wx.redirectTo({
|
|
|
url: '../index/index',
|
|
|
- })
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点击查看下一场会议详情
|
|
|
+ */
|
|
|
+ meetingInfo: function () {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../meeting-cover/meeting-cover?item=' + this.data.nextMeeting,
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 点击参观议程跳转至会议列表
|
|
|
+ */
|
|
|
visitAgenda: function () {
|
|
|
wx.navigateTo({
|
|
|
url: '../meeting-list/meeting-list',
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 图片回传
|
|
|
+ */
|
|
|
+ uploadImage: function () {
|
|
|
+ let that = this;
|
|
|
+ wx.chooseImage({
|
|
|
+ count: 1,
|
|
|
+ success: function (res) {
|
|
|
+ console.info(res.tempFilePaths);
|
|
|
+ wx.uploadFile({
|
|
|
+ filePath: res.tempFilePaths[0],
|
|
|
+ name: 'file',
|
|
|
+ url: that.data.path + '/api/upload/record/upload',
|
|
|
+ header: {
|
|
|
+ "Content-Type": "multipart/form-data",
|
|
|
+ "Authorization": app.globalData.Authorization
|
|
|
+ },
|
|
|
+ formData: {
|
|
|
+ fileType: 10
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ console.info(res)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
fileBrowse: function () {
|
|
|
wx.navigateTo({
|
|
|
url: '../file-browse/file-browse',
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
chatRoom: function () {
|
|
|
wx.navigateTo({
|
|
|
url: '../chat-room/chat-room',
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
lightMap: function () {
|
|
|
wx.navigateTo({
|
|
|
url: '../light-map/light-map',
|