对接不知情的接口

master
chen 2022-08-12 18:14:13 +08:00
parent 08ce9d2038
commit 027d00edc4
24 changed files with 255 additions and 59 deletions

View File

@ -5,7 +5,7 @@
projectname:'', //
lat:'', //
lng:'' ,//
hostapi:'https://chuanwujia.scdxtc.cn' //
hostapi:'https://chuanwujia.com' //
},
// show
onLaunch: ()=> {

View File

@ -27,6 +27,7 @@
</view>
</view>
</view>
<view class="col9 fon24 disjcac pad-sx50" v-if="!dataList.length"></view>
</view>
<view class="bacf pad-sx20 disjcac boxshowt">
<view @tap="executeEv(1)" class="disjcac fon24" style="width: 380rpx;height: 70rpx;border-radius: 35rpx;background-color: #f37617;color: #FFFFFF;">
@ -82,7 +83,8 @@
},
//
checkChoose(){
let exitIndex = this.dataList.findIndex(item=>item.coupon_id==this.couponId);
console.log(this.couponId,666666);
let exitIndex = this.dataList.findIndex(item=>item.id==this.couponId);
if(exitIndex!=-1){
this.dataList[exitIndex].ifcheck = true;
this.setCoupon(true,exitIndex);
@ -90,11 +92,13 @@
},
//
setCoupon(flag,index){
if(this.dataList.length){
this.couponIndex = index;
this.dataList[index].ifcheck = flag;
this.couponPrice = flag?this.dataList[index].amount:0;//
this.couponId = flag?this.dataList[index].coupon_id:'';//id
this.couponId = flag?this.dataList[index].id:'';//id
this.couponCount = flag?1:0;//
}
},
//
chooseCoupon(id,index){

View File

@ -38,6 +38,7 @@
</template>
<script>
import { mapState } from 'vuex';
export default {
name:'status-nav',
props:{
@ -100,6 +101,11 @@
netTimer:null
}
},
computed: {
...mapState({
fristIn: state => state.moduleA.fristIn
})
},
mounted() {
//
this.$toolAll.tools.networkStatus();
@ -130,10 +136,16 @@
},
//
backEv(){
if(this.fristIn){
uni.reLaunch({
url:'/pages/tabbar/pagehome/pagehome'
})
} else {
uni.navigateBack({delta:1})
}
}
}
}
</script>
<style scoped>

View File

@ -5,7 +5,7 @@ export function uploadImg(data) {
}
// 视频上传\音频\文件
export function uploadFile(data) {
return request.upload("/universal/api.upload/upload", data, 'file');
return request.upload("/api/file/upload/video", data, 'video');
}
// 视频播放记录上报
export function reportRecord(data) {

View File

@ -46,6 +46,7 @@ const checkError = (e) => {
case 5001:// xxx错误
case 5050:// 服务器错误,请稍后重试
case 5051:// 未知错误
console.log(e,7777)
uni.showToast({
title:e.data.msg,
icon:'none'
@ -97,6 +98,7 @@ const request = (method, url, options) => {
break;
}
return new Promise((resolve, reject) => {
console.log(`${url}的参数===>`,options);
uni.request({
url: `${getApp().globalData.hostapi}${url}`,
method: methods,
@ -153,6 +155,9 @@ const uploadFile = (url, options, type) => {
if (temp.code == 0) {
resolve(temp)
}
} else {
// 接口返回错误信息
checkError(res);
}
}
});

View File

@ -69,7 +69,7 @@
/* */
"mp-weixin" : {
/* */
"appid" : "wxa02e44170bc722cd",
"appid" : "wxfda00ea49fc88f8f",
"setting" : {
"urlCheck" : true,
"es6" : true,

View File

@ -205,6 +205,15 @@
"enablePullDownRefresh": false
}
}
,{
"path" : "upload-video/upload-video",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
]
}

View File

@ -117,7 +117,7 @@
city: ya.userInfo.city,//
gender: ya.userInfo.gender,//
language:ya.userInfo.language,//
invite_code:uni.getStorageSync('inviteCode')?uni.getStorageSync('inviteCode'):'',
invite_code:uni.getStorageSync('invite_code')?uni.getStorageSync('invite_code'):'',
is_active:1
}
this.$requst.post('/api/user/login',params).then(res => {

View File

@ -2,7 +2,7 @@
<view>
<status-container :ifReturn="false" titlet="课程列表">
<view slot="content" style="margin-top: -20rpx;">
<view class="posi-sticky" :style="{top:newtop+'px'}">
<view class="bacf">
<view class="pad-sx26 pad-zy20" style="border-bottom: 2rpx solid #fcede8;">
<view class="radius40 pad-sx2 disjbac pad-zy20" style="background-color: #fff6f5;border: 2rpx solid #ece6e6;">
<input v-model="keyword" @confirm="getCourseList" type="text" class="fon24 width100 pad-sx6" placeholder="关键字搜索" placeholder-style="color:#aaa4a3">
@ -11,6 +11,8 @@
</view>
</view>
</view>
</view>
<view class="posi-sticky" :style="{top:newtop+'px'}">
<swiper-tab id="tab" :list="dataList" v-model="current" @changeEv="clickTab" :itemColor="'#e42417'" :lineColor="'#e42417'"></swiper-tab>
</view>
<view class="pad-zy20">
@ -48,7 +50,7 @@
noMore:false,//
}
},
onLoad() {
onShow() {
//
this.getCourseCate();
},
@ -108,7 +110,7 @@
//
goDetail(id){
uni.navigateTo({
url:`/pagesB/course-detail/course-detail?id=${id}`
url:`/pagesB/course-detail/course-detail?id=${id}&category_id=${this.classId}`
})
},
}

View File

@ -57,12 +57,11 @@
statusBarHeight: uni.getSystemInfoSync().statusBarHeight, //
newHeight:uni.getSystemInfoSync().screenHeight, //
isLoading:false, //
// {src:'/static/tabbar/icon-panh.png',title:''},
funList:[
{src:'/static/tabbar/icon-set.png',title:'个人资料'},
{src:'/static/tabbar/icon-course.png',title:'我的课程'},
{src:'/static/tabbar/icon-order.png',title:'我的订单'},
{src:'/static/tabbar/icon-panh.png',title:'我的练习视频'},
{src:'/static/tabbar/icon-coupon.png',title:'我的优惠券'},
{src:'/static/tabbar/icon-score.png',title:'我的积分'},
{src:'/static/tabbar/icon-address.png',title:'我的地址'},
@ -97,12 +96,11 @@
//
chooseFun(index){
// '/pagesA/my-video/my-video',
let list = [
'/pagesA/my-data/my-data',
'/pagesA/my-course/my-course',
'/pagesA/my-order/my-order',
'/pagesA/my-video/my-video',
'/pagesA/my-coupon/my-coupon',
'/pagesA/my-integral/my-integral',
'/pagesA/my-address/my-address',

View File

@ -20,7 +20,7 @@
<span class="bold">{{item.price}}</span>
<span class="fon20 colf8 mar-z20 tline-through">{{item.original_price}}</span>
</view>
<view class="radius18 pad-zy12 pad-sx4 borbot-f disjcac">购买</view>
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.id}&category_id=${dataList[current].id}`)" class="radius18 pad-zy12 pad-sx4 borbot-f disjcac">{{item.is_buy?'去学习':'购买'}}</view>
</view>
</view>
</view>
@ -98,7 +98,15 @@
// banner
this.$store.commit('setAutoplay',false);
},
onLoad() {
onShareAppMessage(res) {
var shareObj = {
     title: ``, // (slogan)
     path: `/pages/tabbar/pagehome/pagehome?invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
},
onLoad(op) {
//
this.getCourseCate();
// banner
@ -206,15 +214,15 @@
},
//
palyVideo(index){
if(!this.videoList[index].src){
if(this.videoList[index].type=="video_number"){
// #ifdef MP-WEIXIN
wx.openChannelsActivity({
finderUserName:this.videoList[index].video_number,
feedId:this.videoList[index].subtitle,
feedId:this.videoList[index].video_id,
success:(res)=>{
reportRecord({id:this.videoList[index].id}).then(result=>{})
},fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除')
// this.$toolAll.tools.showToast('')
}
})
// #endif

View File

@ -91,11 +91,11 @@
},
//
palyVideo(index){
if(!this.dataList[index].src){
if(this.dataList[index].type=="video_number"){
// #ifdef MP-WEIXIN
wx.openChannelsActivity({
finderUserName:this.dataList[index].video_number,
feedId:this.dataList[index].subtitle,
feedId:this.dataList[index].video_id,
success:(res)=>{
reportRecord({id:this.dataList[index].id}).then(result=>{
if(result.code==0){
@ -103,7 +103,7 @@
}
})
},fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除')
// this.$toolAll.tools.showToast('')
}
})
// #endif

View File

@ -16,7 +16,7 @@
<nothingPage content="地址列表空荡荡滴"></nothingPage>
</view>
<view class="disjcac pad-s50">
<view @tap="$toolAll.tools.goPage('/pagesB/add-address/add-address')" class="disjcac radius34" style="width: 396rpx;height: 72rpx;background-color: #f37717;color: #FFFFFF;">
<view @tap="$toolAll.tools.goPage('/pagesB/add-address/add-address')" class="disjcac radius34" style="width: 396rpx;height: 72rpx;background-color: #f37717;color: #FFFFFF;position: relative;z-index: 100;">
<view class="icon icon-add04 fon28"></view>
<view class="fon26 mar-z10">新增收货地址</view>
</view>

View File

@ -18,7 +18,7 @@
<view class="">{{item.name}}</view>
<view class="fon20" style="color: #747474;" v-if="item.begin_at">{{item.begin_at.slice(0,10).split('-').join('.')}}-{{item.end_at.slice(0,10).split('-').join('.')}}</view>
</view>
<view class="flexs mar-z20 radius26 colf disjcac" style="width: 124rpx;height: 52rpx;" :style="{backgroundColor:current!=0?'#c0c0c0':'#f37717'}">去使用</view>
<view @tap="goCourse" class="flexs mar-z20 radius26 colf disjcac" style="width: 124rpx;height: 52rpx;" :style="{backgroundColor:current!=0?'#c0c0c0':'#f37717'}">去使用</view>
</view>
<!-- <view class="disac fon20 pad-s20" style="color: #747474;">
<span @tap="lookDetail(index)"></span>
@ -89,6 +89,14 @@
this.getCouponList();
},
methods: {
// 使
goCourse(){
if(this.status=='normal'){
uni.reLaunch({
url:'/pages/tabbar/course/course'
})
}
},
// tab
clickTab(index){
this.dataList = [];

View File

@ -12,7 +12,7 @@
</view>
<view class="disjbac width100">
<view class="fon24">{{item.price}}</view>
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view>
<view @tap="$toolAll.tools.goPage(`/pagesB/course-detail/course-detail?id=${item.spu_id}`)" class="disjcac fon22 radius26" style="width: 144rpx;height: 52rpx;color: #f37717;border: 2rpx solid #f37717;">点击学习</view>
</view>
</view>
</view>

View File

@ -162,6 +162,8 @@
})
},1000)
}
} else {
this.flag = true;
}
})
}

View File

@ -14,6 +14,7 @@
</view>
</view>
</status-container>
<view @tap="$toolAll.tools.goPage('/pagesB/upload-video/upload-video')" class="disjcac colf fon24 radius34" style="position: fixed;bottom: 30rpx;left: 50%;transform: translateX(-50%);width: 360rpx;height: 68rpx;background-color: #e42417;">上传新的练习视频</view>
</view>
</template>

View File

@ -115,6 +115,11 @@
this.$requst.post('/api/order/paid',{order_coding:info.coding}).then(res=>{
if(res.code==0){
this.$toolAll.tools.showToast('支付成功(*^▽^*)');
setTimeout(()=>{
uni.reLaunch({
url:'/pages/tabbar/course/course'
})
},1500)
} else this.$toolAll.tools.showToast(res.msg);
})
},
@ -125,6 +130,8 @@
this.flag = true;
}
});
} else {
this.flag = true;
}
})
}

View File

@ -175,6 +175,8 @@
})
},1000)
}
} else {
this.flag = true;
}
})
}

View File

@ -40,7 +40,7 @@
<view class="posAll disjc" v-if="ifLogin">
<view class="bacf radius10 posir disjcac fc pad-zy60" style="height: 256rpx;margin-top: 304rpx;">
<image src="/static/tabbar/icon-password.png" mode="" lazy-load style="width: 86rpx;height: 102rpx;"></image>
<view class="fon28 mar-s20">请登录后查看课程<span style="color:#e42417;">去登</span></view>
<view class="fon28 mar-s20">请登录后查看课程<span style="color:#e42417;" @tap="goLogin"></span></view>
<view class="posia-sy20" @tap="ifLogin=false"><i class="icon icon-del-white fon24" style="color: #9d9d9d;"></i></view>
</view>
</view>
@ -68,13 +68,20 @@
id:'', //id
page:1, //
size:1000, //
courseList:[]
courseList:[],
}
},
onLoad(op) {
if(op.id){
if(op.invite_code) {
//
this.$store.commit('setFristIn',true);
uni.setStorageSync('invite_code',op.invite_code);
} else {
this.$store.commit('setFristIn',false);
}
this.id = op.id;
this.classId = op.category_id
this.classId = op.category_id;
//
this.getCouresDetail(op.id);
}
@ -82,7 +89,7 @@
onShareAppMessage(res) {
var shareObj = {
     title: ``, // (slogan)
     path: `/pagesB/course-detail/course-detail?id=${this.id}&category_id=${this.classId}&is_activity=${this.detailObj.is_activity==0 ? 0 : 1}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     path: `/pagesB/course-detail/course-detail?id=${this.id}&category_id=${this.classId}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
@ -123,6 +130,7 @@
},
//
goBuy(){
if(uni.getStorageSync('is_active')){
let params = {
sku_list:this.courseList[0].sku_list
};
@ -135,6 +143,9 @@
})
}
})
} else {
this.ifLogin = true;
}
},
//
getCouresRecommend(){
@ -145,7 +156,6 @@
id:this.id
}
this.$requst.get('/api/spu/course-recommend',params).then(res=>{
console.log(res,'课程推荐')
if(res.code==0) {
this.$refs.refcourse.list = res.data.list;
}
@ -160,25 +170,35 @@
},
//
playVideo(){
if(!this.couresDetail[index].src){
if(this.couresDetail.type=="video_number"){
// #ifdef MP-WEIXIN
wx.openChannelsActivity({
finderUserName:this.couresDetail[index].video_number,
feedId:this.couresDetail[index].subtitle,
finderUserName:this.couresDetail.video_number,
feedId:this.couresDetail.video_id,
success:(res)=>{},fail:()=>{
this.$toolAll.tools.showToast('视频已丢失或已删除')
// this.$toolAll.tools.showToast('')
}
})
// #endif
} else {
if(uni.getStorageSync('is_active')){
let newArr = [];
newArr.push(this.couresDetail[index])
newArr.push({src:this.couresDetail.video})
uni.setStorageSync('videoList',newArr);
uni.navigateTo({
url:`/pagesB/play-video/play-video?current=${index}`
url:`/pagesB/play-video/play-video?current=${0}`
})
} else {
this.ifLogin = true;
}
}
},
//
goLogin(){
uni.navigateTo({
url:`/pages/login/login`
})
}
}
}
</script>

View File

@ -124,6 +124,8 @@
})
},1000)
}
} else {
this.flag = true;
}
})
}

View File

@ -88,7 +88,22 @@
// banner
this.$store.commit('setAutoplay',false);
},
onShareAppMessage(res) {
var shareObj = {
     title: ``, // (slogan)
     path: `/pagesB/shop-detail/shop-detail?id=${this.shopId}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: ``//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
},
onLoad(op) {
if(op.invite_code) {
//
this.$store.commit('setFristIn',true);
uni.setStorageSync('invite_code',op.invite_code);
} else {
this.$store.commit('setFristIn',false);
}
this.shopId = op.id;
//
this.getDetail();

View File

@ -0,0 +1,96 @@
<template>
<view>
<status-container titlet="上传练习视频" returnc="#FFFFFF">
<view slot="content">
<view class="pad-zy20">
<view class="radius8 bacf pad-sx40 pad-zy40 boxshow2 col26 fon24">
<view class="">视频标题</view>
<input v-model="title" class="width100 radius4 mar-s20 pad-zy20" type="text" style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;">
<view class="mar-s40">视频上传</view>
<input @tap="uploadVideo" class="width100 radius4 mar-s20 pad-zy20 tcenter" type="text" placeholder="浏览..." disabled
style="border: 2rpx solid #ececec;background-color: #f5f5f5;height: 70rpx;box-sizing: border-box;">
<input @tap="submitEv" class="width100 radius4 mar-s60 tcenter" type="text" placeholder="立即上传" placeholder-style="color:#FFFFFF;" disabled
style="border: 2rpx solid #e42417;background-color: #e42417;height: 70rpx;box-sizing: border-box;">
</view>
</view>
</view>
</status-container>
</view>
</template>
<script>
import {uploadFile} from '@/jsFile/public-api.js';
export default {
data() {
return {
title:'',
videoInfo:{
full_src:'',
src:''
},
flag:true
}
},
methods: {
//
uploadVideo(){
uni.chooseMedia({
sourceType:['album','camera'],
success: (res) => {
uni.showToast({
title:'正在上传...',
icon:'none',
duration:100000
})
uploadFile({path:res.tempFiles[0].tempFilePath}).then(res=>{
if(res.code==0){
this.videoInfo = res.data;
this.$toolAll.tools.showToast('上传视频成功(*^▽^*)');
}
setTimeout(()=>{
uni.hideToast();
},1500)
})
}
})
},
//
submitEv(){
if(!this.title){
this.$toolAll.tools.showToast('请输入视频标题');
} else if(!this.videoInfo.full_src){
this.$toolAll.tools.showToast('请上传视频');
} else {
if(this.flag){
this.flag = false;
let params = {
title:this.title,
video:this.videoInfo.full_src
}
uni.showToast({
title:'正在上传练习视频',
icon:'none',
duration:100000
})
this.$requst.post('/api/user/practice-video',params).then(res=>{
if(res.code==0){
this.title = '';
this.videoInfo.full_src = '';
this.$toolAll.tools.showToast('上传练习视频成功');
}
setTimeout(()=>{
uni.hideToast();
},1500)
}).catch(err=>{
this.flag = true;
})
}
}
}
}
}
</script>
<style>
</style>

View File

@ -2,12 +2,17 @@ export default {
state:{//存放状态
token:'token已生成',
userInfo:{},
ifAutoplay:false // 组件轮播是否自动播放
ifAutoplay:false ,// 组件轮播是否自动播放
fristIn:false
},
// Vuex中store数据改变的唯一方法就是mutations 不适合异步方法
mutations: {
setAutoplay(state,str) {
state.ifAutoplay = str;
}
},
// 设置是否第一次进入
setFristIn(state,str) {
state.fristIn = str;
},
}
}