123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- // pages/me/me.js
- Page({
- data: {
- // role: "teacher",
- userInfo: {
- avatar: '../../image/imgs/avatar.jpg',
- name: '',
- role: '',
- phone: ''
- },
- // orderStatus: [
- // { text: '全部订单', type: 1 },
- // { text: '待付款', type: 2 },
- // { text: '待收货', type: 3 },
- // { text: '已完成', type: 4 }
- // ],
- historyItems: [
- {
- id: 1,
- thumbnail: '../../image/imgs/item1.jpg',
- name: '趣味识字卡片',
- date: '2023-10-15 14:30'
- },
- {
- id: 2,
- thumbnail: '../../image/imgs/item2.jpg',
- name: '趣味识字卡片',
- date: '2023-10-15 14:30'
- },
- // 更多历史记录...
- ],
- xiugaiimg: '',
- xiangjiimg: '',
- xiazi: '',
- souchangs: '',
- },
- onLoad(options) {
- this.getUserInfo();
- const fileIDs = [
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/xiugai.png',
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/xiangji.png',
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/xiazi.png',
- 'cloud://cloud1-6g98iw7i28b01747.636c-cloud1-6g98iw7i28b01747-1367995226/images/icon/soucangs.png'
- ];
-
- // 并发下载多个 fileID
- Promise.all(
- fileIDs.map(fileID => wx.cloud.downloadFile({ fileID }))
- ).then(results => {
- // 每个 result 对应一个下载结果
- const tempFilePaths = results.map(r => r.tempFilePath);
- console.log('全部下载成功:', tempFilePaths);
- this.setData({
- xiugaiimg: tempFilePaths[0],
- xiangjiimg: tempFilePaths[1],
- xiazi: tempFilePaths[2],
- souchangs: tempFilePaths[3],
- });
- }).catch(err => {
- console.error('有文件下载失败:', err);
- });
- },
- getUserInfo() {
- // 模拟获取用户信息的逻辑
- const userInfo = {
- avatar: '../../image/imgs/avatar.jpg',
- name: '琳老师',
- role: '老师',
- phone: '131****9345'
- };
- this.setData({ userInfo });
- },
- handleLogout() {
- wx.navigateTo({
- url: `/subpackages/logoff/logoff`
- });
- // 处理用户注销的逻辑
- // wx.showModal({
- // title: '提示',
- // content: '确定要注销吗?',
- // success: (res) => {
- // if (res.confirm) {
- // // 注销成功后的处理逻辑
- // wx.showToast({
- // title: '已注销',
- // icon: 'success'
- // });
- // }
- // }
- // });
- },
- // 跳转
- goToGoodsList(e) {
- const type = e.currentTarget.dataset.type;
- wx.navigateTo({
- url: `/subpackages/order/order?type=${type}`
- });
- },
- goToGoodsLists() {
- wx.navigateTo({
- url: `/subpackages/changename/changename`
- });
- }
- });
|