| | |
| | | const app = getApp() |
| | | import SparkMD5 from 'spark-md5' |
| | | import tool from "../../../assets/js/toolClass.js"; |
| | | import FormData from '../../../utils/formdata/index.js'; |
| | | Page({ |
| | |
| | | defaultUser = { |
| | | ...teacherInfos, |
| | | nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name, |
| | | icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '', |
| | | icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, |
| | | userId: res.userId, |
| | | role: 'Teacher', |
| | | roleId: teacherRole.role.id, |
| | |
| | | editIconInfo(e) { |
| | | var that = this; |
| | | wx.chooseMedia({ |
| | | // count: 1, // 默认9 |
| | | count: 1, // 默认9 |
| | | sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
| | | sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 |
| | | success: function (res) { |
| | | // 返回选定照片的本地文件路径列表,tempFilePath也可以作为img标签的src属性显示图片 |
| | | tool.getFileMd5(res.tempFiles[0]).then((e) => { |
| | | wx.getFileSystemManager().readFile({ |
| | | filePath: res.tempFiles[0].tempFilePath, //选择图片返回的相对路径 |
| | | // encoding: 'binary', //编码格式 |
| | | success: ress => { |
| | | //成功的回调 |
| | | let spark = new SparkMD5.ArrayBuffer(); |
| | | spark.append(ress.data); |
| | | let md5 = spark.end(false); |
| | | let formData = new FormData(); |
| | | formData.append('Md5', e); |
| | | formData.append('FileName', e); |
| | | formData.append('Md5', md5); |
| | | formData.append('FileName', md5); |
| | | formData.append('FileType', res.tempFiles[0].fileType); |
| | | formData.appendFile("file", res.tempFiles[0].tempFilePath); |
| | | const data = formData.getData(); |
| | |
| | | resolve(res.data); |
| | | if (res.data) { |
| | | that.setData({ |
| | | 'userInfoForm.icon': app.config.requestCtx + `/file/GetPreViewImage?md5=` + e, |
| | | 'userInfoForm.icon': app.config.requestCtx + `/file/GetPreViewImage?md5=` + md5, |
| | | }); |
| | | let userTypeInfo = { |
| | | "requests": [{ |
| | |
| | | icon: 'success', |
| | | duration: 1000, |
| | | }) |
| | | this.getUserInfo() |
| | | this.setData({ |
| | | that.getUserInfo() |
| | | that.setData({ |
| | | userInfoBox: false, |
| | | }); |
| | | } |
| | |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | |
| | | } |
| | | |
| | | }, |
| | | |
| | | onCloseProtocol() { |
| | | this.setData({ |
| | | userInfoBox: false, |
| | | }); |
| | | }, |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |