diff --git a/.env.development b/.env.development index da8a02c3..2911866d 100644 --- a/.env.development +++ b/.env.development @@ -3,4 +3,6 @@ ENV = 'development' # 'development' # base api -VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786' +# VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786' +# 苗扬 +VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786' diff --git a/src/api/common.js b/src/api/common.js index 2e8954f6..871eb002 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -7,8 +7,6 @@ import { export const uploadFile = (file, data) => { - - const url = '/plimg/fileUpload/stuMgrUploadImg'; const base_url = get_base_url(url); const token = getToken(); @@ -43,19 +41,23 @@ export const uploadFile = (file, data) => { // 对象存储预览 /traoss/tras3/show/{文件ID} -export function previewFile(id,responseType = 'blob') { +export function previewFile(id,responseType = 'arraybuffer') { const token = getToken(); - const header = {}; + const header = { + "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", + }; if (token) header['summary'] = token + let baseUrl = get_base_url(); return new Promise((resolve, reject) => { uni.request({ - url: `/traoss/tras3/show/${id}`, + url: `${baseUrl}/traoss/tras3/show/${id}`, header, responseType, success(result) { - resolve(result.data) + let _blob = new Blob([result.data],{type:result.header['content-type'].split(';')[0]}) + resolve(_blob) }, fail(error) { reject(new Error('Upload failed')); diff --git a/src/api/course.js b/src/api/course.js index 31eb14ab..a24eedf7 100644 --- a/src/api/course.js +++ b/src/api/course.js @@ -1,27 +1,68 @@ import request from '@/api/request' +const base_url = '/traapp' // 获取课程分类树接口 export const getCourseTypeListApi = (data) => { - return request({ - url: '/app/traCrsCatalogInfo/courseQueryTraCrsCatalogInfoList', - method: 'post', - data - }); + return request({ + url: base_url + '/app/traCrsCatalogInfo/courseQueryTraCrsCatalogInfoList', + method: 'post', + data + }); }; // 获取生产线分类树接口 export const getPrdLineTypeListApi = (data) => { - return request({ - url: '/app/traPrdLineInfo/courseQueryTraPrdLineInfoList', - method: 'post', - data - }); + return request({ + url: base_url + '/app/traPrdLineInfo/courseQueryTraPrdLineInfoList', + method: 'post', + data + }); }; // 获取标签分类树 接口 export const getTraTagListApi = (data) => { - return request({ - url: '/app/traTagCatalogInfo/queryTraTagCatalogInfoList', - method: 'post', - data - }); -}; \ No newline at end of file + return request({ + url: base_url + '/app/traTagCatalogInfo/queryTraTagCatalogInfoList', + method: 'post', + data + }); +}; +// 全部模块 +export const queryCrsInfoByCatalogApi = (data) => { + return request({ + url: base_url + '/crsInfo/queryCrsInfoByCatalog', + method: 'post', + data + }); +}; +// 生产线模块- +export const queryCrsInfoByPrdLineApi = (data) => { + return request({ + url: base_url + '/crsInfo/queryCrsInfoByPrdLine', + method: 'post', + data + }); +}; +// 最新 +export const queryCrsInfoByLastnewApi = (data) => { + return request({ + url: base_url + '/crsInfo/queryCrsInfoByLastnew', + method: 'post', + data + }); +}; +// 最热 +export const queryCrsInfoByPopularApi = (data) => { + return request({ + url: base_url + '/crsInfo/queryCrsInfoByPopular', + method: 'post', + data + }); +}; +// 推荐 +export const queryCrsInfoByRecmdApi = (data) => { + return request({ + url: base_url + '/crsInfo/queryCrsInfoByRecmd', + method: 'post', + data + }); +}; diff --git a/src/api/login.js b/src/api/login.js index bc20076c..8f3389d1 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -6,7 +6,7 @@ const setUserInfo = data => uni.setStorageSync('userInfo', data) // 账号登录接口 export const useAccountLoginApp = (data) => request({ - url: '/access/userLogin', + url: '/traapp/access/userLogin', method: 'post', data }).then(async({ rtnCode, body }) => { @@ -29,21 +29,21 @@ export const useAccountLoginApp = (data) => request({ // 获取个人信息 export const queryCurrentUser = (data) => request({ - url: '/access/queryCurrentUser', + url: '/traapp/access/queryCurrentUser', method: 'post', data }) //获取隐私协议 export const getYsxy = (data) => request({ - url: '/dfAgtInfo/queryValidDfAgt', + url: '/traapp/dfAgtInfo/queryValidDfAgt', method: 'post', data }) // 获取验证码(作废) export const getLoginAppCheckCode = (data) => request({ - url: '/access/checkCode', + url: '/traapp/access/checkCode', method: 'get', data }) \ No newline at end of file diff --git a/src/api/request.js b/src/api/request.js index 82f92dd1..987b4efe 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -8,10 +8,10 @@ const ENV = import.meta.env export const get_base_url = url => { if (process.env.NODE_ENV === 'development') { // 开发环境 - return ENV.VITE_APP_BASE_API_Url + "/traapp" + return ENV.VITE_APP_BASE_API_Url } else if (process.env.NODE_ENV === 'production') { // 生产环境 - return ENV.VITE_APP_BASE_API_Url + "/traapp" + return ENV.VITE_APP_BASE_API_Url } } @@ -21,17 +21,19 @@ export default function request({ data, meta, isStream, - suppressErrors + suppressErrors, + header={} }) { const base_url = get_base_url(url); - const header = { + const headers_base = { 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', + ...(header||{}) } let token = getToken() if (token) { - header['summary'] = token // 让每个请求携带令牌 + headers_base['summary'] = token // 让每个请求携带令牌 } let that = this return new Promise((resolve, reject) => { @@ -39,7 +41,7 @@ export default function request({ url: `${base_url}${url}`, data: data, method: method, - header: header, + header: headers_base, success: (response) => { if (isStream) { // 流式传输,直接返回 return resolve(response); diff --git a/src/components/course-item/course-item.vue b/src/components/course-item/course-item.vue index 97081824..a6573f9a 100644 --- a/src/components/course-item/course-item.vue +++ b/src/components/course-item/course-item.vue @@ -1,20 +1,128 @@ - \ No newline at end of file diff --git a/src/components/image-preview/image-preview.vue b/src/components/image-preview/image-preview.vue index 44965b37..9ae86165 100644 --- a/src/components/image-preview/image-preview.vue +++ b/src/components/image-preview/image-preview.vue @@ -1,27 +1,29 @@ @@ -102,6 +310,7 @@ import { onMounted } from 'vue' } .course-center-body{ position: absolute; + overflow: hidden; left:0; top: 0; height: 100%; @@ -120,6 +329,7 @@ import { onMounted } from 'vue' font-weight: 500; color:#000; position: relative; + // margin-bottom: 23rpx; .arrow-icon{ position: absolute; left:36rpx; @@ -139,15 +349,99 @@ import { onMounted } from 'vue' } .list-view{ flex:1; + overflow: hidden; margin-bottom: 80rpx; background: #ffffff; border-radius: 23rpx; display: flex; flex-direction: column; + position: relative; + .filter-list{ + position: absolute; + top: 84rpx; + left:0; + width: 100%; + height: 508rpx; + overflow-y: auto; + z-index: 2; + background-color: #f9f9f9; + box-shadow: 0rpx 3.85rpx 38rpx rgba(0,0,0,.05); + padding: 0rpx 25rpx; + box-sizing: border-box; + .filter-type{ + padding: 10rpx 0; + box-sizing: border-box; + .filter-type-title{ + font-size: 29rpx; + line-height: 40rpx; + margin-bottom: 15rpx; + color: #000; + } + .filter-type-list{ + overflow: hidden; + .filter-type-item{ + width: calc(25% - 18rpx); + font-size: 29rpx; + box-sizing: border-box; + padding:0 20rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + text-align: center; + float: left; + margin-right: 24rpx; + height: 65rpx; + line-height: 65rpx; + background-color: #f1f3f8; + border-radius: 6rpx; + margin-bottom: 20rpx; + &:nth-child(4n){ + margin-right: 0; + } + &.is-active{ + color: #06f; + } + } + } + &+.filter-type{ + margin-top: 20rpx; + } + } + } + .filter-list{ + display: none; + &.show{ + display: block; + } + } + .filter-btn{ + position: absolute; + right: 0; + top: 0; + height: 83rpx; + width: 120rpx; + line-height: 83rpx; + font-size: 26rpx; + background: #fff; + z-index: 2; + text-align: center; + box-shadow: -4rpx 0 6rpx rgba(0,0,0,.05); + white-space: nowrap; + padding-right: 30rpx; + box-sizing: border-box; + .filter-icon{ + // display: inline-block; + font-size: 26rpx; + position: absolute; + right: 15rpx; + top: 50%; + transform: translateY(-50%); + } + } .tags-view{ height: 84rpx; display: block; - padding: 20rpx; + padding: 20rpx 120rpx 20rpx 20rpx; box-sizing: border-box; white-space: nowrap; border-bottom: 2rpx solid #eee; @@ -158,16 +452,21 @@ import { onMounted } from 'vue' padding: 0 20rpx; .uv-tags__text{ white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 200rpx; } } } } .course-list{ display: flex; - flex:1; + flex:1; + overflow: hidden; .left-type-list{ width: 152rpx; border-right: 2rpx solid #eee; + overflow-y: auto; .type-item{ height: 90rpx; line-height: 90rpx; @@ -185,6 +484,28 @@ import { onMounted } from 'vue' } .right-course-list{ flex:1; + overflow-y: auto; + .type-list{ + .type-title{ + font-size: 33rpx; + line-height: 43rpx; + margin: 20rpx 15rpx 5rpx; + height: 43rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 600; + .left-color{ + width: 8rpx; + height: 33rpx; + margin-top: 5rpx; + float: left; + overflow: hidden; + background-color: #06f; + margin-right: 8rpx; + } + } + } } } } diff --git a/src/pagesB.json b/src/pagesB.json index 6e9c3836..c4004c85 100644 --- a/src/pagesB.json +++ b/src/pagesB.json @@ -1,5 +1,13 @@ { "pages": [ - + { + "path": "pages/course/index", + "style": { + "navigationBarTitleText": "课程中心", + "app-plus": { + "titleNView": false + } + } + } ] } \ No newline at end of file diff --git a/src/uni_modules/uv-transition/changelog.md b/src/uni_modules/uv-transition/changelog.md new file mode 100644 index 00000000..59e49688 --- /dev/null +++ b/src/uni_modules/uv-transition/changelog.md @@ -0,0 +1,19 @@ +## 1.0.8(2023-10-18) +1. 修复在APP上不能正常显示的BUG +## 1.0.7(2023-10-12) +1. 修复部分情况,修改某属性自动关闭的BUG +## 1.0.6(2023-07-24) +1. 优化 nvue模式下增加cellChild参数,是否在list中cell节点下,nvue中cell下建议设置成true +## 1.0.5(2023-07-02) +修改VUE3模式下可能存在的BUG +## 1.0.4(2023-07-02) +uv-transition 动画组件,代码重构优化,性能更加友好,增加自定义动画功能。详情参考文档:https://www.uvui.cn/components/transition.html +## 1.0.3(2023-06-12) +1. 恢复this.$nextTick的使用,经过测试百度等平台无问题 +## 1.0.2(2023-05-23) +1. 百度小程序等平台不支持this.$nextick,修改成延时 +## 1.0.1(2023-05-16) +1. 优化组件依赖,修改后无需全局引入,组件导入即可使用 +2. 优化部分功能 +## 1.0.0(2023-05-10) +1. 新增动画组件 diff --git a/src/uni_modules/uv-transition/components/uv-transition/createAnimation.js b/src/uni_modules/uv-transition/components/uv-transition/createAnimation.js new file mode 100644 index 00000000..8f89b185 --- /dev/null +++ b/src/uni_modules/uv-transition/components/uv-transition/createAnimation.js @@ -0,0 +1,131 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误 + this.animation = uni.createAnimation({ + ...options + }) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/src/uni_modules/uv-transition/components/uv-transition/props.js b/src/uni_modules/uv-transition/components/uv-transition/props.js new file mode 100644 index 00000000..e8b4e6b8 --- /dev/null +++ b/src/uni_modules/uv-transition/components/uv-transition/props.js @@ -0,0 +1,31 @@ +export default { + props: { + // 是否展示组件 + show: { + type: Boolean, + default: false + }, + // 使用的动画模式 + mode: { + type: [Array, String, null], + default() { + return 'fade' + } + }, + // 动画的执行时间,单位ms + duration: { + type: [String, Number], + default: 300 + }, + // 使用的动画过渡函数 + timingFunction: { + type: String, + default: 'ease-out' + }, + customClass: { + type: String, + default: '' + }, + ...uni.$uv?.props?.transition + } +} \ No newline at end of file diff --git a/src/uni_modules/uv-transition/components/uv-transition/uv-transition.vue b/src/uni_modules/uv-transition/components/uv-transition/uv-transition.vue new file mode 100644 index 00000000..cf9790dd --- /dev/null +++ b/src/uni_modules/uv-transition/components/uv-transition/uv-transition.vue @@ -0,0 +1,320 @@ + + diff --git a/src/uni_modules/uv-transition/package.json b/src/uni_modules/uv-transition/package.json new file mode 100644 index 00000000..c05eadb6 --- /dev/null +++ b/src/uni_modules/uv-transition/package.json @@ -0,0 +1,87 @@ +{ + "id": "uv-transition", + "displayName": "uv-transition 动画 全面兼容vue3+2、app、h5、小程序等多端", + "version": "1.0.8", + "description": "transition 该组件用于组件的动画过渡效果。", + "keywords": [ + "uv-transition", + "uvui", + "uv-ui", + "transition", + "动画" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "插件不采集任何数据", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [ + "uv-ui-tools" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/src/uni_modules/uv-transition/readme.md b/src/uni_modules/uv-transition/readme.md new file mode 100644 index 00000000..fbf8f591 --- /dev/null +++ b/src/uni_modules/uv-transition/readme.md @@ -0,0 +1,15 @@ +## Transition 动画 + +> **组件名:uv-transition** + +该组件用于组件的动画过渡效果,支持自定义动画,开箱即用。 + +# 查看文档 + +## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui) + +### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui) + +![image](https://mp-a667b617-c5f1-4a2d-9a54-683a67cff588.cdn.bspapp.com/uv-ui/banner.png) + +#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:官方QQ群