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:
@@ -1,4 +1,5 @@
|
||||
// pages/agreement/agreement.js
|
||||
import { base } from "@/utils/config";
|
||||
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
@@ -11,14 +12,12 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
type: options.type,
|
||||
});
|
||||
const appletName = base.appletName;
|
||||
this.setData({ type: options.type });
|
||||
wx.setNavigationBarTitle({
|
||||
title:
|
||||
options.type == "user"
|
||||
? "易宝赞数据化管理系统平台用户服务协议"
|
||||
: "易宝赞数据化管理系统隐私权政策",
|
||||
title: `${appletName}${
|
||||
options.type == "user" ? "平台用户服务协议" : "隐私权政策"
|
||||
}`,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { goIndexPage } from "@/utils/util";
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
@@ -13,10 +14,8 @@ Component({
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
navIndex: function () {
|
||||
wx.switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
navIndex() {
|
||||
goIndexPage();
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -1,5 +1,12 @@
|
||||
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";
|
||||
|
||||
/** 拼接符号 */
|
||||
@@ -11,7 +18,7 @@ const RecallCodeMarking = "-";
|
||||
* 解析流程码
|
||||
* @param {string} value
|
||||
*/
|
||||
const parseQrCode = (value) => {
|
||||
const parseQrCode = (value: string) => {
|
||||
value = `${value || ""}`;
|
||||
const obj = {
|
||||
/** 工序码 */
|
||||
@@ -23,7 +30,9 @@ const parseQrCode = (value) => {
|
||||
};
|
||||
if (value.includes(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)) {
|
||||
@@ -43,16 +52,16 @@ Page({
|
||||
processCodeMsg: "",
|
||||
rel_order_no: "",
|
||||
process_code: "",
|
||||
logsList: [],
|
||||
logsList: [] as any[],
|
||||
show: false,
|
||||
orders: [],
|
||||
orders: [] as any[],
|
||||
isLogin: false,
|
||||
isScanCode: false,
|
||||
voice: true,
|
||||
loading: true,
|
||||
authInfo: {},
|
||||
hideTabKeys: [],
|
||||
processItems: [],
|
||||
hideTabKeys: [] as string[],
|
||||
processItems: [] as any[],
|
||||
backFlag: false,
|
||||
selectedProcessCode: "",
|
||||
result: "",
|
||||
@@ -61,10 +70,10 @@ Page({
|
||||
defaultBonus: true,
|
||||
showDefaultBonus: false,
|
||||
defaultBonusConfig: {},
|
||||
defaultBonusConfigKeys: [],
|
||||
defaultBonusConfigKeys: [] as string[],
|
||||
rel_order_no_temp: "",
|
||||
},
|
||||
handleLogin(e) {
|
||||
handleLogin(e: any) {
|
||||
if (e.detail) {
|
||||
this.setData({ isLogin: true, authInfo: getAuthInfo() });
|
||||
this.init();
|
||||
@@ -72,13 +81,15 @@ Page({
|
||||
this.setData({ isLogin: false });
|
||||
}
|
||||
},
|
||||
backChange(e) {
|
||||
backChange(e: any) {
|
||||
this.data.backFlag = e.detail;
|
||||
this.setData({ backFlag: e.detail });
|
||||
wx.setStorageSync("processBackFlag", e.detail ? 1 : 0);
|
||||
if (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) {
|
||||
this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`;
|
||||
}
|
||||
@@ -101,8 +112,9 @@ Page({
|
||||
}
|
||||
}
|
||||
},
|
||||
processItemTap(e) {
|
||||
this.data.selectedProcessCode = e.currentTarget.dataset.code + (this.data.backFlag ? "-" : "");
|
||||
processItemTap(e: any) {
|
||||
this.data.selectedProcessCode =
|
||||
e.currentTarget.dataset.code + (this.data.backFlag ? "-" : "");
|
||||
wx.setStorageSync("selectedProcessCode", this.data.selectedProcessCode);
|
||||
this.setData({
|
||||
selectedProcessCode: this.data.selectedProcessCode,
|
||||
@@ -110,7 +122,7 @@ Page({
|
||||
this.getProcessName();
|
||||
},
|
||||
getExecProcess() {
|
||||
post("Orders/getExecProcess1").then((res) => {
|
||||
post("Orders/getExecProcess1").then((res: any) => {
|
||||
this.data.processItems = toArray(res.data);
|
||||
if (this.data.processItems.length == 1) {
|
||||
this.data.selectedProcessCode = this.data.processItems[0].code;
|
||||
@@ -140,18 +152,18 @@ Page({
|
||||
});
|
||||
this.getExecProcess();
|
||||
},
|
||||
voiceChange(event) {
|
||||
voiceChange(event: any) {
|
||||
this.setData({
|
||||
voice: event.detail,
|
||||
});
|
||||
wx.setStorageSync("processEntryVoice", `${event.detail}`);
|
||||
},
|
||||
getVoice(msg, cacheVoice) {
|
||||
getVoice(msg: string, cacheVoice?: boolean) {
|
||||
if (this.data.voice && msg) {
|
||||
voiceRequest(msg, cacheVoice);
|
||||
}
|
||||
},
|
||||
onLogTypeChange(e) {
|
||||
onLogTypeChange(e: any) {
|
||||
const data = getDataSet(e);
|
||||
this.setData({ 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);
|
||||
post("CompanyProcess/processChildList", {
|
||||
curr_page: 1,
|
||||
page_count: 1,
|
||||
real_code: code.code,
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
const data = res.data;
|
||||
if (Array.isArray(res.data) && data.length) {
|
||||
this.setData({
|
||||
@@ -225,7 +237,7 @@ Page({
|
||||
this.getVoice(`未找到工序`, true);
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
.catch(() => {
|
||||
this.addMsg("未找到 " + real_code + " 工序");
|
||||
wx.showToast({
|
||||
title: "未找到该工序",
|
||||
@@ -239,14 +251,14 @@ Page({
|
||||
this.setProcess();
|
||||
}
|
||||
},
|
||||
LCProcessEnter(e) {
|
||||
LCProcessEnter(e: any) {
|
||||
const item = this.data.orders[e.currentTarget.dataset.index];
|
||||
this.data.rel_order_no_temp = item.rel_order_no;
|
||||
this.setProcess();
|
||||
},
|
||||
setProcess(other) {
|
||||
setProcess(other?: any) {
|
||||
const code = parseQrCode(this.data.process_code);
|
||||
const obj = {};
|
||||
const obj: any = {};
|
||||
if (code.key) {
|
||||
obj[this.data.rel_order_no_temp] = code.key;
|
||||
}
|
||||
@@ -256,12 +268,14 @@ Page({
|
||||
process_code: code.code,
|
||||
action: this.data.action,
|
||||
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",
|
||||
}),
|
||||
other: JSON.stringify({ ...other, ...obj }),
|
||||
})
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (res.bonus == 1) {
|
||||
const data = toObject(res.data);
|
||||
this.setData({
|
||||
@@ -270,10 +284,12 @@ Page({
|
||||
showDefaultBonus: true,
|
||||
});
|
||||
} 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)
|
||||
.map((ell) => {
|
||||
return `${ell.room_name || "未命名"}(${ell.goods_name || "未命名"})`;
|
||||
return `${ell.room_name || "未命名"}(${
|
||||
ell.goods_name || "未命名"
|
||||
})`;
|
||||
})
|
||||
.join(",");
|
||||
|
||||
@@ -303,7 +319,7 @@ Page({
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
.catch((res: any) => {
|
||||
this.addMsg(res.err_msg);
|
||||
if (res.err_code == "244269") {
|
||||
this.setData({
|
||||
@@ -322,7 +338,7 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
onSelectBonus(e) {
|
||||
onSelectBonus(e: any) {
|
||||
const data = getDataSet(e);
|
||||
this.setProcess({ [data.order_no]: data.key });
|
||||
},
|
||||
@@ -337,7 +353,7 @@ Page({
|
||||
// });
|
||||
// setDefaultBonus(e.detail ? "1" : "0");
|
||||
// },
|
||||
addMsg(msg) {
|
||||
addMsg(msg: any) {
|
||||
const now = new Date();
|
||||
this.data.logsList.unshift({
|
||||
date: formatTime(now).substring(5),
|
||||
@@ -351,30 +367,24 @@ Page({
|
||||
});
|
||||
},
|
||||
clearMsg() {
|
||||
this.setData({
|
||||
logsList: [],
|
||||
});
|
||||
this.setData({ logsList: [] });
|
||||
},
|
||||
show() {
|
||||
this.setData({
|
||||
show: true,
|
||||
});
|
||||
this.setData({ show: true });
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
this.setData({ show: false });
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
onLoad(_options) {
|
||||
this.setData({
|
||||
loading: true,
|
||||
voice: wx.getStorageSync("processEntryVoice") == "false" ? false : true,
|
||||
});
|
||||
loginStatus()
|
||||
.then((res) => {
|
||||
.then(() => {
|
||||
this.setData({
|
||||
isLogin: true,
|
||||
loading: false,
|
||||
@@ -3,16 +3,20 @@
|
||||
* YangXB 2021.11.24
|
||||
* */
|
||||
import { base, http } from "./config";
|
||||
import { getStorage, isArray, setStorage, ToastErr } from "./util";
|
||||
import { getStorage, goIndexPage, isArray, setStorage, ToastErr } from "./util";
|
||||
/**
|
||||
* 请求
|
||||
* @param {*} url
|
||||
* @param {*} options
|
||||
* @param {*} config
|
||||
*/
|
||||
const request = (url, options, config = { showLoading: true, showError: true }) => {
|
||||
const request = (
|
||||
url: string,
|
||||
options: any,
|
||||
config = { showLoading: true, showError: true }
|
||||
) => {
|
||||
// 获取缓存cookie
|
||||
const header = { ...http.header };
|
||||
const header: any = { ...http.header };
|
||||
const cookie = getStorage(base.cookieKey);
|
||||
|
||||
if (cookie && !header["Cookie"]) {
|
||||
@@ -33,7 +37,7 @@ const request = (url, options, config = { showLoading: true, showError: true })
|
||||
method: options.method,
|
||||
data: options.data,
|
||||
header,
|
||||
success(request) {
|
||||
success(request: any) {
|
||||
if (config.showLoading != false) {
|
||||
wx.hideLoading();
|
||||
}
|
||||
@@ -42,7 +46,7 @@ const request = (url, options, config = { showLoading: true, showError: true })
|
||||
setStorage(base.cookieKey, request.header["Set-Cookie"]);
|
||||
}
|
||||
|
||||
if (request.data.err_code === 0) {
|
||||
if (request.data?.err_code === 0) {
|
||||
//
|
||||
} else {
|
||||
if (config.showError != false) {
|
||||
@@ -54,17 +58,19 @@ const request = (url, options, config = { showLoading: true, showError: true })
|
||||
if (request.data.err_code == 110000) {
|
||||
const pages = getCurrentPages();
|
||||
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);
|
||||
},
|
||||
fail(error) {
|
||||
fail(error: any) {
|
||||
if (config.showLoading != false) {
|
||||
wx.hideLoading();
|
||||
}
|
||||
@@ -75,20 +81,20 @@ const request = (url, options, config = { showLoading: true, showError: true })
|
||||
};
|
||||
|
||||
// 封装get方法
|
||||
export const get = (url, data = {}, config) => {
|
||||
export const get = (url: string, data = {}, config?: any): any => {
|
||||
return request(url, { method: "GET", data }, config);
|
||||
};
|
||||
|
||||
// 封装post方法
|
||||
export const post = (url, data = {}, config) => {
|
||||
export const post = (url: string, data = {}, config?: any): any => {
|
||||
return request(url, { method: "POST", data }, config);
|
||||
};
|
||||
|
||||
export const wxLogin = (config) => {
|
||||
export const wxLogin = (config?: any) => {
|
||||
wx.login({
|
||||
success: (res) => {
|
||||
post("Applet/code2Sess", { code: res.code, name: "ch" }, config)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
// 记录sessionKey
|
||||
setStorage("session", {
|
||||
openid: res.openid,
|
||||
@@ -96,7 +102,7 @@ export const wxLogin = (config) => {
|
||||
time: Date.now() + 1000 * 3600 * 24, // 缓存一天过期
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
ToastErr("服务失败:" + err.err_code);
|
||||
});
|
||||
},
|
||||
@@ -133,20 +139,20 @@ export const checkSession = () => {
|
||||
export const loginStatus = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
post("Applet/loginStatus", {}, { showLoading: false })
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
setStorage("user_info", res.user_info);
|
||||
setStorage("company_info", res.company_info);
|
||||
setStorage("auth_info", res.auth_info);
|
||||
setStorage("session_id", res.session_id);
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
login("", "", 4)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (isArray(res.data)) {
|
||||
post("Applet/loginOut").then((res) => {
|
||||
post("Applet/loginOut").then(() => {
|
||||
checkSesskey({ showLoading: false, showError: false })
|
||||
.then((res) => {})
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
console.log("checkSesskey", err);
|
||||
});
|
||||
@@ -167,13 +173,13 @@ export const loginStatus = () => {
|
||||
*
|
||||
* @param {*} config { showLoading: true, showError: true }
|
||||
*/
|
||||
export const checkSesskey = (config) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
export const checkSesskey = (config?: any) => {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
post("Applet/checkSesskey", {}, config)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
resolve(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
wxLogin(config);
|
||||
reject(err);
|
||||
});
|
||||
@@ -181,9 +187,14 @@ export const checkSesskey = (config) => {
|
||||
};
|
||||
|
||||
// 后端登录
|
||||
export const login = (encryptedData, iv, type, company_id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {
|
||||
export const login = (
|
||||
encryptedData: any,
|
||||
iv: any,
|
||||
type: any,
|
||||
company_id?: any
|
||||
) => {
|
||||
return new Promise<any>((resolve, reject) => {
|
||||
const data: any = {
|
||||
type: 2,
|
||||
encryptedData,
|
||||
iv,
|
||||
@@ -194,7 +205,7 @@ export const login = (encryptedData, iv, type, company_id) => {
|
||||
}
|
||||
|
||||
post("Applet/login", type == 4 ? { type } : data)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
if (isArray(res.data)) {
|
||||
resolve(res);
|
||||
} else {
|
||||
@@ -205,7 +216,7 @@ export const login = (encryptedData, iv, type, company_id) => {
|
||||
resolve(res);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch((err: any) => {
|
||||
// 签名失败,重新登录
|
||||
// if (err.err_code == 41444) {
|
||||
// wxLogin();
|
||||
@@ -216,7 +227,7 @@ export const login = (encryptedData, iv, type, company_id) => {
|
||||
// wx.removeStorageSync("loginExp");
|
||||
if (type == 4) {
|
||||
checkSesskey()
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
resolve(res);
|
||||
})
|
||||
.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 (
|
||||
base.apiHost +
|
||||
(redirect ? "applet-wv?url=" : "") +
|
||||
encodeURIComponent(url + (openID ? "?openID=" + wx.getStorageSync("session")["openid"] : "")) +
|
||||
encodeURIComponent(
|
||||
url + (openID ? "?openID=" + wx.getStorageSync("session")["openid"] : "")
|
||||
) +
|
||||
(redirect ? "&" : "?") +
|
||||
"cookie=" +
|
||||
encodeURI(wx.getStorageSync(base.cookieKey))
|
||||
);
|
||||
};
|
||||
|
||||
export const urlAddBaseUrl = (url) => {
|
||||
export const urlAddBaseUrl = (url: string) => {
|
||||
if (typeof url == "string") {
|
||||
if (url.startsWith("/")) {
|
||||
url = url.substring(1);
|
||||
@@ -249,7 +262,7 @@ export const urlAddBaseUrl = (url) => {
|
||||
return base.apiHost + url;
|
||||
};
|
||||
|
||||
export const urlAddWebViewBaseUrl = (url) => {
|
||||
export const urlAddWebViewBaseUrl = (url: string) => {
|
||||
if (typeof url == "string") {
|
||||
if (url.startsWith("/")) {
|
||||
url = url.substring(1);
|
||||
@@ -259,7 +272,7 @@ export const urlAddWebViewBaseUrl = (url) => {
|
||||
};
|
||||
|
||||
/** formData请求 */
|
||||
export const formDataRequest = (url, formData, config) => {
|
||||
export const formDataRequest = (url: string, formData: any, config?: any) => {
|
||||
let data = formData.getData();
|
||||
return request(
|
||||
url,
|
||||
@@ -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",
|
||||
},
|
||||
];
|
||||
94
miniprogram/utils/menuConfig.ts
Normal file
94
miniprogram/utils/menuConfig.ts
Normal 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",
|
||||
},
|
||||
];
|
||||
@@ -1,6 +1,6 @@
|
||||
import { post, urlAddBaseUrl } from "./https";
|
||||
|
||||
const playVoice = (src, text) => {
|
||||
const playVoice = (src: string, text: string) => {
|
||||
const innerAudioContext = wx.createInnerAudioContext({
|
||||
useWebAudioImplement: true,
|
||||
});
|
||||
@@ -17,7 +17,7 @@ const playVoice = (src, text) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const voiceRequest = (text, cacheVoice) => {
|
||||
export const voiceRequest = (text: string, cacheVoice?: boolean) => {
|
||||
// if (cacheVoice) {
|
||||
// const data = wx.getStorageSync(text);
|
||||
// console.log(data);
|
||||
@@ -53,7 +53,7 @@ export const voiceRequest = (text, cacheVoice) => {
|
||||
vol: 9,
|
||||
},
|
||||
{ showLoading: false }
|
||||
).then((res) => {
|
||||
).then((res: any) => {
|
||||
if (res.err_code == 0) {
|
||||
playVoice(urlAddBaseUrl(res.data), text);
|
||||
// if (cacheVoice) {
|
||||
Reference in New Issue
Block a user