Initial commit
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID:11 2 7,营业执照号: 9 144 0 60 5 M A 5 5 6H 1 K XH)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view class="fui-avatar__wrap" :class="[width?'':'fui-avatar__size-'+size,radius===-1?'fui-avatar__'+shape:'']"
|
||||
:style="wrapStyles" @tap="handleClick">
|
||||
<image class="fui-avatar__img" :style="styles"
|
||||
:class="[radius===-1?'fui-avatar__'+shape:'',width?'':'fui-avatar__size-'+size]" :src="showImg" :mode="mode"
|
||||
v-if="src" :webp="webp" :lazy-load="lazyLoad" @error="handleError"></image>
|
||||
<text class="fui-avatar__text" :class="[width?'':'fui-avatar__text-'+size]" v-if="!src && text"
|
||||
:style="textStyles">{{text}}</text>
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
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'
|
||||
},
|
||||
//small(64)、middle(96)、large(128)
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-avatar__wrap {
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
z-index: 3;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.fui-avatar__img {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.fui-avatar__text {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
lines: 1;
|
||||
/* #endif */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fui-avatar__size-small {
|
||||
width: 64rpx !important;
|
||||
height: 64rpx !important;
|
||||
|
||||
}
|
||||
|
||||
.fui-avatar__text-small {
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
|
||||
.fui-avatar__size-middle {
|
||||
width: 96rpx !important;
|
||||
height: 96rpx !important;
|
||||
}
|
||||
|
||||
.fui-avatar__text-middle {
|
||||
font-size: 44rpx !important;
|
||||
}
|
||||
|
||||
.fui-avatar__size-large {
|
||||
width: 128rpx !important;
|
||||
height: 128rpx !important;
|
||||
}
|
||||
|
||||
.fui-avatar__text-large {
|
||||
font-size: 56rpx !important;
|
||||
}
|
||||
|
||||
.fui-avatar__circle {
|
||||
/* #ifdef APP-NVUE */
|
||||
border-radius: 500px !important;
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
border-radius: 50% !important;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.fui-avatar__square {
|
||||
border-radius: 8rpx !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID: 112 7,营业执照号: 9 144 06 0 5 MA5 56H 1K X H)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view class="fui-bottom__popup-wrap" :class="{'fui-bottom__popwrap-show':show}"
|
||||
:style="{ zIndex: zIndex,background:maskBackground}" @tap.stop="handleClose" v-if="isShow || !isNvue"
|
||||
ref="fui_bp_mk_ani">
|
||||
<!-- @touchmove.stop.prevent="stop" -->
|
||||
<!-- #ifdef APP-NVUE -->
|
||||
<view class="fui-bottom__popup-border" :style="{height:radius+'rpx',background: background}" v-if="radius">
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view ref="fui_bp_ani" class="fui-bottom__popup"
|
||||
:class="{ 'fui-bottom__popup-show': show,'fui-bp__safe-weex':iphoneX && safeArea}"
|
||||
:style="{borderTopLeftRadius:radius+'rpx',borderTopRightRadius:radius+'rpx' ,background: background}"
|
||||
@tap.stop="stop($event,true)">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
// #endif
|
||||
/*如果底部有自定义导航栏,可适当设置内容padding-bottom值*/
|
||||
export default {
|
||||
name: 'fui-bottom-popup',
|
||||
emits: ['close'],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//背景颜色
|
||||
background: {
|
||||
type: String,
|
||||
default: '#fff'
|
||||
},
|
||||
//圆角
|
||||
radius: {
|
||||
type: [Number, String],
|
||||
default: 24
|
||||
},
|
||||
zIndex: {
|
||||
type: [Number, String],
|
||||
default: 996
|
||||
},
|
||||
//点击遮罩 是否可关闭
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
maskBackground: {
|
||||
type: String,
|
||||
default: 'rgba(0,0,0,.6)'
|
||||
},
|
||||
//是否适配底部安全区
|
||||
safeArea: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let isAndroid = false;
|
||||
let isNvue = false;
|
||||
// #ifdef APP-NVUE
|
||||
isNvue = true;
|
||||
const res = uni.getSystemInfoSync();
|
||||
isAndroid = res.platform.toLocaleLowerCase() == "android"
|
||||
// #endif
|
||||
return {
|
||||
iphoneX: false,
|
||||
isNvue: isNvue,
|
||||
isShow: false,
|
||||
isAndroid: isAndroid
|
||||
}
|
||||
},
|
||||
// #ifdef APP-NVUE
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
created() {
|
||||
// #ifdef APP-NVUE || MP-TOUTIAO
|
||||
this.iphoneX = this.isPhoneX();
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
handleClose(e) {
|
||||
if (!this.maskClosable) return;
|
||||
this.$emit('close', {});
|
||||
},
|
||||
// #ifdef APP-NVUE || MP-TOUTIAO
|
||||
isPhoneX() {
|
||||
if (!this.safeArea) return false;
|
||||
//34px
|
||||
const res = uni.getSystemInfoSync();
|
||||
let iphonex = false;
|
||||
let models = ['iphonex', 'iphonexr', 'iphonexsmax']
|
||||
for (let i = 11; i < 20; i++) {
|
||||
models.push(`iphone${i}`)
|
||||
models.push(`iphone${i}mini`)
|
||||
models.push(`iphone${i}pro`)
|
||||
models.push(`iphone${i}promax`)
|
||||
}
|
||||
const model = res.model.replace(/\s/g, "").toLowerCase()
|
||||
const newModel = model.split('<')[0]
|
||||
if (models.includes(model) || models.includes(newModel) || (res.safeAreaInsets && res.safeAreaInsets
|
||||
.bottom > 0)) {
|
||||
iphonex = true;
|
||||
}
|
||||
return iphonex;
|
||||
},
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
open() {
|
||||
this.isShow = true;
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this._animation(true);
|
||||
}, 50);
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this._animation(false);
|
||||
},
|
||||
_animation(type) {
|
||||
if (!this.$refs['fui_bp_ani'] || !this.$refs['fui_bp_mk_ani']) return;
|
||||
animation.transition(
|
||||
this.$refs['fui_bp_mk_ani'].ref, {
|
||||
styles: {
|
||||
opacity: type ? 1 : 0
|
||||
},
|
||||
duration: 250,
|
||||
timingFunction: 'ease-in-out',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
},
|
||||
() => {
|
||||
if (!type) {
|
||||
this.isShow = false
|
||||
}
|
||||
}
|
||||
);
|
||||
//nvue android 部分手机隐藏时动画有抖动感,调整duration去动画
|
||||
animation.transition(
|
||||
this.$refs['fui_bp_ani'].ref, {
|
||||
styles: {
|
||||
transform: `translateY(${type ? '0' : '100%'})`
|
||||
},
|
||||
duration: !type && this.isAndroid ? 20 : 250,
|
||||
timingFunction: 'ease-in-out',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
},
|
||||
() => {}
|
||||
);
|
||||
},
|
||||
// #endif
|
||||
stop(e, tap) {
|
||||
// #ifdef APP-NVUE
|
||||
tap && e.stopPropagation();
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-bottom__popup-wrap {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 1001;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
/* #ifndef APP-NVUE */
|
||||
transition: all ease-in-out .2s;
|
||||
visibility: hidden;
|
||||
border-bottom-width: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
opacity: 0.001;
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
.fui-bottom__popup-border {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-bottom__popwrap-show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.fui-bottom__popup {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
transform: translate3d(0, 100%, 0);
|
||||
transition: all 0.3s ease-in-out;
|
||||
min-height: 20rpx;
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE || MP-TOUTIAO */
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
/* #ifdef APP-NVUE */
|
||||
transform: translateY(100%);
|
||||
flex-direction: row;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-bottom__popup-show {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef APP-NVUE || MP-TOUTIAO */
|
||||
.fui-bp__safe-weex {
|
||||
padding-bottom: 34px;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
||||
@@ -0,0 +1,325 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID: 1 1 27,营业执照号:91 4 4060 5 M A55 6H 1 K X H)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view @tap="maskClose" :style="{background:maskBackground}" class="fui-dialog__wrap"
|
||||
:class="{'fui-wrap__show':show}" @touchmove.stop.prevent="stop" v-if="visible || !isNvue" ref="fui_dialog_ani">
|
||||
<view class="fui-dialog__inner" :style="{background:background,borderRadius:radius+'rpx'}" @tap.stop="stop">
|
||||
<text class="fui-dialog__title" :style="{color:color}" v-if="title">{{title}}</text>
|
||||
<view class="fui-dialog__body" :class="{'fui-dialog__mtop':!title}">
|
||||
<text class="fui-dialog__descr" :style="{color:contentColor}" v-if="content">{{content}}</text>
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view class="fui-dialog__footer">
|
||||
<text v-for="(item,index) in buttons" :key="index" :style="{color:item.color || '#333333'}"
|
||||
class="fui-dialog__btn" :class="{'fui-dialog__btn-first':index===0}"
|
||||
@tap="handleClick(index)">{{item.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
// #endif
|
||||
export default {
|
||||
name: 'fui-dialog',
|
||||
emits: ['click', 'close'],
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '温馨提示'
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333'
|
||||
},
|
||||
content: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
contentColor: {
|
||||
type: String,
|
||||
default: '#7F7F7F'
|
||||
},
|
||||
buttons: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [{
|
||||
text: '取消'
|
||||
}, {
|
||||
text: '确定',
|
||||
color: '#465CFF'
|
||||
}]
|
||||
}
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
default: '#fff'
|
||||
},
|
||||
radius: {
|
||||
type: [Number, String],
|
||||
default: 24
|
||||
},
|
||||
maskBackground: {
|
||||
type: String,
|
||||
default: 'rgba(0,0,0,.6)'
|
||||
},
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let isNvue = false;
|
||||
// #ifdef APP-NVUE
|
||||
isNvue = true;
|
||||
// #endif
|
||||
return {
|
||||
visible: false,
|
||||
isNvue: isNvue
|
||||
}
|
||||
},
|
||||
// #ifdef APP-NVUE
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
methods: {
|
||||
handleClick(index) {
|
||||
this.$emit('click', {
|
||||
index,
|
||||
...this.buttons[index]
|
||||
});
|
||||
},
|
||||
maskClose() {
|
||||
if (!this.maskClosable) return;
|
||||
this.$emit('close', {});
|
||||
},
|
||||
// #ifdef APP-NVUE
|
||||
open() {
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this._animation(true);
|
||||
}, 50);
|
||||
});
|
||||
},
|
||||
close(type) {
|
||||
this._animation(false);
|
||||
},
|
||||
_animation(type) {
|
||||
let styles = {
|
||||
opacity: type ? 1 : 0
|
||||
};
|
||||
if (!this.$refs['fui_dialog_ani']) return;
|
||||
animation.transition(
|
||||
this.$refs['fui_dialog_ani'].ref, {
|
||||
styles,
|
||||
duration: 200, //ms
|
||||
timingFunction: 'ease-in',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
},
|
||||
() => {
|
||||
if (!type) {
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
// #endif
|
||||
stop() {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-dialog__wrap {
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
transition-property: all;
|
||||
transition-timing-function: ease-in;
|
||||
transition-duration: 0.2s;
|
||||
display: flex;
|
||||
transform: scale3d(1, 1, 0);
|
||||
visibility: hidden;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fui-dialog__inner {
|
||||
width: 680rpx;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
max-height: 90%;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.fui-dialog__title {
|
||||
padding: 64rpx 48rpx 0;
|
||||
font-weight: 700;
|
||||
font-size: 34rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fui-dialog__body {
|
||||
padding: 32rpx 48rpx;
|
||||
margin-bottom: 32rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
word-break: break-all;
|
||||
-webkit-hyphens: auto;
|
||||
hyphens: auto;
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
.fui-dialog__descr {
|
||||
font-size: 30rpx;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fui-dialog__mtop {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.fui-dialog__footer {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
position: relative;
|
||||
line-height: 112rpx;
|
||||
height: 112rpx;
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
border-top-width: 0.5px;
|
||||
border-top-style: solid;
|
||||
border-top-color: #EEEEEE;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-dialog__footer:after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
border-top: 1px solid var(--fui-color-border, #EEEEEE);
|
||||
transform-origin: 0 0;
|
||||
transform: scaleY(.5)
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.fui-dialog__btn {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
height: 112rpx;
|
||||
line-height: 112rpx;
|
||||
font-weight: 700;
|
||||
position: relative;
|
||||
font-size: 34rpx;
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
border-left-width: 0.5px;
|
||||
border-left-style: solid;
|
||||
border-left-color: #EEEEEE;
|
||||
/* #endif */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fui-dialog__btn:active {
|
||||
/* #ifndef APP-NVUE */
|
||||
background-color: var(--fui-bg-color-hover, rgba(0, 0, 0, 0.2));
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
.fui-dialog__btn-first {
|
||||
border-left-width: 0;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-dialog__btn::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 1px;
|
||||
bottom: 0;
|
||||
border-left: 1px solid var(--fui-color-border, #EEEEEE);
|
||||
transform-origin: 0 0;
|
||||
transform: scaleX(.5)
|
||||
}
|
||||
|
||||
.fui-dialog__btn-first::after {
|
||||
width: 0;
|
||||
border-left: 0 !important;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-wrap__show {
|
||||
opacity: 1;
|
||||
transform: scale3d(1, 1, 1);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
page{
|
||||
--fui-color-border:#555;
|
||||
}
|
||||
.fui-dialog__inner{
|
||||
background-color: #333 !important;
|
||||
}
|
||||
.fui-dialog__title{
|
||||
color: #fff !important;
|
||||
}
|
||||
.fui-dialog__descr{
|
||||
color: rgba(255, 255, 255, .8) !important;
|
||||
}
|
||||
.fui-dialog__btn:first-child{
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
/* #endif */
|
||||
</style>
|
||||
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID: 1127,营业执照号: 9 14 40 6 0 5 MA556 H1K XH)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view :class="{'fui-loading__mask':(isMask || isNvue) && isFixed}"
|
||||
:style="{backgroundColor:isFixed?maskBgColor:'transparent'}">
|
||||
<view class="fui-loading fui-loading__wrap" :class="{'fui-loading__fixed':isFixed && !isNvue}"
|
||||
:style="{ backgroundColor: backgroundColor,position:isFixed && !isNvue?'fixed':'static' }"
|
||||
v-if="type === 'col'">
|
||||
<image ref="fui_loading" class="fui-loading__ani" :src="srcCol"></image>
|
||||
<text class="fui-loading__text"
|
||||
:style="{color:colColor,fontSize:size+'rpx','line-height':size+'rpx'}">{{ text }}</text>
|
||||
</view>
|
||||
<view v-else class="fui-loading fui-loading__row" :class="{'fui-loading__fixed':isFixed && !isNvue}"
|
||||
:style="{position:isFixed && !isNvue?'fixed':'static'}">
|
||||
<!-- <loading-indicator :animating="true"></loading-indicator> -->
|
||||
<image ref="fui_loading" class="fui-loading-row__ani" :src="srcRow"></image>
|
||||
<text class="fui-loading__text"
|
||||
:style="{color:rowColor,fontSize:size+'rpx','line-height':size+'rpx'}">{{ text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
// #endif
|
||||
export default {
|
||||
name: "fui-loading",
|
||||
props: {
|
||||
//col、row
|
||||
type: {
|
||||
type: String,
|
||||
default: 'col'
|
||||
},
|
||||
//提示文字
|
||||
text: {
|
||||
type: String,
|
||||
default: '加载中'
|
||||
},
|
||||
//文本颜色,type=col时生效
|
||||
colColor: {
|
||||
type: String,
|
||||
default: '#FFFFFF'
|
||||
},
|
||||
//文本颜色,type=row时生效
|
||||
rowColor: {
|
||||
type: String,
|
||||
default: '#7F7F7F'
|
||||
},
|
||||
//字体大小,单位rpx
|
||||
size: {
|
||||
type: [Number, String],
|
||||
default: 26
|
||||
},
|
||||
//loading背景色,type=col时生效
|
||||
backgroundColor: {
|
||||
type: String,
|
||||
default: 'rgba(0, 0, 0, 0.6)'
|
||||
},
|
||||
//loading icon图片地址,type=col时生效
|
||||
srcCol: {
|
||||
type: String,
|
||||
default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAARVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////9SnXPCAAAAFnRSTlMA8ECgECCAYDDQ4MCwUL9wkN9vP49fRXb34AAAA1dJREFUaN7tmtmSozAMReXdxuyk+f9PnaW6o06CAdtSumqG8xqSi6QrGwfBxcXFD2OW5cP+pVsWDe9AL7YP6xO9mj1w0t3CmkK0H0yhd0qsBzBoazutZxDKACFSrefpJZmFUfad0vpVtonWOvkHZ62Kzas0QcLnJ0dFuxGOHNqny8QMVfjw6By5c+n4GHnwVOGq7tiDD3G74uq234Idzbmue7hVXZtmYfEncqRDicekKPSo+Z6o/EI7bB6Zfc+hXBl1R13V+0Jm6uL3inCiKGZX6g7ENwXKrrwfEB3uyubszYovXahBx3ve9LkvoG4lcc36pf7zagu16JCzeo4E8aLy+TJL1CXAfJWtP7zHKcsPp+NYh6NEY2posOeSbT4v64CMiLU7dvQIVGAsqzyuSKOBEHvCXwHvjZAGQ94PuAVaJIa8X2EDxMSDkGXh0lG9KCkMmCnkbdNq6oARt7t8Oa6A0dhhx1oREPpe9ukVxgEHBnOdyLQAHkI61wqtxcCQ9rXATDPgk9uef7kjFl+PiRJH4EKlijwmniyp15DEqtYBFz7VyQKXLR5ST9iJLibvZLuZiQh8qO1+kizPHq+hNXpT2AIjrlnX+GIii8J8eJPatyQwcwn/j8ISu5uZwj7+d4QBl8w3I3CT4EOnjjcCeJHJXUsDJ35LeHhDPw0yaesROIkmaesAjJgVtmjZizygd99b5CnunCQVsNGlFsbAnOs+tfkNTMdFzOjuqb0HJlR6J4h4uKHH7CSz47SX2tsIGr6Dm9mNyPGFrHZrqBuuKvuD1dhxGbs/6tOGuJcxoObMM5/QQIoWx8G0HA99IwZ89EZzAEI6PKMc+kt4ykRjix4ne6IrczhjGmzmoAn/dOlyXpgrumPoeLrr6JRd1hOkJVN2mW9mFZGywwbJU+51pa/QWJnKk6/o3xbX/Xxl0ZUPvxXp4nREqyuG31zZnFD5nJHp8ZsVc0I9NkTOFFsw9UN7t5x8W1E9oQSdyJ2p1fP04srKSUUlz0zLiqQlKwbwppvfVZ0DjvkR/bWO2urDbIp2t2n9knWk/+ojorfzsty9v8y2n/DTZgBKZLueInZAjR7CkWoYDLBgXCvSs/uoyoJ3Y3zWjOPg4T14KQf7m0FKqeHi4uJH+QUYYoTOYC/s2wAAAABJRU5ErkJggg=='
|
||||
},
|
||||
//loading icon图片地址,type=row时生效
|
||||
srcRow: {
|
||||
type: String,
|
||||
default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAMAAAAPdrEwAAAAM1BMVEUAAACPj4+IiIiIiIiIiIiIiIiKioqHh4eHh4eHh4eHh4eIiIiIiIiJiYmIiIiJiYmIiIi8awvKAAAAEHRSTlMAEEDw4NAwwKAgYICQULBwL0wVnQAAAmpJREFUWMPtmOmO4yAQhLlvMO//tDuyjfAaCEcj7UqTT5o/iafSVLcLY/TldyHID8fPH94oir2TLD6QyugdxVoeazAnYPUaFtsws+yNVjR+htolcWz/luHyhL7F55XNQ0Narx+L8TY8bSGTXsiYUB5V8A+zHJ4rud+p3GI+PiwqCXv0Ec+T42awf3L8+iMtzwwp36UEPHR1SIYPKueS+xxJe1CZiYkooNmTvjLHUzHDR7TVgnI2UXR9k/OhQHslieKCcb87reRnB5fCzMeTVp5cUbeY8O6arEYknYs60CJXK21zOvot7DSK4lrR51eA7dQ1y1bFF9MT2Chb358DsLHeLJeKhpZdDgkDFp1jQtRGXiEYOtZU1PLdUt7OFT84gnJUHNE5XOCO2PLnCALDzl21HD2Yam4ZRU9kER8Qs/V7IQ7BIWVqp10TTCFN0gdgwvumJmkcwWDFgigsQtv4Sv8baZ2lt5Pn+n+Wfm+CMsUsHFIJQ7VH+l2hSXsaHFUbEb1l2GRt5zFb/FC1nSfskGam+lSP4cqmks10jyOc1fditiGMXD1G4DekTH5sf14gkTeD1QOdbrRLXodGAKb1hC7gh5nmvzvgI0NoHyswA1niP7WKQE4dmtYHDH4MwzxS3T2MmCWje5OL2aK26j9EC7qkrVIk97XtrM+RYzSoHSZmUCTlLoLNvTs+aFLug+XEu2Mt59boRl9+4vk7gbD79fXnii2dsS6Xc4lb3fx5lX1bfKfPD1HJInetS64lJQnxhkrryV2+INbxeCHXN1PtaGxClUYgvGJ1XY82IA7Fn7IyFO7DIDcYfflN/AFNdjdeDj7M+wAAAABJRU5ErkJggg=='
|
||||
},
|
||||
isFixed: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
//是否需要遮罩,非nvue有效,nvue默认带遮罩,isFixed为true时生效
|
||||
isMask: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//v1.9.9+
|
||||
maskBgColor: {
|
||||
type: String,
|
||||
default: 'transparent'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let isNvue = false;
|
||||
// #ifdef APP-NVUE
|
||||
isNvue = true;
|
||||
// #endif
|
||||
return {
|
||||
isNvue: isNvue,
|
||||
// #ifdef APP-NVUE
|
||||
deg: 0,
|
||||
stop: false
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
// #ifdef APP-NVUE
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.deg += 360;
|
||||
this._animation()
|
||||
}, 50)
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
//nvue暂不支持vue3,所以不需要做兼容,此处以防后续兼容
|
||||
// #ifdef APP-NVUE
|
||||
// #ifndef VUE3
|
||||
beforeDestroy() {
|
||||
this.deg = 0;
|
||||
this.stop = true;
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
beforeUnmount() {
|
||||
this.deg = 0;
|
||||
this.stop = true;
|
||||
},
|
||||
// #endif
|
||||
// #endif
|
||||
methods: {
|
||||
// #ifdef APP-NVUE
|
||||
_animation() {
|
||||
if (!this.$refs['fui_loading'] || this.stop) return;
|
||||
animation.transition(
|
||||
this.$refs['fui_loading'].ref, {
|
||||
styles: {
|
||||
transform: `rotate(${this.deg}deg)`
|
||||
},
|
||||
duration: 800, //ms
|
||||
timingFunction: 'linear',
|
||||
iterationCount: 'infinite',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
}, () => {
|
||||
this.deg += 360;
|
||||
this._animation()
|
||||
}
|
||||
);
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-loading {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.fui-loading__fixed {
|
||||
/* #ifndef APP-NVUE */
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
/* #endif */
|
||||
z-index: 1008;
|
||||
}
|
||||
|
||||
.fui-loading__wrap {
|
||||
width: 208rpx;
|
||||
height: 208rpx;
|
||||
flex-direction: column;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.fui-loading__ani {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
margin: 0 6px;
|
||||
/* #ifndef APP-NVUE */
|
||||
animation: rotate 0.85s linear infinite;
|
||||
/* #endif */
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.fui-loading__row {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.fui-loading-row__ani {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
/* #ifdef APP-NVUE */
|
||||
border-radius: 36rpx;
|
||||
/* #endif */
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
animation: rotate 0.85s linear infinite;
|
||||
/* #endif */
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.fui-loading__text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
@-webkit-keyframes rotate {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.fui-loading__mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1002;
|
||||
|
||||
/* #ifdef APP-NVUE */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,411 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID: 1 1 27,营业执照号: 9 1 44 06 0 5MA55 6 H1K X H)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view class="fui-modal__wrap" :style="{background:maskBackground,zIndex:zIndex}"
|
||||
:class="{'fui-modal__fadein':isShow}" @tap="closeModal" @touchmove.stop.prevent="stop" v-if="isShow || !isNvue"
|
||||
ref="fui_modal_ani">
|
||||
<view class="fui-modal__inner"
|
||||
:style="{width:width+'rpx',background:background,borderRadius:boxRadius+'rpx',paddingTop:padding+'rpx',paddingBottom:padding+'rpx'}"
|
||||
@tap.stop="stop">
|
||||
<text class="fui-modal__title" :style="{fontSize:size+'rpx',color:color}"
|
||||
v-if="title && title!==true">{{title}}</text>
|
||||
<text class="fui-modal__descr" :style="{fontSize:descrSize+'rpx',color:descrColor}"
|
||||
:class="{'fui-modal__descr-pt':!title}" v-if="descr && descr!==true">{{descr}}</text>
|
||||
<slot></slot>
|
||||
<view class="fui-modal__btn-wrap" :style="getWidth" :class="{'fui-modal__btn-row':direction==='row'}"
|
||||
v-if="vals.length>0">
|
||||
<view class="fui-modal__button"
|
||||
:class="{'fui-modal__button-col':direction==='column' && index!==vals.length-1,'fui-modal__button-bg':!entity.plain && !entity.background,'fui-modal__button-border':entity.plain,'fui-modal__button-bc':entity.plain && !entity.background}"
|
||||
:style="{borderRadius:radius+'rpx',background:entity.plain?'transparent':(entity.background || '#465CFF'),borderColor:entity.plain?(entity.background || '#465CFF'):'transparent'}"
|
||||
v-for="(entity,index) in vals" :key="index" @tap.stop="handleClick($event,index)">
|
||||
<text class="fui-modal__button-inner"
|
||||
:class="{'fui-modal__button-color': !entity.color && entity.plain}"
|
||||
:style="{color:entity.color || (entity.plain?'#465CFF':'#fff')}">{{entity.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP-NVUE
|
||||
const animation = uni.requireNativePlugin('animation');
|
||||
// #endif
|
||||
|
||||
export default {
|
||||
name: 'fui-modal',
|
||||
emits: ['click', 'cancel'],
|
||||
props: {
|
||||
//是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
size: {
|
||||
type: [Number, String],
|
||||
default: 34
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#333'
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
descrSize: {
|
||||
type: [Number, String],
|
||||
default: 28
|
||||
},
|
||||
descrColor: {
|
||||
type: String,
|
||||
default: '#7F7F7F'
|
||||
},
|
||||
buttons: {
|
||||
type: Array,
|
||||
default () {
|
||||
return [{
|
||||
text: '取消',
|
||||
plain: true
|
||||
}, {
|
||||
text: '确定'
|
||||
}]
|
||||
}
|
||||
},
|
||||
//row、column
|
||||
direction: {
|
||||
type: String,
|
||||
default: 'row'
|
||||
},
|
||||
radius: {
|
||||
type: [Number, String],
|
||||
default: 16
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: 640
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
default: '#FFFFFF'
|
||||
},
|
||||
boxRadius: {
|
||||
type: [Number, String],
|
||||
default: 16
|
||||
},
|
||||
//外层上下padding值【1.8.0+】
|
||||
padding: {
|
||||
type: [Number, String],
|
||||
default: 32
|
||||
},
|
||||
maskBackground: {
|
||||
type: String,
|
||||
default: 'rgba(0,0,0,.6)'
|
||||
},
|
||||
maskClosable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
default: 1001
|
||||
}
|
||||
},
|
||||
data() {
|
||||
let isNvue = false;
|
||||
// #ifdef APP-NVUE
|
||||
isNvue = true;
|
||||
// #endif
|
||||
return {
|
||||
isShow: false,
|
||||
isNvue: isNvue,
|
||||
vals: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getWidth() {
|
||||
return "width:" + (Number(this.width) - 60) + 'rpx'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
buttons(newVal) {
|
||||
this.initData(newVal)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData(this.buttons)
|
||||
},
|
||||
methods: {
|
||||
initData(vals) {
|
||||
if (vals && vals.length > 0) {
|
||||
if (typeof vals[0] !== 'object') {
|
||||
vals = vals.map(item => {
|
||||
return {
|
||||
text: item
|
||||
}
|
||||
})
|
||||
}
|
||||
this.vals = vals;
|
||||
}
|
||||
},
|
||||
stop() {},
|
||||
closeModal() {
|
||||
if (!this.maskClosable) return;
|
||||
this.$emit('cancel', {});
|
||||
},
|
||||
handleClick(e, index) {
|
||||
// #ifdef APP-NVUE
|
||||
e.stopPropagation();
|
||||
// #endif
|
||||
if (!this.isShow) return;
|
||||
this.$emit('click', {
|
||||
index: Number(index),
|
||||
...this.vals[index]
|
||||
});
|
||||
},
|
||||
open() {
|
||||
this.isShow = true;
|
||||
// #ifdef APP-NVUE
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this._animation(true);
|
||||
}, 50);
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
close(type) {
|
||||
// #ifndef APP-NVUE
|
||||
this.isShow = false;
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
this._animation(false);
|
||||
// #endif
|
||||
},
|
||||
// #ifdef APP-NVUE
|
||||
_animation(type) {
|
||||
let styles = {
|
||||
transform: `scale(${type ? 1 : 1.2}) `,
|
||||
opacity: type ? 1 : 0
|
||||
};
|
||||
|
||||
if (!this.$refs['fui_modal_ani']) return;
|
||||
animation.transition(
|
||||
this.$refs['fui_modal_ani'].ref, {
|
||||
styles,
|
||||
duration: 300, //ms
|
||||
timingFunction: 'ease',
|
||||
needLayout: false,
|
||||
delay: 0 //ms
|
||||
},
|
||||
() => {
|
||||
if (!type) {
|
||||
this.isShow = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-modal__wrap {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
transition-timing-function: ease;
|
||||
transition-duration: 0.3s;
|
||||
/* #ifdef APP-NVUE */
|
||||
transition-property: transform, opacity;
|
||||
transform: scale(1.2);
|
||||
/* #endif */
|
||||
opacity: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
transform: scale3d(1.2, 1.2, 1);
|
||||
transition-property: all;
|
||||
visibility: hidden;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-modal__fadein {
|
||||
opacity: 1;
|
||||
transform: scale3d(1, 1, 1);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.fui-modal__inner {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fui-modal__title {
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
padding-top: 12rpx;
|
||||
padding-bottom: 24rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
word-break: break-all;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.fui-modal__descr {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
padding-bottom: 24rpx;
|
||||
font-weight: normal;
|
||||
/* #ifndef APP-NVUE */
|
||||
word-break: break-all;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.fui-modal__descr-pt {
|
||||
padding-top: 36rpx;
|
||||
}
|
||||
|
||||
.fui-modal__btn-wrap {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
|
||||
.fui-modal__btn-row {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.fui-modal__button {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
height: 68rpx;
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
.fui-modal__button-col {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.fui-modal__button-border {
|
||||
/* #ifdef APP-NVUE */
|
||||
border-width: 0.5px;
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
border-width: 1rpx;
|
||||
transform: translateZ(0);
|
||||
/* #endif */
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
.fui-modal__button-bg {
|
||||
background: var(--fui-color-primary, #465CFF) !important;
|
||||
}
|
||||
|
||||
.fui-modal__button-bc {
|
||||
border-color: var(--fui-color-primary, #465CFF) !important;
|
||||
}
|
||||
|
||||
.fui-modal__button-color {
|
||||
color: var(--fui-color-primary, #465CFF) !important;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.fui-modal__button-inner {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
lines: 1;
|
||||
line-height: 64rpx;
|
||||
/* #endif */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 26rpx;
|
||||
font-weight: normal;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.fui-modal__button-inner:active {
|
||||
/* #ifdef APP-NVUE */
|
||||
background-color: rgba(0, 0, 0, .2);
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
background-color: var(--fui-bg-color-hover, rgba(0, 0, 0, 0.2));
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.fui-modal__inner {
|
||||
background-color: #333 !important;
|
||||
}
|
||||
|
||||
.fui-modal__title {
|
||||
color: #fff !important
|
||||
}
|
||||
|
||||
.fui-modal__descr {
|
||||
color: rgba(255, 255, 255, .8) !important
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<!--本文件由FirstUI授权予佛山市航电梦联网络科技有限公司(会员ID:1 1 27,营业执照号:914 40 60 5 MA 55 6 H 1KXH)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
|
||||
<view class="fui-safe__area-wrap" :class="{'fui-safe__area-weex':iphonex}" :style="{background:background}"></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "fui-safe-area",
|
||||
props: {
|
||||
//背景颜色
|
||||
background: {
|
||||
type: String,
|
||||
default: '#FFFFFF'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// #ifdef APP-NVUE || MP-TOUTIAO
|
||||
this.iphonex = this.isPhoneX();
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
iphonex: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// #ifdef APP-NVUE || MP-TOUTIAO
|
||||
isPhoneX() {
|
||||
//34px
|
||||
const res = uni.getSystemInfoSync();
|
||||
let iphonex = false;
|
||||
let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax',
|
||||
'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini',
|
||||
'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini',
|
||||
'iphone14pro', 'iphone14promax'
|
||||
]
|
||||
const model = res.model.replace(/\s/g, "").toLowerCase()
|
||||
const newModel = model.split('<')[0]
|
||||
if (models.includes(model) || models.includes(newModel) || (res.safeAreaInsets && res.safeAreaInsets
|
||||
.bottom > 0)) {
|
||||
iphonex = true;
|
||||
}
|
||||
return iphonex;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fui-safe__area-wrap {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
|
||||
/* #ifndef APP-NVUE || MP-TOUTIAO */
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
/* #ifdef APP-NVUE || MP-TOUTIAO */
|
||||
.fui-safe__area-weex {
|
||||
padding-bottom: 34px;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
export const getBaseURL =()=>import.meta.env.VITE_API_URL
|
||||
|
||||
export const getOneAPiURL =()=>import.meta.env.VITE_CHAT_URL
|
||||
|
||||
export const ChatAPiUrl =()=> `${getOneAPiURL()}/v1/chat/completions`
|
||||
|
||||
|
||||
export const getUserToken = () => {
|
||||
// 获取用户信息
|
||||
const refreshToken = uni.getStorageSync('refreshToken')
|
||||
|
||||
console.log("refreshToken获取成功", refreshToken)
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestTask = uni.request({
|
||||
url: `${getBaseURL()}/auth/refreshTokens`, // 请求地址
|
||||
method: "POST",
|
||||
data: {
|
||||
"refreshToken":refreshToken,
|
||||
},
|
||||
enableChunked: false, // 开启流传输
|
||||
success: (res) => {
|
||||
|
||||
resolve(res);
|
||||
// console.log('refreshToken请求成功', res.data);
|
||||
|
||||
// uni.parseStreamData(res.data)
|
||||
}, // 请求成功回调
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
console.log('请求失败', err);
|
||||
} // 请求失败回调
|
||||
});
|
||||
|
||||
console.log('requestTask', requestTask)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const getModelList = (data) => {
|
||||
// 模型列表
|
||||
|
||||
const token = data
|
||||
// console.log("aichat获取token成功", token)
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestTask = uni.request({
|
||||
url: `${getBaseURL()}/oneapi/channel`, // 请求地址
|
||||
method: "GET",
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Host': 'scschool.cc',
|
||||
},
|
||||
enableChunked: false, // 开启流传输
|
||||
success: (res) => {
|
||||
|
||||
resolve(res);
|
||||
// console.log('getModelList请求成功', res.data);
|
||||
|
||||
// uni.parseStreamData(res.data)
|
||||
}, // 请求成功回调
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
console.log('请求失败', err);
|
||||
} // 请求失败回调
|
||||
});
|
||||
|
||||
console.log('requestTask', requestTask)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export const getUserKey = (data,Rtoken_value) => {
|
||||
// 获取用户Key值
|
||||
const usedata = {
|
||||
"user_id": data.id,
|
||||
"status": data.status,
|
||||
"remain_quota": data.quota,
|
||||
"unlimited_quota": false
|
||||
}
|
||||
const token = Rtoken_value
|
||||
// console.log("获取用户Key值", usedata,token)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestTask = uni.request({
|
||||
url: `${getBaseURL()}/oneapi/token`, // 请求地址
|
||||
method: "POST",
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
},
|
||||
data: usedata,
|
||||
enableChunked: false, // 开启流传输
|
||||
success: (res) => {
|
||||
|
||||
resolve(res);
|
||||
// console.log('getModelList请求成功', res.data);
|
||||
|
||||
// uni.parseStreamData(res.data)
|
||||
}, // 请求成功回调
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
console.log('请求失败', err);
|
||||
} // 请求失败回调
|
||||
});
|
||||
|
||||
console.log('requestTask', requestTask)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export const getUserInfo = (data) => {
|
||||
// 获取用户Key值
|
||||
const restoken = data.refresh_token
|
||||
// console.log("获取用户restoken值", restoken)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestTask = uni.request({
|
||||
url: `${getBaseURL()}/oneapi/user`, // 请求地址
|
||||
method: "POST",
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + restoken,
|
||||
|
||||
},
|
||||
data: data,
|
||||
enableChunked: false, // 开启流传输
|
||||
success: (res) => {
|
||||
resolve(res);
|
||||
// console.log('getUserInfo请求成功', res.data);
|
||||
|
||||
// uni.parseStreamData(res.data)
|
||||
}, // 请求成功回调
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
console.log('请求失败', err);
|
||||
} // 请求失败回调
|
||||
});
|
||||
|
||||
console.log('requestTask', requestTask)
|
||||
});
|
||||
}
|
||||
@@ -30,9 +30,14 @@ export const updateUserInfo=(data:Partial<User>)=>request<User>('/users/update',
|
||||
/** 重新获取用户信息 */
|
||||
export const refreshUserInfo=(user=getLoginInfo())=>request<User>(`/users/${user._id}`).then(res=>{useAppStore().setUser(res)})
|
||||
|
||||
|
||||
/** 是否为登录状态 */
|
||||
export const isLogin =computed(()=>{
|
||||
|
||||
const {user}=storeToRefs(useAppStore())
|
||||
console.log("storeToRefs(useAppStore())",user.value)
|
||||
uni.setStorageSync('refreshToken', user.value.refresh_token)
|
||||
|
||||
return !!user.value.refresh_token
|
||||
})
|
||||
/** 获取用户的会员信息,获取用户最高的权限等级会员信息*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
|
||||
|
||||
<view class="fuiNavBar">
|
||||
<fui-nav-bar custom background>
|
||||
<fui-nav-bar custom background>
|
||||
<view class="fui-search__box ">
|
||||
<fui-tabs class="tabs_class" direction='column' color='#ACB0D0' :isSlider='false'
|
||||
selectedColor='#17135F' :tabs="tabbarData" scale='1.5' @change="changeHomePage" :center="false"
|
||||
@@ -13,9 +13,8 @@
|
||||
</view>
|
||||
|
||||
<view v-show="pageindex==0">
|
||||
|
||||
<fui-background-image
|
||||
:src="backGroundImage">
|
||||
|
||||
<fui-background-image :src="backGroundImage">
|
||||
</fui-background-image>
|
||||
<AppSwiper />
|
||||
|
||||
@@ -25,11 +24,13 @@
|
||||
<!-- // 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
|
||||
// 背景图片和用到的素材我都给大家放在/src/static里了 -->
|
||||
<image @click="img2pay" style="width: 320rpx; height: 106rpx; background-color: transparent; display:inline-block; box-sizing:border-box; position:relative; left:40rpx;"
|
||||
<image @click="img2pay"
|
||||
style="width: 320rpx; height: 106rpx; background-color: transparent; display:inline-block; box-sizing:border-box; position:relative; left:40rpx;"
|
||||
mode="scaleToFill" src="https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/画板 2 (1).png"></image>
|
||||
<image @click="handleGotoHistory" style="width: 320rpx; height: 106rpx; background-color: transparent; display:inline-block; box-sizing:border-box; position:relative; left:70rpx;"
|
||||
mode="scaleToFill" src="https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/画板 3.png"></image>
|
||||
|
||||
<image @click="handleGotoHistory"
|
||||
style="width: 320rpx; height: 106rpx; background-color: transparent; display:inline-block; box-sizing:border-box; position:relative; left:70rpx;"
|
||||
mode="scaleToFill" src="https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/画板 3.png"></image>
|
||||
|
||||
<up-gap height="10"></up-gap>
|
||||
<AppTags />
|
||||
|
||||
@@ -37,8 +38,7 @@
|
||||
|
||||
</view>
|
||||
<view v-show="pageindex==1">
|
||||
<fui-background-image
|
||||
:src="backGroundImage">
|
||||
<fui-background-image :src="backGroundImage">
|
||||
</fui-background-image>
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
<BaseLayout>
|
||||
<view>
|
||||
<up-status-bar />
|
||||
|
||||
|
||||
<template v-for="graphicData in graphicDatas">
|
||||
|
||||
|
||||
<view>
|
||||
<MyGraphicCard :avatar="graphicData.avatar" :title="graphicData.title"
|
||||
:username="graphicData.username" :description="graphicData.description"
|
||||
@@ -68,8 +68,89 @@
|
||||
|
||||
</view>
|
||||
<view v-show="pageindex==2">
|
||||
<fui-background-image
|
||||
:src="backGroundImage">
|
||||
<fui-background-image :src="backGroundImage">
|
||||
</fui-background-image>
|
||||
|
||||
|
||||
<view class="fui-wrap">
|
||||
|
||||
<scroll-view scroll-y="true" class="scroll-Y" scroll-with-animation :scroll-into-view="items">
|
||||
<view class="fui-chat__box" ref="chatBox">
|
||||
<view v-for="(item,index) in msgList" :key="index" >
|
||||
<view :id="`items-${index}`" class="fui-chat__item" :class="[item.role=='user'?'fui-chat__right':'fui-chat__left']"
|
||||
@tap="getCopyMsg(1,item.msg,$event)" @longpress="getCopyMsg(2,item.content,$event)">
|
||||
<fui-avatar background="#fff"
|
||||
:src="item.role=='system'?'https://wangbo0808.oss-cn-shanghai.aliyuncs.com/assets/gpt4.png':user.avatar_url">
|
||||
</fui-avatar>
|
||||
<view class="fui-chat__content">
|
||||
<text v-if="item.content.length >1 " @click="copyText(item.content)"
|
||||
decode>{{item.content}}</text>
|
||||
<view v-if=" item.content.length <1 ">
|
||||
<fui-load-ani type='3' color=" #7f7d79"></fui-load-ani>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="fui-chatbar__fixed">
|
||||
<view style="margin-left: 5%;"> 当前模型:{{ chooseModel || modelList[0] }}</view>
|
||||
<view class="fui-chatbar__wrap">
|
||||
<view class="AITool">
|
||||
<view>
|
||||
<!-- 切换模型 -->
|
||||
<fui-icon name="message" color="#3b3ee9" @click="popupMth"></fui-icon>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="fui-chatbar__input-box">
|
||||
<!-- 输入框 -->
|
||||
<textarea :enableNative="false" auto-height :show-count="false" fixed disable-default-padding
|
||||
confirm-type="send" class="fui-chatbar__input" :maxlength="-1" v-model="content"
|
||||
@confirm="msgSend">
|
||||
</textarea>
|
||||
</view>
|
||||
<view class="fui-chatbar__icon-box fui-chatbar__send-box">
|
||||
|
||||
<view v-if="content.length == 0">
|
||||
<!-- 选择图片 -->
|
||||
<fui-icon name="clear" color="#3b3ee9" ></fui-icon>
|
||||
</view>
|
||||
<!-- <view v-if="msgStatu == true ">
|
||||
|
||||
<fui-icon name="play" color="#e9344f" ></fui-icon>
|
||||
</view> -->
|
||||
<view v-else>
|
||||
<!-- 发送按钮 -->
|
||||
<image src="https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/send.png" @tap="msgSend">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<fui-picker :options="modelList" :show="popup" @change="change" @cancel="cancel"></fui-picker>
|
||||
<!-- <fui-bottom-popup :show="popup" @close="closePopup">
|
||||
<view class="fui-custom__wrap">
|
||||
上传图片
|
||||
</view>
|
||||
</fui-bottom-popup> -->
|
||||
<fui-safe-area background="#f8f8f8" v-if="!focus"></fui-safe-area>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- #ifdef VUE2 -->
|
||||
<fui-safe-area background="transparent"></fui-safe-area>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
<view v-show="pageindex==3">
|
||||
<fui-background-image :src="backGroundImage">
|
||||
</fui-background-image><template>
|
||||
<BaseLayout>
|
||||
<view style="margin-top: -20%;">
|
||||
@@ -108,7 +189,7 @@
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-20">
|
||||
<up-cell-group class="trans_back" >
|
||||
<up-cell-group class="trans_back">
|
||||
<up-cell icon="rmb-circle" title="算力充值" @click="showPay=true" :border='false'> </up-cell>
|
||||
</up-cell-group>
|
||||
</view>
|
||||
@@ -122,20 +203,21 @@
|
||||
<tn-icon name="logout" />
|
||||
</template>
|
||||
</up-cell>
|
||||
<button style="background-color: transparent; margin: 0; padding: 0; text-align: left;" open-type="contact">
|
||||
<up-cell icon="chat-fill" title="微信客服"></up-cell>
|
||||
<button style="background-color: transparent; margin: 0; padding: 0; text-align: left;"
|
||||
open-type="contact">
|
||||
<up-cell icon="chat-fill" title="微信客服"></up-cell>
|
||||
</button>
|
||||
<!-- <up-cell icon="coupon" title="卡券(暂未开放)"></up-cell>-->
|
||||
<!-- <up-cell icon="heart" title="关注(暂未开放)"></up-cell>-->
|
||||
</up-cell-group>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</BaseLayout>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -156,16 +238,16 @@
|
||||
saveLoginInfo
|
||||
} from "@/composables/useCommon.ts";
|
||||
import TnIcon from '@tuniao/tnui-vue3-uniapp/components/icon/src/icon.vue'
|
||||
import { onLoad ,onReady } from "@dcloudio/uni-app";
|
||||
import useWorkFlow from "@/composables/useWorkFlow.ts";
|
||||
import { onLoad, onReady } from "@dcloudio/uni-app";
|
||||
import useWorkFlow from "@/composables/useWorkFlow.ts";
|
||||
import UserMemberInfo from "@/components/home/UserMemberInfo.vue";
|
||||
import { ref, onMounted, onUnmounted, computed } from 'vue'
|
||||
import { ref, onMounted, onUnmounted, computed,watch,nextTick } from 'vue'
|
||||
import TnWaterFall from '@tuniao/tnui-vue3-uniapp/components/water-fall/src/water-fall.vue'
|
||||
import { request } from "@/utils/request.ts";
|
||||
import type { IDrawHistoryItem } from "@/types";
|
||||
import TnGraphicCard from 'tnuiv3p-tn-graphic-card/index.vue'
|
||||
import MyGraphicCard from "@/components/custom/MyGraphicCard/MyGraphicCard.vue";
|
||||
import { formatDateTime } from "@/utils/common.ts";
|
||||
import { formatDateTime } from "@/utils/common.ts";
|
||||
import AppSwiper from "@/components/home/AppSwiper.vue";
|
||||
import Search from "@/components/home/Search.vue";
|
||||
import AppTags from "@/components/home/AppTags.vue";
|
||||
@@ -173,7 +255,7 @@
|
||||
import Home from "@/pages/home/home.vue";
|
||||
import Creative from "@/pages/creative/creative.vue";
|
||||
import TaskExcuting from "@/components/common/TaskExcuting.vue";
|
||||
import BottomNavigation from "@/components/BottomNavigation.vue";
|
||||
import BottomNavigation from "@/components/BottomNavigation.vue";
|
||||
import History from "@/pages/history/history.vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useAppStore } from "@/stores/appStore.ts";
|
||||
@@ -181,77 +263,365 @@
|
||||
import { on } from "@/utils/emitter.ts";
|
||||
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 img2pay(){
|
||||
pageindex.value=2
|
||||
showPay.value=true
|
||||
|
||||
// ---------------------------AIChat Page------------------------------
|
||||
|
||||
let items = ref('')
|
||||
|
||||
|
||||
|
||||
function copyText(text) {
|
||||
|
||||
uni.setClipboardData({
|
||||
data: text,
|
||||
success: () => {
|
||||
console.log('复制成功');
|
||||
// 可以在这里给用户提示
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('复制失败', err);
|
||||
// 处理错误情况
|
||||
uni.showToast({
|
||||
title: '复制失败,请稍后再试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const fuiNavBar_class = ref('fuiNavBar')
|
||||
|
||||
function changeStyle(e){
|
||||
console.log("changeStyle-----------------",e)
|
||||
if (e.isFixed == false){
|
||||
fuiNavBar_class.value = "fuiNavBar"
|
||||
|
||||
async function chatAiGetToken() {
|
||||
const requestTask = ref()
|
||||
const userInfo = ref()
|
||||
// 获取 用户信息
|
||||
|
||||
await getUserToken().then(res => {
|
||||
// console.log('获取到的getUserToken信息:', res.data);
|
||||
requestTask.value = res.data
|
||||
}).catch(err => {
|
||||
console.error('获取getUserToken失败:', err);
|
||||
});
|
||||
console.log('getUserToken执行完毕');
|
||||
// console.log('获取到的requestTask信息:', requestTask.value);
|
||||
await getUserInfo(requestTask.value).then(res => {
|
||||
// console.log('获取到的getUserInfo信息:', res.data);
|
||||
userInfo.value = res.data
|
||||
}).catch(err => {
|
||||
console.error('获取getUserInfo失败:', err);
|
||||
});
|
||||
console.log('getUserInfo执行完毕');
|
||||
await getModelList(requestTask.value.token).then(res => {
|
||||
// console.log('获取到的getUserInfo信息:', res.data);
|
||||
modelList.value = res.data
|
||||
chooseModel.value = res.data[0]
|
||||
}).catch(err => {
|
||||
console.error('获取getModelList失败:', err);
|
||||
});
|
||||
console.log('getModelList执行完毕');
|
||||
await 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执行完毕');
|
||||
}
|
||||
else{
|
||||
fuiNavBar_class.value = "fuiNavBar_isTrue"
|
||||
|
||||
|
||||
function chooseImage() {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '您没有输入',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化 modelList 为一个空数组
|
||||
const popup = ref(false)
|
||||
const modelList = ref([]);
|
||||
const chooseModel = ref('')
|
||||
|
||||
function change(e) {
|
||||
// 选择模型
|
||||
popup.value = false
|
||||
chooseModel.value = e.value
|
||||
}
|
||||
function cancel() { popup.value = false }
|
||||
function popupMth() {
|
||||
if (!isLogin.value) {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '您还没有登录',
|
||||
duration: 2000
|
||||
});
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
popup.value = true
|
||||
}
|
||||
// 定义 fetchData 函数
|
||||
|
||||
|
||||
const content = ref('')
|
||||
const msgList = ref([{
|
||||
"content": "你好我是Ai聊天助手,有什么问题问我吧!(温馨提示:点击消息可以复制哦)",
|
||||
"role": "system"
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
// 将下面的改成将你的oneapi的代理域名,注意因为这个域名是单独的,所以记得在小程序业务域名中添加
|
||||
//'https://{你的oneapi的域名}/v1/chat/completions', // 请求地址
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
const userkey = ref('')
|
||||
const StreamRequest = (content) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const requestTask = uni.request({
|
||||
|
||||
url: ChatAPiUrl(), // 请求地址
|
||||
method: "POST",
|
||||
|
||||
data: {
|
||||
"messages": content,
|
||||
"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);
|
||||
// console.log('请求成功', res);
|
||||
// uni.parseStreamData(res.data)
|
||||
}, // 请求成功回调
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '请求失败',
|
||||
duration: 2000
|
||||
});
|
||||
console.log('请求失败', err);
|
||||
} // 请求失败回调
|
||||
});
|
||||
|
||||
// 监听进度更新事件
|
||||
requestTask.onChunkReceived((chunk) => {
|
||||
try {
|
||||
// 将 ArrayBuffer 转换为 Base64 字符串
|
||||
const base64 = wx.arrayBufferToBase64(chunk.data);
|
||||
// 将 Base64 字符串转换为 ArrayBuffer
|
||||
const arrayBuffer = wx.base64ToArrayBuffer(base64);
|
||||
// 使用 TextDecoder 解码 ArrayBuffer
|
||||
const text = new TextDecoder().decode(arrayBuffer, { stream: true });
|
||||
|
||||
|
||||
// console.log('text', text);
|
||||
handleStreamData(text);
|
||||
} catch (error) {
|
||||
console.error('处理数据块失败', error);
|
||||
}
|
||||
});
|
||||
requestTask.onHeadersReceived(() => {
|
||||
console.log('请求完成');
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
const msg = ref('')
|
||||
function handleStreamData(responseText) {
|
||||
const messages = responseText.split('\n').filter(line => line.startsWith('data:'));
|
||||
for (const message of messages) {
|
||||
// console.log('-----message---------',message)
|
||||
if (message.trim() === 'data: [DONE]') {
|
||||
msgStatu.value = true
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const data = JSON.parse(message.substring(5).trim()); // 去掉 'data:' 前缀并解析 JSON
|
||||
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 { tabbarIndex } = storeToRefs(useAppStore())
|
||||
const pageindex = ref(0)
|
||||
const changeHomePage = (index : number) => {
|
||||
pageindex.value = index.index;
|
||||
console.log('index', pageindex.value);
|
||||
|
||||
|
||||
};
|
||||
|
||||
const name_value = ref('我的')
|
||||
function wode_loging (){
|
||||
if(!isLogin.value){
|
||||
name_value.value = '登录'
|
||||
const msgStatu = ref(true)
|
||||
function msgSend() {
|
||||
if (!isLogin.value) {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '您还没有登录',
|
||||
duration: 2000
|
||||
});
|
||||
return 0
|
||||
}
|
||||
else{
|
||||
name_value.value = '我的'
|
||||
|
||||
|
||||
// console.log(chooseModel.value)
|
||||
if (chooseModel.value == undefined) {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '您没有选择模型',
|
||||
duration: 2000
|
||||
});
|
||||
return 0
|
||||
}
|
||||
if (msgStatu.value != true) {
|
||||
uni.showToast({
|
||||
icon: "error",
|
||||
title: '请等待消息结束',
|
||||
duration: 2000
|
||||
});
|
||||
return 0
|
||||
}
|
||||
|
||||
msgList.value.push(
|
||||
{
|
||||
"content": content.value,
|
||||
"role": "user"
|
||||
}
|
||||
)
|
||||
content.value = ''
|
||||
StreamRequest(msgList.value)
|
||||
msgList.value.push({
|
||||
"content": '',
|
||||
"role": "system"
|
||||
})
|
||||
msg.value = ''
|
||||
|
||||
}
|
||||
const tabbarData = [
|
||||
{
|
||||
name: '首页',
|
||||
to: '/pages/index/index',
|
||||
onClick: tabbarIndex
|
||||
},
|
||||
{
|
||||
name: '创意',
|
||||
to: '/pages/creative/creative',
|
||||
onClick: tabbarIndex
|
||||
},
|
||||
{
|
||||
name: name_value,
|
||||
onClick: tabbarIndex,
|
||||
}
|
||||
]
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
|
||||
// 背景图片和用到的素材我都给大家放在/src/static里了
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
const backGroundImage = 'https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/aidraw/image/temps/67873d6c232a3c5d52240dd6/Home2.jpg'
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------
|
||||
onReady(() => {
|
||||
|
||||
socketInit()
|
||||
on(EventType.PAY_SUCCESS, ({ order_id }) => handlePayMessage(order_id))
|
||||
wode_loging()
|
||||
chatAiGetToken()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
onMounted(() => {
|
||||
getTestImageData()
|
||||
|
||||
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
// 销毁当前组件
|
||||
imageData.value = []
|
||||
})
|
||||
function img2pay() {
|
||||
pageindex.value = 2
|
||||
showPay.value = true
|
||||
}
|
||||
|
||||
const fuiNavBar_class = ref('fuiNavBar')
|
||||
|
||||
function changeStyle(e) {
|
||||
// console.log("changeStyle-----------------", e)
|
||||
if (e.isFixed == false) {
|
||||
fuiNavBar_class.value = "fuiNavBar"
|
||||
}
|
||||
else {
|
||||
fuiNavBar_class.value = "fuiNavBar_isTrue"
|
||||
}
|
||||
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
const { tabbarIndex } = storeToRefs(useAppStore())
|
||||
const pageindex = ref(0)
|
||||
const changeHomePage = (index : number) => {
|
||||
pageindex.value = index.index;
|
||||
if (index.index == 2) {
|
||||
chatAiGetToken()
|
||||
}
|
||||
// console.log('index', pageindex.value);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
const name_value = ref('我的')
|
||||
function wode_loging() {
|
||||
if (!isLogin.value) {
|
||||
name_value.value = '登录'
|
||||
}
|
||||
else {
|
||||
name_value.value = '我的'
|
||||
|
||||
}
|
||||
}
|
||||
const tabbarData = [
|
||||
{
|
||||
name: '首页',
|
||||
// to: '/pages/index/index',
|
||||
onClick: tabbarIndex
|
||||
},
|
||||
{
|
||||
name: '创意',
|
||||
// to: '/pages/creative/creative',
|
||||
onClick: tabbarIndex
|
||||
},
|
||||
{
|
||||
name: 'AI助手',
|
||||
// to: '/pages/creative/creative',
|
||||
onClick: tabbarIndex
|
||||
},
|
||||
{
|
||||
name: name_value,
|
||||
onClick: tabbarIndex,
|
||||
},
|
||||
|
||||
]
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
|
||||
// 背景图片和用到的素材我都给大家放在/src/static里了
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
// 下面链接改成你的背景图片,求求大家用自己的,作者oss按量付费,开源不易!
|
||||
const backGroundImage = 'https://chinahu-ai-server.oss-cn-chengdu.aliyuncs.com/aidraw/image/temps/67873d6c232a3c5d52240dd6/Home2.jpg'
|
||||
|
||||
|
||||
const getTestImageData = async () => {
|
||||
imageData.value = await request<IDrawHistoryItem[]>('draw/history/findMany', {
|
||||
method: 'POST',
|
||||
@@ -295,7 +665,7 @@
|
||||
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------
|
||||
@@ -328,7 +698,7 @@
|
||||
// 非开发者工具环境,执行登录操作
|
||||
handleLoginByWechat()
|
||||
} else {
|
||||
console.log('dev')
|
||||
// console.log('dev')
|
||||
// 开发者工具环境,模拟登录 todo
|
||||
|
||||
const user = await loginByUsername({
|
||||
@@ -338,8 +708,9 @@
|
||||
saveLoginInfo(user)
|
||||
uni.hideLoading()
|
||||
}
|
||||
chatAiGetToken()
|
||||
name_value.value = '我的'
|
||||
|
||||
|
||||
}
|
||||
/** 通过微信登录 */
|
||||
const handleLoginByWechat = () => {
|
||||
@@ -348,6 +719,9 @@
|
||||
const result = await loginByWechatCode(code)
|
||||
saveLoginInfo(result)
|
||||
uni.hideLoading()
|
||||
console.log("------------result--------", result)
|
||||
uni.setStorageSync('refreshToken', result.refresh_token)
|
||||
|
||||
},
|
||||
fail: function (err) {
|
||||
uni.showToast({
|
||||
@@ -356,13 +730,10 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
chatAiGetToken()
|
||||
}
|
||||
const { socketInit } = useWorkFlow()
|
||||
onReady(() => {
|
||||
socketInit()
|
||||
on(EventType.PAY_SUCCESS, ({ order_id }) => handlePayMessage(order_id))
|
||||
wode_loging()
|
||||
})
|
||||
|
||||
const handlePayMessage = async (order_id : string) => {
|
||||
// 监听到支付成功事件
|
||||
console.log('收到支付成功消息', order_id)
|
||||
@@ -393,10 +764,39 @@
|
||||
|
||||
|
||||
/** 支付 **/
|
||||
|
||||
const { showPay } = storeToRefs(useAppStore())
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.scroll-Y {
|
||||
margin-top: -11%;
|
||||
height: 1200rpx;
|
||||
}
|
||||
|
||||
.fui-custom__wrap {
|
||||
width: 100%;
|
||||
height: 520rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
.AITool {
|
||||
margin-right: 24rpx;
|
||||
height: 72rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
|
||||
|
||||
}
|
||||
|
||||
.image-data {
|
||||
width: calc(100% - 20rpx);
|
||||
margin: 10rpx;
|
||||
@@ -444,21 +844,23 @@
|
||||
justify-content: left;
|
||||
|
||||
}
|
||||
.fuiNavBar_isTrue{
|
||||
|
||||
.fuiNavBar_isTrue {
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
||||
background: #F8F8F8;
|
||||
color: #465CFF;
|
||||
font-weight: bold;
|
||||
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
|
||||
background: #F8F8F8;
|
||||
color: #465CFF;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
.fuiNavBar {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// text-align: center;
|
||||
margin-top: 10%;
|
||||
margin-bottom: 10%;
|
||||
@@ -471,8 +873,217 @@
|
||||
}
|
||||
|
||||
.tabs_class {
|
||||
width:537rpx;
|
||||
display:flex;
|
||||
display:border-box;
|
||||
width: 537rpx;
|
||||
display: flex;
|
||||
display: border-box;
|
||||
}
|
||||
|
||||
.fui-wrap {
|
||||
background-color: transparent;
|
||||
padding-bottom: 108rpx;
|
||||
}
|
||||
|
||||
.fui-chat__box {
|
||||
margin-top: 2%;
|
||||
width: 100%;
|
||||
padding: 48rpx 24rpx 0;
|
||||
box-sizing: border-box;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.fui-chat__item {
|
||||
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 {
|
||||
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::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::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 {
|
||||
max-width: 100%;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.fui-chat__right {
|
||||
padding-left: 96rpx;
|
||||
padding-right: 0;
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
|
||||
.fui-chat__right .fui-chat__content {
|
||||
margin-left: 0;
|
||||
margin-right: 24rpx;
|
||||
border-radius: 32rpx 0 32rpx 32rpx;
|
||||
background-color: #465CFF;
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
|
||||
.fui-chat__right .fui-chat__content::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::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -42rpx;
|
||||
top: 3rpx;
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
background-color: #EDEDED;
|
||||
z-index: 2;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.fui-chatbar__wrap {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
padding: 6px 24rpx;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
background: #f8f8f8;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.fui-chatbar__input-box {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
position: relative;
|
||||
border-radius: 40rpx;
|
||||
box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 8rpx;
|
||||
}
|
||||
|
||||
.fui-chatbar__input {
|
||||
/* #ifndef APP-NVUE || MP-ALIPAY || MP-QQ */
|
||||
width: 100%;
|
||||
min-height: 32rpx;
|
||||
box-sizing: content-box;
|
||||
padding: 20rpx 40rpx;
|
||||
/* #endif */
|
||||
/* #ifdef MP-ALIPAY || MP-QQ */
|
||||
line-height: 1;
|
||||
min-height: 72rpx;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
/* #ifdef APP-NVUE */
|
||||
height: 72rpx;
|
||||
padding: 16rpx 20rpx;
|
||||
/* #endif */
|
||||
border-radius: 40rpx;
|
||||
font-size: 32rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.fui-chatbar__icon-box {
|
||||
height: 72rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
.fui-chatbar__icon-box_left {
|
||||
height: 72rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
/* #endif */
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
|
||||
}
|
||||
|
||||
.fui-chatbar__icon-box image {
|
||||
width: 68rpx;
|
||||
height: 68rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.fui-chatbar__icon-box:active {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.fui-chatbar__send-box {
|
||||
padding-left: 24rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.fui-chatbar__fixed {
|
||||
/* margin-top: 20%; */
|
||||
margin-bottom: 0%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 755 B |
|
Before Width: | Height: | Size: 969 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 142 KiB |
@@ -18,6 +18,7 @@ export const request=<T>(apiUrl:string,options:IRequestOptions={},retry=true):Pr
|
||||
//将刷新后的token保存到user中
|
||||
saveLoginInfo({token})
|
||||
console.log('刷新后获取的token',token)
|
||||
// uni.setStorageSync('token', token)
|
||||
if (token){
|
||||
options.header={
|
||||
Authorization: `Bearer ${token}`
|
||||
@@ -78,9 +79,14 @@ export const refreshToken = async (
|
||||
data: { refreshToken },
|
||||
timeout,
|
||||
success: (res) => {
|
||||
|
||||
if(res.statusCode>=400){
|
||||
reject(res)
|
||||
// uni.setStorageSync('refreshToken', res);
|
||||
console.log('refreshToken', res)
|
||||
reject(res);
|
||||
}else {
|
||||
// uni.setStorageSync('refreshToken', res.data);
|
||||
console.log('refreshToken', res)
|
||||
resolve(res.data); // 如果没有data字段,返回整个res.data
|
||||
}
|
||||
},
|
||||
@@ -130,6 +136,7 @@ export const uploadFile=<T>(filePath:string,options:IRequestOptions={},apiUrl='
|
||||
reject(res);
|
||||
}
|
||||
const {token}=await refreshToken(_refreshToken)
|
||||
|
||||
//将刷新后的token保存到user中
|
||||
saveLoginInfo({token})
|
||||
console.log('刷新后获取的token',token)
|
||||
@@ -168,6 +175,7 @@ export const uploadFile=<T>(filePath:string,options:IRequestOptions={},apiUrl='
|
||||
//将刷新后的token保存到user中
|
||||
saveLoginInfo({token})
|
||||
console.log('刷新后获取的token',token)
|
||||
|
||||
if (token){
|
||||
options.header={
|
||||
Authorization: `Bearer ${token}`
|
||||
|
||||