diff --git a/api/medication.js b/api/medication.js deleted file mode 100644 index e29b121..0000000 --- a/api/medication.js +++ /dev/null @@ -1,23 +0,0 @@ -import http from '../common/axios.js' - -// 账号密码登录 -function medication_login(data) { - let url = '/dnseyeapi/Login/login' - return http.post(url, data).then(res => { - return res; - }) -} - -//登录 -function login(data) { - let url = '/login' - return http.get(url,data).then(res => { - return res; - }) -} - - -export default { - login, - medication_login, -} \ No newline at end of file diff --git a/api/member.js b/api/member.js index 1713c4e..356fea2 100644 --- a/api/member.js +++ b/api/member.js @@ -1,44 +1,4 @@ import http from '../common/axios.js' - -// 账号密码登录 -function medication_login(data) { - let url = '/dnseyeapi/Login/login' - return http.post(url, data).then(res => { - return res; - }) -} - -//登录 -function login(data) { - let url = '/login' - return http.get(url,data).then(res => { - return res; - }) -} - - - - - - - - - - - - - - - - - - - - - - - - //获取学员信息 function member(data) { @@ -48,10 +8,19 @@ function member(data) { }) } - - export default { - login, - medication_login, member, + // 业务员端配置项(关于我们) + setFeedback(data) { + let url = '/member/set_feedback' + return http.post(url,data).then(res => { + return res; + }) + }, + login(data) { + let url = '/login' + return http.get(url,data).then(res => { + return res; + }) + }, } \ No newline at end of file diff --git a/common/config.js b/common/config.js index 949925a..059450c 100644 --- a/common/config.js +++ b/common/config.js @@ -1,10 +1,10 @@ // 线上地址 -const Api_url='http://146.56.228.75:20021/api' -const img_domian = 'http://146.56.228.75:20021/' +// const Api_url='http://146.56.228.75:20021/api' +// const img_domian = 'http://146.56.228.75:20021/' //本地测试地址 -// const Api_url='http://zhjw.cc/api' -// const img_domian = 'http://zhjw.cc/' +const Api_url='http://zhjw.cc/api' +const img_domian = 'http://zhjw.cc/' const IsDemo = false diff --git a/common/util.js b/common/util.js index b645006..cc67c08 100644 --- a/common/util.js +++ b/common/util.js @@ -1,3 +1,5 @@ +import {img_domian} from "./config"; + function formatTime(time) { if (typeof time !== 'number' || time < 0) { return time @@ -94,10 +96,56 @@ const hexToRgba = (hex, opacity) => { //16进制颜色转rgba return "rgba(" + parseInt("0x" + hex.slice(1, 3)) + "," + parseInt("0x" + hex.slice(3, 5)) + "," + parseInt("0x" + hex.slice(5, 7)) + "," + opacity + ")" } +/** + * 图片路径转换 + * @param {String} img_path 图片地址 + * @param {Object} params 参数,针对商品、相册里面的图片区分大中小,size: big、mid、small + */ +function img(img_path, params) { + var path = ""; + if (img_path != undefined && img_path != "") { + if (img_path.split(',').length > 1) { + img_path = img_path.split(',')[0]; + } + if (params && img_path != getDefaultImage().goods) { + // 过滤默认图 + let arr = img_path.split("."); + let suffix = arr[arr.length - 1]; + arr.pop(); + arr[arr.length - 1] = arr[arr.length - 1] + "_" + params.size.toUpperCase(); + arr.push(suffix); + img_path = arr.join("."); + } + if (img_path.indexOf("http://") == -1 && img_path.indexOf("https://") == -1) { + path = img_domian + "/" + img_path; + } else { + path = img_path; + } + if(img_domian.indexOf('https://') != -1){ + path = path.replace('http://', 'https://'); + } + } + // path += '?t=' + parseInt(new Date().getTime() / 1000); + return path; +} +/** + * 获取默认图 + */ +function getDefaultImage() { + let defaultImg = store.state.defaultImg; + defaultImg.goods = img(defaultImg.goods); + defaultImg.head = img(defaultImg.head); + defaultImg.store = img(defaultImg.store); + defaultImg.article = img(defaultImg.article); + return defaultImg; +} + + module.exports = { formatTime, formatDateTime, formatLocation, dateUtils, - hexToRgba + hexToRgba, + img } diff --git a/components/AQ/AQUplodeImgMulti.vue b/components/AQ/AQUplodeImgMulti.vue index 253fb87..eeef305 100644 --- a/components/AQ/AQUplodeImgMulti.vue +++ b/components/AQ/AQUplodeImgMulti.vue @@ -99,7 +99,7 @@ import {Api_url} from "../../common/config"; }, //上传接口地址 - uploadApiUrl: `${Api_url}api/file/image`, + uploadApiUrl: `${Api_url}/file/image`, // 上传图片的样式 imageStyles: { @@ -137,38 +137,63 @@ import {Api_url} from "../../common/config"; }, async uplodeFile(filePath,index){ + let token = uni.getStorageSync('token') || '' + + // if(!token){ + // //跳转登陆页 + // uni.navigateTo({ + // url: '/pages/student/login/login' + // }) + // } + await uni.uploadFile({ url: this.uploadApiUrl, //仅为示例,非真实的接口地址 filePath: filePath, name: 'file', + header: { + 'token': `${token}`,//请求头设置token + }, // formData: { - // 'file': '' + // 'age': '我是自定义参数' // }, success: (uploadFileRes) => { let res = JSON.parse(uploadFileRes.data.replace(/\ufeff/g, "") || "{}") console.log('上传成功1',res); - if (res.code >= 0){ + if (res.code == 1){ let _arr = {} // 下面3个值是uni-app规定的一个不能少 - _arr.url = res.data.pic_url - _arr.extname = res.data.file_ext - _arr.name = res.data.pic_name + _arr.url = res.data.url + _arr.extname = res.data.ext + _arr.name = res.data.name + console.log('xxx',_arr) this.fileList.push(_arr) console.log('上传成功2',_arr); - this.filePathArr.push(res.data.pic_path) + this.filePathArr.push(res.data.path) //上传成功 this.emitUploadSuccess(this.filePathArr) }else{ //失败 uni.showToast({ - title: res.message + title: res.msg, + icon: 'none' }) + + if(res.code == 401){ + //延迟1s 跳转登陆页 + setTimeout(() => { + uni.navigateTo({ + url: '/pages/student/login/login' + }) + }, 1000); + } + } }, fail: (err) => { //失败 uni.showToast({ - title: err.message + title: err.msg, + icon: 'none' }) } }) diff --git a/pages/common/feedback.vue b/pages/common/feedback.vue index 3388354..03a39e8 100644 --- a/pages/common/feedback.vue +++ b/pages/common/feedback.vue @@ -5,7 +5,7 @@ - + @@ -17,9 +17,10 @@ + - + @@ -27,13 +28,13 @@ 反馈的相关问题会第一时间通过邮箱解答。 - 提交 + 提交 @@ -145,6 +143,10 @@ background-color: #434544 !important; } + ::v-deep textarea { + color: #fff !important; + } + ::v-deep .fui-textarea__background { border: 0; background-color: #434544 !important;