12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import {
- createStoreBindings
- } from 'mobx-miniprogram-bindings'
- import {
- store
- } from '~/store/index'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- score: {},
- tempFilePath: ''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: {
- userInfo: 'userInfo'
- },
- })
- this.storeBindings.updateStoreBindings()
- let score = JSON.parse(options.detail)
- wx.setNavigationBarTitle({
- title: score.title
- })
- let tempFilePath = wx.getStorageSync('tempFilePath')
- this.setData({
- score,
- tempFilePath
- })
- },
- upload() {
- const uploadTask = wx.uploadFile({
- url: 'https://reader-api.ai160.com//file/upload',
- filePath: this.data.tempFilePath,
- name: '朗读录音',
- header: {
- uid: wx.getStorageSync('uid')
- },
- success: (res) => {
- const formateRes = JSON.parse(res.data);
- let audioPath = formateRes.data;
- console.log(audioPath);
- }
- })
- uploadTask.onProgressUpdate((res) => {
- console.log('上传进度', res.progress)
- })
- },
- onShareAppMessage() {
- }
- })
|