Initial commit

This commit is contained in:
chinahu-woker 2025-03-04 16:26:53 +08:00
parent 680597131b
commit b7b4b3b69c
24 changed files with 135 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

View File

@ -2,6 +2,7 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const common_vendor = require("./common/vendor.js"); const common_vendor = require("./common/vendor.js");
const stores_appStore = require("./stores/appStore.js"); const stores_appStore = require("./stores/appStore.js");
const components_common_share = require("./components/common/share.js");
if (!Math) { if (!Math) {
"./pages/index/index.js"; "./pages/index/index.js";
"./pages/creative/creative.js"; "./pages/creative/creative.js";
@ -40,6 +41,7 @@ function createApp() {
const pinia = common_vendor.createPinia(); const pinia = common_vendor.createPinia();
app.use(pinia); app.use(pinia);
app.use(common_vendor.uviewPlus); app.use(common_vendor.uviewPlus);
app.mixin(components_common_share.share);
return { return {
app app
}; };

View File

@ -8562,9 +8562,15 @@ function defineStore(idOrOptions, setup, setupOptions) {
let id; let id;
let options; let options;
const isSetupStore = typeof setup === "function"; const isSetupStore = typeof setup === "function";
{ if (typeof idOrOptions === "string") {
id = idOrOptions; id = idOrOptions;
options = isSetupStore ? setupOptions : setup; 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) { function useStore(pinia, hot) {
const hasContext = hasInjectionContext(); const hasContext = hasInjectionContext();

View File

@ -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;

View File

@ -5,9 +5,8 @@ const getOneAPiURL = () => "https://chatapi.scschool.cc";
const ChatAPiUrl = () => `${getOneAPiURL()}/v1/chat/completions`; const ChatAPiUrl = () => `${getOneAPiURL()}/v1/chat/completions`;
const getUserToken = () => { const getUserToken = () => {
const refreshToken = common_vendor.index.getStorageSync("refreshToken"); const refreshToken = common_vendor.index.getStorageSync("refreshToken");
console.log("refreshToken获取成功", refreshToken);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({ common_vendor.index.request({
url: `${getBaseURL()}/auth/refreshTokens`, url: `${getBaseURL()}/auth/refreshTokens`,
// 请求地址 // 请求地址
method: "POST", method: "POST",
@ -18,7 +17,6 @@ const getUserToken = () => {
// 开启流传输 // 开启流传输
success: (res) => { success: (res) => {
resolve(res); resolve(res);
console.log("getUserToken请求成功", res.data);
}, },
// 请求成功回调 // 请求成功回调
fail: (err) => { fail: (err) => {
@ -27,13 +25,12 @@ const getUserToken = () => {
} }
// 请求失败回调 // 请求失败回调
}); });
console.log("requestTask", requestTask);
}); });
}; };
const getModelList = (data) => { const getModelList = (data) => {
const token = data; const token = data;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({ common_vendor.index.request({
url: `${getBaseURL()}/oneapi/channel`, url: `${getBaseURL()}/oneapi/channel`,
// 请求地址 // 请求地址
method: "GET", method: "GET",
@ -53,7 +50,6 @@ const getModelList = (data) => {
} }
// 请求失败回调 // 请求失败回调
}); });
console.log("requestTask", requestTask);
}); });
}; };
const getUserKey = (data, Rtoken_value) => { const getUserKey = (data, Rtoken_value) => {
@ -65,7 +61,7 @@ const getUserKey = (data, Rtoken_value) => {
}; };
const token = Rtoken_value; const token = Rtoken_value;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({ common_vendor.index.request({
url: `${getBaseURL()}/oneapi/token`, url: `${getBaseURL()}/oneapi/token`,
// 请求地址 // 请求地址
method: "POST", method: "POST",
@ -85,13 +81,12 @@ const getUserKey = (data, Rtoken_value) => {
} }
// 请求失败回调 // 请求失败回调
}); });
console.log("requestTask", requestTask);
}); });
}; };
const getUserInfo = (data) => { const getUserInfo = (data) => {
const restoken = data.refresh_token; const restoken = data.refresh_token;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({ common_vendor.index.request({
url: `${getBaseURL()}/oneapi/user`, url: `${getBaseURL()}/oneapi/user`,
// 请求地址 // 请求地址
method: "POST", method: "POST",
@ -111,7 +106,6 @@ const getUserInfo = (data) => {
} }
// 请求失败回调 // 请求失败回调
}); });
console.log("requestTask", requestTask);
}); });
}; };
exports.ChatAPiUrl = ChatAPiUrl; exports.ChatAPiUrl = ChatAPiUrl;

View File

@ -21,6 +21,7 @@ const isLogin = common_vendor.computed(() => {
console.log("storeToRefs(useAppStore())", user.value); console.log("storeToRefs(useAppStore())", user.value);
common_vendor.index.setStorageSync("userInfo", user.value); common_vendor.index.setStorageSync("userInfo", user.value);
common_vendor.index.setStorageSync("refreshToken", user.value.refresh_token); 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; return !!user.value.refresh_token;
}); });
const getUserVipInfo = () => utils_request.request("/member/topLevel", { method: "POST" }); const getUserVipInfo = () => utils_request.request("/member/topLevel", { method: "POST" });

File diff suppressed because one or more lines are too long

View File

@ -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;

BIN
pic.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

View File

@ -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'
};
}
};

View File

@ -9,7 +9,7 @@ export const getUserToken = () => {
// 获取用户信息 // 获取用户信息
const refreshToken = uni.getStorageSync('refreshToken') const refreshToken = uni.getStorageSync('refreshToken')
console.log("refreshToken获取成功", refreshToken) // console.log("refreshToken获取成功", refreshToken)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const requestTask = uni.request({ const requestTask = uni.request({
url: `${getBaseURL()}/auth/refreshTokens`, // 请求地址 url: `${getBaseURL()}/auth/refreshTokens`, // 请求地址
@ -21,7 +21,7 @@ export const getUserToken = () => {
success: (res) => { success: (res) => {
resolve(res); resolve(res);
console.log('getUserToken请求成功', res.data); // console.log('getUserToken请求成功', res.data);
// uni.parseStreamData(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)
}); });
} }

View File

@ -38,6 +38,7 @@ export const isLogin =computed(()=>{
console.log("storeToRefs(useAppStore())",user.value) console.log("storeToRefs(useAppStore())",user.value)
uni.setStorageSync('userInfo', user.value) uni.setStorageSync('userInfo', user.value)
uni.setStorageSync('refreshToken', user.value.refresh_token) uni.setStorageSync('refreshToken', user.value.refresh_token)
uni.setStorageSync('my_invite_code', user.value.my_invite_code)
return !!user.value.refresh_token return !!user.value.refresh_token
}) })

View File

@ -4,11 +4,16 @@ import {
import App from "./App.vue"; import App from "./App.vue";
import uviewPlus, { setConfig } from 'uview-plus' import uviewPlus, { setConfig } from 'uview-plus'
import {createPinia} from "pinia"; import {createPinia} from "pinia";
import share from '@/components/common/share.js'
import { useInviteStore } from '@/stores/inviteStore.js';
export function createApp() { export function createApp() {
const app = createSSRApp(App); const app = createSSRApp(App);
const pinia = createPinia(); const pinia = createPinia();
app.use(pinia); app.use(pinia);
app.use(uviewPlus) app.use(uviewPlus)
app.mixin(share);
return { return {
app, app,
}; };

View File

@ -261,6 +261,7 @@
<!-- <up-cell icon="coupon" title="卡券(暂未开放)"></up-cell>--> <!-- <up-cell icon="coupon" title="卡券(暂未开放)"></up-cell>-->
<!-- <up-cell icon="heart" title="关注(暂未开放)"></up-cell>--> <!-- <up-cell icon="heart" title="关注(暂未开放)"></up-cell>-->
</up-cell-group> </up-cell-group>
<button open-type="share">分享到微信</button>
</view> </view>
@ -315,13 +316,16 @@
import PaymentPopup from "@/components/home/PaymentPopup.vue"; import PaymentPopup from "@/components/home/PaymentPopup.vue";
import fuiBackgroundImage from "@/components/firstui/fui-background-image/fui-background-image.vue"; import fuiBackgroundImage from "@/components/firstui/fui-background-image/fui-background-image.vue";
import { getModelList, getUserKey, getUserToken, getUserInfo, ChatAPiUrl } from "@/composables/aiChat.ts"; import { getModelList, getUserKey, getUserToken, getUserInfo, ChatAPiUrl } from "@/composables/aiChat.ts";
import { TextEncoder, TextDecoder } from 'text-decoding' import { TextEncoder, TextDecoder } from 'text-decoding'
global.TextEncoder = TextEncoder global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder global.TextDecoder = TextDecoder
function ToConsole(){ function ToConsole(){
uni.navigateTo({ uni.navigateTo({
url: '/pages/console/console' url: '/pages/console/console'
}) })
} }
const role = ref(false) const role = ref(false)
function Kongzhitai() { function Kongzhitai() {

View File

@ -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;
}
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB