123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- // pages/my/my.js
- import {
- createStoreBindings
- } from "mobx-miniprogram-bindings"
- import {
- store
- } from "../../store/index"
- import Dialog from '@vant/weapp/dialog/dialog';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- // 显示学管
- activeCustomer: false
- },
- closeLogin() {
- // 清除缓存,清空数据,返回首页
- },
- showCustomer() {
- this.setData({
- activeCustomer: !this.data.activeCustomer
- })
- },
- // 关闭dialog
- onClose() {
- this.setData({
- activeCustomer: false
- });
- },
- // 拨打电话
- onPhone() {
- wx.makePhoneCall({
- phoneNumber: '1340000' //仅为示例,并非真实的电话号码
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: ["userInfo"],
- actions: {
- upDateActive: "upDateActive",
- setUser: "setUserInfo"
- }
- })
- if (wx.getStorageSync('userInfo')) {
- this.setUser(wx.getStorageSync('userInfo'))
- }
- },
- upload() {
- wx.chooseMedia({
- count: 1,
- mediaType: ['image'],
- sourceType: ['album', 'camera'],
- camera: 'back',
- success(res) {
- console.log(res.tempFiles[0].tempFilePath)
- console.log(res)
- wx.uploadFile({
- filePath: res.tempFiles[0].tempFilePath,
- name: 'file',
- url: 'http://purchase.platomix.net/prod-api/app-api/tutor/h5/upload',
- formData: {
- id: 1
- },
- success: (res) => {
- console.log(res, "data")
- }
- })
- }
- })
- },
- closeSign() {
- Dialog.confirm({
- title: '退出登录',
- message: '确认退出当前账号吗?',
- })
- .then(() => {
- wx.removeStorageSync('userInfo')
- this.upDateActive(0)
- this.setUser({})
- wx.reLaunch({
- url: "/pages/newIndex/newIndex"
- })
- // on confirm
- })
- .catch(() => {
- // on cancel
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|