diff --git a/miniprogram/app.json b/miniprogram/app.json index ea876db..1155aa5 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -3,45 +3,21 @@ "pages/index/index", "pages/agreement/agreement", "pages/my/my", - "pages/processEntry/processEntry" + "pages/processEntry/processEntry", + "pages/produce/processManage/processManage", + "pages/produce/processManageDetail/processManageDetail" ], "window": { "navigationBarTextStyle": "black", - "navigationBarTitleText": "易宝赞管理系统普惠版", + "navigationBarTitleText": "易宝赞普惠版", "navigationBarBackgroundColor": "#ffffff" }, "componentFramework": "glass-easel", "lazyCodeLoading": "requiredComponents", "usingComponents": { "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" }, - "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": { "@/*": "/*" } diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index 6fafd1e..00eeb35 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -12,3 +12,9 @@ view.t-input { view.t-popup__close { padding: 6px; } + +/* +page { + --td-button-small-height: 34px; + --td-button-small-height: 34px; +} */ diff --git a/miniprogram/assets/home.png b/miniprogram/assets/home.png deleted file mode 100644 index 076c90a..0000000 Binary files a/miniprogram/assets/home.png and /dev/null differ diff --git a/miniprogram/assets/home2.png b/miniprogram/assets/home2.png deleted file mode 100644 index 8cf6655..0000000 Binary files a/miniprogram/assets/home2.png and /dev/null differ diff --git a/miniprogram/assets/icons/流程录入.svg b/miniprogram/assets/icons/流程录入.svg new file mode 100644 index 0000000..07f7fa2 --- /dev/null +++ b/miniprogram/assets/icons/流程录入.svg @@ -0,0 +1 @@ + diff --git a/miniprogram/assets/icons/流程管理.svg b/miniprogram/assets/icons/流程管理.svg new file mode 100644 index 0000000..a2068e4 --- /dev/null +++ b/miniprogram/assets/icons/流程管理.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/assets/icons/销售订单.svg b/miniprogram/assets/icons/销售订单.svg new file mode 100644 index 0000000..557e249 --- /dev/null +++ b/miniprogram/assets/icons/销售订单.svg @@ -0,0 +1 @@ + diff --git a/miniprogram/assets/qrcode.png b/miniprogram/assets/qrcode.png deleted file mode 100644 index 17f84a6..0000000 Binary files a/miniprogram/assets/qrcode.png and /dev/null differ diff --git a/miniprogram/assets/qrcode2.png b/miniprogram/assets/qrcode2.png deleted file mode 100644 index 7f46c05..0000000 Binary files a/miniprogram/assets/qrcode2.png and /dev/null differ diff --git a/miniprogram/assets/scan.png b/miniprogram/assets/scan.png deleted file mode 100644 index dbdedcc..0000000 Binary files a/miniprogram/assets/scan.png and /dev/null differ diff --git a/miniprogram/assets/scan2.png b/miniprogram/assets/scan2.png deleted file mode 100644 index 50e54f6..0000000 Binary files a/miniprogram/assets/scan2.png and /dev/null differ diff --git a/miniprogram/assets/user.png b/miniprogram/assets/user.png deleted file mode 100644 index 60525e1..0000000 Binary files a/miniprogram/assets/user.png and /dev/null differ diff --git a/miniprogram/assets/user2.png b/miniprogram/assets/user2.png deleted file mode 100644 index b72ae0c..0000000 Binary files a/miniprogram/assets/user2.png and /dev/null differ diff --git a/miniprogram/pages/components/card-item-plugin/card-item-plugin.json b/miniprogram/pages/components/card-item-plugin/card-item-plugin.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/miniprogram/pages/components/card-item-plugin/card-item-plugin.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/miniprogram/pages/components/card-item-plugin/card-item-plugin.ts b/miniprogram/pages/components/card-item-plugin/card-item-plugin.ts new file mode 100644 index 0000000..ea56f55 --- /dev/null +++ b/miniprogram/pages/components/card-item-plugin/card-item-plugin.ts @@ -0,0 +1,24 @@ +Component({ + options: { multipleSlots: true }, + /** + * 组件的属性列表 + */ + properties: { + label: null, + value: null, + customStyle: null, + labelStyle: null, + valueStyle: null, + }, + + /** + * 组件的初始数据 + */ + data: {}, + + /** + * 组件的方法列表 + */ + methods: {}, +}); + diff --git a/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxml b/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxml new file mode 100644 index 0000000..b614457 --- /dev/null +++ b/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxml @@ -0,0 +1,11 @@ + + + {{ label || '' }} + + + + {{ value || '' }} + + + + diff --git a/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxss b/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxss new file mode 100644 index 0000000..de2583e --- /dev/null +++ b/miniprogram/pages/components/card-item-plugin/card-item-plugin.wxss @@ -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; +} diff --git a/miniprogram/pages/components/card-plugin/card-plugin.ts b/miniprogram/pages/components/card-plugin/card-plugin.ts index 5382dfc..8fae6f1 100644 --- a/miniprogram/pages/components/card-plugin/card-plugin.ts +++ b/miniprogram/pages/components/card-plugin/card-plugin.ts @@ -27,6 +27,7 @@ Component({ */ data: { showMore: false, + showMoreBar: false, }, /** * 组件的方法列表 diff --git a/miniprogram/pages/components/card-plugin/card-plugin.wxml b/miniprogram/pages/components/card-plugin/card-plugin.wxml index 93907b2..22983a7 100644 --- a/miniprogram/pages/components/card-plugin/card-plugin.wxml +++ b/miniprogram/pages/components/card-plugin/card-plugin.wxml @@ -1,4 +1,4 @@ - + diff --git a/miniprogram/pages/components/card-plugin/card-plugin.wxss b/miniprogram/pages/components/card-plugin/card-plugin.wxss index 02f0046..e1148e5 100644 --- a/miniprogram/pages/components/card-plugin/card-plugin.wxss +++ b/miniprogram/pages/components/card-plugin/card-plugin.wxss @@ -9,14 +9,14 @@ display: none; } -.footer > view { +.footer>view { border-top: 1rpx solid #ddd; - padding: 8px 0 0 12px; + padding: 16rpx 0 0 24rpx; display: flex; width: 100%; } -.footer > view:empty { +.footer>view:empty { display: none; } @@ -25,8 +25,8 @@ display: flex; align-items: center; justify-content: center; - font-size: 14px; - height: 26px; + font-size: 0.875em; + height: 52rpx; } .show-more:active { diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.json b/miniprogram/pages/components/popup-plugin/popup-plugin.json index 4d06ee0..bc0b94b 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.json +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.json @@ -1,6 +1,7 @@ { "component": true, "usingComponents": { - "t-popup": "tdesign-miniprogram/popup/popup" + "t-popup": "tdesign-miniprogram/popup/popup", + "t-icon": "tdesign-miniprogram/icon/icon" } -} \ No newline at end of file +} diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.ts b/miniprogram/pages/components/popup-plugin/popup-plugin.ts index ff3abbe..16dc740 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.ts +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.ts @@ -24,5 +24,9 @@ Component({ this.triggerEvent("close"); } }, + onClose() { + this.setData({ open: false }); + this.triggerEvent("close"); + }, }, }); diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.wxml b/miniprogram/pages/components/popup-plugin/popup-plugin.wxml index faa566e..e2e43dd 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.wxml +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.wxml @@ -1,11 +1,7 @@ - - - {{title}} + + + {{title}} + diff --git a/miniprogram/pages/components/popup-plugin/popup-plugin.wxss b/miniprogram/pages/components/popup-plugin/popup-plugin.wxss index 8b13789..4865f95 100644 --- a/miniprogram/pages/components/popup-plugin/popup-plugin.wxss +++ b/miniprogram/pages/components/popup-plugin/popup-plugin.wxss @@ -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; +} diff --git a/miniprogram/pages/components/search-popup/search-popup.ts b/miniprogram/pages/components/search-popup/search-popup.ts index 193be5b..68be5cb 100644 --- a/miniprogram/pages/components/search-popup/search-popup.ts +++ b/miniprogram/pages/components/search-popup/search-popup.ts @@ -1,5 +1,5 @@ Component({ - options: { multipleSlots: true }, + options: { multipleSlots: true, addGlobalClass: true }, /** * 组件的属性列表 */ diff --git a/miniprogram/pages/components/search-popup/search-popup.wxml b/miniprogram/pages/components/search-popup/search-popup.wxml index 7c97083..343c04d 100644 --- a/miniprogram/pages/components/search-popup/search-popup.wxml +++ b/miniprogram/pages/components/search-popup/search-popup.wxml @@ -1,61 +1,60 @@ - - - - - - - - - - - - - 筛选 - + + + + + + + + + + + + 筛选 + - - - - - 搜索 - - + + + + 搜索 + + diff --git a/miniprogram/pages/components/select-plugin/select-plugin.json b/miniprogram/pages/components/select-plugin/select-plugin.json index 85aa4cf..bebedff 100644 --- a/miniprogram/pages/components/select-plugin/select-plugin.json +++ b/miniprogram/pages/components/select-plugin/select-plugin.json @@ -3,6 +3,7 @@ "usingComponents": { "popup-plugin": "/pages/components/popup-plugin/popup-plugin", "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", + "t-radio": "tdesign-miniprogram/radio/radio", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group" } diff --git a/miniprogram/pages/components/select-plugin/select-plugin.ts b/miniprogram/pages/components/select-plugin/select-plugin.ts index 8645f6d..3f54d10 100644 --- a/miniprogram/pages/components/select-plugin/select-plugin.ts +++ b/miniprogram/pages/components/select-plugin/select-plugin.ts @@ -4,22 +4,10 @@ Component({ * 组件的属性列表 */ properties: { - mode: { - type: String, - value: "single", - }, - title: { - type: String, - value: "请选择", - }, - options: { - type: Array, - value: [], - }, - value: { - type: null, - value: [], - }, + mode: { type: String, value: "single" }, + title: { type: String, value: "请选择" }, + options: { type: Array, value: [] }, + value: { type: null, value: [] }, }, observers: { "value,mode": function (v, m) { @@ -50,7 +38,8 @@ Component({ this.setData({ visible: false }); }, 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) { this.setData({ val: e.detail.value }); diff --git a/miniprogram/pages/components/select-plugin/select-plugin.wxml b/miniprogram/pages/components/select-plugin/select-plugin.wxml index b867e9c..31dc02c 100644 --- a/miniprogram/pages/components/select-plugin/select-plugin.wxml +++ b/miniprogram/pages/components/select-plugin/select-plugin.wxml @@ -5,16 +5,30 @@ - + - + borderless + > + {{item.label}} + + + - + 确定 diff --git a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.ts b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.ts index 4ab532a..1250613 100644 --- a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.ts +++ b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.ts @@ -6,7 +6,7 @@ Component({ properties: { active: { type: String, - value: "home", + value: "", }, }, @@ -15,7 +15,7 @@ Component({ */ data: { list: [ - { value: "home", label: "首页", icon: "home" }, + { value: "index", label: "首页", icon: "home" }, { value: "scan", label: "扫码", icon: "scan" }, { value: "my", label: "我的", icon: "user" }, ], @@ -31,12 +31,9 @@ Component({ */ methods: { onChange(e: any) { - if (e.detail.value == this.data.active) { - return; + if (e.detail.value != this.data.active) { + wx.reLaunch({ url: this.data.pages[e.detail.value] }); } - wx.reLaunch({ - url: this.data.pages[e.detail.value], - }); }, }, }); diff --git a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml index 3479f92..ffdf70a 100644 --- a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml +++ b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml @@ -1,13 +1,5 @@ - + {{item.label}} - diff --git a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxss b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxss index e69de29..8b13789 100644 --- a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxss +++ b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxss @@ -0,0 +1 @@ + diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json index 20f49db..19f9765 100644 --- a/miniprogram/pages/index/index.json +++ b/miniprogram/pages/index/index.json @@ -1,6 +1,10 @@ { "usingComponents": { "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" } -} \ No newline at end of file +} diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts index b6f0746..d6dd60b 100644 --- a/miniprogram/pages/index/index.ts +++ b/miniprogram/pages/index/index.ts @@ -1,6 +1,8 @@ // pages/index/index.ts +import { menuConfig } from "@/utils/menuConfig"; import { Subscribe } from "@/utils/subscribe"; +import { getDataSet, toObject } from "@/utils/util"; // const app = getApp(); // 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() { - Subscribe.set("isLogin", "zzzuz"); + Subscribe.set("isLogin", "hello"); // 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() { 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(); + }, /** * 生命周期函数--监听页面隐藏 diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index 206ce86..3b6bd4f 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -1,6 +1,38 @@ - + pages/index/index.wxml change my - - \ No newline at end of file + + + + + {{ item.title }} + + + + + + {{ child.title }} + + + + + + + + 下拉选择 + + + 1111 + + diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss index 8e9c81f..47c784e 100644 --- a/miniprogram/pages/index/index.wxss +++ b/miniprogram/pages/index/index.wxss @@ -1 +1,25 @@ -/* pages/index/index.wxss */ \ No newline at end of file +.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; +} diff --git a/miniprogram/pages/my/my.json b/miniprogram/pages/my/my.json index da897b1..ca7108f 100644 --- a/miniprogram/pages/my/my.json +++ b/miniprogram/pages/my/my.json @@ -1,5 +1,9 @@ { "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" } -} \ No newline at end of file +} diff --git a/miniprogram/pages/my/my.ts b/miniprogram/pages/my/my.ts index e034a66..84fe92b 100644 --- a/miniprogram/pages/my/my.ts +++ b/miniprogram/pages/my/my.ts @@ -2,12 +2,37 @@ import { Subscribe } from "@/utils/subscribe"; import { setStorage } from "@/utils/util"; 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() { setStorage("isLogin", 1); Subscribe.set("isLogin", "zzzuz"); // 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(); + }, /** * 生命周期函数--监听页面隐藏 diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 8e5d2cf..4617a0a 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -2,4 +2,19 @@ pages/my/my.wxml change - \ No newline at end of file + + + + 11111 + + + 11111 + + 11111 + + + + + + + diff --git a/miniprogram/pages/my/my.wxss b/miniprogram/pages/my/my.wxss index 1c3fe88..8eabbf1 100644 --- a/miniprogram/pages/my/my.wxss +++ b/miniprogram/pages/my/my.wxss @@ -1 +1,3 @@ -/* pages/my/my.wxss */ \ No newline at end of file +.container { + height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom)); +} diff --git a/miniprogram/pages/processEntry/processEntry.json b/miniprogram/pages/processEntry/processEntry.json index 1bac181..a8f4b8e 100644 --- a/miniprogram/pages/processEntry/processEntry.json +++ b/miniprogram/pages/processEntry/processEntry.json @@ -1,9 +1,10 @@ { - "navigationBarTitleText": "录入流程", + "navigationBarTitleText": "流程录入", "usingComponents": { "t-input": "tdesign-miniprogram/input/input", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "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" } } diff --git a/miniprogram/pages/processEntry/processEntry.wxml b/miniprogram/pages/processEntry/processEntry.wxml index 8a2ddfa..bcc9be2 100644 --- a/miniprogram/pages/processEntry/processEntry.wxml +++ b/miniprogram/pages/processEntry/processEntry.wxml @@ -1,5 +1,10 @@ - + @@ -9,27 +14,28 @@ - 暂无工序 + 暂无工序 - {{item.name}} + {{item.name}} - + - {{processCodeMsg}} 扫码 - 录入流程 + 流程录入 @@ -39,15 +45,24 @@ 扫码结果 - 图标 - 记录 + 图标 + + 记录 + - + + + + diff --git a/miniprogram/pages/processEntry/processEntry.wxss b/miniprogram/pages/processEntry/processEntry.wxss index 3982cdc..c463a91 100644 --- a/miniprogram/pages/processEntry/processEntry.wxss +++ b/miniprogram/pages/processEntry/processEntry.wxss @@ -28,8 +28,7 @@ .container { display: flex; flex-direction: column; - height: 100vh; - /* height: calc(100vh - 50px - env(safe-area-inset-bottom)); */ + height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom)); } .process-item { diff --git a/miniprogram/pages/produce/processManage/processManage.json b/miniprogram/pages/produce/processManage/processManage.json new file mode 100644 index 0000000..728f052 --- /dev/null +++ b/miniprogram/pages/produce/processManage/processManage.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "流程管理" +} + diff --git a/miniprogram/pages/produce/processManage/processManage.ts b/miniprogram/pages/produce/processManage/processManage.ts new file mode 100644 index 0000000..96d68ad --- /dev/null +++ b/miniprogram/pages/produce/processManage/processManage.ts @@ -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() {}, +}); + diff --git a/miniprogram/pages/produce/processManage/processManage.wxml b/miniprogram/pages/produce/processManage/processManage.wxml new file mode 100644 index 0000000..7249a06 --- /dev/null +++ b/miniprogram/pages/produce/processManage/processManage.wxml @@ -0,0 +1,18 @@ + + + {{ item.p_process_name }} + + + {{ child.process_name }} + {{ child.num }} + + + + + + diff --git a/miniprogram/pages/produce/processManage/processManage.wxss b/miniprogram/pages/produce/processManage/processManage.wxss new file mode 100644 index 0000000..a15f376 --- /dev/null +++ b/miniprogram/pages/produce/processManage/processManage.wxss @@ -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; +} diff --git a/miniprogram/pages/produce/processManageDetail/processManageDetail.json b/miniprogram/pages/produce/processManageDetail/processManageDetail.json new file mode 100644 index 0000000..eeec4f6 --- /dev/null +++ b/miniprogram/pages/produce/processManageDetail/processManageDetail.json @@ -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": "流程管理详情" +} + diff --git a/miniprogram/pages/produce/processManageDetail/processManageDetail.ts b/miniprogram/pages/produce/processManageDetail/processManageDetail.ts new file mode 100644 index 0000000..e2ac6b5 --- /dev/null +++ b/miniprogram/pages/produce/processManageDetail/processManageDetail.ts @@ -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() {}, +}); + diff --git a/miniprogram/pages/produce/processManageDetail/processManageDetail.wxml b/miniprogram/pages/produce/processManageDetail/processManageDetail.wxml new file mode 100644 index 0000000..ce3b191 --- /dev/null +++ b/miniprogram/pages/produce/processManageDetail/processManageDetail.wxml @@ -0,0 +1,17 @@ + + + 待处理 + 已处理 + + + + {{ item.order_no }} + + + + + + + + + diff --git a/miniprogram/pages/produce/processManageDetail/processManageDetail.wxss b/miniprogram/pages/produce/processManageDetail/processManageDetail.wxss new file mode 100644 index 0000000..6e2e847 --- /dev/null +++ b/miniprogram/pages/produce/processManageDetail/processManageDetail.wxss @@ -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; +} diff --git a/miniprogram/utils/config.ts b/miniprogram/utils/config.ts index 7eda7d8..12d0139 100644 --- a/miniprogram/utils/config.ts +++ b/miniprogram/utils/config.ts @@ -4,18 +4,29 @@ */ 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 = "https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0"; export const base = { - appletName: "易宝赞管理系统普惠版", + appletName: "易宝赞普惠版", apiHost: wx.getAccountInfoSync().miniProgram.envVersion == "release" ? "https://ebaozan.com/api/" : "http://192.168.1.138:83/", 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", }; diff --git a/miniprogram/utils/https.ts b/miniprogram/utils/https.ts index 8d1a1e7..7cb6a74 100644 --- a/miniprogram/utils/https.ts +++ b/miniprogram/utils/https.ts @@ -3,12 +3,15 @@ * YangXB 2021.11.24 * */ 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 = ( url: string, @@ -103,7 +106,7 @@ export const wxLogin = (config?: any) => { }); }) .catch((err: any) => { - ToastErr("服务失败:" + err.err_code); + toastError("服务失败:" + err.err_code); }); }, }); @@ -194,11 +197,7 @@ export const login = ( company_id?: any ) => { return new Promise((resolve, reject) => { - const data: any = { - type: 2, - encryptedData, - iv, - }; + const data: any = { type: 2, encryptedData, iv }; if (company_id) { data.companyID = company_id; diff --git a/miniprogram/utils/menuConfig.ts b/miniprogram/utils/menuConfig.ts index 79e2c3f..6fccc87 100644 --- a/miniprogram/utils/menuConfig.ts +++ b/miniprogram/utils/menuConfig.ts @@ -7,88 +7,32 @@ export const menuConfig = [ iconColor: iconColor, children: [ { - title: "订单列表", + title: "销售订单", url: "/pages/orders/ordersList/ordersList", - auth: "SF_VIEW_ORDERS", - }, - { - 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", + auth: "SF_ERP_SALE_ORDERS_VIEW", }, ], }, { - title: "客户管理", - icon: "user-vip", + title: "生产管理", + icon: "form", iconColor: iconColor, children: [ + // { + // title: "生产任务", + // url: "/pages/produce/orderTask/orderTask", + // auth: "SF_ERP_PRODUCT_TASK_VIEW", + // }, { - title: "供应商管理", - url: "/pages/crm_manage/suppliers/suppliers", - auth: "SF_VIEW_CRM_SUPPLIER", + title: "流程管理", + url: "/pages/produce/processManage/processManage", + auth: "SF_ERP_PRODUCT_PROCESS_VIEW", }, { - title: "经销商管理", - url: "/pages/crm_manage/sales/sales", - auth: "SF_VIEW_CRM_SALE", - }, - { - title: "经销商等级", - url: "/pages/crm_manage/crm_level/crm_level", - auth: "SF_VIEW_CRM_LEVEL", + title: "流程录入", + url: "/pages/processEntry/processEntry", + auth: "SF_ERP_PRODUCT_PROCESS_ENTER", }, ], }, ]; - -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", - }, -]; diff --git a/miniprogram/utils/util.ts b/miniprogram/utils/util.ts index 0d90587..981661a 100644 --- a/miniprogram/utils/util.ts +++ b/miniprogram/utils/util.ts @@ -8,7 +8,13 @@ export const formatTime = (date: Date) => { const minute = date.getMinutes(); 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) => { @@ -16,24 +22,12 @@ export const formatNumber = (n: number | string) => { 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((resolve, reject) => { wx.showModal({ title, @@ -51,36 +45,28 @@ export const showModal = (title: string, content: string, showCancel = false) => }; /** 判断数据是不是数组类型 */ -export const isArray = (data: any) => { - return data && Array.isArray(data); -}; +export const isArray = (data: any) => data && Array.isArray(data); /** * 转成数组 * @param {*} data * @returns {Array} */ -export const toArray = (data: any): any[] => { - return isArray(data) ? data : []; -}; +export const toArray = (data: any): any[] => (isArray(data) ? data : []); /** 判断数据是不是对象类型 */ export const isObject = (data: any) => { return data && `${Object.prototype.toString.call(data)}`.includes("Object"); }; -export const toObject = (data: any) => { - return isObject(data) ? data : {}; -}; +export const toObject = (data: any) => (isObject(data) ? data : {}); export const reloadPage = () => { let pages = getCurrentPages(); //获取加载的页面 let currentPage = pages[pages.length - 1]; //获取当前页面的对象 let url = currentPage.route; //当前页面url // 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 - wx.redirectTo({ - url: "/" + url, - }); + wx.redirectTo({ url: "/" + url }); }; /** 判断是json数据 */ @@ -106,13 +92,21 @@ export const jsonParse = (data: any): any[] | object | null => { if (typeof data == "string") { try { 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; } } 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; } } @@ -148,14 +142,10 @@ export const formatToDecimals = (str: any, num: number = 2) => { }; /** 获取权限 */ -export const getAuthInfo = () => { - return toObject(wx.getStorageSync("auth_info")); -}; +export const getAuthInfo = () => toObject(wx.getStorageSync("auth_info")); export const goIndexPage = () => { - wx.switchTab({ - url: "/pages/index/index", - }); + wx.navigateTo({ url: "/pages/index/index" }); }; export const isImageFile = (path: string) => { @@ -186,41 +176,37 @@ export const tabsConfigGet = () => { */ export const mediaPreview = (imageUrls: any[], currentUrl: string) => { 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)) { - wx.previewImage({ - urls: imageUrls, - current: currentUrl, - showmenu: true, - }); + wx.previewImage({ urls: imageUrls, current: currentUrl, showmenu: true }); } else if (["mp3", "mp4", "m4a"].includes(suffix)) { wx.previewMedia({ - sources: [ - { - url: currentUrl, - type: "video", - }, - ], + sources: [{ url: currentUrl, type: "video" }], fail() { - wx.showToast({ - title: "播放失败", - }); + wx.showToast({ 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({ url: currentUrl, header: http.header, - success: function (res) { + success: (res) => { const filePath = res.tempFilePath; wx.openDocument({ filePath: filePath, showMenu: true, fileType: suffix, - success: function () {}, + success: () => {}, }); }, fail() {}, @@ -237,9 +223,7 @@ export const mediaPreview = (imageUrls: any[], currentUrl: string) => { } }); } else { - wx.showToast({ - title: "请前往网页端下载查看", - }); + wx.showToast({ title: "请前往网页端下载查看" }); } }; @@ -252,9 +236,7 @@ export const uploadFile2 = (option: any) => { option = toObject(option); option.name = option.name || "files"; - wx.showLoading({ - title: "文件上传中...", - }); + wx.showLoading({ title: "文件上传中..." }); wx.uploadFile({ filePath: option.filePath, name: option.name, @@ -266,17 +248,13 @@ export const uploadFile2 = (option: any) => { url: option.url, success(res) { const resData = jsonParse(res.data); - wx.showToast({ - title: "上传成功", - }); + wx.showToast({ title: "上传成功" }); if (option.success) { option.success(resData); } }, fail() { - wx.showToast({ - title: "上传失败", - }); + wx.showToast({ title: "上传失败" }); if (option.fail) { option.fail(); } @@ -345,3 +323,4 @@ export const getCurrentPageRoute = () => { const currentPage = pages[pages.length - 1]; // 获取当前页面对象 return `/${currentPage.route}`; // 获取当前页面路径 }; + diff --git a/miniprogram/utils/voiceUtil.ts b/miniprogram/utils/voiceUtil.ts index 0549a20..3daebd7 100644 --- a/miniprogram/utils/voiceUtil.ts +++ b/miniprogram/utils/voiceUtil.ts @@ -18,58 +18,13 @@ const playVoice = (src: string, text: string) => { }; 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( "/Tools/voice", - { - txt: text, - per: 3, - spd: 5, - pit: 5, - vol: 9, - }, + { txt: text, per: 3, spd: 5, pit: 5, vol: 9 }, { showLoading: false } ).then((res: any) => { if (res.err_code == 0) { 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("缓存错误"); - // } - // }, - // }); - // } } }); }; diff --git a/project.config.json b/project.config.json index 4dbdb29..0d971ac 100644 --- a/project.config.json +++ b/project.config.json @@ -13,7 +13,7 @@ }, "coverView": false, "postcss": false, - "minified": false, + "minified": true, "enhance": true, "showShadowRootInWxmlPanel": false, "packNpmRelationList": [ diff --git a/tsconfig.json b/tsconfig.json index a911d19..85c2502 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,17 +17,14 @@ "strict": true, "strictPropertyInitialization": true, "lib": ["ES2020"], - "typeRoots": [ - "./typings" - ], + "typeRoots": ["./typings"], "paths": { - "tdesign-miniprogram/*":["./miniprogram/miniprogram_npm/tdesign-miniprogram/*"] - } + "tdesign-miniprogram/*": ["./miniprogram/miniprogram_npm/tdesign-miniprogram/*"], + "@/*": ["miniprogram/*"] + }, + "baseUrl": "./" }, - "include": [ - "./**/*.ts" - ], - "exclude": [ - "node_modules" - ] + "include": ["./**/*.ts"], + "exclude": ["node_modules"] } +