From 9239c43498f11fca5bd32dd7ef8ccb7c6edfeb39 Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 20 Mar 2025 16:20:44 +0800
Subject: [PATCH 1/4] =?UTF-8?q?refactor(api):=20=E6=96=B0=E5=A2=9E=20membe?=
=?UTF-8?q?r.js=20=E6=96=87=E4=BB=B6=E5=B9=B6=E5=AE=9E=E7=8E=B0=E7=99=BB?=
=?UTF-8?q?=E5=BD=95=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 member.js 文件,实现账号密码登录和普通登录功能
- 修改 login.vue 中的登录逻辑,使用新的 memberApi 替代 medicationApi
---
api/medication.js | 23 -----------------------
1 file changed, 23 deletions(-)
delete mode 100644 api/medication.js
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
From eedc056e860cf13deae1a39df1c473ba9dae21a9 Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 20 Mar 2025 16:38:15 +0800
Subject: [PATCH 2/4] =?UTF-8?q?feat(upload):=20=E4=BC=98=E5=8C=96=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在上传图片时添加 token 验证
- 修改上传接口地址,增加斜线分隔- 添加注释的登录跳转逻辑
- 调整上传请求的 header,增加 token
---
components/AQ/AQUplodeImgMulti.vue | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/components/AQ/AQUplodeImgMulti.vue b/components/AQ/AQUplodeImgMulti.vue
index 253fb87..ac6cf06 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,12 +137,25 @@ import {Api_url} from "../../common/config";
},
async uplodeFile(filePath,index){
+ let token = uni.getStorageSync('token') || ''
+
+ // if(!token){
+ // //跳转登陆页
+ // uni.navigateTo({
+ // url: '/pages/student/login/login'
+ // })
+ // }
+ alert(token)
+
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, "") || "{}")
From 6e98e71ebeab90b7f1c1cd0d0abdbd980e4caa8d Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 20 Mar 2025 17:36:24 +0800
Subject: [PATCH 3/4] =?UTF-8?q?feat(common):=20=E6=9B=B4=E6=96=B0=20API=20?=
=?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=B9=B6=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 更新 API 地址和图片域名,切换至本地测试环境
- 新增 img 函数,用于处理图片路径转换
- 新增 getDefaultImage 函数,用于获取默认图片- 修改图片上传逻辑,优化错误处理和用户提示
---
common/config.js | 8 ++---
common/util.js | 50 +++++++++++++++++++++++++++++-
components/AQ/AQUplodeImgMulti.vue | 28 ++++++++++++-----
3 files changed, 73 insertions(+), 13 deletions(-)
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 ac6cf06..eeef305 100644
--- a/components/AQ/AQUplodeImgMulti.vue
+++ b/components/AQ/AQUplodeImgMulti.vue
@@ -145,7 +145,6 @@ import {Api_url} from "../../common/config";
// url: '/pages/student/login/login'
// })
// }
- alert(token)
await uni.uploadFile({
url: this.uploadApiUrl, //仅为示例,非真实的接口地址
@@ -160,28 +159,41 @@ import {Api_url} from "../../common/config";
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'
})
}
})
From 87d94a510a9bcc50e8647bccf18442cea8cb67fc Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 20 Mar 2025 18:09:51 +0800
Subject: [PATCH 4/4] =?UTF-8?q?feat(member):=20=E6=B7=BB=E5=8A=A0=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E5=8F=8D=E9=A6=88=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E7=99=BB=E5=BD=95=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 member.js 中添加 setFeedback 方法,用于提交用户反馈
- 更新 feedback.vue 页面,增加反馈内容和邮箱输入框的双向绑定
- 添加表单提交功能,验证反馈内容不能为空- 优化 login 方法,统一登录接口
---
api/member.js | 32 +++++++----------
pages/common/feedback.vue | 76 ++++++++++++++++++++-------------------
2 files changed, 52 insertions(+), 56 deletions(-)
diff --git a/api/member.js b/api/member.js
index e29b121..f031064 100644
--- a/api/member.js
+++ b/api/member.js
@@ -1,23 +1,17 @@
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,
+ // 业务员端配置项(关于我们)
+ 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/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;