feat: 添加组件配置文件并优化页面结构

- 新增 components.d.json 文件,包含所有组件的属性配置
- 添加 card-item-plugin 组件及其相关文件(json、ts、wxml、wxss)
- 在 app.json 中添加新的生产流程管理页面路径
- 添加多个SVG图标文件用于菜单项
- 重构 popup-plugin 组件样式和关闭逻辑
- 更新 tab-bar-plugin 的激活状态逻辑
- 优化 search-popup 使用全局样式类
- 在首页添加菜单配置和页面跳转功能
- 调整组件样式细节和间距
This commit is contained in:
zhengw
2026-01-14 16:54:47 +08:00
parent 0d58fc80f4
commit b1ecd88641
58 changed files with 971 additions and 386 deletions

View File

@@ -3,45 +3,21 @@
"pages/index/index", "pages/index/index",
"pages/agreement/agreement", "pages/agreement/agreement",
"pages/my/my", "pages/my/my",
"pages/processEntry/processEntry" "pages/processEntry/processEntry",
"pages/produce/processManage/processManage",
"pages/produce/processManageDetail/processManageDetail"
], ],
"window": { "window": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "易宝赞管理系统普惠版", "navigationBarTitleText": "易宝赞普惠版",
"navigationBarBackgroundColor": "#ffffff" "navigationBarBackgroundColor": "#ffffff"
}, },
"componentFramework": "glass-easel", "componentFramework": "glass-easel",
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"usingComponents": { "usingComponents": {
"page-plugin": "pages/components/page-plugin/page-plugin", "page-plugin": "pages/components/page-plugin/page-plugin",
"no-auth-plugin": "pages/components/no-auth-plugin/no-auth-plugin",
"t-button": "tdesign-miniprogram/button/button" "t-button": "tdesign-miniprogram/button/button"
}, },
"tabBar": {
"color": "#333333",
"selectedColor": "#0052d9",
"borderStyle": "black",
"list": [
{
"iconPath": "assets/home.png",
"selectedIconPath": "assets/home2.png",
"pagePath": "pages/index/index",
"text": "首页"
},
{
"iconPath": "assets/scan.png",
"selectedIconPath": "assets/scan2.png",
"pagePath": "pages/processEntry/processEntry",
"text": "扫码"
},
{
"iconPath": "assets/user.png",
"selectedIconPath": "assets/user2.png",
"pagePath": "pages/my/my",
"text": "我的"
}
]
},
"resolveAlias": { "resolveAlias": {
"@/*": "/*" "@/*": "/*"
} }

View File

@@ -12,3 +12,9 @@ view.t-input {
view.t-popup__close { view.t-popup__close {
padding: 6px; padding: 6px;
} }
/*
page {
--td-button-small-height: 34px;
--td-button-small-height: 34px;
} */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M212.924 434.56h-60.881V71.908h60.881V434.56z m149.56-362.652h-86.03V434.56h86.03V71.908z m111.842 0H431.31V434.56h43.015l0.001-362.652z m151.544 0H525.28V434.56h100.59V71.908z m88.676 0h-25.148V434.56h25.148V71.908z m70.148 0h-33.089V434.56h33.089V71.908z m91.326 0h-64.854V434.56h64.854V71.908z m-6.285 394.083h-58.569V638.8h58.569V465.991z m121.27-31.431h-86.91v31.433h86.91V434.56zM211.77 461.949h-58.572v172.808h58.57V461.949h0.002z m-89.866-27.389H34.995v31.433h86.909V434.56z m600.584 126.252v34.613a270.753 270.753 0 0 1-48.906 155.214L600.72 854.782v93.31H419.4v-93.31l-72.862-104.143a270.76 270.76 0 0 1-48.906-155.214v-34.613c0-37.384 30.305-67.69 67.691-67.69h289.474c37.385 0.002 67.691 30.309 67.691 67.69z m-106.356 20.384H395.72c21.622 38.569 62.84 64.677 110.205 64.677s88.584-26.104 110.207-64.677z" fill="#EA5455"></path></svg>

After

Width:  |  Height:  |  Size: 957 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16z m-564 76v168H176V716h168z m84-408V140h168v168H428z m420 576H680V716h168v168z" fill="#0396FF"></path></svg>

After

Width:  |  Height:  |  Size: 774 B

View File

@@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M860.99968 62.16192H159.0016c-35.3024 0.10752-63.89248 28.6976-64 64v767.68256c0.10752 35.3024 28.6976 63.89248 64 64h701.99808c35.3024-0.10752 63.89248-28.6976 64-64V126.16192c-0.1024-35.3024-28.6976-63.8976-64-64z m0 831.58016l-0.10752 0.10752H159.11936l-0.10752-0.10752V126.26944l0.10752-0.10752h701.76256l0.10752 0.10752 0.01024 767.47264z" fill="#0052d9"></path><path d="M317.06112 286.23872h383.26784a32 32 0 0 0 0-64H317.06112a32 32 0 1 0 0 64z m0 127.84128h383.26784a32 32 0 0 0 0-64H317.06112a32 32 0 1 0 0 64z m128.03072 65.20832h-128a32 32 0 1 0 0 64h128a32 32 0 0 0 0-64zM704.52736 585.40032c4.4544 8.57088 8.82176 17.5616 13.1072 26.9568h74.68544v22.01088h-80.36864v13.5936h71.46496v20.52608h-71.46496v13.59872h71.46496v20.52608h-71.46496v13.8496h83.82976v22.5024h-175.57504v6.6816h-32.64v-68.49536a304.46592 304.46592 0 0 1-14.09536 15.07328c-4.28544-13.83936-8.89344-26.20416-13.84448-37.08928 19.77856-19.28704 36.18304-41.6256 49.20832-67.01056l34.37056 7.66464a541.17376 541.17376 0 0 1-9.14432 16.56832h45.50144a550.4 550.4 0 0 0-9.6512-20.28032l34.61632-6.67648z m-115.97824 245.55008v-80.86016h191.40096v80.86016h-35.61472v-9.64608h-120.17664v9.64608h-35.6096z m31.65184-196.58752v13.5936h59.10016v-13.5936h-59.10016z m0 47.72352h59.10016v-13.59872h-59.10016v13.59872z m0 34.37568h59.10016v-13.8496h-59.10016v13.8496z m124.1344 59.59168h-120.17664v19.29216h120.17664v-19.29216z" fill="#0052d9"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,24 @@
Component({
options: { multipleSlots: true },
/**
* 组件的属性列表
*/
properties: {
label: null,
value: null,
customStyle: null,
labelStyle: null,
valueStyle: null,
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {},
});

View File

@@ -0,0 +1,11 @@
<view class="card-item" style="{{ customStyle }}">
<view class="label" style="{{ labelStyle }}">
{{ label || '' }}
<slot name="label" />
</view>
<view class="value" style="{{ valueStyle }}">
{{ value || '' }}
<slot name="value" />
</view>
</view>

View File

@@ -0,0 +1,23 @@
.card-item {
display: flex;
align-items: center;
justify-content: space-between;
line-height: 1.57;
}
.label,
.value {
min-width: 0;
word-break: break-all;
flex-shrink: 0;
}
.label {
width: var(--label-width, 5em);
}
.value {
flex: 1;
display: inline-flex;
justify-content: flex-end;
}

View File

@@ -27,6 +27,7 @@ Component({
*/ */
data: { data: {
showMore: false, showMore: false,
showMoreBar: false,
}, },
/** /**
* 组件的方法列表 * 组件的方法列表

View File

@@ -1,4 +1,4 @@
<view class="card_plugin {{className}}" style="border: 1rpx solid #ddd;margin-bottom: 12px;border-radius: 4px;{{style}};{{customStyle}}" bind:tap="click"> <view class="card_plugin {{className}}" style="border: 1rpx solid #ddd;margin-bottom: 12px;border-radius: 4px;{{customStyle}}" bind:tap="click">
<view class="header" style="border-bottom: 1rpx solid #ddd;padding: 8px 12px;font-weight: bold;{{headerStyle || ''}}"> <view class="header" style="border-bottom: 1rpx solid #ddd;padding: 8px 12px;font-weight: bold;{{headerStyle || ''}}">
<slot name="header" /> <slot name="header" />
</view> </view>

View File

@@ -9,14 +9,14 @@
display: none; display: none;
} }
.footer > view { .footer>view {
border-top: 1rpx solid #ddd; border-top: 1rpx solid #ddd;
padding: 8px 0 0 12px; padding: 16rpx 0 0 24rpx;
display: flex; display: flex;
width: 100%; width: 100%;
} }
.footer > view:empty { .footer>view:empty {
display: none; display: none;
} }
@@ -25,8 +25,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 14px; font-size: 0.875em;
height: 26px; height: 52rpx;
} }
.show-more:active { .show-more:active {

View File

@@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"t-popup": "tdesign-miniprogram/popup/popup" "t-popup": "tdesign-miniprogram/popup/popup",
"t-icon": "tdesign-miniprogram/icon/icon"
} }
} }

View File

@@ -24,5 +24,9 @@ Component({
this.triggerEvent("close"); this.triggerEvent("close");
} }
}, },
onClose() {
this.setData({ open: false });
this.triggerEvent("close");
},
}, },
}); });

View File

@@ -1,11 +1,7 @@
<t-popup <t-popup visible="{{visible}}" bind:visible-change="onVisibleChange" placement="{{placement || 'bottom'}}">
visible="{{visible}}" <view class="p-header">
bind:visible-change="onVisibleChange" <view class="title">{{title}}</view>
placement="{{placement || 'bottom'}}" <t-icon name="close" size="60rpx" bind:tap="onClose" />
close-btn
>
<view style="border-bottom: 1px solid #ddd;">
<view style="padding: 12px 12px;">{{title}}</view>
</view> </view>
<view style="max-height: 70vh;overflow: auto;"> <view style="max-height: 70vh;overflow: auto;">
<slot/> <slot/>

View File

@@ -1 +1,18 @@
.title {
flex: 1;
text-align: center;
font-weight: bold;
font-size: 32rpx;
color: var(--td-text-color-primary);
}
.p-header {
border-bottom: 1rpx solid #ddd;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: calc(var(--td-popup-border-radius, var(--td-radius-extraLarge, 24rpx)) * 0.5);
padding-left: calc(var(--td-popup-border-radius, var(--td-radius-extraLarge, 24rpx)) * 0.5);
padding-top: 12rpx;
padding-bottom: 12rpx;
}

View File

@@ -1,5 +1,5 @@
Component({ Component({
options: { multipleSlots: true }, options: { multipleSlots: true, addGlobalClass: true },
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */

View File

@@ -1,61 +1,60 @@
<view style="display: flex;align-items: center;margin-bottom: 12px;{{customStyle}}"> <view style="display: flex;align-items: center;margin-bottom: 12px;{{customStyle}}">
<view style="flex: 1;margin-right: {{hideMore ? 0 : '12px'}};"> <view style="flex: 1;margin-right: {{hideMore ? 0 : '12px'}};">
<block wx:if="{{useInputSlot}}"> <block wx:if="{{useInputSlot}}">
<slot name='input' /> <slot name='input' />
</block> </block>
<block wx:else> <block wx:else>
<t-input <t-input
wx:if="{{!hideInput}}" wx:if="{{!hideInput}}"
placeholder="{{placeholder || '请输入关键字'}}" placeholder="{{placeholder || '请输入关键字'}}"
clearable clearable
borderless borderless
bindchange="change" bindchange="change"
value="{{value || ''}}" value="{{value || ''}}"
data-key="{{dataKey}}" data-key="{{dataKey}}"
confirm-type="search" confirm-type="search"
bind:clear="clear" bind:clear="clear"
custom-style="background:#f5f5f5;min-height: 34px;height:34px;padding: 0;" custom-style="background:#f5f5f5;min-height: var(--td-button-small-height,64rpx);height:var(--td-button-small-height,64rpx);padding: 0;"
size="small" size="small"
> t-class="aaaaaa"
<t-button >
name="search" <t-button
slot="prefix-icon" name="search"
size="small" slot="prefix-icon"
theme="primary" size="small"
bindtap="scanCode" theme="primary"
icon="scan" bindtap="scanCode"
/> icon="scan"
<t-button />
slot="suffix-icon" <t-button
bindtap="search" slot="suffix-icon"
icon="search" bindtap="search"
theme="primary" icon="search"
size="small" theme="primary"
/> size="small"
</t-input> />
</block> </t-input>
</view> </block>
<t-button </view>
wx:if="{{!hideMore}}" <t-button
bindtap="showSearch" wx:if="{{!hideMore}}"
theme="primary" bindtap="showSearch"
size="small" theme="primary"
> size="small"
筛选 >筛选
</t-button> </t-button>
</view> </view>
<popup-plugin visible="{{ show }}" bind:close="close" title="筛选条件"> <popup-plugin visible="{{ show }}" bind:close="close" title="筛选条件">
<slot name='content' /> <slot name='content' />
<slot wx:if="{{useFooterSlot}}" name="footer" /> <slot wx:if="{{useFooterSlot}}" name="footer" />
<view wx:else style="padding: 12px 0;display: flex;justify-content: center;position: sticky;bottom: 0;left: 0;background-color: #fff;z-index: 1;"> <view wx:else style="padding: 12px 0;display: flex;justify-content: center;position: sticky;bottom: 0;left: 0;background-color: #fff;z-index: 1;">
<t-button <t-button
bindtap="ok" bindtap="ok"
style="min-width: 80px;" style="min-width: 80px;"
size="small" size="small"
theme="primary" theme="primary"
>搜索 >搜索
</t-button> </t-button>
</view> </view>
</popup-plugin> </popup-plugin>

View File

@@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"popup-plugin": "/pages/components/popup-plugin/popup-plugin", "popup-plugin": "/pages/components/popup-plugin/popup-plugin",
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group", "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
"t-radio": "tdesign-miniprogram/radio/radio",
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
"t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group" "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group"
} }

View File

@@ -4,22 +4,10 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
mode: { mode: { type: String, value: "single" },
type: String, title: { type: String, value: "请选择" },
value: "single", options: { type: Array, value: [] },
}, value: { type: null, value: [] },
title: {
type: String,
value: "请选择",
},
options: {
type: Array,
value: [],
},
value: {
type: null,
value: [],
},
}, },
observers: { observers: {
"value,mode": function (v, m) { "value,mode": function (v, m) {
@@ -50,7 +38,8 @@ Component({
this.setData({ visible: false }); this.setData({ visible: false });
}, },
radioChange(e: any) { radioChange(e: any) {
this.setData({ val: e.detail.value }); this.triggerEvent("change", { value: e.detail.value });
this.setData({ val: e.detail.value, visible: false });
}, },
checkboxChange(e: any) { checkboxChange(e: any) {
this.setData({ val: e.detail.value }); this.setData({ val: e.detail.value });

View File

@@ -5,16 +5,30 @@
<popup-plugin visible="{{visible}}" bind:close="close" title="{{title}}"> <popup-plugin visible="{{visible}}" bind:close="close" title="{{title}}">
<view> <view style="padding: 12px 0;">
<t-radio-group <t-radio-group
wx:if="{{mode == 'single'}}" wx:if="{{mode == 'single'}}"
bind:change="radioChange" bind:change="radioChange"
allow-uncheck allow-uncheck
value="{{val}}" value="{{val}}"
options="{{options}}" borderless
/> >
<t-checkbox-group wx:else value="{{val}}" bind:change="checkboxChange"> <t-radio
wx:for="{{options}}"
wx:key="index"
value="{{item.value}}"
style="padding-bottom: 6px;padding-top: 6px;"
>{{item.label}}
</t-radio>
</t-radio-group>
<t-checkbox-group
wx:else
value="{{val}}"
bind:change="checkboxChange"
borderless
>
<t-checkbox <t-checkbox
style="padding-bottom: 6px;padding-top: 6px;"
wx:for="{{options}}" wx:for="{{options}}"
icon="rectangle" icon="rectangle"
wx:key="index" wx:key="index"
@@ -23,7 +37,7 @@
</t-checkbox> </t-checkbox>
</t-checkbox-group> </t-checkbox-group>
</view> </view>
<view class="footer"> <view class="footer" wx:if="{{ mode == 'multiple' }}">
<t-button size="small" theme="primary" bindtap="ok">确定</t-button> <t-button size="small" theme="primary" bindtap="ok">确定</t-button>
</view> </view>
</popup-plugin> </popup-plugin>

View File

@@ -6,7 +6,7 @@ Component({
properties: { properties: {
active: { active: {
type: String, type: String,
value: "home", value: "",
}, },
}, },
@@ -15,7 +15,7 @@ Component({
*/ */
data: { data: {
list: [ list: [
{ value: "home", label: "首页", icon: "home" }, { value: "index", label: "首页", icon: "home" },
{ value: "scan", label: "扫码", icon: "scan" }, { value: "scan", label: "扫码", icon: "scan" },
{ value: "my", label: "我的", icon: "user" }, { value: "my", label: "我的", icon: "user" },
], ],
@@ -31,12 +31,9 @@ Component({
*/ */
methods: { methods: {
onChange(e: any) { onChange(e: any) {
if (e.detail.value == this.data.active) { if (e.detail.value != this.data.active) {
return; wx.reLaunch({ url: this.data.pages[e.detail.value] });
} }
wx.reLaunch({
url: this.data.pages[e.detail.value],
});
}, },
}, },
}); });

View File

@@ -1,13 +1,5 @@
<t-tab-bar <t-tab-bar t-class="t-tab-bar" value="{{active}}" bindchange="onChange" theme="normal" fixed="{{true}}" split="{{false}}">
t-class="t-tab-bar"
value="{{active}}"
bindchange="onChange"
theme="normal"
fixed="{{true}}"
split="{{false}}"
>
<t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}"> <t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}">
{{item.label}} {{item.label}}
</t-tab-bar-item> </t-tab-bar-item>
</t-tab-bar> </t-tab-bar>

View File

@@ -1,6 +1,10 @@
{ {
"usingComponents": { "usingComponents": {
"t-button": "tdesign-miniprogram/button/button", "t-button": "tdesign-miniprogram/button/button",
"t-icon": "tdesign-miniprogram/icon/icon" "t-icon": "tdesign-miniprogram/icon/icon",
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"select-plugin": "/pages/components/select-plugin/select-plugin",
"search-popup": "/pages/components/search-popup/search-popup"
} }
} }

View File

@@ -1,6 +1,8 @@
// pages/index/index.ts // pages/index/index.ts
import { menuConfig } from "@/utils/menuConfig";
import { Subscribe } from "@/utils/subscribe"; import { Subscribe } from "@/utils/subscribe";
import { getDataSet, toObject } from "@/utils/util";
// const app = getApp(); // const app = getApp();
// const Storage = app.Storage; // const Storage = app.Storage;
@@ -8,15 +10,123 @@ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: {}, data: {
BGColors: [
"linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)",
"linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)",
"linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)",
"linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)",
"linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)",
"linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)",
"linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)",
"linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)",
"linear-gradient( 135deg, #F97794 10%, #623AA2 100%)",
"linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)",
"linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)",
"linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)",
"linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)",
"linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)",
"linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)",
"linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)",
"linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)",
"linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)",
"linear-gradient( 135deg, #92FFC0 10%, #002661 100%)",
"linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)",
"linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)",
"linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)",
"linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)",
"linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)",
"linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)",
"linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)",
],
params: {
curr_page: 1,
page_count: 20,
},
total: 100,
current1: ["checkbox1", "checkbox2"],
current2: "checkbox1",
options: [
{ label: "多选", value: "checkbox1" },
{ label: "多选", value: "checkbox2" },
{
label:
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
value: "checkbox3",
maxLabelRow: 2,
},
{
label: "多选",
value: "checkbox4",
content:
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
maxContentRow: 2,
},
{ label: "多选", value: "checkbox11" },
{ label: "多选", value: "checkbox21" },
{
label:
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
value: "checkbox31",
maxLabelRow: 2,
},
{
label: "多选",
value: "checkbox41",
content:
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
maxContentRow: 2,
},
],
authInfo: {} as any,
menuList: [] as any,
},
change() { change() {
Subscribe.set("isLogin", "zzzuz"); Subscribe.set("isLogin", "hello");
// wx.navigateTo({ url: "/pages/my/my" }); // wx.navigateTo({ url: "/pages/my/my" });
}, },
changePage(e: any) {
this.data.params.curr_page = e.detail.curr_page;
this.setData({ params: this.data.params });
},
changeSelect(e: any) {
console.log(e);
},
navToMy() { navToMy() {
wx.navigateTo({ url: "/pages/my/my" }); wx.navigateTo({ url: "/pages/my/my" });
}, },
init() {
this.data.authInfo = {};
const companyInfo = toObject(wx.getStorageSync("company_info"));
this.data.menuList.length = 0;
menuConfig.forEach((el) => {
const children: any[] = [];
el.children.forEach((ell) => {
// todo 权限判断
// if (!ell.auth || this.data.authInfo[ell.auth]) {
children.push(ell);
// }
});
if (children.length) {
this.data.menuList.push({
...el,
children: children,
});
}
});
// this.getIndex();
this.setData({
authInfo: this.data.authInfo,
menuList: this.data.menuList,
hideTabKeys: companyInfo.staff_type == 3 ? ["2"] : [],
});
},
nav(e: any) {
const url = getDataSet(e).url;
wx.navigateTo({ url });
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@@ -30,7 +140,10 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() {}, onShow() {
wx.hideHomeButton();
this.init();
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏

View File

@@ -1,6 +1,38 @@
<page-plugin> <page-plugin loading="{{true}}" isLogin="{{true}}" isAuth="{{true}}">
<text>pages/index/index.wxml</text> <text>pages/index/index.wxml</text>
<t-button bind:tap="change">change</t-button> <t-button bind:tap="change">change</t-button>
<t-button bind:tap="navToMy">my</t-button> <t-button bind:tap="navToMy">my</t-button>
<t-icon name="user-vip" style="color: #0052D9" size="20px"></t-icon> <pagination-plugin
</page-plugin> curr_page="{{params.curr_page}}"
total="{{total}}"
page_count="{{params.page_count}}"
bind:change="changePage"
/>
<block wx:for="{{ menuList }}" wx:key="index" wx:for-item="item">
<view style="display: flex;align-items: center;">
<t-icon name="{{ item.icon }}" style="color: {{item.iconColor}};font-size: 1.2em;margin-right: 4px;" />
<text style="font-weight: bold;font-size: 1.1em;">{{ item.title }}</text>
</view>
<view style="display: flex;align-items: center;flex-wrap: wrap;">
<block wx:for="{{ item.children }}" wx:key="index" wx:for-item="child">
<view class="menu-item" bindtap="nav" data-url="{{ child.url }}">
<image class="nav-item-icon" src="/assets/icons/{{child.title}}.svg" mode="aspectFit" />
<view>{{ child.title }}</view>
</view>
</block>
</view>
</block>
</page-plugin>
<tab-bar-plugin active="index" />
<select-plugin
mode="single"
value="{{current2}}"
options="{{options}}"
bind:change="changeSelect"
>
<view style="display: block;">下拉选择</view>
</select-plugin>
<search-popup>
<view slot="content">1111</view>
</search-popup>

View File

@@ -1 +1,25 @@
/* pages/index/index.wxss */ .container {
height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom));
}
.menu-item {
display: inline-flex;
flex-direction: column;
width: clamp(80px, 25%, 120px);
box-sizing: border-box;
padding: 8px;
--width: calc((100vw - 16px - 24px) / 4 * 0.4);
justify-content: center;
align-items: center;
}
.menu-item:active {
background-color: #f5f5f5;
}
.nav-item-icon {
width: var(--width);
height: var(--width);
display: inline-flex;
box-sizing: border-box;
}

View File

@@ -1,5 +1,9 @@
{ {
"usingComponents": { "usingComponents": {
"t-button": "tdesign-miniprogram/button/button" "t-button": "tdesign-miniprogram/button/button",
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"t-input": "tdesign-miniprogram/input/input",
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin"
} }
} }

View File

@@ -2,12 +2,37 @@ import { Subscribe } from "@/utils/subscribe";
import { setStorage } from "@/utils/util"; import { setStorage } from "@/utils/util";
Page({ Page({
data: {}, data: {
columns: [
{ title: "我的收藏", width: "100px", dataIndex: "name" },
{ title: "我的点赞", width: "200px", dataIndex: "count" },
{ title: "我的评论", width: "300px", dataIndex: "desc" },
],
data: [
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
],
},
change() { change() {
setStorage("isLogin", 1); setStorage("isLogin", 1);
Subscribe.set("isLogin", "zzzuz"); Subscribe.set("isLogin", "zzzuz");
// wx.navigateTo({ url: "/pages/my/my" }); // wx.navigateTo({ url: "/pages/my/my" });
}, },
searchChange(e: any) {
console.log(e);
},
ok() {
console.log("ok");
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
@@ -21,7 +46,9 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() {}, onShow() {
wx.hideHomeButton();
},
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏

View File

@@ -2,4 +2,19 @@
<text>pages/my/my.wxml</text> <text>pages/my/my.wxml</text>
<t-button bind:tap="change">change</t-button> <t-button bind:tap="change">change</t-button>
</page-plugin> <view style="padding: 12px;">
<search-popup bind:ok="ok" bind:change="searchChange">
<view slot="content">11111</view>
</search-popup>
<card-plugin>
<view slot="header">11111</view>
<view slot="content">
<view style="height: 70px">11111</view>
</view>
</card-plugin>
</view>
</page-plugin>
<tab-bar-plugin active="my" />

View File

@@ -1 +1,3 @@
/* pages/my/my.wxss */ .container {
height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom));
}

View File

@@ -1,9 +1,10 @@
{ {
"navigationBarTitleText": "录入流程", "navigationBarTitleText": "流程录入",
"usingComponents": { "usingComponents": {
"t-input": "tdesign-miniprogram/input/input", "t-input": "tdesign-miniprogram/input/input",
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
"t-icon": "tdesign-miniprogram/icon/icon", "t-icon": "tdesign-miniprogram/icon/icon",
"popup-plugin": "/pages/components/popup-plugin/popup-plugin" "popup-plugin": "/pages/components/popup-plugin/popup-plugin",
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin"
} }
} }

View File

@@ -1,5 +1,10 @@
<page-plugin is-login="{{isLogin}}" is-auth="{{authInfo['SF_ENTER_PROCESS']}}" loading="{{loading}}" <page-plugin
bind:handleLogin="handleLogin" style="padding: 0;"> is-login="{{isLogin}}"
is-auth="{{authInfo['SF_ENTER_PROCESS']}}"
loading="{{loading}}"
bind:handleLogin="handleLogin"
customStyle="padding: 0;"
>
<view class="container"> <view class="container">
<view style="display: flex;padding: 12px 12px 4px 12px;"> <view style="display: flex;padding: 12px 12px 4px 12px;">
<view style="display: flex;flex-shrink: 0;flex-direction: column;margin-right: 12px;align-items: flex-end;"> <view style="display: flex;flex-shrink: 0;flex-direction: column;margin-right: 12px;align-items: flex-end;">
@@ -9,27 +14,28 @@
</view> </view>
</view> </view>
<view style="display: flex;flex-wrap: wrap;min-height: 44px;max-height: 88px;overflow: auto;flex: 1;"> <view style="display: flex;flex-wrap: wrap;min-height: 44px;max-height: 88px;overflow: auto;flex: 1;">
<view wx:if="{{processItems.length == 0}}" <view wx:if="{{processItems.length == 0}}" style="display: flex;justify-content: center;height: 100%;width: 100%;align-items: center;color: #999;">暂无工序
style="display: flex;justify-content: center;height: 100%;width: 100%;align-items: center;color: #999;">暂无工序
</view> </view>
<block wx:for="{{processItems}}" wx:key="process_id"> <block wx:for="{{processItems}}" wx:key="process_id">
<view <view class="process-item {{item.code == selectedProcessCode || (item.code + '-') == selectedProcessCode ? 'active': ''}}" bind:tap="processItemTap" data-code="{{item.code}}">{{item.name}}</view>
class="process-item {{item.code == selectedProcessCode || (item.code + '-') == selectedProcessCode ? 'active': ''}}"
bind:tap="processItemTap" data-code="{{item.code}}">{{item.name}}</view>
</block> </block>
</view> </view>
</view> </view>
<t-input label="订单编号" value="{{rel_order_no}}" readonly placeholder="扫码流程编码, 订单编号" /> <t-input
label="订单编号"
value="{{rel_order_no}}"
readonly
placeholder="扫码流程编码, 订单编号"
/>
<t-input label="流程编码" readonly value="{{process_code}}" /> <t-input label="流程编码" readonly value="{{process_code}}" />
<view wx:if="{{processCodeMsg}}" style="padding: 8px 12px 0 12px;color: {{action == 'end'? '#52c41a': '#ff4d4f'}};"> <view wx:if="{{processCodeMsg}}" style="padding: 8px 12px 0 12px;color: {{action == 'end'? '#52c41a': '#ff4d4f'}};">
{{processCodeMsg}} {{processCodeMsg}}
</view> </view>
<view style="padding: 12px;padding-top: 0;"> <view style="padding: 12px;padding-top: 0;">
<view style="display: flex;justify-content: center;margin-top: 12px;align-items: center;column-gap: 16px;"> <view style="display: flex;justify-content: center;margin-top: 12px;align-items: center;column-gap: 16px;">
<t-button theme="primary" bind:tap="scanCode" icon="qr">扫码</t-button> <t-button theme="primary" bind:tap="scanCode" icon="qr">扫码</t-button>
<t-button theme="primary" disabled="{{!(rel_order_no && process_code)}}" bind:tap="processEnter">录入流程</t-button> <t-button theme="primary" disabled="{{!(rel_order_no && process_code)}}" bind:tap="processEnter">流程录入</t-button>
<!-- <view style="width: 16px;"></view> --> <!-- <view style="width: 16px;"></view> -->
<!-- <van-checkbox value="{{voice}}" bind:change="voiceChange">语音播报</van-checkbox> --> <!-- <van-checkbox value="{{voice}}" bind:change="voiceChange">语音播报</van-checkbox> -->
</view> </view>
@@ -39,15 +45,24 @@
<!-- <text>扫码记录</text> --> <!-- <text>扫码记录</text> -->
<text bind:tap="addMsg2">扫码结果</text> <text bind:tap="addMsg2">扫码结果</text>
<view> <view>
<t-button size="extra-small" theme="{{logType == '0' ? 'primary' :'default'}}" bind:tap="onLogTypeChange" <t-button
data-key="0">图标</t-button> size="extra-small"
<t-button size="extra-small" theme="{{logType == '1' ? 'primary' :'default'}}" bind:tap="onLogTypeChange" theme="{{logType == '0' ? 'primary' :'default'}}"
data-key="1">记录</t-button> bind:tap="onLogTypeChange"
data-key="0"
>图标
</t-button>
<t-button
size="extra-small"
theme="{{logType == '1' ? 'primary' :'default'}}"
bind:tap="onLogTypeChange"
data-key="1"
>记录
</t-button>
</view> </view>
<!-- <t-button size="extra-small" theme="primary" bind:tap="clearMsg">清空</t-button> --> <!-- <t-button size="extra-small" theme="primary" bind:tap="clearMsg">清空</t-button> -->
</view> </view>
<view wx:if="{{logType == 0}}" class="log-box" <view wx:if="{{logType == 0}}" class="log-box" style="display: flex;justify-content: center;align-items: center;font-size: 65vw;">
style="display: flex;justify-content: center;align-items: center;font-size: 65vw;">
<!-- <view wx:for="{{logsList}}" wx:for-item="item" wx:key="date" style="font-size: 14px;word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;"> <!-- <view wx:for="{{logsList}}" wx:for-item="item" wx:key="date" style="font-size: 14px;word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;">
{{item.date}} {{item.date}}
{{item.msg}} {{item.msg}}
@@ -57,8 +72,12 @@
</view> </view>
<view wx:else class="log-box"> <view wx:else class="log-box">
<view wx:for="{{logsList}}" wx:for-item="item" wx:key="date" <view
style="word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;"> wx:for="{{logsList}}"
wx:for-item="item"
wx:key="date"
style="word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;"
>
<text style="color: #666;margin-right: 4px;">{{item.date}}</text> <text style="color: #666;margin-right: 4px;">{{item.date}}</text>
{{item.msg}} {{item.msg}}
</view> </view>
@@ -108,4 +127,7 @@
</view> </view>
</popup-plugin> --> </popup-plugin> -->
</view> </view>
</page-plugin> </page-plugin>
<tab-bar-plugin active="scan" />

View File

@@ -28,8 +28,7 @@
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom));
/* height: calc(100vh - 50px - env(safe-area-inset-bottom)); */
} }
.process-item { .process-item {

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "流程管理"
}

View File

@@ -0,0 +1,211 @@
import { getDataSet } from "@/utils/util";
Page({
/**
* 页面的初始数据
*/
data: {
process: [
{
p_process_name: "办公流程",
parent_process_id: 34,
child: [
{
process_name: "录单亲亲我",
process_id: 86,
parent_process_id: 34,
p_process_name: "办公流程",
num: 1,
tot_num: 1,
},
],
},
{
p_process_name: "车间流程",
parent_process_id: 36,
child: [
{
process_name: "接单",
process_id: 85,
parent_process_id: 36,
p_process_name: "车间流程",
num: 12,
tot_num: 12,
},
{
process_name: "测量",
process_id: 91,
parent_process_id: 36,
p_process_name: "车间流程",
num: 11,
tot_num: 12,
},
{
process_name: "报价",
process_id: 92,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "复尺",
process_id: 93,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "备料",
process_id: 94,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "拆单",
process_id: 95,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "跟单",
process_id: 96,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "排单",
process_id: 97,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "开料",
process_id: 98,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "封边",
process_id: 99,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "打孔",
process_id: 100,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "特殊加工",
process_id: 101,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "分拣",
process_id: 102,
parent_process_id: 36,
p_process_name: "车间流程",
num: 5,
tot_num: 6,
},
{
process_name: "包装",
process_id: 103,
parent_process_id: 36,
p_process_name: "车间流程",
num: 6,
tot_num: 7,
},
{
process_name: "入库",
process_id: 104,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "出库",
process_id: 105,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
],
},
],
},
navDetail(e: any) {
const index = getDataSet(e).index.split(",");
const pProcess = this.data.process[index[0]];
const cProcess = pProcess.child[index[1]];
const { p_process_name, process_name, process_id } = cProcess;
const title = encodeURIComponent(`${p_process_name} - ${process_name}`);
console.log(title);
wx.navigateTo({
url: `/pages/produce/processManageDetail/processManageDetail?process_id=${process_id}&title=${title}`,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,18 @@
<block wx:for="{{ process }}" wx:key="parent_process_id">
<view class="process-box">
<view class="p_process_name">{{ item.p_process_name }}</view>
<view class="process-child-box">
<block
wx:for="{{ item.child }}"
wx:key="process_id"
wx:for-item="child"
wx:for-index="ci"
>
<view class="process-child-item-box" bind:tap="navDetail" data-index="{{ index+','+ci }}">{{ child.process_name }}
<view class="process-child-item-num">{{ child.num }}</view>
</view>
</block>
</view>
</view>
</block>

View File

@@ -0,0 +1,35 @@
.process-child-box {
display: flex;
flex-wrap: wrap;
align-items: center;
column-gap: 32rpx;
row-gap: 32rpx;
margin-bottom: 32rpx;
}
.p_process_name {
font-size: 1.125em;
font-weight: bold;
margin-bottom: 24rpx;
}
.process-child-item-box {
position: relative;
border: 1rpx solid #ddd;
padding: 16rpx;
border-radius: 8rpx;
}
.process-child-item-num {
position: absolute;
top: 0;
right: 0;
transform: translate(50%, -50%);
background-color: #2ba471;
color: #fff;
border-radius: 100%;
line-height: 1.1;
padding: 2rpx 8rpx;
font-size: 28rpx;
}

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin"
},
"navigationBarTitleText": "流程管理详情"
}

View File

@@ -0,0 +1,85 @@
import { getDataSet } from "@/utils/util";
Page({
/**
* 页面的初始数据
*/
data: {
params: { curr_page: 1, page_count: 20, state: "1", process_id: "" },
list: [
{
order_no: "XSDD2025112500000043",
custom_name: "客户5",
custom_address: "",
custom_phone: null,
custom_order_no: "",
goods_name: "浴室柜",
info_process_id: 163,
produce_info_id: 62,
process_code: "ld",
state: 1,
end_user_address: null,
end_user_name: null,
end_user_phone: null,
},
],
count: 1,
},
tabChange(e: any) {
const state = getDataSet(e).key;
this.data.params.state = state;
this.page();
},
page(curr: number = 1) {
this.data.params.curr_page = curr;
this.setData({ params: this.data.params });
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// console.log(options);
wx.setNavigationBarTitle({
title: decodeURIComponent(options.title || ""),
});
this.data.params.process_id = `${options.process_id || ""}`;
this.page();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,17 @@
<search-popup placeholder="输入销售单号" />
<view class="tabs">
<view class="tabs-item {{ params.state == '1' ? 'active': '' }}" bind:tap="tabChange" data-key="1">待处理</view>
<view class="tabs-item {{ params.state == '2' ? 'active': '' }}" bind:tap="tabChange" data-key="2">已处理</view>
</view>
<block wx:for="{{ list }}" wx:key="info_process_id">
<card-plugin>
<view slot="header">{{ item.order_no }}</view>
<view slot="content">
<card-item-plugin label="订单编号" value="1哒哒哒哒哒哒多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多" />
<card-item-plugin label="订单编号" value="111111" />
<card-item-plugin label="订单编号" value="111111" />
<card-item-plugin label="订单编号" value="111111" />
</view>
</card-plugin>
</block>

View File

@@ -0,0 +1,18 @@
.tabs {
display: inline-flex;
margin-bottom: 32rpx;
}
.tabs-item {
display: inline-flex;
height: 64rpx;
align-items: center;
padding: 0 24rpx;
background-color: #f5f5f5;
line-height: 1;
}
.tabs-item.active {
background-color: #0052d9;
color: #fff;
}

View File

@@ -4,18 +4,29 @@
*/ */
export const servicePhone = "4000-5858-22"; export const servicePhone = "4000-5858-22";
export const colors = {
primary: "#0052d9",
success: "#2ba471",
warning: "#e37318",
danger: "#d54941",
info: "#029cd4",
gray: "#999999",
} as const;
export const defaultAvatarUrl = export const defaultAvatarUrl =
"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0"; "https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0";
export const base = { export const base = {
appletName: "易宝赞管理系统普惠版", appletName: "易宝赞普惠版",
apiHost: apiHost:
wx.getAccountInfoSync().miniProgram.envVersion == "release" wx.getAccountInfoSync().miniProgram.envVersion == "release"
? "https://ebaozan.com/api/" ? "https://ebaozan.com/api/"
: "http://192.168.1.138:83/", : "http://192.168.1.138:83/",
webViewBaseUrl: webViewBaseUrl:
wx.getAccountInfoSync().miniProgram.envVersion == "release" ? "https://ebaozan.com/" : "http://ebaozan.cf/", wx.getAccountInfoSync().miniProgram.envVersion == "release"
? "https://ebaozan.com/"
: "http://ebaozan.cf/",
cookieKey: "OwCookie", cookieKey: "OwCookie",
}; };

View File

@@ -3,12 +3,15 @@
* YangXB 2021.11.24 * YangXB 2021.11.24
* */ * */
import { base, http } from "./config"; import { base, http } from "./config";
import { getStorage, goIndexPage, isArray, setStorage, ToastErr } from "./util"; import {
getStorage,
goIndexPage,
isArray,
setStorage,
toastError,
} from "./util";
/** /**
* 请求 * 请求
* @param {*} url
* @param {*} options
* @param {*} config
*/ */
const request = ( const request = (
url: string, url: string,
@@ -103,7 +106,7 @@ export const wxLogin = (config?: any) => {
}); });
}) })
.catch((err: any) => { .catch((err: any) => {
ToastErr("服务失败:" + err.err_code); toastError("服务失败:" + err.err_code);
}); });
}, },
}); });
@@ -194,11 +197,7 @@ export const login = (
company_id?: any company_id?: any
) => { ) => {
return new Promise<any>((resolve, reject) => { return new Promise<any>((resolve, reject) => {
const data: any = { const data: any = { type: 2, encryptedData, iv };
type: 2,
encryptedData,
iv,
};
if (company_id) { if (company_id) {
data.companyID = company_id; data.companyID = company_id;

View File

@@ -7,88 +7,32 @@ export const menuConfig = [
iconColor: iconColor, iconColor: iconColor,
children: [ children: [
{ {
title: "订单列表", title: "销售订单",
url: "/pages/orders/ordersList/ordersList", url: "/pages/orders/ordersList/ordersList",
auth: "SF_VIEW_ORDERS", auth: "SF_ERP_SALE_ORDERS_VIEW",
},
{
title: "流程管理",
url: "/pages/orders/processManage/processManage",
auth: "SF_VIEW_ORDER_PROCESS_MANAGE",
},
{
title: "录入流程",
url: "/pages/processEntry/processEntry",
auth: "SF_ENTER_PROCESS",
},
{
title: "工量查询",
url: "/pages/orders/workload/workload",
auth: "SF_VIEW_WORK_LIST",
},
{
title: "订单备忘",
url: "/pages/orders/orderMemo/orderMemo",
auth: "SF_VIEW_ORDER_MEMO",
},
{
title: "订单排序",
url: "/pages/orders/ordersSort/ordersSort",
auth: "SF_SET_ORDER_SORT",
},
{
title: "板号查询",
url: "/pages/orders/sale_no_query/sale_no_query",
auth: "SF_VIEW_ORDER_SALE_NO_PROCESS",
}, },
], ],
}, },
{ {
title: "客户管理", title: "生产管理",
icon: "user-vip", icon: "form",
iconColor: iconColor, iconColor: iconColor,
children: [ children: [
// {
// title: "生产任务",
// url: "/pages/produce/orderTask/orderTask",
// auth: "SF_ERP_PRODUCT_TASK_VIEW",
// },
{ {
title: "供应商管理", title: "流程管理",
url: "/pages/crm_manage/suppliers/suppliers", url: "/pages/produce/processManage/processManage",
auth: "SF_VIEW_CRM_SUPPLIER", auth: "SF_ERP_PRODUCT_PROCESS_VIEW",
}, },
{ {
title: "经销商管理", title: "流程录入",
url: "/pages/crm_manage/sales/sales", url: "/pages/processEntry/processEntry",
auth: "SF_VIEW_CRM_SALE", auth: "SF_ERP_PRODUCT_PROCESS_ENTER",
},
{
title: "经销商等级",
url: "/pages/crm_manage/crm_level/crm_level",
auth: "SF_VIEW_CRM_LEVEL",
}, },
], ],
}, },
]; ];
const iconPath = "/images/nav_icons/";
/** 导航栏 */
export const navTabBar = [
{
iconPath: `${iconPath}home.svg`,
selectedIconPath: `${iconPath}home2.svg`,
pagePath: "/pages/index/index",
text: "首页",
key: "1",
},
{
iconPath: `${iconPath}code.svg`,
selectedIconPath: `${iconPath}code2.svg`,
pagePath: "/pages/processEntry/processEntry",
text: "扫码",
key: "2",
},
{
iconPath: `${iconPath}my.svg`,
selectedIconPath: `${iconPath}my2.svg`,
pagePath: "/pages/my/my",
text: "我的",
key: "3",
},
];

View File

@@ -8,7 +8,13 @@ export const formatTime = (date: Date) => {
const minute = date.getMinutes(); const minute = date.getMinutes();
const second = date.getSeconds(); const second = date.getSeconds();
return `${[year, month, day].map(formatNumber).join("-")} ${[hour, minute, second].map(formatNumber).join(":")}`; return `${[year, month, day].map(formatNumber).join("-")} ${[
hour,
minute,
second,
]
.map(formatNumber)
.join(":")}`;
}; };
export const formatNumber = (n: number | string) => { export const formatNumber = (n: number | string) => {
@@ -16,24 +22,12 @@ export const formatNumber = (n: number | string) => {
return n[1] ? n : `0${n}`; return n[1] ? n : `0${n}`;
}; };
export const ToastOK = (title: string, duration = 2000) => {
wx.showToast({
title,
icon: "success",
duration,
});
};
export const ToastErr = (title: string, duration = 2000) => {
wx.showToast({
title,
icon: "error",
duration,
});
};
// 对话框 // 对话框
export const showModal = (title: string, content: string, showCancel = false) => { export const showModal = (
title: string,
content: string,
showCancel = false
) => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
wx.showModal({ wx.showModal({
title, title,
@@ -51,36 +45,28 @@ export const showModal = (title: string, content: string, showCancel = false) =>
}; };
/** 判断数据是不是数组类型 */ /** 判断数据是不是数组类型 */
export const isArray = (data: any) => { export const isArray = (data: any) => data && Array.isArray(data);
return data && Array.isArray(data);
};
/** /**
* 转成数组 * 转成数组
* @param {*} data * @param {*} data
* @returns {Array} * @returns {Array}
*/ */
export const toArray = (data: any): any[] => { export const toArray = (data: any): any[] => (isArray(data) ? data : []);
return isArray(data) ? data : [];
};
/** 判断数据是不是对象类型 */ /** 判断数据是不是对象类型 */
export const isObject = (data: any) => { export const isObject = (data: any) => {
return data && `${Object.prototype.toString.call(data)}`.includes("Object"); return data && `${Object.prototype.toString.call(data)}`.includes("Object");
}; };
export const toObject = (data: any) => { export const toObject = (data: any) => (isObject(data) ? data : {});
return isObject(data) ? data : {};
};
export const reloadPage = () => { export const reloadPage = () => {
let pages = getCurrentPages(); //获取加载的页面 let pages = getCurrentPages(); //获取加载的页面
let currentPage = pages[pages.length - 1]; //获取当前页面的对象 let currentPage = pages[pages.length - 1]; //获取当前页面的对象
let url = currentPage.route; //当前页面url let url = currentPage.route; //当前页面url
// 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 // 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
wx.redirectTo({ wx.redirectTo({ url: "/" + url });
url: "/" + url,
});
}; };
/** 判断是json数据 */ /** 判断是json数据 */
@@ -106,13 +92,21 @@ export const jsonParse = (data: any): any[] | object | null => {
if (typeof data == "string") { if (typeof data == "string") {
try { try {
const obj = JSON.parse(data); const obj = JSON.parse(data);
if (["Array", "Object"].includes(Object.prototype.toString.call(obj).slice(8, -1))) { if (
["Array", "Object"].includes(
Object.prototype.toString.call(obj).slice(8, -1)
)
) {
return obj; return obj;
} }
} catch (e) { } catch (e) {
// //
} }
} else if (["Array", "Object"].includes(Object.prototype.toString.call(data).slice(8, -1))) { } else if (
["Array", "Object"].includes(
Object.prototype.toString.call(data).slice(8, -1)
)
) {
return data; return data;
} }
} }
@@ -148,14 +142,10 @@ export const formatToDecimals = (str: any, num: number = 2) => {
}; };
/** 获取权限 */ /** 获取权限 */
export const getAuthInfo = () => { export const getAuthInfo = () => toObject(wx.getStorageSync("auth_info"));
return toObject(wx.getStorageSync("auth_info"));
};
export const goIndexPage = () => { export const goIndexPage = () => {
wx.switchTab({ wx.navigateTo({ url: "/pages/index/index" });
url: "/pages/index/index",
});
}; };
export const isImageFile = (path: string) => { export const isImageFile = (path: string) => {
@@ -186,41 +176,37 @@ export const tabsConfigGet = () => {
*/ */
export const mediaPreview = (imageUrls: any[], currentUrl: string) => { export const mediaPreview = (imageUrls: any[], currentUrl: string) => {
console.log("媒体图片预览方法"); console.log("媒体图片预览方法");
const lastLen = `${currentUrl}`.indexOf("?") > -1 ? `${currentUrl}`.indexOf("?") : `${currentUrl}`.length; const lastLen =
`${currentUrl}`.indexOf("?") > -1
? `${currentUrl}`.indexOf("?")
: `${currentUrl}`.length;
const suffix: any = currentUrl.substring(currentUrl.lastIndexOf(".") + 1, lastLen).toLocaleLowerCase(); const suffix: any = currentUrl
.substring(currentUrl.lastIndexOf(".") + 1, lastLen)
.toLocaleLowerCase();
if (isImageFile("." + suffix)) { if (isImageFile("." + suffix)) {
wx.previewImage({ wx.previewImage({ urls: imageUrls, current: currentUrl, showmenu: true });
urls: imageUrls,
current: currentUrl,
showmenu: true,
});
} else if (["mp3", "mp4", "m4a"].includes(suffix)) { } else if (["mp3", "mp4", "m4a"].includes(suffix)) {
wx.previewMedia({ wx.previewMedia({
sources: [ sources: [{ url: currentUrl, type: "video" }],
{
url: currentUrl,
type: "video",
},
],
fail() { fail() {
wx.showToast({ wx.showToast({ title: "播放失败" });
title: "播放失败",
});
}, },
}); });
} else if (["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"].includes(suffix)) { } else if (
["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"].includes(suffix)
) {
const downloadTask = wx.downloadFile({ const downloadTask = wx.downloadFile({
url: currentUrl, url: currentUrl,
header: http.header, header: http.header,
success: function (res) { success: (res) => {
const filePath = res.tempFilePath; const filePath = res.tempFilePath;
wx.openDocument({ wx.openDocument({
filePath: filePath, filePath: filePath,
showMenu: true, showMenu: true,
fileType: suffix, fileType: suffix,
success: function () {}, success: () => {},
}); });
}, },
fail() {}, fail() {},
@@ -237,9 +223,7 @@ export const mediaPreview = (imageUrls: any[], currentUrl: string) => {
} }
}); });
} else { } else {
wx.showToast({ wx.showToast({ title: "请前往网页端下载查看" });
title: "请前往网页端下载查看",
});
} }
}; };
@@ -252,9 +236,7 @@ export const uploadFile2 = (option: any) => {
option = toObject(option); option = toObject(option);
option.name = option.name || "files"; option.name = option.name || "files";
wx.showLoading({ wx.showLoading({ title: "文件上传中..." });
title: "文件上传中...",
});
wx.uploadFile({ wx.uploadFile({
filePath: option.filePath, filePath: option.filePath,
name: option.name, name: option.name,
@@ -266,17 +248,13 @@ export const uploadFile2 = (option: any) => {
url: option.url, url: option.url,
success(res) { success(res) {
const resData = jsonParse(res.data); const resData = jsonParse(res.data);
wx.showToast({ wx.showToast({ title: "上传成功" });
title: "上传成功",
});
if (option.success) { if (option.success) {
option.success(resData); option.success(resData);
} }
}, },
fail() { fail() {
wx.showToast({ wx.showToast({ title: "上传失败" });
title: "上传失败",
});
if (option.fail) { if (option.fail) {
option.fail(); option.fail();
} }
@@ -345,3 +323,4 @@ export const getCurrentPageRoute = () => {
const currentPage = pages[pages.length - 1]; // 获取当前页面对象 const currentPage = pages[pages.length - 1]; // 获取当前页面对象
return `/${currentPage.route}`; // 获取当前页面路径 return `/${currentPage.route}`; // 获取当前页面路径
}; };

View File

@@ -18,58 +18,13 @@ const playVoice = (src: string, text: string) => {
}; };
export const voiceRequest = (text: string, cacheVoice?: boolean) => { export const voiceRequest = (text: string, cacheVoice?: boolean) => {
// if (cacheVoice) {
// const data = wx.getStorageSync(text);
// console.log(data);
// if (data) {
// console.log("有 base64");
// const fs = wx.getFileSystemManager();
// //随机定义路径名称
// var times = new Date().getTime();
// var codeimg = wx.env.USER_DATA_PATH + "/" + times + ".mp3";
// //将base64图片写入
// fs.writeFile({
// filePath: codeimg,
// data: data,
// encoding: "base64",
// success: (res) => {
// console.log(res);
// playVoice(codeimg, text);
// },
// fail: (res) => {
// console.log(res);
// },
// });
// return;
// }
// }
post( post(
"/Tools/voice", "/Tools/voice",
{ { txt: text, per: 3, spd: 5, pit: 5, vol: 9 },
txt: text,
per: 3,
spd: 5,
pit: 5,
vol: 9,
},
{ showLoading: false } { showLoading: false }
).then((res: any) => { ).then((res: any) => {
if (res.err_code == 0) { if (res.err_code == 0) {
playVoice(urlAddBaseUrl(res.data), text); playVoice(urlAddBaseUrl(res.data), text);
// if (cacheVoice) {
// wx.request({
// url: urlAddBaseUrl(res.data),
// responseType: "arraybuffer",
// success(res) {
// const base64 = base64js.fromByteArray(new Uint8Array(res.data));
// try {
// wx.setStorageSync(text, base64);
// } catch (_) {
// console.log("缓存错误");
// }
// },
// });
// }
} }
}); });
}; };

View File

@@ -13,7 +13,7 @@
}, },
"coverView": false, "coverView": false,
"postcss": false, "postcss": false,
"minified": false, "minified": true,
"enhance": true, "enhance": true,
"showShadowRootInWxmlPanel": false, "showShadowRootInWxmlPanel": false,
"packNpmRelationList": [ "packNpmRelationList": [

View File

@@ -17,17 +17,14 @@
"strict": true, "strict": true,
"strictPropertyInitialization": true, "strictPropertyInitialization": true,
"lib": ["ES2020"], "lib": ["ES2020"],
"typeRoots": [ "typeRoots": ["./typings"],
"./typings"
],
"paths": { "paths": {
"tdesign-miniprogram/*":["./miniprogram/miniprogram_npm/tdesign-miniprogram/*"] "tdesign-miniprogram/*": ["./miniprogram/miniprogram_npm/tdesign-miniprogram/*"],
} "@/*": ["miniprogram/*"]
},
"baseUrl": "./"
}, },
"include": [ "include": ["./**/*.ts"],
"./**/*.ts" "exclude": ["node_modules"]
],
"exclude": [
"node_modules"
]
} }