Initial commit
Before Width: | Height: | Size: 123 KiB |
2
dist/dev/mp-weixin/app.js
vendored
@ -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
|
||||
};
|
||||
|
8
dist/dev/mp-weixin/common/vendor.js
vendored
@ -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
dist/dev/mp-weixin/components/common/share.js
vendored
Normal 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;
|
14
dist/dev/mp-weixin/composables/aiChat.js
vendored
@ -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
dist/dev/mp-weixin/composables/useCommon.js
vendored
@ -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" });
|
||||
|
2
dist/dev/mp-weixin/pages/index/index.wxml
vendored
13
dist/dev/mp-weixin/stores/inviteStore.js.js
vendored
Normal 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;
|
40
src/components/common/share.js
Normal 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'
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
});
|
||||
}
|
@ -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
|
||||
})
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -261,6 +261,7 @@
|
||||
<!-- <up-cell icon="coupon" title="卡券(暂未开放)"></up-cell>-->
|
||||
<!-- <up-cell icon="heart" title="关注(暂未开放)"></up-cell>-->
|
||||
</up-cell-group>
|
||||
<button open-type="share">分享到微信</button>
|
||||
</view>
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
14
src/stores/inviteStore.js.js
Normal 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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Before Width: | Height: | Size: 153 KiB |
Before Width: | Height: | Size: 456 KiB |
Before Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 334 KiB |
Before Width: | Height: | Size: 420 KiB |
Before Width: | Height: | Size: 392 KiB |
Before Width: | Height: | Size: 424 KiB |
Before Width: | Height: | Size: 112 KiB |