Compare commits
37 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
48811b88dc | |
|
|
1ab9d97fce | |
|
|
7b76e969af | |
|
|
eca7bb81d3 | |
|
|
ef56dd4a2a | |
|
|
685905991d | |
|
|
fc1e6ac22b | |
|
|
5eabbdc365 | |
|
|
a475776039 | |
|
|
7741e4b153 | |
|
|
e64a9d2e65 | |
|
|
030f7525f8 | |
|
|
dda213fc9b | |
|
|
8226d4274f | |
|
|
6313fc5c91 | |
|
|
ee0d5d9c1e | |
|
|
ccc7b7ff3c | |
|
|
5d5a4ba39c | |
|
|
4a26132b8f | |
|
|
7ce2f12a95 | |
|
|
a2f3c598fc | |
|
|
8e31d553e3 | |
|
|
367810086a | |
|
|
1b936a3988 | |
|
|
08fa88129e | |
|
|
d768df328a | |
|
|
9696c309b7 | |
|
|
da36d5a0fe | |
|
|
654b85eba0 | |
|
|
324949dbc2 | |
|
|
80d500ed00 | |
|
|
963b3801f5 | |
|
|
6c6f8c84aa | |
|
|
032c32b337 | |
|
|
e9bf76d506 | |
|
|
a871ea7a5f | |
|
|
79e9540da5 |
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "芋道商城",
|
"name": "芋道商城",
|
||||||
"appid": "__UNI__460BC4C",
|
"appid": "__UNI__460BC4C",
|
||||||
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
||||||
"versionName": "2.1.0",
|
"versionName": "2025.09",
|
||||||
"versionCode": "183",
|
"versionCode": "183",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "shopro",
|
"id": "shopro",
|
||||||
"name": "shopro",
|
"name": "shopro",
|
||||||
"displayName": "芋道商城",
|
"displayName": "芋道商城",
|
||||||
"version": "2.6.0",
|
"version": "2025.09",
|
||||||
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||||
|
|
|
||||||
|
|
@ -681,6 +681,9 @@
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/index/index"
|
"pagePath": "pages/index/index"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"pagePath": "pages/index/category"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/index/cart"
|
"pagePath": "pages/index/cart"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
<view class="ss-m-t-60 ss-flex ss-flex-wrap ss-row-center">
|
<view class="ss-m-t-60 ss-flex ss-flex-wrap ss-row-center">
|
||||||
<!-- 团长 -->
|
<!-- 团长 -->
|
||||||
<view class="header-avatar ss-m-r-24 ss-m-b-20">
|
<view class="header-avatar ss-m-r-24 ss-m-b-20">
|
||||||
<image :src="sheep.$url.cdn(state.data.headRecord.avatar)" class="avatar-img"></image>
|
<image :src="sheep.$url.cdn(state.data.headRecord.avatar) || sheep.$url.static('/static/img/shop/default_avatar.png')" class="avatar-img"></image>
|
||||||
<view class="header-tag ss-flex ss-col-center ss-row-center">团长</view>
|
<view class="header-tag ss-flex ss-col-center ss-row-center">团长</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 团员 -->
|
<!-- 团员 -->
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
v-for="item in state.data.memberRecords"
|
v-for="item in state.data.memberRecords"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
<image :src="sheep.$url.cdn(item.avatar)" class="avatar-img"></image>
|
<image :src="sheep.$url.cdn(item.avatar) || sheep.$url.static('/static/img/shop/default_avatar.png')" class="avatar-img"></image>
|
||||||
<view
|
<view
|
||||||
class="header-tag ss-flex ss-col-center ss-row-center"
|
class="header-tag ss-flex ss-col-center ss-row-center"
|
||||||
v-if="item.is_leader == '1'"
|
v-if="item.is_leader == '1'"
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="send-wrap ss-flex">
|
<view class="send-wrap ss-flex">
|
||||||
<view class="left ss-flex ss-flex-1">
|
<view class="left ss-flex ss-flex-1">
|
||||||
<uni-easyinput
|
<optimize-input
|
||||||
class="ss-flex-1 ss-p-l-22"
|
class="ss-flex-1 ss-p-l-22"
|
||||||
:inputBorder="false"
|
:inputBorder="false"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
v-model="message"
|
v-model="message"
|
||||||
placeholder="请输入你要咨询的问题"
|
placeholder="请输入你要咨询的问题"
|
||||||
:maxlength="maxLength"
|
></optimize-input>
|
||||||
:focus="autoFocus"
|
|
||||||
@focus="handleFocus"
|
|
||||||
></uni-easyinput>
|
|
||||||
<text v-if="showCharCount" class="char-count">{{ message.length }}/{{ maxLength }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<text class="sicon-basic bq" @tap.stop="onTools('emoji')"></text>
|
<text class="sicon-basic bq" @tap.stop="onTools('emoji')"></text>
|
||||||
<text
|
<text
|
||||||
|
|
@ -35,6 +31,7 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onUnmounted } from 'vue';
|
import { computed, ref, onUnmounted } from 'vue';
|
||||||
|
import OptimizeInput from '@/pages/chat/components/optimize-input.vue';
|
||||||
/**
|
/**
|
||||||
* 消息发送组件
|
* 消息发送组件
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,83 +46,27 @@
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
// 是否自动获取焦点
|
|
||||||
autoFocus: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
// 最大字数限制
|
|
||||||
maxLength: {
|
|
||||||
type: Number,
|
|
||||||
default: 500,
|
|
||||||
},
|
|
||||||
// 是否显示字数统计
|
|
||||||
showCharCount: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emits = defineEmits(['update:modelValue', 'onTools', 'sendMessage']);
|
const emits = defineEmits(['update:modelValue', 'onTools', 'sendMessage']);
|
||||||
|
|
||||||
const message = computed({
|
const message = computed({
|
||||||
get() {
|
get() {
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
emits(`update:modelValue`, newValue);
|
emits(`update:modelValue`, newValue);
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// 控制发送状态
|
|
||||||
const sending = ref(false);
|
|
||||||
|
|
||||||
// 是否禁用发送按钮
|
|
||||||
const isDisabled = computed(() => {
|
|
||||||
return !message.value.trim() || message.value.length > props.maxLength;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 输入框获取焦点
|
|
||||||
const handleFocus = () => {
|
|
||||||
// 输入框获取焦点时关闭工具栏
|
|
||||||
if (props.toolsMode !== '') {
|
|
||||||
onTools('');
|
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
|
|
||||||
// 打开工具菜单
|
// 打开工具菜单
|
||||||
function onTools(mode) {
|
function onTools(mode) {
|
||||||
emits('onTools', mode);
|
emits('onTools', mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 防抖处理
|
|
||||||
let sendTimer = null;
|
|
||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
// 如果正在发送中,或者内容为空,则不处理
|
emits('sendMessage');
|
||||||
if (sending.value || isDisabled.value) return;
|
|
||||||
|
|
||||||
// 清除可能存在的定时器
|
|
||||||
if (sendTimer) clearTimeout(sendTimer);
|
|
||||||
|
|
||||||
// 设置发送状态
|
|
||||||
sending.value = true;
|
|
||||||
|
|
||||||
// 执行发送,并添加防抖
|
|
||||||
sendTimer = setTimeout(() => {
|
|
||||||
emits('sendMessage');
|
|
||||||
// 发送完成后重置状态
|
|
||||||
setTimeout(() => {
|
|
||||||
sending.value = false;
|
|
||||||
}, 300);
|
|
||||||
}, 300);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件卸载时清除定时器
|
|
||||||
onUnmounted(() => {
|
|
||||||
if (sendTimer) clearTimeout(sendTimer);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
@ -137,16 +78,6 @@
|
||||||
height: 64rpx;
|
height: 64rpx;
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
background: var(--ui-BG-1);
|
background: var(--ui-BG-1);
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.char-count {
|
|
||||||
position: absolute;
|
|
||||||
right: 15rpx;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
font-size: 22rpx;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bq {
|
.bq {
|
||||||
|
|
@ -174,12 +105,6 @@
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
margin-left: 11rpx;
|
margin-left: 11rpx;
|
||||||
transition: all 0.3s;
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
opacity: 0.6;
|
|
||||||
background: #cccccc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,7 @@
|
||||||
<image
|
<image
|
||||||
v-show="message.senderType === UserTypeEnum.ADMIN"
|
v-show="message.senderType === UserTypeEnum.ADMIN"
|
||||||
class="chat-avatar ss-m-r-24"
|
class="chat-avatar ss-m-r-24"
|
||||||
:src="
|
:src="sheep.$url.cdn(message.senderAvatar) || sheep.$url.static('')"
|
||||||
sheep.$url.cdn(message.senderAvatar) ||
|
|
||||||
sheep.$url.static('/static/img/shop/chat/default.png')
|
|
||||||
"
|
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
lazy-load
|
lazy-load
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,540 @@
|
||||||
|
<template>
|
||||||
|
<view
|
||||||
|
class="uni-easyinput"
|
||||||
|
:class="{ 'uni-easyinput-error': msg }"
|
||||||
|
:style="{ color: inputBorder && msg ? '#e43d33' : styles.color }"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="uni-easyinput__content"
|
||||||
|
:class="{
|
||||||
|
'is-input-border': inputBorder,
|
||||||
|
'is-input-error-border': inputBorder && msg,
|
||||||
|
'is-textarea': type === 'textarea',
|
||||||
|
'is-disabled': disabled
|
||||||
|
}"
|
||||||
|
:style="{
|
||||||
|
'border-color': inputBorder && msg ? '#dd524d' : styles.borderColor,
|
||||||
|
'background-color': disabled ? styles.disableColor : ''
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<uni-icons
|
||||||
|
v-if="prefixIcon"
|
||||||
|
class="content-clear-icon"
|
||||||
|
:type="prefixIcon"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@click="onClickIcon('prefix')"
|
||||||
|
></uni-icons>
|
||||||
|
<textarea
|
||||||
|
v-if="type === 'textarea'"
|
||||||
|
class="uni-easyinput__content-textarea"
|
||||||
|
:class="{ 'input-padding': inputBorder }"
|
||||||
|
:name="name"
|
||||||
|
:value="val"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
:disabled="disabled"
|
||||||
|
placeholder-class="uni-easyinput__placeholder-class"
|
||||||
|
:maxlength="inputMaxlength"
|
||||||
|
:focus="focused"
|
||||||
|
:autoHeight="autoHeight"
|
||||||
|
:adjust-position="false"
|
||||||
|
@input="onInput"
|
||||||
|
@blur="onBlur"
|
||||||
|
@focus="onFocus"
|
||||||
|
@confirm="onConfirm"
|
||||||
|
></textarea>
|
||||||
|
<input
|
||||||
|
v-else
|
||||||
|
:type="type === 'password' ? 'text' : type"
|
||||||
|
class="uni-easyinput__content-input"
|
||||||
|
:style="{
|
||||||
|
'padding-right': type === 'password' || clearable || prefixIcon ? '' : '10px',
|
||||||
|
'padding-left': paddingLeft + 'px'
|
||||||
|
|
||||||
|
}"
|
||||||
|
:name="name"
|
||||||
|
:value="val"
|
||||||
|
:password="!showPassword && type === 'password'"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:placeholderStyle="placeholderStyle"
|
||||||
|
placeholder-class="uni-easyinput__placeholder-class"
|
||||||
|
:disabled="disabled"
|
||||||
|
:maxlength="inputMaxlength"
|
||||||
|
:focus="focused"
|
||||||
|
:confirmType="confirmType"
|
||||||
|
:adjust-position="false"
|
||||||
|
@focus="onFocus"
|
||||||
|
@blur="onBlur"
|
||||||
|
@input="onInput"
|
||||||
|
@change="onInput"
|
||||||
|
@confirm="onConfirm"
|
||||||
|
:cursor-spacing="30"
|
||||||
|
always-embed
|
||||||
|
/>
|
||||||
|
<template v-if="type === 'password' && passwordIcon">
|
||||||
|
<uni-icons
|
||||||
|
v-if="val"
|
||||||
|
class="content-clear-icon"
|
||||||
|
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||||
|
:type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
|
||||||
|
:size="18"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@click="onEyes"
|
||||||
|
></uni-icons>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="suffixIcon">
|
||||||
|
<uni-icons
|
||||||
|
v-if="suffixIcon"
|
||||||
|
class="content-clear-icon"
|
||||||
|
:type="suffixIcon"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@click="onClickIcon('suffix')"
|
||||||
|
></uni-icons>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<uni-icons
|
||||||
|
class="content-clear-icon"
|
||||||
|
:class="{ 'is-textarea-icon': type === 'textarea' }"
|
||||||
|
type="clear"
|
||||||
|
:size="clearSize"
|
||||||
|
v-if="clearable && val && !disabled"
|
||||||
|
color="#c0c4cc"
|
||||||
|
@click="onClear"
|
||||||
|
></uni-icons>
|
||||||
|
</template>
|
||||||
|
<slot name="right"></slot>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// import {
|
||||||
|
// debounce,
|
||||||
|
// throttle
|
||||||
|
// } from './common.js'
|
||||||
|
/**
|
||||||
|
* Easyinput 输入框
|
||||||
|
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
||||||
|
* @property {String} value 输入内容
|
||||||
|
* @property {String } type 输入框的类型(默认text) password/text/textarea/..
|
||||||
|
* @value text 文本输入键盘
|
||||||
|
* @value textarea 多行文本输入键盘
|
||||||
|
* @value password 密码输入键盘
|
||||||
|
* @value number 数字输入键盘,注意iOS上app-vue弹出的数字键盘并非9宫格方式
|
||||||
|
* @value idcard 身份证输入键盘,信、支付宝、百度、QQ小程序
|
||||||
|
* @value digit 带小数点的数字键盘 ,App的nvue页面、微信、支付宝、百度、头条、QQ小程序支持
|
||||||
|
* @property {Boolean} clearable 是否显示右侧清空内容的图标控件,点击可清空输入框内容(默认true)
|
||||||
|
* @property {Boolean} autoHeight 是否自动增高输入区域,type为textarea时有效(默认false)
|
||||||
|
* @property {String } placeholder 输入框的提示文字
|
||||||
|
* @property {String } placeholderStyle placeholder的样式(内联样式,字符串),如"color: #ddd"
|
||||||
|
* @property {Boolean} focus 是否自动获得焦点(默认false)
|
||||||
|
* @property {Boolean} disabled 是否禁用(默认false)
|
||||||
|
* @property {Number } maxlength 最大输入长度,设置为 -1 的时候不限制最大长度(默认140)
|
||||||
|
* @property {String } confirmType 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done)
|
||||||
|
* @property {Number } clearSize 清除图标的大小,单位px(默认15)
|
||||||
|
* @property {String} prefixIcon 输入框头部图标
|
||||||
|
* @property {String} suffixIcon 输入框尾部图标
|
||||||
|
* @property {Boolean} trim 是否自动去除两端的空格
|
||||||
|
* @value both 去除两端空格
|
||||||
|
* @value left 去除左侧空格
|
||||||
|
* @value right 去除右侧空格
|
||||||
|
* @value start 去除左侧空格
|
||||||
|
* @value end 去除右侧空格
|
||||||
|
* @value all 去除全部空格
|
||||||
|
* @value none 不去除空格
|
||||||
|
* @property {Boolean} inputBorder 是否显示input输入框的边框(默认true)
|
||||||
|
* @property {Boolean} passwordIcon type=password时是否显示小眼睛图标
|
||||||
|
* @property {Object} styles 自定义颜色
|
||||||
|
* @event {Function} input 输入框内容发生变化时触发
|
||||||
|
* @event {Function} focus 输入框获得焦点时触发
|
||||||
|
* @event {Function} blur 输入框失去焦点时触发
|
||||||
|
* @event {Function} confirm 点击完成按钮时触发
|
||||||
|
* @event {Function} iconClick 点击图标时触发
|
||||||
|
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'optimize-input',
|
||||||
|
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm'],
|
||||||
|
model: {
|
||||||
|
prop: 'modelValue',
|
||||||
|
event: 'update:modelValue'
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
name: String,
|
||||||
|
value: [Number, String],
|
||||||
|
modelValue: [Number, String],
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'text'
|
||||||
|
},
|
||||||
|
clearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
autoHeight: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
placeholder: String,
|
||||||
|
placeholderStyle: String,
|
||||||
|
focus: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 140
|
||||||
|
},
|
||||||
|
confirmType: {
|
||||||
|
type: String,
|
||||||
|
default: 'done'
|
||||||
|
},
|
||||||
|
clearSize: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 15
|
||||||
|
},
|
||||||
|
inputBorder: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
prefixIcon: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
suffixIcon: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
trim: {
|
||||||
|
type: [Boolean, String],
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
passwordIcon: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
styles: {
|
||||||
|
type: Object,
|
||||||
|
default() {
|
||||||
|
return {
|
||||||
|
color: '#333',
|
||||||
|
disableColor: '#F7F6F6',
|
||||||
|
borderColor: '#e5e5e5'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorMessage: {
|
||||||
|
type: [String, Boolean],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
paddingLeft:{
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
focused: false,
|
||||||
|
errMsg: '',
|
||||||
|
val: '',
|
||||||
|
showMsg: '',
|
||||||
|
border: false,
|
||||||
|
isFirstBorder: false,
|
||||||
|
showClearIcon: false,
|
||||||
|
showPassword: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
msg() {
|
||||||
|
return this.errorMessage || this.errMsg;
|
||||||
|
},
|
||||||
|
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
||||||
|
inputMaxlength() {
|
||||||
|
return Number(this.maxlength);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(newVal) {
|
||||||
|
if (this.errMsg) this.errMsg = '';
|
||||||
|
this.val = newVal;
|
||||||
|
// fix by mehaotian is_reset 在 uni-forms 中定义
|
||||||
|
if (this.form && this.formItem && !this.is_reset) {
|
||||||
|
this.is_reset = false;
|
||||||
|
this.formItem.setValue(newVal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modelValue(newVal) {
|
||||||
|
if (this.errMsg) this.errMsg = '';
|
||||||
|
this.val = newVal;
|
||||||
|
if (this.form && this.formItem && !this.is_reset) {
|
||||||
|
this.is_reset = false;
|
||||||
|
this.formItem.setValue(newVal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focus(newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.focused = this.focus;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (!this.value && this.value !== 0) {
|
||||||
|
this.val = this.modelValue;
|
||||||
|
}
|
||||||
|
if (!this.modelValue && this.modelValue !== 0) {
|
||||||
|
this.val = this.value;
|
||||||
|
}
|
||||||
|
this.form = this.getForm('uniForms');
|
||||||
|
this.formItem = this.getForm('uniFormsItem');
|
||||||
|
if (this.form && this.formItem) {
|
||||||
|
if (this.formItem.name) {
|
||||||
|
if (!this.is_reset) {
|
||||||
|
this.is_reset = false;
|
||||||
|
this.formItem.setValue(this.val);
|
||||||
|
}
|
||||||
|
this.rename = this.formItem.name;
|
||||||
|
this.form.inputChildrens.push(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.focused = this.focus;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 初始化变量值
|
||||||
|
*/
|
||||||
|
init() {},
|
||||||
|
onClickIcon(type) {
|
||||||
|
this.$emit('iconClick', type);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取父元素实例
|
||||||
|
*/
|
||||||
|
getForm(name = 'uniForms') {
|
||||||
|
let parent = this.$parent;
|
||||||
|
let parentName = parent.$options.name;
|
||||||
|
while (parentName !== name) {
|
||||||
|
parent = parent.$parent;
|
||||||
|
if (!parent) return false;
|
||||||
|
parentName = parent.$options.name;
|
||||||
|
}
|
||||||
|
return parent;
|
||||||
|
},
|
||||||
|
|
||||||
|
onEyes() {
|
||||||
|
this.showPassword = !this.showPassword;
|
||||||
|
},
|
||||||
|
onInput(event) {
|
||||||
|
let value = event.detail.value;
|
||||||
|
// 判断是否去除空格
|
||||||
|
if (this.trim) {
|
||||||
|
if (typeof this.trim === 'boolean' && this.trim) {
|
||||||
|
value = this.trimStr(value);
|
||||||
|
}
|
||||||
|
if (typeof this.trim === 'string') {
|
||||||
|
value = this.trimStr(value, this.trim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.errMsg) this.errMsg = '';
|
||||||
|
this.val = value;
|
||||||
|
// TODO 兼容 vue2
|
||||||
|
this.$emit('input', value);
|
||||||
|
// TODO 兼容 vue3
|
||||||
|
this.$emit('update:modelValue', value);
|
||||||
|
},
|
||||||
|
onFocus(event) {
|
||||||
|
this.$emit('focus', event);
|
||||||
|
},
|
||||||
|
onBlur(event) {
|
||||||
|
let value = event.detail.value;
|
||||||
|
this.$emit('blur', event);
|
||||||
|
},
|
||||||
|
onConfirm(e) {
|
||||||
|
this.$emit('confirm', e.detail.value);
|
||||||
|
},
|
||||||
|
onClear(event) {
|
||||||
|
this.val = '';
|
||||||
|
// TODO 兼容 vue2
|
||||||
|
this.$emit('input', '');
|
||||||
|
// TODO 兼容 vue2
|
||||||
|
// TODO 兼容 vue3
|
||||||
|
this.$emit('update:modelValue', '');
|
||||||
|
},
|
||||||
|
fieldClick() {
|
||||||
|
this.$emit('click');
|
||||||
|
},
|
||||||
|
trimStr(str, pos = 'both') {
|
||||||
|
if (pos === 'both') {
|
||||||
|
return str.trim();
|
||||||
|
} else if (pos === 'left') {
|
||||||
|
return str.trimLeft();
|
||||||
|
} else if (pos === 'right') {
|
||||||
|
return str.trimRight();
|
||||||
|
} else if (pos === 'start') {
|
||||||
|
return str.trimStart();
|
||||||
|
} else if (pos === 'end') {
|
||||||
|
return str.trimEnd();
|
||||||
|
} else if (pos === 'all') {
|
||||||
|
return str.replace(/\s+/g, '');
|
||||||
|
} else if (pos === 'none') {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
$uni-error: #e43d33;
|
||||||
|
$uni-border-1: #dcdfe6 !default;
|
||||||
|
.uni-easyinput {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
width: 100%;
|
||||||
|
/* #endif */
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
text-align: left;
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput__content {
|
||||||
|
flex: 1;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 72rpx;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput__content-input {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
width: auto;
|
||||||
|
/* #endif */
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
flex: 1;
|
||||||
|
line-height: 56rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
}
|
||||||
|
.uni-easyinput__placeholder-class {
|
||||||
|
color: #bbbbbb;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
.is-textarea {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-textarea-icon {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput__content-textarea {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
flex: 1;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-size: 14px;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
height: 80px;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
min-height: 80px;
|
||||||
|
width: auto;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-padding {
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-clear-icon {
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
margin-top: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 显示边框
|
||||||
|
.is-input-border {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid $uni-border-1;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-error-message {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -17px;
|
||||||
|
left: 0;
|
||||||
|
line-height: 12px;
|
||||||
|
color: $uni-error;
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-error-msg--boeder {
|
||||||
|
position: relative;
|
||||||
|
bottom: 0;
|
||||||
|
line-height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-input-error-border {
|
||||||
|
border-color: $uni-error;
|
||||||
|
.uni-easyinput__placeholder-class {
|
||||||
|
// color: mix(#fff, $uni-error, 50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput--border {
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding: 10px 15px;
|
||||||
|
// padding-bottom: 0;
|
||||||
|
border-top: 1px #eee solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-easyinput-error {
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-first-border {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
border: none;
|
||||||
|
/* #endif */
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
border-width: 0;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-disabled {
|
||||||
|
border-color: red;
|
||||||
|
background-color: #f7f6f6;
|
||||||
|
color: #d5d5d5;
|
||||||
|
.uni-easyinput__placeholder-class {
|
||||||
|
color: #d5d5d5;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
>
|
>
|
||||||
<template #rightBottom>
|
<template #rightBottom>
|
||||||
<view class="ss-flex ss-row-between">
|
<view class="ss-flex ss-row-between">
|
||||||
<view class="commission-num" v-if="item.brokerageMinPrice === undefined"
|
<view class="commission-num" v-if="item.brokerageMinPrice === undefined">
|
||||||
>预计佣金:计算中</view
|
预计佣金:计算中
|
||||||
>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="commission-num"
|
class="commission-num"
|
||||||
v-else-if="item.brokerageMinPrice === item.brokerageMaxPrice"
|
v-else-if="item.brokerageMinPrice === item.brokerageMaxPrice"
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,8 @@
|
||||||
if (state.accountInfo.type === '5') {
|
if (state.accountInfo.type === '5') {
|
||||||
data.userAccount = openid;
|
data.userAccount = openid;
|
||||||
data.transferChannelCode = getWeixinPayChannelCode();
|
data.transferChannelCode = getWeixinPayChannelCode();
|
||||||
|
} else if (state.accountInfo.type === '6' || state.accountInfo.type === '2') {
|
||||||
|
delete data.transferChannelCode;
|
||||||
} else {
|
} else {
|
||||||
delete data.userAccount;
|
delete data.userAccount;
|
||||||
delete data.transferChannelCode;
|
delete data.transferChannelCode;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
<template>
|
||||||
|
<view class="content-container">
|
||||||
|
<span v-for="(part, index) in formattedContent" :key="index"
|
||||||
|
@click="handleClick(part)"
|
||||||
|
:class="{'highlight-number': part.isNumber, 'phone-number': part.isPhone}">
|
||||||
|
{{ part.text }}
|
||||||
|
</span>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'HighlightNumber',
|
||||||
|
props: {
|
||||||
|
content: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
formattedContent() {
|
||||||
|
const phoneRegex = /(1[3-9]\d{9})/g;
|
||||||
|
const numberRegex = /(\d+)/g;
|
||||||
|
let text = this.content;
|
||||||
|
let result = [];
|
||||||
|
let match;
|
||||||
|
|
||||||
|
// Step 1: 提取手机号
|
||||||
|
while ((match = phoneRegex.exec(text)) !== null) {
|
||||||
|
if (match.index > 0) {
|
||||||
|
const before = text.slice(0, match.index);
|
||||||
|
result.push(...this.splitAndPush(before, false, false));
|
||||||
|
}
|
||||||
|
result.push({ text: match[0], isNumber: true, isPhone: true });
|
||||||
|
text = text.slice(match.index + match[0].length);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: 提取普通数字
|
||||||
|
while ((match = numberRegex.exec(text)) !== null) {
|
||||||
|
if (match.index > 0) {
|
||||||
|
const before = text.slice(0, match.index);
|
||||||
|
result.push(...this.splitAndPush(before, false, false));
|
||||||
|
}
|
||||||
|
result.push({ text: match[0], isNumber: true });
|
||||||
|
text = text.slice(match.index + match[0].length);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: 添加剩余文本
|
||||||
|
if (text.length > 0) {
|
||||||
|
result.push(...this.splitAndPush(text, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
splitAndPush(str, isNumber = false, isPhone = false) {
|
||||||
|
return str.split('').map(char => ({ text: char, isNumber, isPhone }));
|
||||||
|
},
|
||||||
|
handleClick(part) {
|
||||||
|
if (part.isPhone) {
|
||||||
|
this.$emit('phone-click', { phoneNumber: part.text });
|
||||||
|
} else if (part.isNumber) {
|
||||||
|
this.$emit('number-click', { number: part.text });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.highlight-number {
|
||||||
|
color: #ff5722;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phone-number {
|
||||||
|
color: #007AFF;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -38,7 +38,11 @@
|
||||||
<!-- <view class="log-msg-title ss-m-b-20">-->
|
<!-- <view class="log-msg-title ss-m-b-20">-->
|
||||||
<!-- {{ item.status_text }}-->
|
<!-- {{ item.status_text }}-->
|
||||||
<!-- </view>-->
|
<!-- </view>-->
|
||||||
<view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>
|
<!-- <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>-->
|
||||||
|
<view class="log-msg-desc ss-m-b-16">
|
||||||
|
<highlight-number :content="item.content" @phone-click="handlePhoneClick" />
|
||||||
|
<!-- <rich-text :nodes="item.content"></rich-text>-->
|
||||||
|
</view>
|
||||||
<view class="log-msg-date ss-m-b-40">
|
<view class="log-msg-date ss-m-b-40">
|
||||||
{{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
|
{{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -54,6 +58,7 @@
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive } from 'vue';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
|
import HighlightNumber from '@/pages/components/HighlightNumberText.vue';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
info: [],
|
info: [],
|
||||||
|
|
@ -74,7 +79,7 @@
|
||||||
|
|
||||||
async function getExpressDetail(id) {
|
async function getExpressDetail(id) {
|
||||||
const { data } = await OrderApi.getOrderExpressTrackList(id);
|
const { data } = await OrderApi.getOrderExpressTrackList(id);
|
||||||
state.tracks = data.reverse();
|
state.tracks = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getOrderDetail(id) {
|
async function getOrderDetail(id) {
|
||||||
|
|
@ -86,53 +91,117 @@
|
||||||
getExpressDetail(options.id);
|
getExpressDetail(options.id);
|
||||||
getOrderDetail(options.id);
|
getOrderDetail(options.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handlePhoneClick(data) {
|
||||||
|
handleClick(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick(data) {
|
||||||
|
const phoneNumber = data.phoneNumber;
|
||||||
|
|
||||||
|
if (!phoneNumber) return;
|
||||||
|
|
||||||
|
// 获取当前平台
|
||||||
|
const platform = uni.getSystemInfoSync().platform.toLowerCase();
|
||||||
|
|
||||||
|
if (platform === 'devtools') {
|
||||||
|
uni.showToast({ title: '真机才可拨打电话', icon: 'none' });
|
||||||
|
handleCopy(phoneNumber);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platform === 'wechat') {
|
||||||
|
uni.showToast({ title: '请手动拨打', icon: 'none' });
|
||||||
|
handleCopy(phoneNumber);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: phoneNumber,
|
||||||
|
success: () => {
|
||||||
|
console.log('拨打电话成功');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('拨打电话失败', err);
|
||||||
|
uni.showToast({ title: '拨号失败,请手动拨打', icon: 'none' });
|
||||||
|
handleCopy(phoneNumber);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCopy(text) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: text,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({ title: '已复制到剪贴板', icon: 'success' });
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({ title: '复制失败', icon: 'none' });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.highlight {
|
||||||
|
color: red; /* 高亮颜色 */
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.swiper-box {
|
.swiper-box {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-card {
|
.log-card {
|
||||||
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
|
border-top: 2rpx solid rgba(#dfdfdf, 0.5);
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
.log-card-img {
|
.log-card-img {
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-card-msg {
|
.log-card-msg {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
width: 490rpx;
|
width: 490rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
|
|
||||||
.warning-color {
|
.warning-color {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-content {
|
.log-content {
|
||||||
padding: 34rpx 20rpx 0rpx 20rpx;
|
padding: 34rpx 20rpx 0rpx 20rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
||||||
.log-content-box {
|
.log-content-box {
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-icon {
|
.log-icon {
|
||||||
height: inherit;
|
height: inherit;
|
||||||
|
|
||||||
.cicon-title {
|
.cicon-title {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-color {
|
.activity-color {
|
||||||
color: #f0c785;
|
color: #f0c785;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-color {
|
.info-color {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
@ -146,16 +215,18 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-msg-desc {
|
.log-msg-desc {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
line-height: 36rpx;
|
line-height: 36rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-msg-date {
|
.log-msg-date {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #999999;
|
color: #000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
class="content-img"
|
class="content-img"
|
||||||
isPreview
|
isPreview
|
||||||
:current="0"
|
:current="0"
|
||||||
:src="state.model?.avatar"
|
:src="state.model?.avatar || sheep.$url.static('/static/img/shop/default_avatar.png')"
|
||||||
:height="160"
|
:height="160"
|
||||||
:width="160"
|
:width="160"
|
||||||
:radius="80"
|
:radius="80"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import request, { getAccessToken } from '@/sheep/request';
|
||||||
|
|
||||||
const FileApi = {
|
const FileApi = {
|
||||||
// 上传文件
|
// 上传文件
|
||||||
uploadFile: (file, directory) => {
|
uploadFile: (file, directory = '') => {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '上传中',
|
title: '上传中',
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过网站域名获取租户信息
|
||||||
|
* @param {string} website - 网站域名
|
||||||
|
* @returns {Promise<Object>} 租户信息
|
||||||
|
*/
|
||||||
|
export function getTenantByWebsite(website) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant/get-by-website',
|
||||||
|
method: 'GET',
|
||||||
|
params: { website },
|
||||||
|
custom: {
|
||||||
|
isToken: false, // 避免登录情况下,跨租户访问被拦截
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -18,17 +18,16 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// 组件样式
|
// 组件样式
|
||||||
|
|
||||||
const elBackground = computed(() => {
|
const elBackground = computed(() => {
|
||||||
if (props.styles) {
|
if (props.styles) {
|
||||||
if (props.styles.bgType === 'color')
|
if (props.styles.bgType === 'color') {
|
||||||
return { background: props.styles.bgColor };
|
return { background: props.styles.bgColor };
|
||||||
if (props.styles.bgType === 'img')
|
}
|
||||||
|
if (props.styles.bgType === 'img') {
|
||||||
return {
|
return {
|
||||||
background: `url(${sheep.$url.cdn(
|
background: `url(${sheep.$url.cdn(props.styles.bgImg)}) no-repeat top center / 100% auto`,
|
||||||
props.styles.bgImage,
|
|
||||||
)}) no-repeat top center / 100% auto`,
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,13 @@
|
||||||
<view class="ss-flex-1" v-if="data.type === 'search'" :style="[{ width: width }]">
|
<view class="ss-flex-1" v-if="data.type === 'search'" :style="[{ width: width }]">
|
||||||
<s-search-block
|
<s-search-block
|
||||||
:placeholder="data.placeholder || '搜索关键字'"
|
:placeholder="data.placeholder || '搜索关键字'"
|
||||||
|
:placeholder-position="data.placeholderPosition"
|
||||||
:radius="data.borderRadius"
|
:radius="data.borderRadius"
|
||||||
elBackground="#fff"
|
:el-background="data.backgroundColor"
|
||||||
|
:font-color="data.textColor"
|
||||||
:height="height"
|
:height="height"
|
||||||
:width="width"
|
:width="width"
|
||||||
|
:show-scan="data.showScan"
|
||||||
@click="sheep.$router.go('/pages/index/search')"
|
@click="sheep.$router.go('/pages/index/search')"
|
||||||
></s-search-block>
|
></s-search-block>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
:autoplay="data.autoplay"
|
:autoplay="data.autoplay"
|
||||||
:interval="data.interval * 1000"
|
:interval="data.interval * 1000"
|
||||||
:mode="data.type"
|
:mode="data.type"
|
||||||
|
:height="px2rpx(data.height)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -28,6 +29,12 @@
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function px2rpx(px) {
|
||||||
|
//计算比例
|
||||||
|
let scale = uni.upx2px(100)/100;
|
||||||
|
return px/scale
|
||||||
|
}
|
||||||
|
|
||||||
const imgList = computed(() =>
|
const imgList = computed(() =>
|
||||||
props.data.items.map((item) => {
|
props.data.items.map((item) => {
|
||||||
const src = item.type === 'img' ? item.imgUrl : item.videoUrl;
|
const src = item.type === 'img' ? item.imgUrl : item.videoUrl;
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,28 @@
|
||||||
]"
|
]"
|
||||||
:class="[{ 'border-content': navbar }]"
|
:class="[{ 'border-content': navbar }]"
|
||||||
>
|
>
|
||||||
<view class="ss-flex ss-col-center" v-if="navbar">
|
<view
|
||||||
<view class="search-icon _icon-search ss-m-l-10" :style="[{ color: props.iconColor }]"></view>
|
class="ss-flex ss-col-center"
|
||||||
<view class="search-input ss-flex-1 ss-line-1" :style="[{ color: fontColor, width: width }]">
|
:class="[placeholderPosition === 'center' ? 'ss-row-center' : 'ss-row-left']"
|
||||||
|
v-if="navbar"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="search-icon _icon-search"
|
||||||
|
:style="{ color: fontColor, margin: '0 10rpx' }"
|
||||||
|
></view>
|
||||||
|
<view class="search-input ss-line-1" :style="{ color: fontColor }">
|
||||||
{{ placeholder }}
|
{{ placeholder }}
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 右侧扫一扫图标 -->
|
||||||
|
<view
|
||||||
|
v-if="showScan"
|
||||||
|
class="scan-icon _icon-scan"
|
||||||
|
:style="{ color: fontColor }"
|
||||||
|
@tap.stop="onScan"
|
||||||
|
style="margin-left: auto"
|
||||||
|
>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<uni-search-bar
|
<uni-search-bar
|
||||||
v-if="!navbar"
|
v-if="!navbar"
|
||||||
|
|
@ -34,8 +51,9 @@
|
||||||
class="ss-m-r-16"
|
class="ss-m-r-16"
|
||||||
:style="[{ color: data.textColor }]"
|
:style="[{ color: data.textColor }]"
|
||||||
@tap.stop="sheep.$router.go('/pages/goods/list', { keyword: item })"
|
@tap.stop="sheep.$router.go('/pages/goods/list', { keyword: item })"
|
||||||
>{{ item }}</view
|
|
||||||
>
|
>
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="data.hotKeywords && data.hotKeywords.length && navbar" class="ss-flex">
|
<view v-if="data.hotKeywords && data.hotKeywords.length && navbar" class="ss-flex">
|
||||||
|
|
@ -55,15 +73,15 @@
|
||||||
/**
|
/**
|
||||||
* 基础组件 - 搜索栏
|
* 基础组件 - 搜索栏
|
||||||
*
|
*
|
||||||
* @property {String} elBackground - 输入框背景色
|
* @property {String} elBackground - 输入框背景色
|
||||||
* @property {String} iconColor - 图标颜色
|
* @property {String} iconColor - 图标颜色
|
||||||
* @property {String} fontColor - 字体颜色
|
* @property {String} fontColor - 字体颜色
|
||||||
* @property {Number} placeholder - 默认placeholder
|
* @property {Number} placeholder - 默认placeholder
|
||||||
* @property {Number} topRadius - 组件上圆角
|
* @property {Number} topRadius - 组件上圆角
|
||||||
* @property {Number} bottomRadius - 组件下圆角
|
* @property {Number} bottomRadius - 组件下圆角
|
||||||
*
|
*
|
||||||
* @slot keywords - 关键字
|
* @slot keywords - 关键字
|
||||||
* @event {Function} click - 点击组件时触发
|
* @event {Function} click - 点击组件时触发
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive } from 'vue';
|
||||||
|
|
@ -107,6 +125,16 @@
|
||||||
type: String,
|
type: String,
|
||||||
default: '这是一个搜索框',
|
default: '这是一个搜索框',
|
||||||
},
|
},
|
||||||
|
// placeholder位置(left | center)
|
||||||
|
placeholderPosition: {
|
||||||
|
type: String,
|
||||||
|
default: 'left',
|
||||||
|
},
|
||||||
|
// 是否显示扫一扫图标
|
||||||
|
showScan: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
radius: {
|
radius: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 10,
|
default: 10,
|
||||||
|
|
@ -134,6 +162,116 @@
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫一扫功能
|
||||||
|
*/
|
||||||
|
function onScan() {
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: false,
|
||||||
|
sound: 'default',
|
||||||
|
scanType: ['qrCode', 'barCode'],
|
||||||
|
success: (res) => {
|
||||||
|
showScanResult(res.result);
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error(err);
|
||||||
|
uni.showToast({
|
||||||
|
title: err.errMsg === 'scanCode:fail cancel' ? '操作已取消' : '扫码失败',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测是否为有效URL
|
||||||
|
* @param {string} str 待检测字符串
|
||||||
|
* @returns {boolean} 是否为有效URL
|
||||||
|
*/
|
||||||
|
function isValidUrl(str) {
|
||||||
|
try {
|
||||||
|
// 微信环境专用验证方式
|
||||||
|
const url = str.trim();
|
||||||
|
return (
|
||||||
|
(url.startsWith('http://') || url.startsWith('https://') || url.startsWith('ftp://')) &&
|
||||||
|
// 简单长度验证
|
||||||
|
url.length >= 10
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展示扫码结果并处理用户操作
|
||||||
|
* @param {string} text 扫码得到的内容
|
||||||
|
*/
|
||||||
|
function showScanResult(text) {
|
||||||
|
const isUrl = isValidUrl(text);
|
||||||
|
// 显示结果弹窗
|
||||||
|
uni.showModal({
|
||||||
|
title: '扫描结果',
|
||||||
|
content: text,
|
||||||
|
confirmText: isUrl ? '访问' : '复制',
|
||||||
|
cancelText: '取消',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
if (isUrl) {
|
||||||
|
handleUrl(text);
|
||||||
|
} else {
|
||||||
|
handleCopy(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理URL跳转
|
||||||
|
* @param {string} url 要访问的URL
|
||||||
|
*/
|
||||||
|
function handleUrl(url) {
|
||||||
|
// 方案1:跳转到webview页面(推荐)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/public/webview?url=${encodeURIComponent(url)}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 方案2:直接复制链接(备选方案)
|
||||||
|
/*
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: url,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '链接已复制,请在浏览器打开',
|
||||||
|
icon: 'success',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理文本复制
|
||||||
|
* @param {string} text 要复制的文本
|
||||||
|
*/
|
||||||
|
function handleCopy(text) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: text,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已复制到剪贴板',
|
||||||
|
icon: 'success',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '复制失败,请重试',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
@ -151,6 +289,11 @@
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scan-icon {
|
||||||
|
font-size: 38rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.keyword-link {
|
.keyword-link {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 16rpx;
|
right: 16rpx;
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
});
|
});
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
selectedSku: {}, // 选中的 SKU
|
selectedSku: {}, // 选中的 SKU
|
||||||
currentPropertyArray: [], // 当前选中的属性,实际是个 Map。key 是 property 编号,value 是 value 编号
|
currentPropertyArray: {}, // 当前选中的属性,实际是个 Map。key 是 property 编号,value 是 value 编号
|
||||||
grouponNum: props.grouponNum,
|
grouponNum: props.grouponNum,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@
|
||||||
noChooseValueIds.splice(index, 1);
|
noChooseValueIds.splice(index, 1);
|
||||||
} else {
|
} else {
|
||||||
// 循环去除当前已选择的 value 属性值 id
|
// 循环去除当前已选择的 value 属性值 id
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId.toString() !== '') {
|
if (currentPropertyId.toString() !== '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -229,8 +229,8 @@
|
||||||
let choosePropertyIds = [];
|
let choosePropertyIds = [];
|
||||||
if (!isChecked) {
|
if (!isChecked) {
|
||||||
// 当前已选择的 property
|
// 当前已选择的 property
|
||||||
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentValueId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyIds.push(currentValueId);
|
choosePropertyIds.push(currentValueId);
|
||||||
}
|
}
|
||||||
|
|
@ -261,9 +261,9 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let isOk = true;
|
let isOk = true;
|
||||||
state.currentPropertyArray.forEach((propertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
|
||||||
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
|
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
|
||||||
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
|
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
|
||||||
isOk = false;
|
isOk = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -292,7 +292,7 @@
|
||||||
|
|
||||||
// 选中的 property 大类
|
// 选中的 property 大类
|
||||||
let choosePropertyId = [];
|
let choosePropertyId = [];
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentPropertyId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyId.push(currentPropertyId);
|
choosePropertyId.push(currentPropertyId);
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
goodsInfo: computed(() => props.modelValue),
|
goodsInfo: computed(() => props.modelValue),
|
||||||
selectedSku: {},
|
selectedSku: {},
|
||||||
currentPropertyArray: [],
|
currentPropertyArray: {},
|
||||||
});
|
});
|
||||||
const getShowPriceText = computed(() => {
|
const getShowPriceText = computed(() => {
|
||||||
let priceText = `¥${fen2yuan(state.goodsInfo.price)}`;
|
let priceText = `¥${fen2yuan(state.goodsInfo.price)}`;
|
||||||
|
|
@ -209,7 +209,7 @@
|
||||||
noChooseValueIds.splice(index, 1);
|
noChooseValueIds.splice(index, 1);
|
||||||
} else {
|
} else {
|
||||||
// 循环去除当前已选择的 value 属性值 id
|
// 循环去除当前已选择的 value 属性值 id
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId.toString() !== '') {
|
if (currentPropertyId.toString() !== '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -226,8 +226,8 @@
|
||||||
let choosePropertyIds = [];
|
let choosePropertyIds = [];
|
||||||
if (!isChecked) {
|
if (!isChecked) {
|
||||||
// 当前已选择的 property
|
// 当前已选择的 property
|
||||||
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentValueId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyIds.push(currentValueId);
|
choosePropertyIds.push(currentValueId);
|
||||||
}
|
}
|
||||||
|
|
@ -258,9 +258,9 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let isOk = true;
|
let isOk = true;
|
||||||
state.currentPropertyArray.forEach((propertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
|
||||||
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
|
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
|
||||||
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
|
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
|
||||||
isOk = false;
|
isOk = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -289,7 +289,7 @@
|
||||||
|
|
||||||
// 选中的 property 大类
|
// 选中的 property 大类
|
||||||
let choosePropertyId = [];
|
let choosePropertyId = [];
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentPropertyId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyId.push(currentPropertyId);
|
choosePropertyId.push(currentPropertyId);
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
selectedSku: {}, // 选中的 SKU
|
selectedSku: {}, // 选中的 SKU
|
||||||
currentPropertyArray: [], // 当前选中的属性,实际是个 Map。key 是 property 编号,value 是 value 编号
|
currentPropertyArray: {}, // 当前选中的属性,实际是个 Map。key 是 property 编号,value 是 value 编号
|
||||||
});
|
});
|
||||||
|
|
||||||
const propertyList = convertProductPropertyList(props.goodsInfo.skus);
|
const propertyList = convertProductPropertyList(props.goodsInfo.skus);
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
noChooseValueIds.splice(index, 1);
|
noChooseValueIds.splice(index, 1);
|
||||||
} else {
|
} else {
|
||||||
// 循环去除当前已选择的 value 属性值 id
|
// 循环去除当前已选择的 value 属性值 id
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId.toString() !== '') {
|
if (currentPropertyId.toString() !== '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -219,8 +219,8 @@
|
||||||
let choosePropertyIds = [];
|
let choosePropertyIds = [];
|
||||||
if (!isChecked) {
|
if (!isChecked) {
|
||||||
// 当前已选择的 property
|
// 当前已选择的 property
|
||||||
state.currentPropertyArray.forEach((currentPropertyId, currentValueId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentValueId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentValueId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyIds.push(currentValueId);
|
choosePropertyIds.push(currentValueId);
|
||||||
}
|
}
|
||||||
|
|
@ -251,9 +251,9 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let isOk = true;
|
let isOk = true;
|
||||||
state.currentPropertyArray.forEach((propertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, valueId]) => {
|
||||||
// propertyId 不为空,并且,这个 条 sku 没有被选中,则排除
|
// valueId 不为空,并且,这个 条 sku 没有被选中,则排除
|
||||||
if (propertyId.toString() !== '' && sku.value_id_array.indexOf(propertyId) < 0) {
|
if (valueId.toString() !== '' && sku.value_id_array.indexOf(valueId) < 0) {
|
||||||
isOk = false;
|
isOk = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -282,7 +282,7 @@
|
||||||
|
|
||||||
// 选中的 property 大类
|
// 选中的 property 大类
|
||||||
let choosePropertyId = [];
|
let choosePropertyId = [];
|
||||||
state.currentPropertyArray.forEach((currentPropertyId) => {
|
Object.entries(state.currentPropertyArray).forEach(([propertyId, currentPropertyId]) => {
|
||||||
if (currentPropertyId !== '') {
|
if (currentPropertyId !== '') {
|
||||||
// currentPropertyId 为空是反选 填充的
|
// currentPropertyId 为空是反选 填充的
|
||||||
choosePropertyId.push(currentPropertyId);
|
choosePropertyId.push(currentPropertyId);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
import { formatImageUrlProtocol, getWxaQrcode } from './index';
|
||||||
|
import { measureTextWidth } from '@/utils/textUtils'; // 引入新封装的方法
|
||||||
const user = async (poster) => {
|
const user = async (poster) => {
|
||||||
const width = poster.width;
|
const width = poster.width;
|
||||||
const userInfo = sheep.$store('user').userInfo;
|
const userInfo = sheep.$store('user').userInfo;
|
||||||
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
const wxa_qrcode = await getWxaQrcode(poster.shareInfo.path, poster.shareInfo.query);
|
||||||
|
const widthNickName = measureTextWidth(userInfo.nickname, 14); // 使用新方法
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'image',
|
type: 'image',
|
||||||
|
|
@ -28,7 +29,7 @@ const user = async (poster) => {
|
||||||
fontFamily: 'sans-serif',
|
fontFamily: 'sans-serif',
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
top: width * 0.4,
|
top: width * 0.4,
|
||||||
left: width / 2,
|
left: (width-widthNickName) / 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ function uploadCloudFiles(files, max = 5, onUploadProgress) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadFilesFromPath(path, directory) {
|
function uploadFilesFromPath(path, directory = '') {
|
||||||
// 目的:用于微信小程序,选择图片时,只有 path
|
// 目的:用于微信小程序,选择图片时,只有 path
|
||||||
return uploadFiles(
|
return uploadFiles(
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
|
|
@ -251,7 +251,7 @@ async function uploadFiles(choosePromise, { onChooseFile, onUploadProgress, dire
|
||||||
} else {
|
} else {
|
||||||
// 后端上传
|
// 后端上传
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
const { data } = await FileApi.uploadFile(file.path);
|
const { data } = await FileApi.uploadFile(file.path, directory);
|
||||||
file.url = data;
|
file.url = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<view class="left-box ss-flex ss-col-center ss-m-l-36">
|
<view class="left-box ss-flex ss-col-center ss-m-l-36">
|
||||||
<view class="avatar-box ss-m-r-24">
|
<view class="avatar-box ss-m-r-24">
|
||||||
<image class="avatar-img" :src="
|
<image class="avatar-img" :src="
|
||||||
isLogin
|
isLogin && userInfo.avatar
|
||||||
? sheep.$url.cdn(userInfo.avatar)
|
? sheep.$url.cdn(userInfo.avatar)
|
||||||
: sheep.$url.static('/static/img/shop/default_avatar.png')"
|
: sheep.$url.static('/static/img/shop/default_avatar.png')"
|
||||||
mode="aspectFill" @tap="sheep.$router.go('/pages/user/info')">
|
mode="aspectFill" @tap="sheep.$router.go('/pages/user/info')">
|
||||||
|
|
|
||||||
|
|
@ -631,10 +631,13 @@ function pages() {
|
||||||
export function getRootUrl() {
|
export function getRootUrl() {
|
||||||
let url = '';
|
let url = '';
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
url = location.origin + location.pathname;
|
url = location.origin;
|
||||||
|
// + location.pathname;
|
||||||
|
|
||||||
if (location.hash !== '') {
|
if (location.hash !== '') {
|
||||||
url += '#/';
|
url += '#/';
|
||||||
|
} else {
|
||||||
|
url += '/';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
return url;
|
return url;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
||||||
const url = location.href.split('#')[0];
|
const url = location.origin;
|
||||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
|
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
jweixin.config({
|
jweixin.config({
|
||||||
|
|
@ -43,6 +43,7 @@ export default {
|
||||||
'chooseWXPay',
|
'chooseWXPay',
|
||||||
'openLocation',
|
'openLocation',
|
||||||
'getLocation',
|
'getLocation',
|
||||||
|
'updateAppMessageShareData',
|
||||||
'updateTimelineShareData',
|
'updateTimelineShareData',
|
||||||
'scanQRCode',
|
'scanQRCode',
|
||||||
], // TODO 芋艿:后续可以设置更多权限;
|
], // TODO 芋艿:后续可以设置更多权限;
|
||||||
|
|
@ -55,13 +56,11 @@ export default {
|
||||||
// 监听结果
|
// 监听结果
|
||||||
configSuccess = true;
|
configSuccess = true;
|
||||||
jweixin.error((err) => {
|
jweixin.error((err) => {
|
||||||
debugger;
|
|
||||||
configSuccess = false;
|
configSuccess = false;
|
||||||
console.error('微信 JSSDK 初始化失败', err);
|
console.error('微信 JSSDK 初始化失败', err);
|
||||||
// $helper.toast('微信JSSDK:' + err.errMsg);
|
$helper.toast('微信JSSDK:' + err.errMsg);
|
||||||
});
|
});
|
||||||
jweixin.ready(() => {
|
jweixin.ready(() => {
|
||||||
debugger;
|
|
||||||
if (configSuccess) {
|
if (configSuccess) {
|
||||||
console.log('微信 JSSDK 初始化成功');
|
console.log('微信 JSSDK 初始化成功');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,7 @@ export default class SheepPay {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @芋艿:【可优化】如果是沙箱支付,EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX),相关 https://t.zsxq.com/yjyJQ
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'alipay',
|
provider: 'alipay',
|
||||||
orderInfo: data.displayContent, // 直接使用返回的支付参数
|
orderInfo: data.displayContent, // 直接使用返回的支付参数
|
||||||
|
|
@ -263,8 +264,16 @@ export default class SheepPay {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析支付参数
|
// 解析支付参数
|
||||||
const payConfig = JSON.parse(data.displayContent);
|
let payConfig = JSON.parse(data.displayContent);
|
||||||
|
if(typeof payConfig.appId === 'undefined'){
|
||||||
|
payConfig.appId = payConfig.appid;
|
||||||
|
}
|
||||||
|
if(typeof payConfig.nonceStr === 'undefined'){
|
||||||
|
payConfig.nonceStr = payConfig.noncestr;
|
||||||
|
}
|
||||||
|
if(typeof payConfig.timeStamp === 'undefined'){
|
||||||
|
payConfig.timeStamp = payConfig.timestamp;
|
||||||
|
}
|
||||||
// 调用微信支付
|
// 调用微信支付
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ const options = {
|
||||||
loadingMsg: '加载中',
|
loadingMsg: '加载中',
|
||||||
// 需要授权才能请求 默认放开
|
// 需要授权才能请求 默认放开
|
||||||
auth: false,
|
auth: false,
|
||||||
// ...
|
// 是否传递 token
|
||||||
|
isToken: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Loading全局实例
|
// Loading全局实例
|
||||||
|
|
@ -90,14 +91,14 @@ http.interceptors.request.use(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
|
// 增加 token 令牌、terminal 终端、tenant 租户的请求头
|
||||||
const token = getAccessToken();
|
const token = config.custom.isToken ? getAccessToken() : undefined;
|
||||||
if (token) {
|
if (token) {
|
||||||
config.header['Authorization'] = token;
|
config.header['Authorization'] = token;
|
||||||
}
|
}
|
||||||
config.header['terminal'] = getTerminal();
|
config.header['terminal'] = getTerminal();
|
||||||
|
|
||||||
config.header['Accept'] = '*/*';
|
config.header['Accept'] = '*/*';
|
||||||
config.header['tenant-id'] = tenantId;
|
config.header['tenant-id'] = getTenantId();
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|
@ -297,6 +298,11 @@ export const getRefreshToken = () => {
|
||||||
return uni.getStorageSync('refresh-token');
|
return uni.getStorageSync('refresh-token');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 获得租户编号 */
|
||||||
|
export const getTenantId = () => {
|
||||||
|
return uni.getStorageSync('tenant-id') || tenantId;
|
||||||
|
};
|
||||||
|
|
||||||
const request = (config) => {
|
const request = (config) => {
|
||||||
return http.middleware(config);
|
return http.middleware(config);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'colorui'; /* Project id 2620914 */
|
font-family: 'colorui'; /* Project id 2620914 */
|
||||||
src: url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAA08AAsAAAAAIIAAAAzuAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACIUgqqHKM2ATYCJAOBJAtUAAQgBYR5B4MwGwIcs6JmclIAsv9LAT3W/EiCkXnK3Xny3Onomo8T7OwIi5b6OurgI7NQyMA0DecgDbMUXzZtybquth6v1ed4jzlbhWe8oZQGrbWZlVt/3xesuXQIRTwSkka/imlMNEIkda7mMvhA4790wiQPssgK0F3uNkCb2eyTq63TFabC13bqKnT/f9r2XRijHkYPBoxYQdioY200RxgzwE6Gn4NsYyX+qsD9VRvVQwAcs1sVVQBPpMFHVTiQ0SY0khn2Z8ycgyURv1jvJyjWdAPEHyCPBYW6EyErvLhvBgDU54DA7uCctjbtpwoHYQbOEsApsYk9Q2BggezBcZ+bo/+fmistkypBinEV7nXZqewmBwsHezD9/D5TnvCgwKyQciUAWeHIo6/ynRppC6ZrdCN/KHpRo/+MrZoHW6HrYDSjXzAweu/6SUCAN2ef1Ty/fTAGK8mlMeSwViRETblKImm0Hp1UQTJZa0G9Yhj8okHsxS/As/ft+UiSgYCgQ7AutDE508bX574s8v4P3VE/lPo82JkFQAMkYMowlxgUF7Bv2AGa8oiXfRpOYI4LXCTyWoFlG+zFKuqMab5PL8+X18tXf7FkeEnXczQarXBs0Sv6CQppD6S+92ewm2hT9tS1yjKWvNppv6d++Ar+Gf/X8z/lsbZxdLK1s1dSVdNxMFTWUeEFUVLR1dVTUCBBUloGZuYmVhILU0syUWhcBzJvvPJEcETWREBkQwRFjkRIptI4RLZETWRH1EX2RE+kBDEQaUFsRNrEjumAHsAcQE9ghqDPwNqjr2BGoO9gKqAfYKqgn2Bq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aVmj3JomO8uzbxIxViOH1QwQOEIB/82VBlpjh8UC7HzbOIIG0CkALkKAMKLlxZDOOIjARIiERIjAkmQFSKRNZIiGXIU2GCLHfY4oGQMFCrG4sg41NA4weCMC6644Y4HnnjhjQ+++DnwSBYCToSQXVFfqZvK6pblO4+PQ7B9IgbOiK+sSSvMrp2Pw3oS/pJtruAAWQSXUlE+5FWDGUtK+NIpgkNkVOLAc1OTd6BTSQDB1aBjVRZCmrL4DBci4MMBL8HTibgjBsaAa3CTSAIrYc5EIJCgfI6lYmNJCW+z5Aq4UQCAykKJHMGzbRRAl0YBOEcEsCFkafkER+6NVxcb5wpr51YmhgYlnnVJicEBJBAAAA==')
|
||||||
format('woff2');
|
format('woff2');
|
||||||
/* #ifdef MP-ALIPAY */
|
/* #ifdef MP-ALIPAY */
|
||||||
src: url('//at.alicdn.com/t/font_2620914_57y9q5zpbel.woff?t=1624238023908') format('woff'),
|
src: url('//at.alicdn.com/t/font_2620914_57y9q5zpbel.woff?t=1624238023908') format('woff'),
|
||||||
|
|
@ -179,3 +179,7 @@
|
||||||
._icon-move-round-o:before {
|
._icon-move-round-o:before {
|
||||||
content: '\e603';
|
content: '\e603';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
._icon-scan:before {
|
||||||
|
content: '\e85d';
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
import DiyApi from '@/sheep/api/promotion/diy';
|
import DiyApi from '@/sheep/api/promotion/diy';
|
||||||
|
import { getTenantByWebsite } from '@/sheep/api/infra/tenant';
|
||||||
|
import { getTenantId } from '@/sheep/request';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import $platform from '@/sheep/platform';
|
import $platform from '@/sheep/platform';
|
||||||
import $router from '@/sheep/router';
|
import $router from '@/sheep/router';
|
||||||
|
|
@ -60,6 +62,9 @@ const app = defineStore({
|
||||||
$router.error('EnvError');
|
$router.error('EnvError');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载租户
|
||||||
|
await adaptTenant();
|
||||||
|
|
||||||
// 加载装修配置
|
// 加载装修配置
|
||||||
await adaptTemplate(this.template, templateId);
|
await adaptTemplate(this.template, templateId);
|
||||||
|
|
||||||
|
|
@ -68,7 +73,7 @@ const app = defineStore({
|
||||||
this.info = {
|
this.info = {
|
||||||
name: '芋道商城',
|
name: '芋道商城',
|
||||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||||
version: '2.6.0',
|
version: '2025.09',
|
||||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||||
copytime: 'Copyright© 2018-2025',
|
copytime: 'Copyright© 2018-2025',
|
||||||
|
|
||||||
|
|
@ -119,6 +124,55 @@ const app = defineStore({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** 初始化租户编号 */
|
||||||
|
const adaptTenant = async () => {
|
||||||
|
// 1. 获取当前租户 ID
|
||||||
|
const oldTenantId = getTenantId();
|
||||||
|
let newTenantId = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 2.1 情况一:H5:根据 url 参数、域名来获取新的租户ID
|
||||||
|
// #ifdef H5
|
||||||
|
// H5 环境下的处理逻辑
|
||||||
|
if (window?.location) {
|
||||||
|
// 优先从 URL 查询参数获取 tenantId
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
newTenantId = urlParams.get('tenantId');
|
||||||
|
|
||||||
|
// 如果 URL 参数中没有,则通过 host 获取
|
||||||
|
if (!newTenantId && window.location.host) {
|
||||||
|
const { data } = await getTenantByWebsite(window.location.host);
|
||||||
|
newTenantId = data?.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 2.2 情况二:微信小程序:小程序环境下的处理逻辑 - 根据 appId 获取租户
|
||||||
|
// #ifdef MP
|
||||||
|
const appId = uni.getAccountInfoSync()?.miniProgram?.appId;
|
||||||
|
if (appId) {
|
||||||
|
const { data } = await getTenantByWebsite(appId);
|
||||||
|
newTenantId = data?.id;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// 3. 如果是新租户(不相等),则进行切换
|
||||||
|
// noinspection EqualityComparisonWithCoercionJS
|
||||||
|
if (newTenantId && newTenantId != oldTenantId) {
|
||||||
|
// 清理掉登录用户的 token
|
||||||
|
const userStore = user();
|
||||||
|
userStore.setToken();
|
||||||
|
|
||||||
|
// 设置新的 tenantId 到本地存储
|
||||||
|
uni.setStorageSync('tenant-id', newTenantId);
|
||||||
|
console.log('租户 ID 已更新:', `${oldTenantId} -> ${newTenantId}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('adaptTenant 执行失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 初始化装修模版 */
|
||||||
const adaptTemplate = async (appTemplate, templateId) => {
|
const adaptTemplate = async (appTemplate, templateId) => {
|
||||||
const { data: diyTemplate } = templateId
|
const { data: diyTemplate } = templateId
|
||||||
? // 查询指定模板,一般是预览时使用
|
? // 查询指定模板,一般是预览时使用
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
// sheep/utils/textUtils.js
|
||||||
|
export function measureTextWidth(text, fontSize = 14, fontFamily = 'sans-serif') {
|
||||||
|
// 钉钉小程序没有 uni.createCanvasContext 方法
|
||||||
|
if (typeof uni === 'undefined' || typeof uni.createCanvasContext !== 'function') {
|
||||||
|
return estimateTextWidth(text, fontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const ctx = uni.createCanvasContext('tempCanvasForText');
|
||||||
|
ctx.setFontSize(fontSize);
|
||||||
|
ctx.font = `${fontSize}px ${fontFamily}`;
|
||||||
|
const metrics = ctx.measureText(text);
|
||||||
|
return metrics.width;
|
||||||
|
} catch (e) {
|
||||||
|
// 某些平台可能不支持 measureText,降级使用估算
|
||||||
|
return estimateTextWidth(text, fontSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 简单估算中文和英文字符宽度
|
||||||
|
function estimateTextWidth(text, fontSize = 14) {
|
||||||
|
let width = 0;
|
||||||
|
for (let i = 0; i < text.length; i++) {
|
||||||
|
const charCode = text.charCodeAt(i);
|
||||||
|
if (charCode >= 0x4e00 && charCode <= 0x9fff) {
|
||||||
|
// 中文字符
|
||||||
|
width += fontSize;
|
||||||
|
} else {
|
||||||
|
// 英文字符
|
||||||
|
width += fontSize * 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return width;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue