Initial commit
This commit is contained in:
Vendored
+2
@@ -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
|
||||
};
|
||||
|
||||
Vendored
+7
-1
@@ -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();
|
||||
|
||||
+37
@@ -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;
|
||||
+4
-10
@@ -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;
|
||||
|
||||
+1
@@ -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" });
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+13
@@ -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;
|
||||
Reference in New Issue
Block a user