Initial commit

This commit is contained in:
chinahu-woker
2025-02-16 11:40:12 +08:00
parent d7af560866
commit a151610d25
212 changed files with 14008 additions and 231 deletions
+1883 -42
View File
File diff suppressed because one or more lines are too long
@@ -0,0 +1,175 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {
name: "fui-avatar",
emits: ["click", "error"],
props: {
src: {
type: String,
default: ""
},
errorSrc: {
type: String,
default: ""
},
mode: {
type: String,
default: "widthFix"
},
//微信小程序、百度小程序、字节跳动小程序
//图片懒加载。只针对page与scroll-view下的image有效
lazyLoad: {
type: Boolean,
default: true
},
//默认不解析 webP 格式,只支持网络资源 微信小程序2.9.0
webp: {
type: Boolean,
default: false
},
background: {
type: String,
default: "#D1D1D1"
},
//small64)、middle96)、large128
size: {
type: String,
default: "middle"
},
//图片宽度,设置大于0的数值生效,默认使用size
width: {
type: [Number, String],
default: 0
},
//默认等宽,设置图大于0的数值且设置了图片宽度生效
height: {
type: [Number, String],
default: 0
},
//指定头像的形状,可选值为 circle、square
shape: {
type: String,
default: "circle"
},
//图片圆角值,默认使用shape,当设置大于等于0的数值,shape失效
radius: {
type: [Number, String],
default: -1
},
//没有src时可以使用文本代替
text: {
type: String,
default: ""
},
color: {
type: String,
default: "#fff"
},
//默认使用size下字体大小
fontSize: {
type: [Number, String],
default: 0
},
fontWeight: {
type: [Number, String],
default: 600
},
marginRight: {
type: [Number, String],
default: 0
},
marginBottom: {
type: [Number, String],
default: 0
},
//在列表中的索引值
index: {
type: Number,
default: 0
},
//其他参数
params: {
type: [Number, String],
default: 0
}
},
computed: {
wrapStyles() {
return `background:${this.background};margin-right:${this.marginRight}rpx;margin-bottom:${this.marginBottom}rpx;${this.styles}`;
},
styles() {
let styles = "";
if (this.width) {
styles = `width:${this.width}rpx;height:${this.height || this.width}rpx;`;
}
if (this.radius !== -1) {
styles += `border-radius:${this.radius}rpx;`;
}
return styles;
},
textStyles() {
let styles = `color:${this.color};font-weight:${this.fontWeight};`;
if (this.fontSize) {
styles += `font-size:${this.fontSize}rpx;`;
}
return styles;
}
},
watch: {
src(val) {
this.src && (this.showImg = this.src);
}
},
data() {
return {
showImg: ""
};
},
created() {
this.src && (this.showImg = this.src);
},
methods: {
handleError(e) {
if (this.src) {
this.errorSrc && (this.showImg = this.errorSrc);
this.$emit("error", {
index: this.index,
params: this.params
});
}
},
handleClick() {
this.$emit("click", {
index: this.index,
params: this.params
});
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.src
}, $props.src ? {
b: common_vendor.s($options.styles),
c: common_vendor.n($props.radius === -1 ? "fui-avatar__" + $props.shape : ""),
d: common_vendor.n($props.width ? "" : "fui-avatar__size-" + $props.size),
e: $data.showImg,
f: $props.mode,
g: $props.webp,
h: $props.lazyLoad,
i: common_vendor.o((...args) => $options.handleError && $options.handleError(...args))
} : {}, {
j: !$props.src && $props.text
}, !$props.src && $props.text ? {
k: common_vendor.t($props.text),
l: common_vendor.n($props.width ? "" : "fui-avatar__text-" + $props.size),
m: common_vendor.s($options.textStyles)
} : {}, {
n: common_vendor.n($props.width ? "" : "fui-avatar__size-" + $props.size),
o: common_vendor.n($props.radius === -1 ? "fui-avatar__" + $props.shape : ""),
p: common_vendor.s($options.wrapStyles),
q: common_vendor.o((...args) => $options.handleClick && $options.handleClick(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cde923ba"]]);
wx.createComponent(Component);
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="{{['fui-avatar__wrap', 'data-v-cde923ba', n, o, virtualHostClass]}}" style="{{p + ';' + virtualHostStyle}}" bindtap="{{q}}"><image wx:if="{{a}}" style="{{b}}" class="{{['fui-avatar__img', 'data-v-cde923ba', c, d]}}" src="{{e}}" mode="{{f}}" webp="{{g}}" lazy-load="{{h}}" binderror="{{i}}"></image><text wx:if="{{j}}" class="{{['fui-avatar__text', 'data-v-cde923ba', l]}}" style="{{m}}">{{k}}</text><slot></slot></view>
@@ -0,0 +1,66 @@
.fui-avatar__wrap.data-v-cde923ba {
position: relative;
display: inline-flex;
overflow: hidden;
flex-shrink: 0;
z-index: 3;
flex-direction: row;
align-items: center;
justify-content: center;
}
.fui-avatar__img.data-v-cde923ba {
flex: 1;
display: block;
-o-object-fit: cover;
object-fit: cover;
}
.fui-avatar__text.data-v-cde923ba {
flex: 1;
display: block;
white-space: nowrap;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
}
.fui-avatar__size-small.data-v-cde923ba {
width: 64rpx !important;
height: 64rpx !important;
}
.fui-avatar__text-small.data-v-cde923ba {
font-size: 32rpx !important;
}
.fui-avatar__size-middle.data-v-cde923ba {
width: 96rpx !important;
height: 96rpx !important;
}
.fui-avatar__text-middle.data-v-cde923ba {
font-size: 44rpx !important;
}
.fui-avatar__size-large.data-v-cde923ba {
width: 128rpx !important;
height: 128rpx !important;
}
.fui-avatar__text-large.data-v-cde923ba {
font-size: 56rpx !important;
}
.fui-avatar__circle.data-v-cde923ba {
border-radius: 50% !important;
}
.fui-avatar__square.data-v-cde923ba {
border-radius: 8rpx !important;
}
@@ -0,0 +1,666 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {
name: "fui-picker",
emits: ["change", "cancel"],
props: {
options: {
type: Array,
default() {
return [];
}
},
layer: {
type: [Number, String],
default: 1
},
show: {
type: Boolean,
default: false
},
value: {
type: [Array, String, Number],
default() {
return [];
}
},
linkage: {
type: Boolean,
default: false
},
fields: {
type: Array,
default() {
return ["text", "value", "children"];
}
},
radius: {
type: Boolean,
default: false
},
height: {
type: [Number, String],
default: 520
},
size: {
type: [Number, String],
default: 16
},
color: {
type: String,
default: ""
},
title: {
type: String,
default: ""
},
titleSize: {
type: [Number, String],
default: 28
},
titleColor: {
type: String,
default: ""
},
confirmText: {
type: String,
default: "确定"
},
confirmColor: {
type: String,
default: ""
},
cancelText: {
type: String,
default: "取消"
},
cancelColor: {
type: String,
default: ""
},
btnSize: {
type: [Number, String],
default: 32
},
background: {
type: String,
default: ""
},
theme: {
type: String,
default: "light"
},
maskClosable: {
type: Boolean,
default: true
},
maskBackground: {
type: String,
default: "rgba(0,0,0,.6)"
},
zIndex: {
type: [Number, String],
default: 996
},
isClose: {
type: Boolean,
default: true
},
//自定义参数
param: {
type: [Number, String],
default: 0
}
},
created() {
this.initialize();
this.isShow = this.show;
},
computed: {
cancelStyl() {
let styles = `fontSize:${this.btnSize}rpx;`;
if (this.cancelColor) {
styles += `color:${this.cancelColor};`;
}
return styles;
},
confrimStyl() {
let styles = `font-size:${this.btnSize}rpx;`;
let color = this.confirmColor;
if (color) {
styles += `color:${color};`;
}
return styles;
},
titleStyl() {
let styles = `font-size:${this.titleSize}rpx;`;
if (this.titleColor) {
styles += `color:${this.titleColor};`;
}
return styles;
},
contentStyl() {
let styles = `font-size:${this.size}px;`;
if (this.color) {
styles += `color:${this.color};`;
}
return styles;
},
headerStyl() {
let styles = "";
if (this.background) {
styles += `background:${this.background};`;
}
return styles;
},
maskStyl() {
return `background:${this.maskBackground};z-index:${Number(this.zIndex - 10)};`;
}
},
watch: {
layer(val) {
this.reset();
},
value(val) {
if (val) {
this.setDefaultOptions();
}
},
options(val) {
setTimeout(() => {
this.initialize();
}, 50);
},
fields(val) {
setTimeout(() => {
this.initialize();
}, 50);
},
isShow: {
handler(newVal) {
if (newVal) {
this.isInitShow = true;
}
},
immediate: true
},
show(val) {
this.isShow = val;
}
},
data() {
let immediate = true;
return {
immediate,
firstArr: [],
secondArr: [],
thirdArr: [],
fourthArr: [],
vals: [],
nvueVals: [],
darkStyle: "background-image: -webkit-linear-gradient(top, rgba(35, 35, 35, .95), rgba(35, 35, 35, .6)), -webkit-linear-gradient(bottom, rgba(35, 35, 35, .95), rgba(35, 35, 35, .6));",
indicatorStyl: "border-color: #333;height: 44px;",
darkBottomStyle: "",
tKey: "text",
vKey: "value",
cKey: "children",
isEnd: true,
isShow: false,
isInitShow: false
};
},
methods: {
initialize() {
if (this.linkage) {
this.getFields(this.fields);
this.setLayerData(-1, 0, 0, 0);
} else {
this.initData();
}
this.$nextTick(() => {
setTimeout(() => {
this.setDefaultOptions();
}, 50);
});
},
getFields(vals) {
if (!vals || vals.length === 0)
return;
this.tKey = vals[0] || "text";
this.vKey = vals[1] || "value";
this.cKey = vals[2] || "children";
},
btnCancel(e) {
this.isShow = false;
this.$emit("cancel", {
param: this.param
});
},
maskClick(e) {
if (!this.maskClosable)
return;
this.btnCancel(e);
},
getValue(layer = 1) {
let vals = this.vals;
let result = {};
if (this.linkage) {
let data = this.options;
const cKey = this.cKey;
if (layer == 1) {
result = data[vals[0]];
} else if (layer == 2) {
if (data[vals[0]][cKey])
result = data[vals[0]][cKey][vals[1]];
} else if (layer == 3) {
if (data[vals[0]][cKey] && data[vals[0]][cKey][vals[1]][cKey])
result = data[vals[0]][cKey][vals[1]][cKey][vals[2]];
} else {
if (data[vals[0]][cKey] && data[vals[0]][cKey][vals[1]][cKey] && data[vals[0]][cKey][vals[1]][cKey][vals[2]][cKey])
result = data[vals[0]][cKey][vals[1]][cKey][vals[2]][cKey][vals[3]];
}
} else {
if (layer == 1) {
result = this.firstArr[vals[0]] || "";
} else if (layer == 2) {
result = this.secondArr[vals[1]] || "";
} else if (layer == 3) {
result = this.thirdArr[vals[2]] || "";
} else {
result = this.fourthArr[vals[3]] || "";
}
}
return result;
},
checkChildrenData(data, layer, first, second, third) {
let arr = [];
const children = this.cKey;
if (layer == 1) {
if (data[first])
arr = data[first][children] || [];
} else if (layer == 2) {
if (data[first] && data[first][children] && data[first][children][second])
arr = data[first][children][second][children] || [];
} else {
if (data[first] && data[first][children] && data[first][children][second] && data[first][children][second][children] && data[first][children][second][children][third])
arr = data[first][children][second][children][third][children] || [];
}
return arr;
},
handleData(data, tKey) {
tKey = tKey || this.tKey;
let arr = [];
if (data && data.length > 0) {
for (let item of data) {
arr.push(item[tKey]);
}
}
return arr;
},
initData() {
let data = this.options;
if (!data || data.length === 0) {
this.firstArr = [];
this.secondArr = [];
this.thirdArr = [];
this.fourthArr = [];
return;
}
if (this.layer == 1 && !Array.isArray(data[0])) {
this.firstArr = data;
} else {
this.firstArr = data[0];
}
if (this.layer == 2) {
this.secondArr = data[1];
} else if (this.layer == 3) {
this.secondArr = data[1];
this.thirdArr = data[2];
} else if (this.layer == 4) {
this.secondArr = data[1];
this.thirdArr = data[2];
this.fourthArr = data[3];
}
},
setLayerData(reset, first, second, third) {
let data = this.options;
if (!data || data.length === 0) {
this.firstArr = [];
this.secondArr = [];
this.thirdArr = [];
this.fourthArr = [];
return;
}
if (this.layer == 1) {
this.firstArr = this.handleData(data);
} else if (this.layer == 2) {
if (reset == -1)
this.firstArr = this.handleData(data);
this.secondArr = this.handleData(this.checkChildrenData(data, 1, first));
} else if (this.layer == 3) {
if (reset == -1)
this.firstArr = this.handleData(data);
if (reset == 1 || reset == -1)
this.secondArr = this.handleData(this.checkChildrenData(data, 1, first));
this.thirdArr = this.handleData(this.checkChildrenData(data, 2, first, second));
} else {
if (reset == -1)
this.firstArr = this.handleData(data);
if (reset == 1 || reset == -1)
this.secondArr = this.handleData(this.checkChildrenData(data, 1, first));
if (reset == 1 || reset == -1 || reset == 2)
this.thirdArr = this.handleData(this.checkChildrenData(data, 2, first, second));
this.fourthArr = this.handleData(this.checkChildrenData(data, 3, first, second, third));
}
},
reset() {
const vals = [
[0],
[0, 0],
[0, 0, 0],
[0, 0, 0, 0]
][Number(this.layer) - 1];
this.vals = [...vals];
},
open() {
this.isShow = true;
},
//手动关闭弹框
close() {
this.isShow = false;
},
setDefaultOptions() {
let values = this.value;
if (this.layer == 1 && !Array.isArray(values)) {
values = values ? [values] : [];
}
let vals = [];
let txtArr = this.firstArr;
const len = values.length;
const index = txtArr.indexOf(values[0]);
if (len > 0 && index !== -1) {
vals.push(index);
for (let i = 1; i < len; i++) {
if (i === 1) {
if (this.linkage) {
this.secondArr = this.handleData(this.checkChildrenData(this.options, 1, vals[0]));
}
vals.push(this.secondArr.indexOf(values[i]));
} else if (i === 2) {
if (this.linkage) {
this.thirdArr = this.handleData(this.checkChildrenData(
this.options,
2,
vals[0],
vals[1]
));
}
vals.push(this.thirdArr.indexOf(values[i]));
} else {
if (this.linkage) {
this.fourthArr = this.handleData(this.checkChildrenData(
this.options,
3,
vals[0],
vals[1],
vals[2]
));
}
vals.push(this.fourthArr.indexOf(values[i]));
}
}
if (this.vals.join("") === vals.join(""))
return;
this.vals = [];
this.$nextTick(() => {
setTimeout(() => {
this.vals = [...vals];
}, 200);
});
} else {
this.vals = [];
this.$nextTick(() => {
setTimeout(() => {
this.reset();
}, 200);
});
}
},
setOneLayers(value) {
if (this.vals[0] != value[0]) {
this.vals = value;
}
},
setTwoLayers(value) {
if (this.vals[0] != value[0]) {
this.setLayerData(0, value[0]);
this.vals = [value[0], 0];
} else {
this.vals = value;
}
},
setThreeLayers(value) {
if (this.vals[0] != value[0]) {
this.setLayerData(1, value[0], 0);
this.vals = [value[0], 0, 0];
} else if (this.vals[1] != value[1]) {
this.setLayerData(0, value[0], value[1]);
this.vals = [value[0], value[1], 0];
} else {
this.vals = value;
}
},
setFourLayers(value) {
if (this.vals[0] != value[0]) {
this.setLayerData(1, value[0], 0, 0);
this.vals = [value[0], 0, 0, 0];
} else if (this.vals[1] != value[1]) {
this.setLayerData(2, value[0], value[1], 0);
this.vals = [value[0], value[1], 0, 0];
} else if (this.vals[2] != value[2]) {
this.setLayerData(0, value[0], value[1], value[2]);
this.vals = [value[0], value[1], value[2], 0];
} else {
this.vals = value;
}
},
emitChange() {
let text = [];
let value = [];
let result = "";
if (this.options.length > 0) {
if (this.layer == 1) {
const vals = this.getValue();
if (this.linkage) {
text = vals[this.tKey];
value = vals[this.vKey];
} else {
text = vals;
value = vals;
}
result = text;
} else if (this.layer == 2) {
const vals = this.getValue();
const vals2 = this.getValue(2);
if (this.linkage) {
text = [vals[this.tKey], vals2[this.tKey] || ""];
value = [vals[this.vKey], vals2[this.vKey] || ""];
} else {
text = [vals, vals2 || ""];
value = [vals, vals2 || ""];
}
result = text.join("");
} else if (this.layer == 3) {
const vals = this.getValue();
const vals2 = this.getValue(2);
const vals3 = this.getValue(3);
if (this.linkage) {
text = [vals[this.tKey], vals2[this.tKey] || "", vals3[this.tKey] || ""];
value = [vals[this.vKey], vals2[this.vKey] || "", vals3[this.vKey] || ""];
} else {
text = [vals, vals2 || "", vals3 || ""];
value = [vals, vals2 || "", vals3 || ""];
}
result = text.join("");
} else {
const vals = this.getValue();
const vals2 = this.getValue(2);
const vals3 = this.getValue(3);
const vals4 = this.getValue(4);
if (this.linkage) {
text = [
vals[this.tKey],
vals2[this.tKey] || "",
vals3[this.tKey] || "",
vals4[this.tKey] || ""
];
value = [
vals[this.vKey],
vals2[this.vKey] || "",
vals3[this.vKey] || "",
vals4[this.vKey] || ""
];
} else {
text = [vals, vals2 || "", vals3 || "", vals4 || ""];
value = [vals, vals2 || "", vals3 || "", vals4 || ""];
}
result = text.join("");
}
}
this.$emit("change", {
text,
value,
index: this.vals,
result,
param: this.param
});
},
waitForTrigger(index = 0) {
if (this.isEnd) {
this.emitChange();
} else {
index++;
if (index >= 20) {
this.isEnd = true;
}
setTimeout(() => {
this.waitForTrigger(index);
}, 50);
}
},
btnConfirm(e) {
setTimeout(() => {
if (this.isClose) {
this.isShow = false;
}
this.waitForTrigger();
}, 50);
},
pickerChange(e) {
let value = e.detail.value;
if (!this.isInitShow || value.length != this.layer)
return;
if (this.linkage) {
if (this.layer == 1) {
this.setOneLayers(value);
} else if (this.layer == 2) {
this.setTwoLayers(value);
} else if (this.layer == 3) {
this.setThreeLayers(value);
} else {
this.setFourLayers(value);
}
} else {
this.vals = value;
}
this.isEnd = true;
},
pickerstart() {
this.isEnd = false;
},
stop(e) {
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.o((...args) => $options.stop && $options.stop(...args)),
b: $data.isShow ? 1 : "",
c: common_vendor.s($options.maskStyl),
d: common_vendor.o((...args) => $options.maskClick && $options.maskClick(...args)),
e: common_vendor.t($props.cancelText),
f: common_vendor.n($props.theme === "dark" ? "fui-pk__cancel-color_dark" : "fui-pk__cancel-color"),
g: common_vendor.s($options.cancelStyl),
h: common_vendor.o((...args) => $options.btnCancel && $options.btnCancel(...args)),
i: common_vendor.t($props.title),
j: common_vendor.n($props.theme === "dark" ? "fui-pk__title-color_dark" : "fui-pk__title-color"),
k: common_vendor.s($options.titleStyl),
l: common_vendor.t($props.confirmText),
m: !$props.confirmColor || $props.confirmColor === true ? 1 : "",
n: common_vendor.s($options.confrimStyl),
o: common_vendor.o((...args) => $options.btnConfirm && $options.btnConfirm(...args)),
p: $props.theme === "dark" ? 1 : "",
q: $props.radius ? 1 : "",
r: common_vendor.s($options.headerStyl),
s: common_vendor.f($data.firstArr, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
t: common_vendor.s($options.contentStyl),
v: $props.theme === "dark" ? 1 : "",
w: $props.layer == 2 || $props.layer == 3 || $props.layer == 4
}, $props.layer == 2 || $props.layer == 3 || $props.layer == 4 ? {
x: common_vendor.f($data.secondArr, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
y: common_vendor.s($options.contentStyl),
z: $props.theme === "dark" ? 1 : ""
} : {}, {
A: $props.layer == 3 || $props.layer == 4
}, $props.layer == 3 || $props.layer == 4 ? {
B: common_vendor.f($data.thirdArr, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
C: common_vendor.s($options.contentStyl),
D: $props.theme === "dark" ? 1 : ""
} : {}, {
E: $props.layer == 4
}, $props.layer == 4 ? {
F: common_vendor.f($data.fourthArr, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
G: common_vendor.s($options.contentStyl),
H: $props.theme === "dark" ? 1 : ""
} : {}, {
I: $props.theme === "dark" ? $data.darkStyle : "",
J: $props.theme === "dark" ? $data.darkBottomStyle : "",
K: $props.theme === "dark" ? $data.darkStyle : "",
L: $props.theme === "dark" ? $data.indicatorStyl : "height: 44px;border-top-width:0.5px;border-bottom-width:0.5px;",
M: $props.theme === "dark" ? "fui-picker__indicator" : "",
N: $props.height + "rpx",
O: $props.theme + $props.layer,
P: $data.vals,
Q: $data.immediate,
R: common_vendor.o((...args) => $options.pickerChange && $options.pickerChange(...args)),
S: common_vendor.o((...args) => $options.pickerstart && $options.pickerstart(...args)),
T: $props.theme,
U: $props.theme === "dark" ? 1 : "",
V: $data.isShow ? 1 : "",
W: $props.radius ? 1 : "",
X: $props.zIndex,
Y: common_vendor.o((...args) => $options.stop && $options.stop(...args))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-debed8cc"]]);
wx.createComponent(Component);
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view bindtouchend="{{Y}}" class="{{['fui-picker__wrap', 'data-v-debed8cc', virtualHostClass]}}" style="{{virtualHostStyle}}"><view catchtouchmove="{{a}}" class="{{['fui-picker__mask', 'data-v-debed8cc', b && 'fui-picker__mask-show']}}" style="{{c}}" ref="fui_pkm_ani" catchtap="{{d}}"></view><view key="{{T}}" class="{{['fui-picker__content', 'data-v-debed8cc', U && 'fui-picker__content-dark', V && 'fui-picker__content-show', W && 'fui-picker__radius']}}" style="{{'z-index:' + X}}" ref="fui_pk_ani"><view class="{{['fui-picker__header', 'data-v-debed8cc', p && 'fui-picker__header-dark', q && 'fui-picker__radius']}}" style="{{r}}"><text class="{{['fui-picker__btn-cancel', 'data-v-debed8cc', f]}}" style="{{g}}" catchtap="{{h}}">{{e}}</text><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><text class="{{['fui-picker__title', 'data-v-debed8cc', j]}}" style="{{k}}">{{i}}</text></block><text class="{{['fui-picker__btn-sure', 'data-v-debed8cc', m && 'fui-pk__sure-color']}}" style="{{n}}" catchtap="{{o}}">{{l}}</text></view><view class="data-v-debed8cc" catchtouchstart="{{S}}"><picker-view mask-top-style="{{I}}" mask-bottom-style="{{J}}" mask-style="{{K}}" indicator-style="{{L}}" indicator-class="{{M}}" class="fui-picker__view data-v-debed8cc" style="{{'height:' + N}}" key="{{O}}" value="{{P}}" immediate-change="{{Q}}" bindchange="{{R}}"><picker-view-column class="data-v-debed8cc"><text wx:for="{{s}}" wx:for-item="item" wx:key="b" style="{{t}}" class="{{['fui-picker__text', 'data-v-debed8cc', v && 'fui-picker__color-dark']}}">{{item.a}}</text></picker-view-column><picker-view-column wx:if="{{w}}" class="data-v-debed8cc"><text wx:for="{{x}}" wx:for-item="item" wx:key="b" style="{{y}}" class="{{['fui-picker__text', 'data-v-debed8cc', z && 'fui-picker__color-dark']}}">{{item.a}}</text></picker-view-column><picker-view-column wx:if="{{A}}" class="data-v-debed8cc"><text wx:for="{{B}}" wx:for-item="item" wx:key="b" style="{{C}}" class="{{['fui-picker__text', 'data-v-debed8cc', D && 'fui-picker__color-dark']}}">{{item.a}}</text></picker-view-column><picker-view-column wx:if="{{E}}" class="data-v-debed8cc"><text wx:for="{{F}}" wx:for-item="item" wx:key="b" style="{{G}}" class="{{['fui-picker__text', 'data-v-debed8cc', H && 'fui-picker__color-dark']}}">{{item.a}}</text></picker-view-column></picker-view></view></view></view>
@@ -0,0 +1,182 @@
.fui-picker__mask.data-v-debed8cc {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
transition: all 0.25s ease-in-out;
visibility: hidden;
opacity: 0;
}
.fui-picker__mask-show.data-v-debed8cc {
visibility: visible;
opacity: 1;
}
.fui-picker__content.data-v-debed8cc {
width: 100%;
visibility: hidden;
position: fixed;
left: 0;
right: 0;
bottom: 0;
transform: translate3d(0, 100%, 0);
transition: all 0.25s ease-in-out;
transform-origin: center center;
flex-direction: column;
background: #fff;
}
.fui-picker__content-dark.data-v-debed8cc {
background: #222;
}
.fui-picker__content-show.data-v-debed8cc {
transform: translate3d(0, 0, 0);
visibility: visible;
}
.fui-picker__radius.data-v-debed8cc {
border-top-left-radius: 24rpx;
border-top-right-radius: 24rpx;
overflow: hidden;
}
.fui-picker__header.data-v-debed8cc {
width: 100%;
display: flex;
box-sizing: border-box;
flex: 1;
flex-direction: row;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 20rpx;
background: #fff;
position: relative;
}
.fui-picker__header-dark.data-v-debed8cc {
background: #222;
border-bottom-color: #333;
}
.fui-picker__header.data-v-debed8cc::after {
content: '';
position: absolute;
border-bottom: 1px solid #eee;
transform: scaleY(0.5) translateZ(0);
bottom: 0;
right: 0;
left: 0;
}
.fui-picker__header-dark.data-v-debed8cc::after {
border-bottom-color: #333;
}
.fui-picker__btn-cancel.data-v-debed8cc,
.fui-picker__btn-sure.data-v-debed8cc {
font-weight: normal;
height: 88rpx;
padding: 0 24rpx;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
text-align: center;
}
.fui-picker__btn-cancel.data-v-debed8cc:active {
opacity: .5;
}
.fui-picker__btn-sure.data-v-debed8cc:active {
opacity: .5;
}
.fui-picker__title.data-v-debed8cc {
font-weight: normal;
font-size: 28rpx;
flex: 1;
padding: 0 24rpx;
display: block;
white-space: nowrap;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
}
.fui-pk__title-color.data-v-debed8cc {
color: #333333;
}
.fui-pk__title-color_dark.data-v-debed8cc {
color: #A3A3A3;
}
.fui-pk__cancel-color.data-v-debed8cc {
color: #181818;
}
.fui-pk__cancel-color_dark.data-v-debed8cc {
color: #D1D1D1;
}
.fui-pk__sure-color.data-v-debed8cc {
color: var(--fui-color-primary, #465CFF) !important;
}
.fui-picker__view.data-v-debed8cc {
width: 100%;
height: 520rpx;
}
.fui-picker__text.data-v-debed8cc {
width: 100%;
display: block;
white-space: nowrap;
box-sizing: border-box;
line-height: 44px;
text-align: center;
font-size: 16px;
font-weight: normal;
color: #181818;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 4rpx;
}
.fui-picker__color-dark.data-v-debed8cc {
color: #D1D1D1;
}
.data-v-debed8cc .fui-picker__indicator {
position: relative;
border-color: transparent;
}
.data-v-debed8cc .fui-picker__indicator::before {
border-color: #333;
}
.data-v-debed8cc .fui-picker__indicator::after {
border-color: #333;
}
@@ -0,0 +1,28 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {
name: "fui-safe-area",
props: {
//背景颜色
background: {
type: String,
default: "#FFFFFF"
}
},
created() {
},
data() {
return {
iphonex: false
};
},
methods: {}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: $data.iphonex ? 1 : "",
b: $props.background
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-37358499"]]);
wx.createComponent(Component);
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="{{['fui-safe__area-wrap', 'data-v-37358499', a && 'fui-safe__area-weex', virtualHostClass]}}" style="{{'background:' + b + ';' + virtualHostStyle}}"></view>
@@ -0,0 +1,21 @@
.fui-safe__area-wrap.data-v-37358499 {
width: 100%;
display: flex;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
flex: 1;
flex-direction: row;
}
+120
View File
@@ -0,0 +1,120 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const getBaseURL = () => "https://scschool.cc/api";
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({
url: `${getBaseURL()}/auth/refreshTokens`,
// 请求地址
method: "POST",
data: {
"refreshToken": refreshToken
},
enableChunked: false,
// 开启流传输
success: (res) => {
resolve(res);
},
// 请求成功回调
fail: (err) => {
reject(err);
console.log("请求失败", err);
}
// 请求失败回调
});
console.log("requestTask", requestTask);
});
};
const getModelList = (data) => {
const token = data;
return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({
url: `${getBaseURL()}/oneapi/channel`,
// 请求地址
method: "GET",
header: {
"Authorization": "Bearer " + token,
"Host": "scschool.cc"
},
enableChunked: false,
// 开启流传输
success: (res) => {
resolve(res);
},
// 请求成功回调
fail: (err) => {
reject(err);
console.log("请求失败", err);
}
// 请求失败回调
});
console.log("requestTask", requestTask);
});
};
const getUserKey = (data, Rtoken_value) => {
const usedata = {
"user_id": data.id,
"status": data.status,
"remain_quota": data.quota,
"unlimited_quota": false
};
const token = Rtoken_value;
return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({
url: `${getBaseURL()}/oneapi/token`,
// 请求地址
method: "POST",
header: {
"Authorization": "Bearer " + token
},
data: usedata,
enableChunked: false,
// 开启流传输
success: (res) => {
resolve(res);
},
// 请求成功回调
fail: (err) => {
reject(err);
console.log("请求失败", err);
}
// 请求失败回调
});
console.log("requestTask", requestTask);
});
};
const getUserInfo = (data) => {
const restoken = data.refresh_token;
return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({
url: `${getBaseURL()}/oneapi/user`,
// 请求地址
method: "POST",
header: {
"Authorization": "Bearer " + restoken
},
data,
enableChunked: false,
// 开启流传输
success: (res) => {
resolve(res);
},
// 请求成功回调
fail: (err) => {
reject(err);
console.log("请求失败", err);
}
// 请求失败回调
});
console.log("requestTask", requestTask);
});
};
exports.ChatAPiUrl = ChatAPiUrl;
exports.getModelList = getModelList;
exports.getUserInfo = getUserInfo;
exports.getUserKey = getUserKey;
exports.getUserToken = getUserToken;
+3 -1
View File
@@ -1,7 +1,7 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_request = require("../utils/request.js");
const stores_appStore = require("../stores/appStore.js");
const common_vendor = require("../common/vendor.js");
const types_event_types = require("../types/event.types.js");
const utils_emitter = require("../utils/emitter.js");
const loginByWechatCode = (code) => utils_request.request(`auth/loginByWechatMiniProgram?code=${code}`);
@@ -18,6 +18,8 @@ const refreshUserInfo = (user = getLoginInfo()) => utils_request.request(`/users
});
const isLogin = common_vendor.computed(() => {
const { user } = common_vendor.storeToRefs(stores_appStore.useAppStore());
console.log("storeToRefs(useAppStore())", user.value);
common_vendor.index.setStorageSync("refreshToken", user.value.refresh_token);
return !!user.value.refresh_token;
});
const getUserVipInfo = () => utils_request.request("/member/topLevel", { method: "POST" });
+316 -37
View File
@@ -7,30 +7,41 @@ const utils_common = require("../../utils/common.js");
const stores_appStore = require("../../stores/appStore.js");
const types_event_types = require("../../types/event.types.js");
const utils_emitter = require("../../utils/emitter.js");
const composables_aiChat = require("../../composables/aiChat.js");
if (!Array) {
const _easycom_fui_tabs2 = common_vendor.resolveComponent("fui-tabs");
const _easycom_fui_nav_bar2 = common_vendor.resolveComponent("fui-nav-bar");
const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
const _easycom_up_status_bar2 = common_vendor.resolveComponent("up-status-bar");
const _easycom_fui_footer2 = common_vendor.resolveComponent("fui-footer");
const _easycom_fui_avatar2 = common_vendor.resolveComponent("fui-avatar");
const _easycom_fui_load_ani2 = common_vendor.resolveComponent("fui-load-ani");
const _easycom_fui_icon2 = common_vendor.resolveComponent("fui-icon");
const _easycom_fui_picker2 = common_vendor.resolveComponent("fui-picker");
const _easycom_fui_safe_area2 = common_vendor.resolveComponent("fui-safe-area");
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
const _easycom_up_cell_group2 = common_vendor.resolveComponent("up-cell-group");
const _component_template = common_vendor.resolveComponent("template");
(_easycom_fui_tabs2 + _easycom_fui_nav_bar2 + _easycom_up_gap2 + _easycom_up_status_bar2 + _easycom_fui_footer2 + _easycom_up_avatar2 + _easycom_up_icon2 + _easycom_up_cell2 + _easycom_up_cell_group2 + _component_template)();
(_easycom_fui_tabs2 + _easycom_fui_nav_bar2 + _easycom_up_gap2 + _easycom_up_status_bar2 + _easycom_fui_footer2 + _easycom_fui_avatar2 + _easycom_fui_load_ani2 + _easycom_fui_icon2 + _easycom_fui_picker2 + _easycom_fui_safe_area2 + _easycom_up_avatar2 + _easycom_up_icon2 + _easycom_up_cell2 + _easycom_up_cell_group2 + _component_template)();
}
const _easycom_fui_tabs = () => "../../components/firstui/fui-tabs/fui-tabs.js";
const _easycom_fui_nav_bar = () => "../../components/firstui/fui-nav-bar/fui-nav-bar.js";
const _easycom_up_gap = () => "../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_status_bar = () => "../../node-modules/uview-plus/components/u-status-bar/u-status-bar.js";
const _easycom_fui_footer = () => "../../components/firstui/fui-footer/fui-footer.js";
const _easycom_fui_avatar = () => "../../components/firstui/fui-avatar/fui-avatar.js";
const _easycom_fui_load_ani = () => "../../components/firstui/fui-load-ani/fui-load-ani.js";
const _easycom_fui_icon = () => "../../components/firstui/fui-icon/fui-icon.js";
const _easycom_fui_picker = () => "../../components/firstui/fui-picker/fui-picker.js";
const _easycom_fui_safe_area = () => "../../components/firstui/fui-safe-area/fui-safe-area.js";
const _easycom_up_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up_cell = () => "../../node-modules/uview-plus/components/u-cell/u-cell.js";
const _easycom_up_cell_group = () => "../../node-modules/uview-plus/components/u-cell-group/u-cell-group.js";
if (!Math) {
(_easycom_fui_tabs + _easycom_fui_nav_bar + fuiBackgroundImage + AppSwiper + _easycom_up_gap + AppTags + AppWaterFall + _easycom_up_status_bar + MyGraphicCard + BaseLayout + _easycom_fui_footer + _easycom_up_avatar + UserMemberInfo + GetUserInfoPopup + _easycom_up_icon + _easycom_up_cell + _easycom_up_cell_group + TnIcon)();
(_easycom_fui_tabs + _easycom_fui_nav_bar + fuiBackgroundImage + AppSwiper + _easycom_up_gap + AppTags + AppWaterFall + _easycom_up_status_bar + MyGraphicCard + BaseLayout + _easycom_fui_footer + _easycom_fui_avatar + _easycom_fui_load_ani + _easycom_fui_icon + _easycom_fui_picker + _easycom_fui_safe_area + _easycom_up_avatar + UserMemberInfo + GetUserInfoPopup + _easycom_up_icon + _easycom_up_cell + _easycom_up_cell_group + TnIcon)();
}
const BaseLayout = () => "../../layouts/BaseLayout.js";
const GetUserInfoPopup = () => "../../components/GetUserInfoPopup.js";
@@ -45,6 +56,212 @@ const backGroundImage = "https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/a
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "index",
setup(__props) {
global.TextEncoder = common_vendor.TextEncoder;
global.TextDecoder = common_vendor.TextDecoder;
let items = common_vendor.ref("");
function copyText(text) {
common_vendor.index.setClipboardData({
data: text,
success: () => {
console.log("复制成功");
common_vendor.index.showToast({
title: "复制成功",
icon: "none"
});
},
fail: (err) => {
console.error("复制失败", err);
common_vendor.index.showToast({
title: "复制失败,请稍后再试",
icon: "none"
});
}
});
}
async function chatAiGetToken() {
const requestTask = common_vendor.ref();
const userInfo = common_vendor.ref();
await composables_aiChat.getUserToken().then((res) => {
requestTask.value = res.data;
}).catch((err) => {
console.error("获取getUserToken失败:", err);
});
console.log("getUserToken执行完毕");
await composables_aiChat.getUserInfo(requestTask.value).then((res) => {
userInfo.value = res.data;
}).catch((err) => {
console.error("获取getUserInfo失败:", err);
});
console.log("getUserInfo执行完毕");
await composables_aiChat.getModelList(requestTask.value.token).then((res) => {
modelList.value = res.data;
chooseModel.value = res.data[0];
}).catch((err) => {
console.error("获取getModelList失败:", err);
});
console.log("getModelList执行完毕");
await composables_aiChat.getUserKey(userInfo.value, requestTask.value.refresh_token).then((res) => {
console.log("获取到的getUserKey信息:", res.data);
userkey.value = res.data.key;
}).catch((err) => {
console.error("获取getUserKey失败:", err);
});
console.log("getUserKey执行完毕");
}
const popup = common_vendor.ref(false);
const modelList = common_vendor.ref([]);
const chooseModel = common_vendor.ref("");
function change(e) {
popup.value = false;
chooseModel.value = e.value;
}
function cancel() {
popup.value = false;
}
function popupMth() {
if (!composables_useCommon.isLogin.value) {
common_vendor.index.showToast({
icon: "error",
title: "您还没有登录",
duration: 2e3
});
return 0;
}
popup.value = true;
}
const content = common_vendor.ref("");
const msgList = common_vendor.ref([
{
"content": "你好我是Ai聊天助手,有什么问题问我吧!(温馨提示:长按消息可以复制文本哦)",
"role": "system"
}
]);
const userkey = common_vendor.ref("");
const StreamRequest = (content2) => {
return new Promise((resolve, reject) => {
const requestTask = common_vendor.index.request({
url: composables_aiChat.ChatAPiUrl(),
// 请求地址
method: "POST",
data: {
"messages": content2,
"model": chooseModel.value,
"stream": true,
"features": {
"thinking_enabled": false
}
},
dataType: "json",
header: {
"Authorization": "Bearer sk-" + userkey.value
},
responseType: "text",
enableChunked: true,
// 开启流传输
success: (res) => {
resolve(res);
},
// 请求成功回调
fail: (err) => {
reject(err);
common_vendor.index.showToast({
icon: "error",
title: "请求失败",
duration: 2e3
});
console.log("请求失败", err);
}
// 请求失败回调
});
requestTask.onChunkReceived((chunk) => {
try {
const base64 = common_vendor.wx$1.arrayBufferToBase64(chunk.data);
const arrayBuffer = common_vendor.wx$1.base64ToArrayBuffer(base64);
const text = new common_vendor.TextDecoder().decode(arrayBuffer, { stream: true });
handleStreamData(text);
} catch (error) {
console.error("处理数据块失败", error);
}
});
requestTask.onHeadersReceived(() => {
console.log("请求完成");
});
});
};
const msg = common_vendor.ref("");
function handleStreamData(responseText) {
const messages = responseText.split("\n").filter((line) => line.startsWith("data:"));
for (const message of messages) {
if (message.trim() === "data: [DONE]") {
msgStatu.value = true;
return;
}
try {
const data = JSON.parse(message.substring(5).trim());
if (data.choices && data.choices[0] && data.choices[0].delta && data.choices[0].delta.content) {
msg.value += data.choices[0].delta.content;
}
} catch (error) {
console.log("解析错误:", error);
}
}
const index = msgList.value.length - 1;
msgList.value[index].content = msg.value;
items.value = "items-" + (msgList.value.length - 1);
msgStatu.value = false;
}
const msgStatu = common_vendor.ref(true);
function msgSend() {
if (!composables_useCommon.isLogin.value) {
common_vendor.index.showToast({
icon: "error",
title: "您还没有登录",
duration: 2e3
});
return 0;
}
if (chooseModel.value == void 0) {
common_vendor.index.showToast({
icon: "error",
title: "您没有选择模型",
duration: 2e3
});
return 0;
}
if (msgStatu.value != true) {
common_vendor.index.showToast({
icon: "error",
title: "请等待消息结束",
duration: 2e3
});
return 0;
}
msgList.value.push(
{
"content": content.value,
"role": "user"
}
);
content.value = "";
StreamRequest(msgList.value);
msgList.value.push({
"content": "",
"role": "system"
});
msg.value = "";
}
common_vendor.onReady(() => {
socketInit();
utils_emitter.on(types_event_types.EventType.PAY_SUCCESS, ({ order_id }) => handlePayMessage(order_id));
wode_loging();
chatAiGetToken();
});
common_vendor.onMounted(() => {
getTestImageData();
});
common_vendor.onUnmounted(() => {
imageData.value = [];
});
function img2pay() {
pageindex.value = 2;
showPay.value = true;
@@ -54,7 +271,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
const pageindex = common_vendor.ref(0);
const changeHomePage = (index) => {
pageindex.value = index.index;
console.log("index", pageindex.value);
if (index.index == 2) {
chatAiGetToken();
}
};
const name_value = common_vendor.ref("我的");
function wode_loging() {
@@ -67,12 +286,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
const tabbarData = [
{
name: "首页",
to: "/pages/index/index",
// to: '/pages/index/index',
onClick: tabbarIndex
},
{
name: "创意",
to: "/pages/creative/creative",
// to: '/pages/creative/creative',
onClick: tabbarIndex
},
{
name: "AI助手",
// to: '/pages/creative/creative',
onClick: tabbarIndex
},
{
@@ -80,12 +304,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
onClick: tabbarIndex
}
];
common_vendor.onMounted(() => {
getTestImageData();
});
common_vendor.onUnmounted(() => {
imageData.value = [];
});
const getTestImageData = async () => {
imageData.value = await utils_request.request("draw/history/findMany", {
method: "POST",
@@ -150,7 +368,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
if (uniPlatform !== "web") {
handleLoginByWechat();
} else {
console.log("dev");
const user2 = await composables_useCommon.loginByUsername({
username: "test456",
password: "123456"
@@ -158,6 +375,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
composables_useCommon.saveLoginInfo(user2);
common_vendor.index.hideLoading();
}
chatAiGetToken();
name_value.value = "我的";
};
const handleLoginByWechat = () => {
@@ -166,6 +384,8 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
const result = await composables_useCommon.loginByWechatCode(code);
composables_useCommon.saveLoginInfo(result);
common_vendor.index.hideLoading();
console.log("------------result--------", result);
common_vendor.index.setStorageSync("refreshToken", result.refresh_token);
},
fail: function(err) {
common_vendor.index.showToast({
@@ -174,13 +394,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
});
}
});
chatAiGetToken();
};
const { socketInit } = composables_useWorkFlow.useWorkFlow();
common_vendor.onReady(() => {
socketInit();
utils_emitter.on(types_event_types.EventType.PAY_SUCCESS, ({ order_id }) => handlePayMessage(order_id));
wode_loging();
});
const handlePayMessage = async (order_id) => {
console.log("收到支付成功消息", order_id);
const order = await composables_useCommon.getOrderInfoById(order_id);
@@ -269,59 +485,122 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
n: common_vendor.p({
src: backGroundImage
}),
o: common_vendor.p({
o: common_vendor.f(msgList.value, (item, index, i0) => {
return common_vendor.e({
a: "83a5a03c-14-" + i0,
b: common_vendor.p({
background: "#fff",
src: item.role == "system" ? "https://wangbo0808.oss-cn-shanghai.aliyuncs.com/assets/gpt4.png" : common_vendor.unref(user).avatar_url
}),
c: item.content.length > 1
}, item.content.length > 1 ? {
d: common_vendor.t(item.content),
e: common_vendor.o(($event) => copyText(item.content), index)
} : {}, {
f: item.content.length < 1
}, item.content.length < 1 ? {
g: "83a5a03c-15-" + i0,
h: common_vendor.p({
type: "3",
color: " #7f7d79"
})
} : {}, {
i: `items-${index}`,
j: common_vendor.n(item.role == "user" ? "fui-chat__right" : "fui-chat__left"),
k: common_vendor.o(($event) => _ctx.getCopyMsg(1, item.msg, $event), index),
l: common_vendor.o(($event) => _ctx.getCopyMsg(2, item.content, $event), index),
m: index
});
}),
p: common_vendor.unref(items),
q: common_vendor.t(chooseModel.value || modelList.value[0]),
r: common_vendor.o(popupMth),
s: common_vendor.p({
name: "message",
color: "#3b3ee9"
}),
t: -1,
v: common_vendor.o(msgSend),
w: content.value,
x: common_vendor.o(($event) => content.value = $event.detail.value),
y: content.value.length == 0
}, content.value.length == 0 ? {
z: common_vendor.p({
name: "clear",
color: "#3b3ee9"
})
} : {
A: common_vendor.o(msgSend)
}, {
B: common_vendor.o(change),
C: common_vendor.o(cancel),
D: common_vendor.p({
options: modelList.value,
show: popup.value
}),
E: !_ctx.focus
}, !_ctx.focus ? {
F: common_vendor.p({
background: "#f8f8f8"
})
} : {}, {
G: pageindex.value == 2,
H: common_vendor.p({
src: backGroundImage
}),
I: common_vendor.p({
src: common_vendor.unref(user).avatar_url,
size: "80"
}),
p: !common_vendor.unref(composables_useCommon.isLogin)
J: !common_vendor.unref(composables_useCommon.isLogin)
}, !common_vendor.unref(composables_useCommon.isLogin) ? {} : {}, {
q: common_vendor.unref(composables_useCommon.isLogin)
K: common_vendor.unref(composables_useCommon.isLogin)
}, common_vendor.unref(composables_useCommon.isLogin) ? {
r: common_vendor.t(common_vendor.unref(user).nickname)
L: common_vendor.t(common_vendor.unref(user).nickname)
} : {}, {
s: common_vendor.unref(composables_useCommon.isLogin)
M: common_vendor.unref(composables_useCommon.isLogin)
}, common_vendor.unref(composables_useCommon.isLogin) ? {
t: common_vendor.t(common_vendor.unref(user).balance)
N: common_vendor.t(common_vendor.unref(user).balance)
} : {}, {
v: common_vendor.p({
O: common_vendor.p({
name: "scan",
color: "#969799",
size: "28"
}),
w: common_vendor.o(toEmpty),
x: common_vendor.p({
P: common_vendor.o(toEmpty),
Q: common_vendor.p({
name: "arrow-right",
color: "#969799",
size: "28"
}),
y: common_vendor.o(toEmpty),
z: common_vendor.o(handleLogin),
A: common_vendor.o(($event) => showPay.value = true),
B: common_vendor.p({
R: common_vendor.o(toEmpty),
S: common_vendor.o(handleLogin),
T: common_vendor.o(($event) => showPay.value = true),
U: common_vendor.p({
icon: "rmb-circle",
title: "算力充值",
border: false
}),
C: common_vendor.o(handleGotoHistory),
D: common_vendor.p({
V: common_vendor.o(handleGotoHistory),
W: common_vendor.p({
border: false,
icon: "photo",
title: "绘图历史"
}),
E: common_vendor.p({
X: common_vendor.p({
name: "logout"
}),
F: common_vendor.o(handleLoginOut),
G: common_vendor.p({
Y: common_vendor.o(handleLoginOut),
Z: common_vendor.p({
border: false,
icon: "setting",
title: "退出登录"
}),
H: common_vendor.p({
aa: common_vendor.p({
icon: "chat-fill",
title: "微信客服"
}),
I: pageindex.value == 2
ab: pageindex.value == 3
});
};
}
+5
View File
@@ -7,6 +7,11 @@
"up-gap": "../../node-modules/uview-plus/components/u-gap/u-gap",
"up-status-bar": "../../node-modules/uview-plus/components/u-status-bar/u-status-bar",
"fui-footer": "../../components/firstui/fui-footer/fui-footer",
"fui-avatar": "../../components/firstui/fui-avatar/fui-avatar",
"fui-load-ani": "../../components/firstui/fui-load-ani/fui-load-ani",
"fui-icon": "../../components/firstui/fui-icon/fui-icon",
"fui-picker": "../../components/firstui/fui-picker/fui-picker",
"fui-safe-area": "../../components/firstui/fui-safe-area/fui-safe-area",
"up-avatar": "../../node-modules/uview-plus/components/u-avatar/u-avatar",
"up-icon": "../../node-modules/uview-plus/components/u-icon/u-icon",
"up-cell": "../../node-modules/uview-plus/components/u-cell/u-cell",
File diff suppressed because one or more lines are too long
+179
View File
@@ -23,6 +23,26 @@
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.scroll-Y.data-v-83a5a03c {
margin-top: -11%;
height: 1200rpx;
}
.fui-custom__wrap.data-v-83a5a03c {
width: 100%;
height: 520rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #EDEDED;
}
.AITool.data-v-83a5a03c {
margin-right: 24rpx;
height: 72rpx;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
}
.image-data.data-v-83a5a03c {
width: calc(100% - 20rpx);
margin: 10rpx;
@@ -80,4 +100,163 @@ page.data-v-83a5a03c {
width: 537rpx;
display: flex;
display: border-box;
}
.fui-wrap.data-v-83a5a03c {
background-color: transparent;
padding-bottom: 108rpx;
}
.fui-chat__box.data-v-83a5a03c {
margin-top: 2%;
width: 100%;
padding: 48rpx 24rpx 0;
box-sizing: border-box;
white-space: pre-wrap;
word-break: break-word;
}
.fui-chat__item.data-v-83a5a03c {
width: 100%;
display: flex;
padding-right: 96rpx;
margin-bottom: 148rpx;
box-sizing: border-box;
overflow: hidden;
white-space: pre-wrap;
word-break: break-word;
}
.fui-chat__content.data-v-83a5a03c {
margin-left: 24rpx;
background-color: #fff;
padding: 20rpx 24rpx;
box-sizing: border-box;
border-radius: 0 32rpx 32rpx 32rpx;
font-size: 32rpx;
text-align: justify;
display: flex;
align-items: center;
white-space: pre-wrap;
word-break: break-word;
/* overflow: hidden; */
position: relative;
}
.fui-chat__left .fui-chat__content.data-v-83a5a03c::after {
content: "";
position: absolute;
left: -43rpx;
top: 0;
width: 44rpx;
height: 44rpx;
background-color: #fff;
clip-path: polygon(45% 0, 100% 0, 100% 45%);
}
.fui-chat__left .fui-chat__content.data-v-83a5a03c::before {
content: "";
position: absolute;
left: -42rpx;
top: 3rpx;
width: 42rpx;
height: 42rpx;
background-color: #EDEDED;
z-index: 2;
border-radius: 50%;
}
.fui-chat__content text.data-v-83a5a03c {
max-width: 100%;
white-space: pre-wrap;
word-break: break-word;
}
.fui-chat__right.data-v-83a5a03c {
padding-left: 96rpx;
padding-right: 0;
flex-direction: row-reverse;
}
.fui-chat__right .fui-chat__content.data-v-83a5a03c {
margin-left: 0;
margin-right: 24rpx;
border-radius: 32rpx 0 32rpx 32rpx;
background-color: #465CFF;
color: #fff;
}
.fui-chat__right .fui-chat__content.data-v-83a5a03c::after {
content: "";
position: absolute;
right: -43rpx;
top: 0;
width: 44rpx;
height: 44rpx;
background-color: #465CFF;
clip-path: polygon(0 0, 45% 0, 0 45%);
}
.fui-chat__right .fui-chat__content.data-v-83a5a03c::before {
content: "";
position: absolute;
right: -42rpx;
top: 3rpx;
width: 42rpx;
height: 42rpx;
background-color: #EDEDED;
z-index: 2;
border-radius: 50%;
}
.fui-chatbar__wrap.data-v-83a5a03c {
width: 100%;
display: flex;
padding: 6px 24rpx;
flex-direction: row;
align-items: flex-end;
justify-content: space-between;
background: #f8f8f8;
box-sizing: border-box;
}
.fui-chatbar__input-box.data-v-83a5a03c {
width: 100%;
display: flex;
flex-direction: row;
flex: 1;
position: relative;
border-radius: 40rpx;
box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 8rpx;
}
.fui-chatbar__input.data-v-83a5a03c {
width: 100%;
min-height: 32rpx;
box-sizing: content-box;
padding: 20rpx 40rpx;
flex: 1;
border-radius: 40rpx;
font-size: 32rpx;
background: #fff;
}
.fui-chatbar__icon-box.data-v-83a5a03c {
height: 72rpx;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
}
.fui-chatbar__icon-box_left.data-v-83a5a03c {
height: 72rpx;
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
}
.fui-chatbar__icon-box image.data-v-83a5a03c {
width: 68rpx;
height: 68rpx;
flex-shrink: 0;
}
.fui-chatbar__icon-box.data-v-83a5a03c:active {
opacity: 0.5;
}
.fui-chatbar__send-box.data-v-83a5a03c {
padding-left: 24rpx;
}
.fui-chatbar__fixed.data-v-83a5a03c {
/* margin-top: 20%; */
margin-bottom: 0%;
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
}
+2
View File
@@ -62,8 +62,10 @@ const refreshToken = async (refreshToken2, apiUrl = "/auth/refreshTokens", maxRe
timeout,
success: (res) => {
if (res.statusCode >= 400) {
console.log("refreshToken", res);
reject(res);
} else {
console.log("refreshToken", res);
resolve(res.data);
}
},