dev
xiaowen 3 years ago
parent 4aa38df050
commit 44d2a11b64

@ -4,7 +4,10 @@ Page({
data: {
imageUrl: getApp().globalData.imageUrl,
bgImage: "background-image: url(" + getApp().globalData.imageUrl + "/img_mybg.png)",
statusBarHeight:0
statusBarHeight: 0,
nickName: "",
avatarUrl: "",
btnShow: false
},
onLoad: function () {
wx.getSystemInfo({
@ -18,5 +21,17 @@ Page({
},
onShow() {
this.getTabBar().init();
this.getUser();
},
getUser() {
if(wx.getStorageSync("userInfo")) {
let userInfo = wx.getStorageSync("userInfo");
this.setData({
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl,
btnShow: true
})
}
}
});

@ -2,11 +2,11 @@
<!-- style="margin-top:{{statusBarHeight*2}}rpx" -->
<view class="mine_title">
<view class="title_left" style="margin-left: 32rpx;">
<view style="font-size:48rpx;font-weight:600;">胆怯的麦粒</view>
<view style="font-size:48rpx;font-weight:600;">{{nickName}}</view>
<view style="font-size:24rpx; color: #9b9999;margin-top: 24rpx;"> 欢迎您使⽤硕为思平台</view>
</view>
<view class="title_right" style="margin-right: 32rpx;">
<van-image round width="128rpx" height="128rpx" fit='cover' src="https://img.yzcdn.cn/vant/cat.jpeg"/>
<van-image round width="128rpx" height="128rpx" fit='cover' src="{{avatarUrl}}"/>
</view>
</view>
<view class="content">
@ -22,6 +22,6 @@
</view>
<view class="quit">
<button class="btns">退出登录</button>
<button class="btns" wx:if="{{btnShow}}">退出登录</button>
</view>
</view>

@ -13,7 +13,7 @@ Page({
img: '',
unionID: '',
code: '',
nickName: '',
nickName: '未登录',
avatarUrl: ''
},
usernameInput: function (e) {
@ -30,7 +30,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.initData()
// this.initData()
},
// 微信用户初始化
initData() {
@ -48,18 +48,20 @@ Page({
getUserCode() {
let that = this;
return new Promise((resolve, reject) => {
wx.login({
success (res) {
that.setData({
code: res.code
})
wx.getUserInfo({
wx.getUserProfile({
desc: 'desc',
success(data) {
console.log(data)
let userInfo = data.userInfo;
that.setData({
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl
})
wx.login({
success(res) {
that.setData({
code: res.code
})
resolve(true)
},
fail() {
@ -126,8 +128,12 @@ Page({
unionID: this.data.unionID
}
app.globalData.request(obj).then(res => {
const userInfo = Object.assign({}, res, {
nickName: this.data.nickName,
avatarUrl: this.data.avatarUrl
})
wx.setStorageSync('token', res.toKen);
wx.setStorageSync('userInfo', res);
wx.setStorageSync('userInfo', userInfo);
wx.setStorageSync('openid', this.data.openid);
wx.navigateBack({
delta: 1
@ -135,8 +141,12 @@ Page({
}).catch(err => {
if (err.Code == 2) {
let data = err.Data;
const userInfo = Object.assign({}, data, {
nickName: this.data.nickName,
avatarUrl: this.data.avatarUrl
})
wx.setStorageSync('token', data.toKen);
wx.setStorageSync('userInfo', data);
wx.setStorageSync('userInfo', userInfo);
wx.setStorageSync('openid', this.data.openid);
wx.showModal({
title: '提示',

@ -5,10 +5,9 @@ Page({
* 页面的初始数据
*/
data: {
fileList:[]
},
afterRead(){
fileList:[],
mobile: '',
content: ''
},
/**
* 生命周期函数--监听页面加载
@ -17,52 +16,35 @@ Page({
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
contentInput(e) {
this.setData({
content: e.detail.value
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
phoneInput(e) {
this.setData({
mobile: e.detail.value
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
afterRead(event) {
const { file } = event.detail;
wx.uploadFile({
url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
filePath: file.url,
name: 'file',
formData: { user: 'test' },
success(res) {
// 上传完成需要更新 fileList
const { fileList = [] } = this.data;
fileList.push({ ...file, url: res.data });
this.setData({ fileList });
},
});
}
})

@ -1,11 +1,11 @@
<!--pages/mine/pages/helpCenter/index.wxml-->
<view style="margin-top:32rpx;margin-left:32rpx;font-size: 28rpx; font-weight: bold;">问题描述</view>
<view class="center">
<textarea placeholder="请输入您的问题并上传页面截屏可帮助技术人员更快地解决问题" placeholder-class="placeholder-style"></textarea>
<textarea value="{{content}}" placeholder="请输入您的问题并上传页面截屏可帮助技术人员更快地解决问题" placeholder-class="placeholder-style" bindinput="contentInput"></textarea>
<view style="margin-left:32rpx">
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead" />
<van-uploader accept="image" file-list="{{ fileList }}" bind:after-read="afterRead" />
</view>
</view>
<view style="margin-top:32rpx;margin-left:32rpx;font-size: 28rpx; font-weight: bold;">联系方式</view>
<input type="text" placeholder="请输入您的手机号码方便联系" placeholder-class="placeholder-style2" />
<input type="text" value="{{mobile}}" placeholder="请输入您的手机号码方便联系" placeholder-class="placeholder-style2" bindinput="phoneInput"/>
<button>提交</button>

@ -1,3 +1,6 @@
const app = getApp();
let iPageIndex = 1;
let iPageSize = 20;
// pages/mine/pages/myReport/index.js
Page({
@ -6,7 +9,9 @@ Page({
*/
data: {
imageUrl: getApp().globalData.imageUrl,
list: [],
loadMore: false, //"上拉加载"的变量默认false隐藏
loadAll: false, //“没有数据”的变量默认false隐藏
},
/**
@ -15,53 +20,98 @@ Page({
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
//页面上拉触底事件的处理函数
onReachBottom: function () {
let that = this
if (!that.data.loadMore) {
that.setData({
loadMore: true, //加载中
loadAll: false //是否加载完所有数据
});
//加载更多,这里做下延时加载
that.getData();
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
iPageIndex = 1;
this.getData()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
searchScrollLower() {
this.getData();
},
getData() {
if (iPageIndex == 1) {
this.setData({
loadMore: true, //把"上拉加载"的变量设为true显示
loadAll: false //把“没有数据”设为false隐藏
})
}
app.globalData.request({
action: "getFileInfoExcel",
iPageIndex: iPageIndex,
iPageSize: iPageSize,
sType: 'User',
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => {
let arr = res.Table || []
if (arr && arr.length > 0) {
iPageIndex++;
let list = this.data.list.concat(arr);
this.setData({
list: list,
loadMore: false //把"上拉加载"的变量设为false显示
})
if (arr.length < iPageSize) {
this.setData({
loadMore: false, //隐藏加载中。。
loadAll: true //所有数据都加载完了
});
}
} else {
this.setData({
loadAll: true, //把“没有数据”设为true显示
loadMore: false //把"上拉加载"的变量设为false隐藏
});
}
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
openFile(e) {
const row = e.currentTarget.dataset.row
if (row.Status !== 2) {
wx.showModal({
title: '提示',
content: '数据还未完成,请耐心等待!'
})
return;
}
wx.downloadFile({
url: row.FilePath,
success: function (res) {
// console.log(res)
let filePath = res.tempFilePath //返回的文件临时地址,用于后面打开本地预览所用
let filename = row.FilePath;
let index1 = filename.lastIndexOf(".");
let index2 = filename.length;
let postf = filename.substring(index1, index2); //后缀名
let postf1 = postf.replace(/\./g, '')
// console.log(postf1)
if (filePath != null) {
wx.openDocument({
filePath: filePath,
fileType: postf1,
success: function (res) {
console.log(res)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
fail: function (res) {
console.log(res)
}
})
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
fail: function (res) {
console.log(res)
}
})
}
})

@ -1,22 +1,16 @@
<view class="box">
<view class="ppt">
<scroll-view scroll-y="true" bindscrolltolower="searchScrollLower">
<view class="ppt" wx:for="{{list}}" wx:key="index" data-row="{{item}}" bindtap="openFile">
<van-image width="64rpx" height="64rpx" fit='cover' src="{{imageUrl}}/my_ppt.png"
custom-class='img1'/>
<view class="ppt_cneter">
<view style="font-size: 28rpx;font-weight: bold;" class="title">测试v7_PPT主题分析报告</view>
<view style="font-size: 24rpx; color: #9d9d9d;">2022-06-15 11:24:47</view>
</view>
<van-image width="48rpx" height="48rpx" fit='cover' src="{{imageUrl}}/my_right.png"
custom-class='img2' />
</view>
<view class="ppt">
<van-image width="64rpx" height="64rpx" fit='cover' src="{{imageUrl}}/my_ppt.png"
custom-class='img1'/>
<view class="ppt_cneter">
<view style="font-size: 28rpx;font-weight: bold;" class="title">测试v7_PPT主题分析报告aaaaaaaaaa</view>
<view style="font-size: 24rpx; color: #9d9d9d;">2022-06-15 11:24:47</view>
<view style="font-size: 28rpx;font-weight: bold;" class="title">{{item.Folder}}</view>
<view style="font-size: 24rpx; color: #9d9d9d;">{{item.AddTime}}</view>
</view>
<van-image width="48rpx" height="48rpx" fit='cover' src="{{imageUrl}}/my_right.png"
custom-class='img2' />
</view>
<view class="loading" hidden="{{!loadMore}}">正在载入更多...</view>
<view class="loading" hidden="{{!loadAll}}">已加载全部</view>
</scroll-view>
</view>

@ -39,3 +39,10 @@ page{
-webkit-line-clamp:1;
-webkit-box-orient: vertical;
}
.loading {
position: relative;
bottom: 5rpx;
padding: 10rpx;
text-align: center;
font-size: 12px;
}
Loading…
Cancel
Save