diff --git a/.env.development b/.env.development
index 384b4d9..00c0ba4 100644
--- a/.env.development
+++ b/.env.development
@@ -1,5 +1,5 @@
NODE_ENV= development
-# VITE_HTTP_BASE_URL = http://10.39.13.78:8002/api/
-VITE_HTTP_BASE_URL = https://test-weapp-api.linyikj.com.cn/api/
+VITE_HTTP_BASE_URL = http://10.39.13.78:8002/api/
+# VITE_HTTP_BASE_URL = https://test-weapp-api.linyikj.com.cn/api/
# VITE_HTTP_BASE_URL = https://weapp-api.linyikj.com.cn/api/
VITE_ACCESS_TOKEN_KEY= 'ACCESS_TOKEN_CUSTOMER'
\ No newline at end of file
diff --git a/dist/dev/mp-weixin/common/libraries/request.js b/dist/dev/mp-weixin/common/libraries/request.js
index 16846ac..1dcb1ce 100644
--- a/dist/dev/mp-weixin/common/libraries/request.js
+++ b/dist/dev/mp-weixin/common/libraries/request.js
@@ -3,7 +3,7 @@ const common_vendor = require("../vendor.js");
const common_store_useWeAppAuthStore = require("../store/useWeAppAuthStore.js");
const http = new common_vendor.Request();
http.setConfig((config) => {
- config.baseURL = "https://test-weapp-api.linyikj.com.cn/api/";
+ config.baseURL = "http://10.39.13.78:8002/api/";
config.header = {
...config.header
};
diff --git a/dist/dev/mp-weixin/pages/ai/chat.js b/dist/dev/mp-weixin/pages/ai/chat.js
index 7014b41..937f4eb 100644
--- a/dist/dev/mp-weixin/pages/ai/chat.js
+++ b/dist/dev/mp-weixin/pages/ai/chat.js
@@ -11,16 +11,16 @@ require("../../common/libraries/setTabBar.js");
require("../../common/libraries/apiLoading.js");
require("../../common/libraries/upload.js");
if (!Array) {
- const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_hs_empty2 = common_vendor.resolveComponent("hs-empty");
+ const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
- (_easycom_uni_icons2 + _easycom_hs_empty2 + _easycom_hs_button2)();
+ (_easycom_hs_empty2 + _easycom_uni_icons2 + _easycom_hs_button2)();
}
-const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_empty = () => "../../components/hs-empty/hs-empty.js";
+const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_button = () => "../../components/hs-button/hs-button.js";
if (!Math) {
- (MyHeaderPrologue + _easycom_uni_icons + _easycom_hs_empty + _easycom_hs_button)();
+ (MyHeaderPrologue + _easycom_hs_empty + _easycom_uni_icons + _easycom_hs_button)();
}
const MyHeaderPrologue = () => "./components/HeaderPrologue.js";
const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
@@ -600,7 +600,7 @@ const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
}
});
return (_ctx, _cache) => {
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
return common_vendor.e({
a: userLoginStatus.value
}, userLoginStatus.value ? common_vendor.e({
@@ -703,16 +703,22 @@ const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
H: common_vendor.n(message.role === "user" ? "user-message" : "ai-message")
});
}),
- d: loading.value
- }, loading.value ? {
- e: common_vendor.t(loadingText.value)
+ d: !((_a = messages.value) == null ? void 0 : _a.length)
+ }, !((_b = messages.value) == null ? void 0 : _b.length) ? {
+ e: common_vendor.p({
+ height: "20vh"
+ })
} : {}, {
- f: ((_c = (_b = (_a = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _a.selectedImages) == null ? void 0 : _b.value) == null ? void 0 : _c.length) > 0
- }, ((_f = (_e = (_d = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _d.selectedImages) == null ? void 0 : _e.value) == null ? void 0 : _f.length) > 0 ? common_vendor.e({
- g: common_vendor.f((_h = (_g = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _g.selectedImages) == null ? void 0 : _h.value, (image, index, i0) => {
+ f: loading.value
+ }, loading.value ? {
+ g: common_vendor.t(loadingText.value)
+ } : {}, {
+ h: ((_e = (_d = (_c = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _c.selectedImages) == null ? void 0 : _d.value) == null ? void 0 : _e.length) > 0
+ }, ((_h = (_g = (_f = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _f.selectedImages) == null ? void 0 : _g.value) == null ? void 0 : _h.length) > 0 ? common_vendor.e({
+ i: common_vendor.f((_j = (_i = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _i.selectedImages) == null ? void 0 : _j.value, (image, index, i0) => {
return {
a: image,
- b: "25c36616-1-" + i0,
+ b: "25c36616-2-" + i0,
c: common_vendor.o(($event) => {
var _a2;
return (_a2 = common_vendor.unref(pages_ai_method.method)) == null ? void 0 : _a2.removeImage(index);
@@ -720,66 +726,66 @@ const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
d: index
};
}),
- h: common_vendor.p({
+ j: common_vendor.p({
type: "closeempty",
size: "14",
color: "#fff"
}),
- i: ((_k = (_j = (_i = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _i.selectedImages) == null ? void 0 : _j.value) == null ? void 0 : _k.length) < 9
- }, ((_n = (_m = (_l = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _l.selectedImages) == null ? void 0 : _m.value) == null ? void 0 : _n.length) < 9 ? {
- j: common_vendor.p({
+ k: ((_m = (_l = (_k = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _k.selectedImages) == null ? void 0 : _l.value) == null ? void 0 : _m.length) < 9
+ }, ((_p = (_o = (_n = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _n.selectedImages) == null ? void 0 : _o.value) == null ? void 0 : _p.length) < 9 ? {
+ l: common_vendor.p({
type: "plus",
size: "30",
color: "#999"
}),
- k: common_vendor.o(($event) => {
+ m: common_vendor.o(($event) => {
var _a2;
return (_a2 = common_vendor.unref(pages_ai_method.method)) == null ? void 0 : _a2.chooseImage();
})
} : {}) : {}, {
- l: common_vendor.o(($event) => isInputFocused.value = true),
- m: common_vendor.o(($event) => isInputFocused.value = false),
- n: common_vendor.o(handleSendMessage),
- o: inputMessage.value,
- p: common_vendor.o(($event) => inputMessage.value = $event.detail.value),
- q: !inputMessage.value.trim() && !isInputFocused.value && ((_q = (_p = (_o = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _o.selectedImages) == null ? void 0 : _p.value) == null ? void 0 : _q.length) === 0
- }, !inputMessage.value.trim() && !isInputFocused.value && ((_t = (_s = (_r = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _r.selectedImages) == null ? void 0 : _s.value) == null ? void 0 : _t.length) === 0 ? {
- r: common_vendor.p({
+ n: common_vendor.o(($event) => isInputFocused.value = true),
+ o: common_vendor.o(($event) => isInputFocused.value = false),
+ p: common_vendor.o(handleSendMessage),
+ q: inputMessage.value,
+ r: common_vendor.o(($event) => inputMessage.value = $event.detail.value),
+ s: !inputMessage.value.trim() && !isInputFocused.value && ((_s = (_r = (_q = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _q.selectedImages) == null ? void 0 : _r.value) == null ? void 0 : _s.length) === 0
+ }, !inputMessage.value.trim() && !isInputFocused.value && ((_v = (_u = (_t = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _t.selectedImages) == null ? void 0 : _u.value) == null ? void 0 : _v.length) === 0 ? {
+ t: common_vendor.p({
type: "camera",
size: "24",
color: "#666"
}),
- s: common_vendor.o(($event) => {
+ v: common_vendor.o(($event) => {
var _a2;
return (_a2 = common_vendor.unref(pages_ai_method.method)) == null ? void 0 : _a2.chooseImage();
})
} : {}, {
- t: (inputMessage.value.trim() || isInputFocused.value || ((_w = (_v = (_u = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _u.selectedImages) == null ? void 0 : _v.value) == null ? void 0 : _w.length) > 0) && !loading.value
- }, (inputMessage.value.trim() || isInputFocused.value || ((_z = (_y = (_x = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _x.selectedImages) == null ? void 0 : _y.value) == null ? void 0 : _z.length) > 0) && !loading.value ? {
- v: common_vendor.p({
+ w: (inputMessage.value.trim() || isInputFocused.value || ((_y = (_x = (_w = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _w.selectedImages) == null ? void 0 : _x.value) == null ? void 0 : _y.length) > 0) && !loading.value
+ }, (inputMessage.value.trim() || isInputFocused.value || ((_B = (_A = (_z = common_vendor.unref(pages_ai_model.useModel)) == null ? void 0 : _z.selectedImages) == null ? void 0 : _A.value) == null ? void 0 : _B.length) > 0) && !loading.value ? {
+ x: common_vendor.p({
type: "paperplane-filled",
size: "20",
color: "#fff"
}),
- w: common_vendor.o(handleSendMessage)
+ y: common_vendor.o(handleSendMessage)
} : {}, {
- x: loading.value
+ z: loading.value
}, loading.value ? {
- y: common_vendor.p({
+ A: common_vendor.p({
type: "spinner-cycle",
size: "20",
color: "#ccc"
})
} : {}) : {
- z: common_vendor.p({
+ B: common_vendor.p({
height: "20vh",
baseStyle: {
paddingTop: "35%"
},
text: "登录体验更多功能"
}),
- A: common_vendor.o(goToPageLogin),
- B: common_vendor.p({
+ C: common_vendor.o(goToPageLogin),
+ D: common_vendor.p({
label: "去登录",
size: "md",
type: "primary"
diff --git a/dist/dev/mp-weixin/pages/ai/chat.json b/dist/dev/mp-weixin/pages/ai/chat.json
index 54b1809..25ac585 100644
--- a/dist/dev/mp-weixin/pages/ai/chat.json
+++ b/dist/dev/mp-weixin/pages/ai/chat.json
@@ -2,8 +2,8 @@
"navigationBarTitleText": "客服服务",
"enablePullDownRefresh": true,
"usingComponents": {
- "uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"hs-empty": "../../components/hs-empty/hs-empty",
+ "uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"hs-button": "../../components/hs-button/hs-button",
"my-header-prologue": "./components/HeaderPrologue"
}
diff --git a/dist/dev/mp-weixin/pages/ai/chat.wxml b/dist/dev/mp-weixin/pages/ai/chat.wxml
index d27ba9d..729fbd1 100644
--- a/dist/dev/mp-weixin/pages/ai/chat.wxml
+++ b/dist/dev/mp-weixin/pages/ai/chat.wxml
@@ -1 +1 @@
-{{line.a}}{{question.a}}是否{{message.C}}{{e}}添加图片
\ No newline at end of file
+{{line.a}}{{question.a}}是否{{message.C}}{{g}}添加图片
\ No newline at end of file
diff --git a/dist/dev/mp-weixin/pages/index/components/AiInput.js b/dist/dev/mp-weixin/pages/index/components/AiInput.js
index 12e7ecb..42506da 100644
--- a/dist/dev/mp-weixin/pages/index/components/AiInput.js
+++ b/dist/dev/mp-weixin/pages/index/components/AiInput.js
@@ -1,12 +1,13 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
+const common_libraries_naviHelper = require("../../../common/libraries/naviHelper.js");
require("../../../common/libraries/getPageConfig.js");
const common_libraries_public = require("../../../common/libraries/public.js");
const common_libraries_userUserLogin = require("../../../common/libraries/userUserLogin.js");
-require("../../../common/store/useWeAppAuthStore.js");
-require("../../../gen/Apis.js");
require("../../../common/libraries/request.js");
+const common_store_useWeAppAuthStore = require("../../../common/store/useWeAppAuthStore.js");
require("../../../common/store/useWorkStore.js");
+require("../../../gen/Apis.js");
require("../../../common/libraries/setTabBar.js");
require("../../../common/libraries/apiLoading.js");
if (!Array) {
@@ -20,18 +21,18 @@ if (!Math) {
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "AiInput",
setup(__props) {
- const handleAiPage = (i) => {
- common_vendor.index.navigateTo({
- url: `/pages/ai/chat?message=${i == null ? void 0 : i.message}`
- });
- };
- const handleInputChange = () => {
- var _a;
+ const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
+ const handleInputChange = (i) => {
+ var _a, _b, _c;
if (!((_a = common_libraries_userUserLogin.getUserLogin) == null ? void 0 : _a.onBindPhone())) {
return false;
}
+ if (!((_c = (_b = auth.data) == null ? void 0 : _b.selected_house) == null ? void 0 : _c.asset_projects_id)) {
+ common_libraries_naviHelper.showToast("请绑定房屋");
+ return false;
+ }
common_vendor.index.navigateTo({
- url: "/pages/ai/chat"
+ url: `/pages/ai/chat?message=${(i == null ? void 0 : i.message) || ""}`
});
};
return (_ctx, _cache) => {
@@ -47,7 +48,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
a: `/static/svg/${i.icon}`,
b: common_vendor.t(i.label),
c: `item_${index}`,
- d: common_vendor.o(($event) => handleAiPage(i), `item_${index}`)
+ d: common_vendor.o(($event) => handleInputChange(i), `item_${index}`)
};
})
};
diff --git a/src/pages/ai/chat.vue b/src/pages/ai/chat.vue
index cedf61f..658db56 100644
--- a/src/pages/ai/chat.vue
+++ b/src/pages/ai/chat.vue
@@ -144,7 +144,7 @@
-
+
-
+
{
// 获取历史记录
const getHistoryMessages = async (page: number = 1) => {
const userPhone = auth.data?.user?.phone
-
+ const projectId = auth.data?.selected_house?.asset_projects_id
if (!userPhone) {
console.log('用户未登录,无法获取历史记录')
return
}
+ if (!projectId) {
+ console.log('请先绑定房屋,无法获取历史记录')
+ return
+ }
if (isLoadingHistory.value) {
return
@@ -348,7 +352,8 @@ const getHistoryMessages = async (page: number = 1) => {
platform: 'property',
platform_user_id: userPhone, //userPhone
limit: pageSize.value,
- offset: offset
+ offset: offset,
+ tenant_project_id: projectId,
})
if (response.statusCode === 200) {
@@ -883,14 +888,23 @@ const handleSendMessage = async () => {
const projectId = auth.data?.selected_house?.asset_projects_id
const projectName = auth.data?.selected_house?.full_name
- if (!userPhone || !projectId) {
+ if (!userPhone ) {
uni.showToast({
- title: '请先登录并绑定房屋',
+ title: '请登录并绑定房屋',
icon: 'none'
})
return
}
+ if(!projectId) {
+ uni.showToast({
+ title: '请绑定房屋',
+ icon: 'none'
+ })
+ return
+ }
+
+
// 如果WebSocket未连接,先建立连接
if (!isConnected.value) {
initWebSocket()
diff --git a/src/pages/ai/model.ts b/src/pages/ai/model.ts
index 6a85724..22ad3cf 100644
--- a/src/pages/ai/model.ts
+++ b/src/pages/ai/model.ts
@@ -2,10 +2,10 @@ import { reactive, ref } from 'vue'
export default {
selectedImages: ref([]), // 选中的图片
quickQuestionsData: ref({}),
- // API_BASE_URL: 'http://10.39.13.78:8000', //dev环境
- // WS_BASE_URL: 'wss://10.39.13.78:8000' //dev环境
+ API_BASE_URL: 'http://10.39.13.78:8000', //dev环境
+ WS_BASE_URL: 'wss://10.39.13.78:8000' //dev环境
// API_BASE_URL: 'https://kf-api-test.linyikj.com.cn', //测试环境
// WS_BASE_URL: 'wss://kf-api-test.linyikj.com.cn' //测试环境
- API_BASE_URL: 'https://kf-api.linyikj.com.cn', //正式环境
- WS_BASE_URL: 'wss://kf-api.linyikj.com.cn' //正式环境
+ // API_BASE_URL: 'https://kf-api.linyikj.com.cn', //正式环境
+ // WS_BASE_URL: 'wss://kf-api.linyikj.com.cn' //正式环境
}
diff --git a/src/pages/index/components/AiInput.vue b/src/pages/index/components/AiInput.vue
index 87da7df..081f7d3 100644
--- a/src/pages/index/components/AiInput.vue
+++ b/src/pages/index/components/AiInput.vue
@@ -18,7 +18,7 @@
v-for="(i, index) in quickActions"
:key="`item_${index}`"
class="items"
- @click="handleAiPage(i)"
+ @click="handleInputChange(i)"
>
@@ -54,20 +54,21 @@ import { showToast } from '@/common/libraries/naviHelper'
import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig'
import { quickActions, QuickAction } from '@/common/libraries/public'
import userLoginStatus from '@/common/libraries/userUserLogin'
+import { useWeAppAuthStore } from '@/common'
+const auth = useWeAppAuthStore()
-const handleAiPage = (i: QuickAction) => {
- uni.navigateTo({
- url: `/pages/ai/chat?message=${i?.message}`
- })
-}
-const handleInputChange = () => {
- if (!userLoginStatus?.onBindPhone()) {
+
+const handleInputChange = (i: QuickAction) => {
+ if (!userLoginStatus?.onBindPhone()) {
+ return false
+ }
+ if (!auth.data?.selected_house?.asset_projects_id) {
+ showToast('请绑定房屋')
return false
}
uni.navigateTo({
- url: '/pages/ai/chat'
+ url: `/pages/ai/chat?message=${i?.message || ""}`
})
- // showToast('该功能在当前项目暂未开放,敬请期待!')
}