diff --git a/20250224myself.png b/20250224myself.png deleted file mode 100644 index a907314b..00000000 Binary files a/20250224myself.png and /dev/null differ diff --git a/dist/dev/mp-weixin/app.js b/dist/dev/mp-weixin/app.js index b1e6077e..21318920 100644 --- a/dist/dev/mp-weixin/app.js +++ b/dist/dev/mp-weixin/app.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const common_vendor = require("./common/vendor.js"); const stores_appStore = require("./stores/appStore.js"); +const components_common_share = require("./components/common/share.js"); if (!Math) { "./pages/index/index.js"; "./pages/creative/creative.js"; @@ -40,6 +41,7 @@ function createApp() { const pinia = common_vendor.createPinia(); app.use(pinia); app.use(common_vendor.uviewPlus); + app.mixin(components_common_share.share); return { app }; diff --git a/dist/dev/mp-weixin/common/vendor.js b/dist/dev/mp-weixin/common/vendor.js index c236c31b..157307cd 100644 --- a/dist/dev/mp-weixin/common/vendor.js +++ b/dist/dev/mp-weixin/common/vendor.js @@ -8562,9 +8562,15 @@ function defineStore(idOrOptions, setup, setupOptions) { let id; let options; const isSetupStore = typeof setup === "function"; - { + if (typeof idOrOptions === "string") { id = idOrOptions; options = isSetupStore ? setupOptions : setup; + } else { + options = idOrOptions; + id = idOrOptions.id; + if (typeof id !== "string") { + throw new Error(`[🍍]: "defineStore()" must be passed a store id as its first argument.`); + } } function useStore(pinia, hot) { const hasContext = hasInjectionContext(); diff --git a/dist/dev/mp-weixin/components/common/share.js b/dist/dev/mp-weixin/components/common/share.js new file mode 100644 index 00000000..86bed827 --- /dev/null +++ b/dist/dev/mp-weixin/components/common/share.js @@ -0,0 +1,37 @@ +"use strict"; +const stores_inviteStore_js = require("../../stores/inviteStore.js.js"); +const share = { + data() { + return { + shareParams: { + path: "", + title: "邀请您成为新用户" + } + }; + }, + created() { + const inviteStore = stores_inviteStore_js.useInviteStore(); + if (inviteStore.inviteCode) { + this.shareParams.path = `/pages/index/index?my_invite_code=${inviteStore.inviteCode}`; + } + }, + onShareAppMessage(res) { + if (res.from === "button") { + console.log(res.target); + } + return { + title: this.shareParams.title, + path: this.shareParams.path, + imageUrl: "https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/67873d6c232a3c5d52240dd6/upload/白银.png", + desc: "邀请你使用" + }; + }, + onShareTimeline() { + return { + title: this.shareParams.title, + path: this.shareParams.path, + imageUrl: "https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/67873d6c232a3c5d52240dd6/upload/白银.png" + }; + } +}; +exports.share = share; diff --git a/dist/dev/mp-weixin/composables/aiChat.js b/dist/dev/mp-weixin/composables/aiChat.js index 7f34c578..feb29af2 100644 --- a/dist/dev/mp-weixin/composables/aiChat.js +++ b/dist/dev/mp-weixin/composables/aiChat.js @@ -5,9 +5,8 @@ const getOneAPiURL = () => "https://chatapi.scschool.cc"; const ChatAPiUrl = () => `${getOneAPiURL()}/v1/chat/completions`; const getUserToken = () => { const refreshToken = common_vendor.index.getStorageSync("refreshToken"); - console.log("refreshToken获取成功", refreshToken); return new Promise((resolve, reject) => { - const requestTask = common_vendor.index.request({ + common_vendor.index.request({ url: `${getBaseURL()}/auth/refreshTokens`, // 请求地址 method: "POST", @@ -18,7 +17,6 @@ const getUserToken = () => { // 开启流传输 success: (res) => { resolve(res); - console.log("getUserToken请求成功", res.data); }, // 请求成功回调 fail: (err) => { @@ -27,13 +25,12 @@ const getUserToken = () => { } // 请求失败回调 }); - console.log("requestTask", requestTask); }); }; const getModelList = (data) => { const token = data; return new Promise((resolve, reject) => { - const requestTask = common_vendor.index.request({ + common_vendor.index.request({ url: `${getBaseURL()}/oneapi/channel`, // 请求地址 method: "GET", @@ -53,7 +50,6 @@ const getModelList = (data) => { } // 请求失败回调 }); - console.log("requestTask", requestTask); }); }; const getUserKey = (data, Rtoken_value) => { @@ -65,7 +61,7 @@ const getUserKey = (data, Rtoken_value) => { }; const token = Rtoken_value; return new Promise((resolve, reject) => { - const requestTask = common_vendor.index.request({ + common_vendor.index.request({ url: `${getBaseURL()}/oneapi/token`, // 请求地址 method: "POST", @@ -85,13 +81,12 @@ const getUserKey = (data, Rtoken_value) => { } // 请求失败回调 }); - console.log("requestTask", requestTask); }); }; const getUserInfo = (data) => { const restoken = data.refresh_token; return new Promise((resolve, reject) => { - const requestTask = common_vendor.index.request({ + common_vendor.index.request({ url: `${getBaseURL()}/oneapi/user`, // 请求地址 method: "POST", @@ -111,7 +106,6 @@ const getUserInfo = (data) => { } // 请求失败回调 }); - console.log("requestTask", requestTask); }); }; exports.ChatAPiUrl = ChatAPiUrl; diff --git a/dist/dev/mp-weixin/composables/useCommon.js b/dist/dev/mp-weixin/composables/useCommon.js index 75544ba1..3b8a1910 100644 --- a/dist/dev/mp-weixin/composables/useCommon.js +++ b/dist/dev/mp-weixin/composables/useCommon.js @@ -21,6 +21,7 @@ const isLogin = common_vendor.computed(() => { console.log("storeToRefs(useAppStore())", user.value); common_vendor.index.setStorageSync("userInfo", user.value); common_vendor.index.setStorageSync("refreshToken", user.value.refresh_token); + common_vendor.index.setStorageSync("my_invite_code", user.value.my_invite_code); return !!user.value.refresh_token; }); const getUserVipInfo = () => utils_request.request("/member/topLevel", { method: "POST" }); diff --git a/dist/dev/mp-weixin/pages/index/index.wxml b/dist/dev/mp-weixin/pages/index/index.wxml index 605a91f0..5093d3a7 100644 --- a/dist/dev/mp-weixin/pages/index/index.wxml +++ b/dist/dev/mp-weixin/pages/index/index.wxml @@ -1,2 +1,2 @@ \ No newline at end of file + \ No newline at end of file diff --git a/dist/dev/mp-weixin/stores/inviteStore.js.js b/dist/dev/mp-weixin/stores/inviteStore.js.js new file mode 100644 index 00000000..58045709 --- /dev/null +++ b/dist/dev/mp-weixin/stores/inviteStore.js.js @@ -0,0 +1,13 @@ +"use strict"; +const common_vendor = require("../common/vendor.js"); +const useInviteStore = common_vendor.defineStore("invite", { + state: () => ({ + inviteCode: "" + }), + actions: { + setInviteCode(inviteCode) { + this.inviteCode = inviteCode; + } + } +}); +exports.useInviteStore = useInviteStore; diff --git a/pic.png b/pic.png deleted file mode 100644 index ec2d60c3..00000000 Binary files a/pic.png and /dev/null differ diff --git a/src/components/common/share.js b/src/components/common/share.js new file mode 100644 index 00000000..610b4821 --- /dev/null +++ b/src/components/common/share.js @@ -0,0 +1,40 @@ +// src/components/common/share.js +import { useInviteStore } from '@/stores/inviteStore.js'; // 加上 .js 后缀 + +export default { + data() { + return { + shareParams: { + path: '', + title: '邀请您成为新用户' + } + }; + }, + created() { + const inviteStore = useInviteStore(); + if (inviteStore.inviteCode) { + this.shareParams.path = `/pages/index/index?my_invite_code=${inviteStore.inviteCode}`; + } + }, + onShareAppMessage(res) { + if (res.from === 'button') { + console.log(res.target); + } + return { + title: this.shareParams.title, + path: this.shareParams.path, + imageUrl: 'https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/67873d6c232a3c5d52240dd6/upload/白银.png', + desc: '邀请你使用' + }; + }, + onShareTimeline() { + return { + title: this.shareParams.title, + path: this.shareParams.path, + imageUrl: 'https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/67873d6c232a3c5d52240dd6/upload/白银.png' + }; + } +}; + + + diff --git a/src/composables/aiChat.ts b/src/composables/aiChat.ts index e0cce862..fd437cb2 100644 --- a/src/composables/aiChat.ts +++ b/src/composables/aiChat.ts @@ -9,7 +9,7 @@ export const getUserToken = () => { // 获取用户信息 const refreshToken = uni.getStorageSync('refreshToken') - console.log("refreshToken获取成功", refreshToken) + // console.log("refreshToken获取成功", refreshToken) return new Promise((resolve, reject) => { const requestTask = uni.request({ url: `${getBaseURL()}/auth/refreshTokens`, // 请求地址 @@ -21,7 +21,7 @@ export const getUserToken = () => { success: (res) => { resolve(res); - console.log('getUserToken请求成功', res.data); + // console.log('getUserToken请求成功', res.data); // uni.parseStreamData(res.data) }, // 请求成功回调 @@ -31,7 +31,7 @@ export const getUserToken = () => { } // 请求失败回调 }); - console.log('requestTask', requestTask) + // console.log('requestTask', requestTask) }); } @@ -66,7 +66,7 @@ export const getModelList = (data) => { } // 请求失败回调 }); - console.log('requestTask', requestTask) + // console.log('requestTask', requestTask) }); } @@ -104,7 +104,7 @@ export const getUserKey = (data,Rtoken_value) => { } // 请求失败回调 }); - console.log('requestTask', requestTask) + // console.log('requestTask', requestTask) }); } @@ -136,6 +136,6 @@ export const getUserInfo = (data) => { } // 请求失败回调 }); - console.log('requestTask', requestTask) + // console.log('requestTask', requestTask) }); } \ No newline at end of file diff --git a/src/composables/useCommon.ts b/src/composables/useCommon.ts index a891bf42..da9a5d96 100644 --- a/src/composables/useCommon.ts +++ b/src/composables/useCommon.ts @@ -38,6 +38,7 @@ export const isLogin =computed(()=>{ console.log("storeToRefs(useAppStore())",user.value) uni.setStorageSync('userInfo', user.value) uni.setStorageSync('refreshToken', user.value.refresh_token) + uni.setStorageSync('my_invite_code', user.value.my_invite_code) return !!user.value.refresh_token }) diff --git a/src/main.js b/src/main.js index 77d7200e..12e1696a 100644 --- a/src/main.js +++ b/src/main.js @@ -4,11 +4,16 @@ import { import App from "./App.vue"; import uviewPlus, { setConfig } from 'uview-plus' import {createPinia} from "pinia"; +import share from '@/components/common/share.js' +import { useInviteStore } from '@/stores/inviteStore.js'; export function createApp() { + const app = createSSRApp(App); const pinia = createPinia(); app.use(pinia); app.use(uviewPlus) + app.mixin(share); + return { app, }; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1f4745f0..b90ba36e 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -261,6 +261,7 @@ + @@ -315,13 +316,16 @@ import PaymentPopup from "@/components/home/PaymentPopup.vue"; import fuiBackgroundImage from "@/components/firstui/fui-background-image/fui-background-image.vue"; import { getModelList, getUserKey, getUserToken, getUserInfo, ChatAPiUrl } from "@/composables/aiChat.ts"; + import { TextEncoder, TextDecoder } from 'text-decoding' global.TextEncoder = TextEncoder global.TextDecoder = TextDecoder + function ToConsole(){ uni.navigateTo({ url: '/pages/console/console' }) + } const role = ref(false) function Kongzhitai() { diff --git a/src/stores/inviteStore.js.js b/src/stores/inviteStore.js.js new file mode 100644 index 00000000..cba9e94f --- /dev/null +++ b/src/stores/inviteStore.js.js @@ -0,0 +1,14 @@ +// src/stores/inviteStore.js +import { defineStore } from 'pinia'; + +export const useInviteStore = defineStore('invite', { + state: () => ({ + inviteCode: '' + }), + actions: { + setInviteCode(inviteCode) { + this.inviteCode = inviteCode; + } + } +}); + diff --git a/微信图片_20250208181944.jpg b/微信图片_20250208181944.jpg deleted file mode 100644 index 409f59c2..00000000 Binary files a/微信图片_20250208181944.jpg and /dev/null differ diff --git a/微信截图_20250208193439.png b/微信截图_20250208193439.png deleted file mode 100644 index b2ef0ab9..00000000 Binary files a/微信截图_20250208193439.png and /dev/null differ diff --git a/微信截图_20250208193453.png b/微信截图_20250208193453.png deleted file mode 100644 index ec44f05d..00000000 Binary files a/微信截图_20250208193453.png and /dev/null differ diff --git a/微信截图_20250208193548.png b/微信截图_20250208193548.png deleted file mode 100644 index ceceffed..00000000 Binary files a/微信截图_20250208193548.png and /dev/null differ diff --git a/微信截图_20250208193616.png b/微信截图_20250208193616.png deleted file mode 100644 index 86f87c88..00000000 Binary files a/微信截图_20250208193616.png and /dev/null differ diff --git a/微信截图_20250208193623.png b/微信截图_20250208193623.png deleted file mode 100644 index 6b3398ab..00000000 Binary files a/微信截图_20250208193623.png and /dev/null differ diff --git a/微信截图_20250208193627.png b/微信截图_20250208193627.png deleted file mode 100644 index 45e323d0..00000000 Binary files a/微信截图_20250208193627.png and /dev/null differ diff --git a/微信截图_20250208193635.png b/微信截图_20250208193635.png deleted file mode 100644 index 022f3a90..00000000 Binary files a/微信截图_20250208193635.png and /dev/null differ diff --git a/微信截图_20250216113853.png b/微信截图_20250216113853.png deleted file mode 100644 index b0d81f1a..00000000 Binary files a/微信截图_20250216113853.png and /dev/null differ