feat: 将多个页面从JavaScript转换为TypeScript

- 将 agreement.js、no-auth-plugin.js、processEntry.js、https.js、
  menuConfig.js、voiceUtil.js 文件重命名为对应的 .ts 扩展名

- 在 agreement.ts 中引入配置并动态设置标题
- 在 no-auth-plugin.ts 中使用工具函数替代硬编码跳转
- 为 processEntry.ts 添加类型注解并重构代码结构
- 为 https.ts 添加类型定义并优化错误处理
- 创建 menuConfig.ts 并迁移导航配置
- 为 voiceUtil.ts 添加类型注解
This commit is contained in:
zhengw
2026-01-12 10:59:13 +08:00
parent d36c005100
commit f0c68126dc
7 changed files with 206 additions and 145 deletions

View File

@@ -1,4 +1,5 @@
// pages/agreement/agreement.js import { base } from "@/utils/config";
Page({ Page({
/** /**
* *
@@ -11,14 +12,12 @@ Page({
* -- * --
*/ */
onLoad(options) { onLoad(options) {
this.setData({ const appletName = base.appletName;
type: options.type, this.setData({ type: options.type });
});
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: title: `${appletName}${
options.type == "user" options.type == "user" ? "平台用户服务协议" : "隐私权政策"
? "易宝赞数据化管理系统平台用户服务协议" }`,
: "易宝赞数据化管理系统隐私权政策",
}); });
}, },

View File

@@ -1,3 +1,4 @@
import { goIndexPage } from "@/utils/util";
Component({ Component({
/** /**
* *
@@ -13,10 +14,8 @@ Component({
* *
*/ */
methods: { methods: {
navIndex: function () { navIndex() {
wx.switchTab({ goIndexPage();
url: "/pages/index/index",
});
}, },
}, },
}); });

View File

@@ -1,5 +1,12 @@
import { loginStatus, post } from "@/utils/https"; import { loginStatus, post } from "@/utils/https";
import { formatTime, getAuthInfo, getDataSet, isArray, toArray, toObject } from "@/utils/util"; import {
formatTime,
getAuthInfo,
getDataSet,
isArray,
toArray,
toObject,
} from "@/utils/util";
import { voiceRequest } from "@/utils/voiceUtil"; import { voiceRequest } from "@/utils/voiceUtil";
/** 拼接符号 */ /** 拼接符号 */
@@ -11,7 +18,7 @@ const RecallCodeMarking = "-";
* *
* @param {string} value * @param {string} value
*/ */
const parseQrCode = (value) => { const parseQrCode = (value: string) => {
value = `${value || ""}`; value = `${value || ""}`;
const obj = { const obj = {
/** 工序码 */ /** 工序码 */
@@ -23,7 +30,9 @@ const parseQrCode = (value) => {
}; };
if (value.includes(ProcessCodeConcatSymbol)) { if (value.includes(ProcessCodeConcatSymbol)) {
obj.code = value.substring(0, value.indexOf(ProcessCodeConcatSymbol)); obj.code = value.substring(0, value.indexOf(ProcessCodeConcatSymbol));
obj.key = value.substring(value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length); obj.key = value.substring(
value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length
);
} }
if (obj.code.includes(RecallCodeMarking)) { if (obj.code.includes(RecallCodeMarking)) {
@@ -43,16 +52,16 @@ Page({
processCodeMsg: "", processCodeMsg: "",
rel_order_no: "", rel_order_no: "",
process_code: "", process_code: "",
logsList: [], logsList: [] as any[],
show: false, show: false,
orders: [], orders: [] as any[],
isLogin: false, isLogin: false,
isScanCode: false, isScanCode: false,
voice: true, voice: true,
loading: true, loading: true,
authInfo: {}, authInfo: {},
hideTabKeys: [], hideTabKeys: [] as string[],
processItems: [], processItems: [] as any[],
backFlag: false, backFlag: false,
selectedProcessCode: "", selectedProcessCode: "",
result: "", result: "",
@@ -61,10 +70,10 @@ Page({
defaultBonus: true, defaultBonus: true,
showDefaultBonus: false, showDefaultBonus: false,
defaultBonusConfig: {}, defaultBonusConfig: {},
defaultBonusConfigKeys: [], defaultBonusConfigKeys: [] as string[],
rel_order_no_temp: "", rel_order_no_temp: "",
}, },
handleLogin(e) { handleLogin(e: any) {
if (e.detail) { if (e.detail) {
this.setData({ isLogin: true, authInfo: getAuthInfo() }); this.setData({ isLogin: true, authInfo: getAuthInfo() });
this.init(); this.init();
@@ -72,13 +81,15 @@ Page({
this.setData({ isLogin: false }); this.setData({ isLogin: false });
} }
}, },
backChange(e) { backChange(e: any) {
this.data.backFlag = e.detail; this.data.backFlag = e.detail;
this.setData({ backFlag: e.detail }); this.setData({ backFlag: e.detail });
wx.setStorageSync("processBackFlag", e.detail ? 1 : 0); wx.setStorageSync("processBackFlag", e.detail ? 1 : 0);
if (this.data.selectedProcessCode) { if (this.data.selectedProcessCode) {
const { code, key } = parseQrCode(this.data.selectedProcessCode); const { code, key } = parseQrCode(this.data.selectedProcessCode);
this.data.selectedProcessCode = `${code}${e.detail ? RecallCodeMarking : ""}`; this.data.selectedProcessCode = `${code}${
e.detail ? RecallCodeMarking : ""
}`;
if (key) { if (key) {
this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`; this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`;
} }
@@ -101,8 +112,9 @@ Page({
} }
} }
}, },
processItemTap(e) { processItemTap(e: any) {
this.data.selectedProcessCode = e.currentTarget.dataset.code + (this.data.backFlag ? "-" : ""); this.data.selectedProcessCode =
e.currentTarget.dataset.code + (this.data.backFlag ? "-" : "");
wx.setStorageSync("selectedProcessCode", this.data.selectedProcessCode); wx.setStorageSync("selectedProcessCode", this.data.selectedProcessCode);
this.setData({ this.setData({
selectedProcessCode: this.data.selectedProcessCode, selectedProcessCode: this.data.selectedProcessCode,
@@ -110,7 +122,7 @@ Page({
this.getProcessName(); this.getProcessName();
}, },
getExecProcess() { getExecProcess() {
post("Orders/getExecProcess1").then((res) => { post("Orders/getExecProcess1").then((res: any) => {
this.data.processItems = toArray(res.data); this.data.processItems = toArray(res.data);
if (this.data.processItems.length == 1) { if (this.data.processItems.length == 1) {
this.data.selectedProcessCode = this.data.processItems[0].code; this.data.selectedProcessCode = this.data.processItems[0].code;
@@ -140,18 +152,18 @@ Page({
}); });
this.getExecProcess(); this.getExecProcess();
}, },
voiceChange(event) { voiceChange(event: any) {
this.setData({ this.setData({
voice: event.detail, voice: event.detail,
}); });
wx.setStorageSync("processEntryVoice", `${event.detail}`); wx.setStorageSync("processEntryVoice", `${event.detail}`);
}, },
getVoice(msg, cacheVoice) { getVoice(msg: string, cacheVoice?: boolean) {
if (this.data.voice && msg) { if (this.data.voice && msg) {
voiceRequest(msg, cacheVoice); voiceRequest(msg, cacheVoice);
} }
}, },
onLogTypeChange(e) { onLogTypeChange(e: any) {
const data = getDataSet(e); const data = getDataSet(e);
this.setData({ logType: data.key }); this.setData({ logType: data.key });
wx.setStorageSync("processEntry_logType", data.key); wx.setStorageSync("processEntry_logType", data.key);
@@ -196,14 +208,14 @@ Page({
}, },
}); });
}, },
getProcess(real_code) { getProcess(real_code: any) {
const code = parseQrCode(real_code); const code = parseQrCode(real_code);
post("CompanyProcess/processChildList", { post("CompanyProcess/processChildList", {
curr_page: 1, curr_page: 1,
page_count: 1, page_count: 1,
real_code: code.code, real_code: code.code,
}) })
.then((res) => { .then((res: any) => {
const data = res.data; const data = res.data;
if (Array.isArray(res.data) && data.length) { if (Array.isArray(res.data) && data.length) {
this.setData({ this.setData({
@@ -225,7 +237,7 @@ Page({
this.getVoice(`未找到工序`, true); this.getVoice(`未找到工序`, true);
} }
}) })
.catch((res) => { .catch(() => {
this.addMsg("未找到 " + real_code + " 工序"); this.addMsg("未找到 " + real_code + " 工序");
wx.showToast({ wx.showToast({
title: "未找到该工序", title: "未找到该工序",
@@ -239,14 +251,14 @@ Page({
this.setProcess(); this.setProcess();
} }
}, },
LCProcessEnter(e) { LCProcessEnter(e: any) {
const item = this.data.orders[e.currentTarget.dataset.index]; const item = this.data.orders[e.currentTarget.dataset.index];
this.data.rel_order_no_temp = item.rel_order_no; this.data.rel_order_no_temp = item.rel_order_no;
this.setProcess(); this.setProcess();
}, },
setProcess(other) { setProcess(other?: any) {
const code = parseQrCode(this.data.process_code); const code = parseQrCode(this.data.process_code);
const obj = {}; const obj: any = {};
if (code.key) { if (code.key) {
obj[this.data.rel_order_no_temp] = code.key; obj[this.data.rel_order_no_temp] = code.key;
} }
@@ -256,12 +268,14 @@ Page({
process_code: code.code, process_code: code.code,
action: this.data.action, action: this.data.action,
if_scan: 1, if_scan: 1,
same_process: this.data.rel_order_no_temp.startsWith("LC") ? 1 : undefined, same_process: this.data.rel_order_no_temp.startsWith("LC")
? 1
: undefined,
// defaultBonus: getDefaultBonus() != "0", // defaultBonus: getDefaultBonus() != "0",
}), }),
other: JSON.stringify({ ...other, ...obj }), other: JSON.stringify({ ...other, ...obj }),
}) })
.then((res) => { .then((res: any) => {
if (res.bonus == 1) { if (res.bonus == 1) {
const data = toObject(res.data); const data = toObject(res.data);
this.setData({ this.setData({
@@ -270,10 +284,12 @@ Page({
showDefaultBonus: true, showDefaultBonus: true,
}); });
} else if (isArray(res.data) && res.data.length) { } else if (isArray(res.data) && res.data.length) {
res.data.forEach((el) => { res.data.forEach((el: any) => {
el.product_info_str = toArray(el.product_info) el.product_info_str = toArray(el.product_info)
.map((ell) => { .map((ell) => {
return `${ell.room_name || "未命名"}(${ell.goods_name || "未命名"})`; return `${ell.room_name || "未命名"}(${
ell.goods_name || "未命名"
})`;
}) })
.join(""); .join("");
@@ -303,7 +319,7 @@ Page({
}); });
} }
}) })
.catch((res) => { .catch((res: any) => {
this.addMsg(res.err_msg); this.addMsg(res.err_msg);
if (res.err_code == "244269") { if (res.err_code == "244269") {
this.setData({ this.setData({
@@ -322,7 +338,7 @@ Page({
} }
}); });
}, },
onSelectBonus(e) { onSelectBonus(e: any) {
const data = getDataSet(e); const data = getDataSet(e);
this.setProcess({ [data.order_no]: data.key }); this.setProcess({ [data.order_no]: data.key });
}, },
@@ -337,7 +353,7 @@ Page({
// }); // });
// setDefaultBonus(e.detail ? "1" : "0"); // setDefaultBonus(e.detail ? "1" : "0");
// }, // },
addMsg(msg) { addMsg(msg: any) {
const now = new Date(); const now = new Date();
this.data.logsList.unshift({ this.data.logsList.unshift({
date: formatTime(now).substring(5), date: formatTime(now).substring(5),
@@ -351,30 +367,24 @@ Page({
}); });
}, },
clearMsg() { clearMsg() {
this.setData({ this.setData({ logsList: [] });
logsList: [],
});
}, },
show() { show() {
this.setData({ this.setData({ show: true });
show: true,
});
}, },
onClose() { onClose() {
this.setData({ this.setData({ show: false });
show: false,
});
}, },
/** /**
* -- * --
*/ */
onLoad(options) { onLoad(_options) {
this.setData({ this.setData({
loading: true, loading: true,
voice: wx.getStorageSync("processEntryVoice") == "false" ? false : true, voice: wx.getStorageSync("processEntryVoice") == "false" ? false : true,
}); });
loginStatus() loginStatus()
.then((res) => { .then(() => {
this.setData({ this.setData({
isLogin: true, isLogin: true,
loading: false, loading: false,

View File

@@ -3,16 +3,20 @@
* YangXB 2021.11.24 * YangXB 2021.11.24
* */ * */
import { base, http } from "./config"; import { base, http } from "./config";
import { getStorage, isArray, setStorage, ToastErr } from "./util"; import { getStorage, goIndexPage, isArray, setStorage, ToastErr } from "./util";
/** /**
* *
* @param {*} url * @param {*} url
* @param {*} options * @param {*} options
* @param {*} config * @param {*} config
*/ */
const request = (url, options, config = { showLoading: true, showError: true }) => { const request = (
url: string,
options: any,
config = { showLoading: true, showError: true }
) => {
// 获取缓存cookie // 获取缓存cookie
const header = { ...http.header }; const header: any = { ...http.header };
const cookie = getStorage(base.cookieKey); const cookie = getStorage(base.cookieKey);
if (cookie && !header["Cookie"]) { if (cookie && !header["Cookie"]) {
@@ -33,7 +37,7 @@ const request = (url, options, config = { showLoading: true, showError: true })
method: options.method, method: options.method,
data: options.data, data: options.data,
header, header,
success(request) { success(request: any) {
if (config.showLoading != false) { if (config.showLoading != false) {
wx.hideLoading(); wx.hideLoading();
} }
@@ -42,7 +46,7 @@ const request = (url, options, config = { showLoading: true, showError: true })
setStorage(base.cookieKey, request.header["Set-Cookie"]); setStorage(base.cookieKey, request.header["Set-Cookie"]);
} }
if (request.data.err_code === 0) { if (request.data?.err_code === 0) {
// //
} else { } else {
if (config.showError != false) { if (config.showError != false) {
@@ -54,17 +58,19 @@ const request = (url, options, config = { showLoading: true, showError: true })
if (request.data.err_code == 110000) { if (request.data.err_code == 110000) {
const pages = getCurrentPages(); const pages = getCurrentPages();
if ( if (
!["pages/index/index", "pages/processEntry/processEntry", "pages/my/my"].includes( ![
pages[pages.length - 1].route "pages/index/index",
) "pages/processEntry/processEntry",
"pages/my/my",
].includes(pages[pages.length - 1].route)
) { ) {
wx.switchTab({ url: "/pages/index/index" }); goIndexPage();
} }
} }
} }
resolve(request.data); resolve(request.data);
}, },
fail(error) { fail(error: any) {
if (config.showLoading != false) { if (config.showLoading != false) {
wx.hideLoading(); wx.hideLoading();
} }
@@ -75,20 +81,20 @@ const request = (url, options, config = { showLoading: true, showError: true })
}; };
// 封装get方法 // 封装get方法
export const get = (url, data = {}, config) => { export const get = (url: string, data = {}, config?: any): any => {
return request(url, { method: "GET", data }, config); return request(url, { method: "GET", data }, config);
}; };
// 封装post方法 // 封装post方法
export const post = (url, data = {}, config) => { export const post = (url: string, data = {}, config?: any): any => {
return request(url, { method: "POST", data }, config); return request(url, { method: "POST", data }, config);
}; };
export const wxLogin = (config) => { export const wxLogin = (config?: any) => {
wx.login({ wx.login({
success: (res) => { success: (res) => {
post("Applet/code2Sess", { code: res.code, name: "ch" }, config) post("Applet/code2Sess", { code: res.code, name: "ch" }, config)
.then((res) => { .then((res: any) => {
// 记录sessionKey // 记录sessionKey
setStorage("session", { setStorage("session", {
openid: res.openid, openid: res.openid,
@@ -96,7 +102,7 @@ export const wxLogin = (config) => {
time: Date.now() + 1000 * 3600 * 24, // 缓存一天过期 time: Date.now() + 1000 * 3600 * 24, // 缓存一天过期
}); });
}) })
.catch((err) => { .catch((err: any) => {
ToastErr("服务失败:" + err.err_code); ToastErr("服务失败:" + err.err_code);
}); });
}, },
@@ -133,20 +139,20 @@ export const checkSession = () => {
export const loginStatus = () => { export const loginStatus = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
post("Applet/loginStatus", {}, { showLoading: false }) post("Applet/loginStatus", {}, { showLoading: false })
.then((res) => { .then((res: any) => {
setStorage("user_info", res.user_info); setStorage("user_info", res.user_info);
setStorage("company_info", res.company_info); setStorage("company_info", res.company_info);
setStorage("auth_info", res.auth_info); setStorage("auth_info", res.auth_info);
setStorage("session_id", res.session_id); setStorage("session_id", res.session_id);
resolve(res); resolve(res);
}) })
.catch((err) => { .catch((err: any) => {
login("", "", 4) login("", "", 4)
.then((res) => { .then((res: any) => {
if (isArray(res.data)) { if (isArray(res.data)) {
post("Applet/loginOut").then((res) => { post("Applet/loginOut").then(() => {
checkSesskey({ showLoading: false, showError: false }) checkSesskey({ showLoading: false, showError: false })
.then((res) => {}) .then(() => {})
.catch((err) => { .catch((err) => {
console.log("checkSesskey", err); console.log("checkSesskey", err);
}); });
@@ -167,13 +173,13 @@ export const loginStatus = () => {
* *
* @param {*} config { showLoading: true, showError: true } * @param {*} config { showLoading: true, showError: true }
*/ */
export const checkSesskey = (config) => { export const checkSesskey = (config?: any) => {
return new Promise((resolve, reject) => { return new Promise<any>((resolve, reject) => {
post("Applet/checkSesskey", {}, config) post("Applet/checkSesskey", {}, config)
.then((res) => { .then((res: any) => {
resolve(res); resolve(res);
}) })
.catch((err) => { .catch((err: any) => {
wxLogin(config); wxLogin(config);
reject(err); reject(err);
}); });
@@ -181,9 +187,14 @@ export const checkSesskey = (config) => {
}; };
// 后端登录 // 后端登录
export const login = (encryptedData, iv, type, company_id) => { export const login = (
return new Promise((resolve, reject) => { encryptedData: any,
const data = { iv: any,
type: any,
company_id?: any
) => {
return new Promise<any>((resolve, reject) => {
const data: any = {
type: 2, type: 2,
encryptedData, encryptedData,
iv, iv,
@@ -194,7 +205,7 @@ export const login = (encryptedData, iv, type, company_id) => {
} }
post("Applet/login", type == 4 ? { type } : data) post("Applet/login", type == 4 ? { type } : data)
.then((res) => { .then((res: any) => {
if (isArray(res.data)) { if (isArray(res.data)) {
resolve(res); resolve(res);
} else { } else {
@@ -205,7 +216,7 @@ export const login = (encryptedData, iv, type, company_id) => {
resolve(res); resolve(res);
} }
}) })
.catch((err) => { .catch((err: any) => {
// 签名失败,重新登录 // 签名失败,重新登录
// if (err.err_code == 41444) { // if (err.err_code == 41444) {
// wxLogin(); // wxLogin();
@@ -216,7 +227,7 @@ export const login = (encryptedData, iv, type, company_id) => {
// wx.removeStorageSync("loginExp"); // wx.removeStorageSync("loginExp");
if (type == 4) { if (type == 4) {
checkSesskey() checkSesskey()
.then(() => { .then((res) => {
resolve(res); resolve(res);
}) })
.catch(() => { .catch(() => {
@@ -229,18 +240,20 @@ export const login = (encryptedData, iv, type, company_id) => {
}); });
}; };
export const makeURL = (url, redirect = false, openID = false) => { export const makeURL = (url: string, redirect = false, openID = false) => {
return ( return (
base.apiHost + base.apiHost +
(redirect ? "applet-wv?url=" : "") + (redirect ? "applet-wv?url=" : "") +
encodeURIComponent(url + (openID ? "?openID=" + wx.getStorageSync("session")["openid"] : "")) + encodeURIComponent(
url + (openID ? "?openID=" + wx.getStorageSync("session")["openid"] : "")
) +
(redirect ? "&" : "?") + (redirect ? "&" : "?") +
"cookie=" + "cookie=" +
encodeURI(wx.getStorageSync(base.cookieKey)) encodeURI(wx.getStorageSync(base.cookieKey))
); );
}; };
export const urlAddBaseUrl = (url) => { export const urlAddBaseUrl = (url: string) => {
if (typeof url == "string") { if (typeof url == "string") {
if (url.startsWith("/")) { if (url.startsWith("/")) {
url = url.substring(1); url = url.substring(1);
@@ -249,7 +262,7 @@ export const urlAddBaseUrl = (url) => {
return base.apiHost + url; return base.apiHost + url;
}; };
export const urlAddWebViewBaseUrl = (url) => { export const urlAddWebViewBaseUrl = (url: string) => {
if (typeof url == "string") { if (typeof url == "string") {
if (url.startsWith("/")) { if (url.startsWith("/")) {
url = url.substring(1); url = url.substring(1);
@@ -259,7 +272,7 @@ export const urlAddWebViewBaseUrl = (url) => {
}; };
/** formData请求 */ /** formData请求 */
export const formDataRequest = (url, formData, config) => { export const formDataRequest = (url: string, formData: any, config?: any) => {
let data = formData.getData(); let data = formData.getData();
return request( return request(
url, url,

View File

@@ -1,54 +0,0 @@
/** 首页菜单 */
const iconColor = "#0052D9";
export const menuConfig = [
{
title: "订单管理",
icon: "form",
iconColor: iconColor,
children: [
{ 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" },
],
},
{
title: "客户管理",
icon: "user-vip",
iconColor: iconColor,
children: [
{ title: "供应商管理", url: "/pages/crm_manage/suppliers/suppliers", auth: "SF_VIEW_CRM_SUPPLIER" },
{ 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" },
],
},
];
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

@@ -0,0 +1,94 @@
/** 首页菜单 */
const iconColor = "#0052D9";
export const menuConfig = [
{
title: "订单管理",
icon: "form",
iconColor: iconColor,
children: [
{
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",
},
],
},
{
title: "客户管理",
icon: "user-vip",
iconColor: iconColor,
children: [
{
title: "供应商管理",
url: "/pages/crm_manage/suppliers/suppliers",
auth: "SF_VIEW_CRM_SUPPLIER",
},
{
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",
},
],
},
];
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

@@ -1,6 +1,6 @@
import { post, urlAddBaseUrl } from "./https"; import { post, urlAddBaseUrl } from "./https";
const playVoice = (src, text) => { const playVoice = (src: string, text: string) => {
const innerAudioContext = wx.createInnerAudioContext({ const innerAudioContext = wx.createInnerAudioContext({
useWebAudioImplement: true, useWebAudioImplement: true,
}); });
@@ -17,7 +17,7 @@ const playVoice = (src, text) => {
}); });
}; };
export const voiceRequest = (text, cacheVoice) => { export const voiceRequest = (text: string, cacheVoice?: boolean) => {
// if (cacheVoice) { // if (cacheVoice) {
// const data = wx.getStorageSync(text); // const data = wx.getStorageSync(text);
// console.log(data); // console.log(data);
@@ -53,7 +53,7 @@ export const voiceRequest = (text, cacheVoice) => {
vol: 9, vol: 9,
}, },
{ showLoading: false } { showLoading: false }
).then((res) => { ).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) { // if (cacheVoice) {