|
- const app = getApp()
- const config = require("../../config/config")
- const Http = require("../../utils/HttpBasics.js")
- const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
- Page({
- data:{
- imgHttps:app.globalData.imgHttps,
- navigationBarHeight,
- id:"",//upid
- name:'',//upName
- indexFlog:2,//选着类别
- upData:{},//作者信息
- pageNum:1,
- classList:[],//课程列表
- dNum:"",//但课程数
- zNum:"",//专栏数
- addFlag: true,
- },
- hieaddCheck() {
- let animation = tt.createAnimation({
- duration: 1000,
- timingFunction: "ease",
- });
- animation.translateX(400).step()
- this.setData({
- // extraClasses: 'addBox-transition',
- showAddBox: animation.export(),
- addFlag: true
- })
- },
- showAddCheck: function () {
- this.setData({
- addFlag: false
- })
- let animation = tt.createAnimation({
- duration: 1000,
- timingFunction: "ease",
- });
- animation.translateX(0).step()
- this.setData({
- showAddBox: animation.export(),
-
- })
- },
- getClass(){//课程list
- Http.get({
- url:config.api.columnLsit,
- data:{
- merchantId:this.data.id,
- type:this.data.indexFlog,
- pageNum:this.data.pageNum,
- pageSize: 6
- }
- }).then(res=>{
- if(this.data.pageNum>1){
- let temp = this.data.classList
- temp.push(...res.data.list)
- this.setData({
- classList:temp
- })
- }else{
- this.setData({
- classList:res.data.list
- })
- }
-
- })
- },
- setIndex(e){
- let index = e.currentTarget.dataset.index
- console.log(index);
- this.setData({
- indexFlog:index,
- pageNum:1,
- classList:[]
- })
- this.getClass()
- },
- getUpData(){
- Http.get({
- url:config.api.getUpUser,
- data:{
- id:this.data.id
- }
- }).then(res=>{
- let temp = res.data
- let arr = JSON.parse(res.data.businessTypes)
- let sring = ""
- arr.map(item=>{
- sring += ' '+item.title
- })
- temp.sring = sring
- console.log(temp);
- this.setData({
- upData:temp
- })
- }).catch(err=>{
- tt.showToast({
- title: err.message, // 内容
- icon:"none"
- });
- })
- },
- onLoad(options){
- if(app.globalData.token){
- this.setData({
- id:options.id,
- name:options.name
- })
- this.getUpData()
- this.getClass()
-
- }else{
- app.tokenCallback = token =>{
- this.setData({
- id:options.id,
- name:options.name
- })
- this.getUpData()
- this.getClass()
- }
- }
-
- },
- onReachBottom() {
- console.log("到底了");
- this.setData({
- pageNum:this.data.pageNum+1
- })
- this.getClass()
-
- },
- onShow() {
- let animation = tt.createAnimation({
- duration: 0,
- // timingFunction: "ease",
- });
- animation.translateX(400).step()
- this.setData({
- showAddBox: animation.export(),
- screenFlag:false,//初始化防录屏弹框
- })
- // this.itiRecording()
-
- },
- onShareAppMessage: function (shareOption) {
- let that = this
- if (shareOption.channel == 'video') { // 判断是是不是分享视频
- return {
- channel: 'video', // 必写 video
- // templateId: '', // 分享的模版 id (如果未设置就是默认,下面会说如何设置)
- title: `知播堂-${that.data.upData.name}`, // 分享的标题
- // desc: '我是简介', // 分享的内容介绍目前没有用
- path: `/pages/UpHome/UpHome?id=${that.data.id}&name=${that.data.name}`, // 分享的路径
- extra: {
- videoTopics: ["知播堂",] // 只有抖音才会有的属性
- },
- }
- } else { // 右上角分享
- return {
- templateId: '', //分享的模版 id
- title: '', //分享的标题
- desc: '', // 分享的内容
- // path: ``, // 分享的路径
- }
- }
- },
- })
|