fix:更新

This commit is contained in:
zsqtony 2025-07-09 00:34:00 +08:00
parent f231f64c1d
commit aa26889f03
128 changed files with 99572 additions and 10831 deletions

10
.prettierrc Normal file
View File

@ -0,0 +1,10 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100,
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "auto"
}

17
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.requireConfig": true
}

View File

@ -9,15 +9,64 @@ const useWeAppAuthStore = common_vendor.defineStore("we_app_auth", () => {
user: { id: 0, username: "" } user: { id: 0, username: "" }
}); });
function login(app) { function login(app) {
common_vendor.index.login({ var _a, _b, _c;
provider: "weixin", const res = common_vendor.index.getSystemInfoSync();
//使用微信登录 if ((res == null ? void 0 : res.environment) === "wxwork") {
success: function(loginRes) { (_b = (_a = common_vendor.index) == null ? void 0 : _a.qy) == null ? void 0 : _b.login({
console.log(loginRes.code); success: function(loginRes) {
console.log(loginRes);
getWorkToken(app, loginRes.code);
}
});
} else {
(_c = common_vendor.index) == null ? void 0 : _c.login({
provider: "weixin",
//使用微信登录
success: function(loginRes) {
console.log(loginRes);
getWXToken(app, loginRes.code);
}
});
}
}
const getWorkToken = (app, code) => {
gen_Apis.Apis.Login.Auth.WorkLogin({ code, app_id: "ww8e14f3d20774c997" }).then((res) => {
var _a, _b, _c, _d;
console.log("登录", res == null ? void 0 : res.data);
data.value.user = (_a = res.data) == null ? void 0 : _a.user;
loading.value = false;
common_vendor.index.setStorageSync("ACCESS_TOKEN_CUSTOMER", (_c = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.token) == null ? void 0 : _c.token);
app == null ? void 0 : app.appContext.config.globalProperties.$isResolve();
if (!((_d = res.data) == null ? void 0 : _d.user)) {
common_vendor.index.redirectTo({
url: "/pages/login"
});
return false; return false;
} }
}).catch(() => {
loading.value = false;
hasError.value = true;
}); });
} };
const getWXToken = (app, code) => {
gen_Apis.Apis.Login.Auth.Login({ code, app_id: "wx09b52ea34b5e8855" }).then((res) => {
var _a, _b, _c, _d;
console.log("登录", res == null ? void 0 : res.data);
data.value.user = (_a = res.data) == null ? void 0 : _a.user;
loading.value = false;
common_vendor.index.setStorageSync("ACCESS_TOKEN_CUSTOMER", (_c = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.token) == null ? void 0 : _c.token);
app == null ? void 0 : app.appContext.config.globalProperties.$isResolve();
if (!((_d = res.data) == null ? void 0 : _d.user)) {
common_vendor.index.redirectTo({
url: "/pages/login"
});
return false;
}
}).catch(() => {
loading.value = false;
hasError.value = true;
});
};
function me() { function me() {
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Login.Auth.Me, {}).then((res) => { common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Login.Auth.Me, {}).then((res) => {
data.value.user = res.data.user; data.value.user = res.data.user;
@ -27,7 +76,10 @@ const useWeAppAuthStore = common_vendor.defineStore("we_app_auth", () => {
}); });
} }
const handleUserLogin = async (from_data) => { const handleUserLogin = async (from_data) => {
common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Login.Auth.BindPhoneNumber, from_data).then((res) => { common_libraries_apiLoading.getApiLoading(gen_Apis.Apis.Login.Auth.BindPhoneNumber, {
app_id: "wx09b52ea34b5e8855",
...from_data
}).then((res) => {
me(); me();
}); });
}; };

View File

@ -5140,16 +5140,6 @@ function formatComponentName(instance, Component2, isRoot = false) {
const computed = (getterOrOptions, debugOptions) => { const computed = (getterOrOptions, debugOptions) => {
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
}; };
function useSlots() {
return getContext().slots;
}
function getContext() {
const i = getCurrentInstance();
if (!i) {
warn(`useContext() called without active instance.`);
}
return i.setupContext || (i.setupContext = createSetupContext(i));
}
const version$1 = "3.2.47"; const version$1 = "3.2.47";
function unwrapper(target) { function unwrapper(target) {
return unref(target); return unref(target);
@ -12793,6 +12783,5 @@ exports.t = t;
exports.test = test; exports.test = test;
exports.throttle = throttle; exports.throttle = throttle;
exports.unref = unref; exports.unref = unref;
exports.useSlots = useSlots;
exports.uviewPlus = uviewPlus; exports.uviewPlus = uviewPlus;
exports.watch = watch; exports.watch = watch;

View File

@ -1,30 +0,0 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "hs-card",
props: ["title", "backgroundUrl", "styles", "borderHead"],
setup(__props) {
const props = __props;
const slots = common_vendor.useSlots();
const handleGetRelationNodes = () => {
let show = slots.default;
return show;
};
return (_ctx, _cache) => {
return common_vendor.e({
a: props == null ? void 0 : props.title
}, (props == null ? void 0 : props.title) ? {
b: common_vendor.t(props == null ? void 0 : props.title),
c: (props == null ? void 0 : props.borderHead) ? "1rpx solid #eee" : ""
} : {}, {
d: handleGetRelationNodes()
}, handleGetRelationNodes() ? {} : {}, {
e: props.backgroundUrl ? `url(${props.backgroundUrl || ""})` : "#fff",
f: common_vendor.s(__props.styles),
g: common_vendor.o(($event) => _ctx.$emit("click"))
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-card/hs-card.vue"]]);
wx.createComponent(Component);

View File

@ -1,22 +0,0 @@
.card_content {
padding: 0 30rpx;
margin: 30rpx;
border-radius: 20rpx;
}
.card_header {
padding: 30rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.card_header .title {
flex: 1;
font-weight: 450;
font-size: 30rpx;
}
.card_header .right_value {
padding: 2rpx 12rpx;
align-content: center;
font-size: 27rpx;
color: #000;
}

View File

@ -1,65 +0,0 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_libraries_day = require("../../common/libraries/day.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "hs-day-picker",
props: [
"Enums",
"title",
"pickerIndex",
"value",
"borderTop",
"required",
"valueModel",
"icon",
"iconSize"
],
emits: ["change", "update:valueModel"],
setup(__props, { emit }) {
const props = __props;
const selectValue = common_vendor.ref("");
const onChange = (e) => {
var _a, _b, _c;
selectValue.value = (_a = e == null ? void 0 : e.detail) == null ? void 0 : _a.value;
emit("update:valueModel", (_b = e == null ? void 0 : e.detail) == null ? void 0 : _b.value);
emit("change", (_c = e == null ? void 0 : e.detail) == null ? void 0 : _c.value);
};
common_vendor.watch(
() => props == null ? void 0 : props.valueModel,
(val) => {
selectValue.value = val;
}
);
common_vendor.onMounted(() => {
if (props == null ? void 0 : props.valueModel) {
selectValue.value = props == null ? void 0 : props.valueModel;
} else {
selectValue.value = common_libraries_day.getDay();
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(selectValue.value),
b: props == null ? void 0 : props.icon
}, (props == null ? void 0 : props.icon) ? {
c: common_vendor.p({
type: props == null ? void 0 : props.icon,
size: (props == null ? void 0 : props.iconSize) || 19,
color: "#555"
})
} : {}, {
d: common_vendor.o(onChange)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7a35584e"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-day-picker/hs-day-picker.vue"]]);
wx.createComponent(Component);

View File

@ -1,9 +0,0 @@
.nchl_day_picker.data-v-7a35584e {
color: #333;
font-size: 28rpx;
display: flex;
align-items: center;
}
.nchl_day_picker text.data-v-7a35584e {
padding-right: 10rpx;
}

View File

@ -1,93 +0,0 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const components_hsInput_reducer = require("./reducer.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "hs-input",
props: components_hsInput_reducer.wlInputProps,
emits: [
"update:valueModel",
"input",
"blur",
"bindconfirm",
"onClose"
],
setup(__props, { emit }) {
const props = __props;
const valueModel = common_vendor.ref("");
common_vendor.watch(
() => props.valueModel,
(val) => {
valueModel.value = val;
handleChange(val);
}
);
common_vendor.onMounted(() => {
valueModel.value = props.valueModel;
handleChange(props.valueModel);
});
const onChange = (e) => {
const target = e.target;
let value = target.value;
handleChange(value);
};
const handleChange = (value) => {
emit("update:valueModel", value);
emit("input", value);
};
const onBlur = () => {
emit("blur", props.valueModel);
};
const onConfirm = (e) => {
const target = e.target;
let value = target.value;
emit("bindconfirm", value);
};
const emptyInput = () => {
valueModel.value = "";
onChange({ target: { value: "" } });
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.n(props.classInputName),
b: common_vendor.o([($event) => valueModel.value = $event.detail.value, onChange]),
c: props.placeholderStyle,
d: (props == null ? void 0 : props.width) || "300rpx",
e: props == null ? void 0 : props.textAlign,
f: common_vendor.o(onChange),
g: (props == null ? void 0 : props.placeholder) || "请输入",
h: (props == null ? void 0 : props.maxLength) || 255,
i: (props == null ? void 0 : props.type) || "text",
j: common_vendor.o(onBlur),
k: common_vendor.o(onConfirm),
l: props == null ? void 0 : props.disabled,
m: props == null ? void 0 : props.confirmType,
n: (props == null ? void 0 : props.password) || false,
o: valueModel.value,
p: valueModel.value.length
}, valueModel.value.length ? {
q: common_vendor.o(emptyInput),
r: common_vendor.p({
type: "closeempty",
color: "#999999",
size: "12"
})
} : {}, {
s: _ctx.suffix
}, _ctx.suffix ? {
t: common_vendor.t(_ctx.suffix)
} : {}, {
v: common_vendor.n(props.className)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-input/hs-input.vue"]]);
wx.createComponent(Component);

View File

@ -1,6 +0,0 @@
{
"component": true,
"usingComponents": {
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
}
}

View File

@ -1 +0,0 @@
<view class="{{['input_content', v]}}"><block wx:if="{{r0}}"><input class="{{['uni-input', a]}}" bindinput="{{b}}" placeholder-style="{{c}}" style="{{'width:' + d + ';' + ('text-align:' + e)}}" bindchange="{{f}}" placeholder="{{g}}" maxlength="{{h}}" type="{{i}}" bindblur="{{j}}" bindconfirm="{{k}}" disabled="{{l}}" confirm-type="{{m}}" password="{{n}}" value="{{o}}"/></block><view wx:if="{{p}}" class="close"><uni-icons wx:if="{{r}}" bindclick="{{q}}" u-i="3eb21455-0" bind:__l="__l" u-p="{{r}}"/></view><view wx:if="{{s}}" class="suffix">{{t}}</view></view>

View File

@ -1,19 +0,0 @@
.input_content {
display: flex;
align-items: center;
justify-content: space-between;
}
.input_content .uni-input {
flex: 1;
height: 70rpx;
}
.suffix {
color: #333333;
font-size: 28rpx;
margin-left: 20rpx;
}
.close {
height: 70rpx;
line-height: 70rpx;
padding: 0 10rpx;
}

View File

@ -1,74 +0,0 @@
"use strict";
const defInputProps = {
valueModel: "",
placeholder: "请输入内容",
width: "100%",
suffix: "",
maxLength: 255,
type: "text",
className: "",
placeholderStyle: "color: #ccc;font-size:25rpx;",
classInputName: "",
textAlign: "left",
confirmType: "done",
hasClose: false
};
const wlInputProps = {
valueModel: {
type: String,
default: defInputProps.valueModel
},
placeholder: {
type: String,
default: defInputProps.placeholder
},
width: {
type: String,
default: defInputProps.width
},
suffix: {
type: String,
default: defInputProps.suffix
},
maxLength: {
type: Number,
default: defInputProps.maxLength
},
type: {
type: String,
default: defInputProps.type
},
className: {
type: String,
default: defInputProps.className
},
placeholderStyle: {
type: String,
default: defInputProps.placeholderStyle
},
classInputName: {
type: String,
default: defInputProps.classInputName
},
password: {
type: Boolean,
default: false
},
textAlign: {
type: String,
default: defInputProps.textAlign
},
confirmType: {
type: String,
default: defInputProps.confirmType
},
disabled: {
type: Boolean,
default: false
},
hasClose: {
type: Boolean,
default: defInputProps.hasClose
}
};
exports.wlInputProps = wlInputProps;

View File

@ -1,31 +0,0 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
(_easycom_uni_icons2 + _easycom_hs_button2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_button = () => "../hs-button/hs-button.js";
if (!Math) {
(_easycom_uni_icons + _easycom_hs_button)();
}
function _sfc_render(_ctx, _cache) {
return {
a: common_vendor.p({
type: "phone",
size: "13",
color: "#3da605"
}),
b: common_vendor.p({
label: "删除",
type: "delete"
}),
c: common_vendor.p({
label: "编辑"
})
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-88a741e2"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-order-items/hs-order-items.vue"]]);
wx.createComponent(Component);

View File

@ -1,7 +0,0 @@
{
"component": true,
"usingComponents": {
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"hs-button": "../hs-button/hs-button"
}
}

View File

@ -1 +0,0 @@
<view class="order_items data-v-88a741e2"><view class="header_no data-v-88a741e2">no.312312312321321</view><view class="user_info data-v-88a741e2"><view class="user_name data-v-88a741e2"> 黄先生 <text class="data-v-88a741e2">一人会有限公司</text></view><view class="prices data-v-88a741e2"> ¥122.32 </view></view><view class="parameters_body data-v-88a741e2"><view class="items data-v-88a741e2"> 塑料类-<text class="data-v-88a741e2">饮料瓶</text></view><view class="items data-v-88a741e2"> 计件:<text class="data-v-88a741e2">32件</text></view></view><view class="item_footer data-v-88a741e2"><view class="phone_btn data-v-88a741e2"><uni-icons wx:if="{{a}}" class="data-v-88a741e2" u-i="88a741e2-0" bind:__l="__l" u-p="{{a}}"></uni-icons> 打电话 </view><view class="group_btn data-v-88a741e2"><hs-button wx:if="{{b}}" class="data-v-88a741e2" u-i="88a741e2-1" bind:__l="__l" u-p="{{b}}"/><hs-button wx:if="{{c}}" class="data-v-88a741e2" u-i="88a741e2-2" bind:__l="__l" u-p="{{c}}"/></view></view></view>

View File

@ -1,61 +0,0 @@
.order_items.data-v-88a741e2 {
background-color: #fff;
padding: 30rpx;
border-radius: 10rpx;
margin: 30rpx;
position: relative;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
}
.order_items .header_no.data-v-88a741e2 {
color: #666;
font-size: 27rpx;
}
.order_items .user_info.data-v-88a741e2 {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15rpx 0;
}
.order_items .user_info .user_name.data-v-88a741e2 {
font-size: 27rpx;
font-weight: 600;
}
.order_items .user_info .user_name text.data-v-88a741e2 {
padding-left: 30rpx;
color: #999;
font-weight: 400;
}
.order_items .user_info .prices.data-v-88a741e2 {
font-size: 26rpx;
}
.order_items .parameters_body.data-v-88a741e2 {
display: flex;
align-items: center;
flex-wrap: wrap;
font-size: 27rpx;
color: #333;
}
.order_items .parameters_body .items.data-v-88a741e2 {
width: 50%;
}
.order_items .item_footer.data-v-88a741e2 {
display: flex;
align-items: center;
justify-content: space-between;
padding-top: 25rpx;
border-top: 1rpx solid #f8f8f8;
margin-top: 25rpx;
}
.order_items .item_footer .phone_btn.data-v-88a741e2 {
display: flex;
align-items: center;
color: #3da605;
font-size: 27rpx;
}
.order_items .item_footer .group_btn.data-v-88a741e2 {
display: flex;
align-items: center;
}
.order_items .item_footer .group_btn hs-button.data-v-88a741e2:last-child {
margin-left: 30rpx;
}

View File

@ -31,11 +31,8 @@ const Apis = {
PreUpload(data) { PreUpload(data) {
return common_libraries_request.request("employee/login/auth/pre_upload", { data }); return common_libraries_request.request("employee/login/auth/pre_upload", { data });
}, },
DoUpload(data) { TemporaryUrl(data) {
return common_libraries_request.request("employee/login/auth/do_upload", { data }); return common_libraries_request.request("employee/login/auth/temporary_url", { data });
},
ImLogin() {
return common_libraries_request.request("employee/login/auth/im_login", {});
} }
} }
} }

View File

@ -1,42 +0,0 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_libraries_day = require("../../../common/libraries/day.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "daySelect",
props: ["day"],
emits: ["update:valueModel"],
setup(__props, { emit }) {
const props = __props;
const handleSelect = (day) => {
emit("update:valueModel", day);
};
const listDay = common_vendor.ref([
{
label: "今天",
value: common_libraries_day.getDay()
},
{
label: "昨天",
value: common_libraries_day.getDay(1)
},
{
label: "前天",
value: common_libraries_day.getDay(2)
}
]);
return (_ctx, _cache) => {
return {
a: common_vendor.f(listDay.value, (i, index, i0) => {
return {
a: common_vendor.t(i == null ? void 0 : i.label),
b: index,
c: common_vendor.n(`day_items ${(i == null ? void 0 : i.value) === props.day ? "active" : ""}`),
d: common_vendor.o(($event) => handleSelect(i == null ? void 0 : i.value), index)
};
})
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b04b217e"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/pages/index/components/daySelect.vue"]]);
wx.createComponent(Component);

View File

@ -1,21 +0,0 @@
.day_select.data-v-b04b217e {
display: flex;
align-items: center;
width: 340rpx;
height: 55rpx;
line-height: 55rpx;
border: 1px solid #44ba04;
border-radius: 100rpx;
font-size: 27rpx;
color: #44ba04;
overflow: hidden;
}
.day_select .day_items.data-v-b04b217e {
flex: 1;
text-align: center;
border-radius: 100rpx;
}
.day_select .active.data-v-b04b217e {
background-color: #44ba04;
color: #fff;
}

View File

@ -1,41 +0,0 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const pages_index_model = require("../model.js");
require("../method.js");
require("../../../common/libraries/day.js");
require("../../../common/libraries/request.js");
require("../../../common/store/useWeAppAuthStore.js");
require("../../../gen/Apis.js");
require("../../../common/libraries/apiLoading.js");
if (!Array) {
const _easycom_hs_day_picker2 = common_vendor.resolveComponent("hs-day-picker");
const _easycom_hs_card2 = common_vendor.resolveComponent("hs-card");
(_easycom_hs_day_picker2 + _easycom_hs_card2)();
}
const _easycom_hs_day_picker = () => "../../../components/hs-day-picker/hs-day-picker.js";
const _easycom_hs_card = () => "../../../components/hs-card/hs-card.js";
if (!Math) {
(MyDaySelect + _easycom_hs_day_picker + _easycom_hs_card)();
}
const MyDaySelect = () => "./daySelect.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "showData",
setup(__props) {
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => common_vendor.unref(pages_index_model.useModel).formData.day = $event),
b: common_vendor.p({
day: common_vendor.unref(pages_index_model.useModel).formData.day,
valueModel: common_vendor.unref(pages_index_model.useModel).formData.day
}),
c: common_vendor.o(($event) => common_vendor.unref(pages_index_model.useModel).formData.day = $event),
d: common_vendor.p({
icon: "calendar",
valueModel: common_vendor.unref(pages_index_model.useModel).formData.day
})
};
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a9a28d4d"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/pages/index/components/showData.vue"]]);
wx.createComponent(Component);

View File

@ -1,44 +0,0 @@
.data_header.data-v-a9a28d4d {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 0 40rpx 0;
}
.data_total_price.data-v-a9a28d4d {
text-align: center;
padding: 10rpx 0 30rpx 0;
}
.data_total_price .data_title.data-v-a9a28d4d {
color: #999;
font-size: 25rpx;
padding-bottom: 8rpx;
font-weight: 500;
}
.data_total_price .prices.data-v-a9a28d4d {
color: #f00;
font-size: 40rpx;
font-weight: bold;
}
.data_total_price .prices text.data-v-a9a28d4d {
font-size: 25rpx;
}
.data_item_list.data-v-a9a28d4d {
display: flex;
align-items: center;
flex-wrap: wrap;
padding-bottom: 40rpx;
}
.data_item_list .data_item.data-v-a9a28d4d {
width: 33.333%;
padding: 20rpx 0 0 0;
text-align: center;
}
.data_item_list .data_item .data_label.data-v-a9a28d4d {
font-size: 22rpx;
color: #999;
padding-bottom: 8rpx;
}
.data_item_list .data_item .data_value.data-v-a9a28d4d {
font-weight: 600;
font-size: 35rpx;
}

View File

@ -1,22 +0,0 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache) {
return {
a: common_vendor.p({
type: "plus",
size: "24",
color: "#3da605"
})
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ac65dc11"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/pages/index/components/useInfo.vue"]]);
wx.createComponent(Component);

View File

@ -1,32 +0,0 @@
.user_info.data-v-ac65dc11 {
display: flex;
align-items: center;
padding: 0 30rpx 20rpx 30rpx;
}
.user_info .avatar_info.data-v-ac65dc11 {
width: 140rpx;
height: 140rpx;
border-radius: 40rpx;
background: rgba(229, 229, 229, 0.34);
}
.user_info .user_info_content.data-v-ac65dc11 {
flex: 1;
padding: 0 0 0 30rpx;
color: #fff;
font-size: 27rpx;
}
.user_info .user_info_content .user_name.data-v-ac65dc11 {
display: flex;
align-items: center;
font-size: 32rpx;
padding-bottom: 10rpx;
}
.user_info .user_info_content text.data-v-ac65dc11 {
padding-left: 40rpx;
font-size: 27rpx;
}
.user_info .add_btn.data-v-ac65dc11 {
padding: 10rpx;
background-color: #fff;
border-radius: 15rpx;
}

View File

@ -11,21 +11,13 @@ require("../../common/libraries/day.js");
require("../../gen/Apis.js"); require("../../gen/Apis.js");
require("../../common/libraries/apiLoading.js"); require("../../common/libraries/apiLoading.js");
if (!Array) { if (!Array) {
const _easycom_hs_custom_title2 = common_vendor.resolveComponent("hs-custom-title");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_hs_order_items2 = common_vendor.resolveComponent("hs-order-items");
const _easycom_cc_root_view2 = common_vendor.resolveComponent("cc-root-view"); const _easycom_cc_root_view2 = common_vendor.resolveComponent("cc-root-view");
(_easycom_hs_custom_title2 + _easycom_uni_icons2 + _easycom_hs_order_items2 + _easycom_cc_root_view2)(); _easycom_cc_root_view2();
} }
const _easycom_hs_custom_title = () => "../../components/hs-custom-title/hs-custom-title.js";
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_order_items = () => "../../components/hs-order-items/hs-order-items.js";
const _easycom_cc_root_view = () => "../../common/components/cc-root-view/cc-root-view.js"; const _easycom_cc_root_view = () => "../../common/components/cc-root-view/cc-root-view.js";
if (!Math) { if (!Math) {
(_easycom_hs_custom_title + MyUserInfo + MyShowData + _easycom_uni_icons + _easycom_hs_order_items + _easycom_cc_root_view)(); _easycom_cc_root_view();
} }
const MyShowData = () => "./components/showData.js";
const MyUserInfo = () => "./components/useInfo.js";
const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({ const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
__name: "index", __name: "index",
setup(__props) { setup(__props) {
@ -49,16 +41,7 @@ const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
}; };
}); });
return (_ctx, _cache) => { return (_ctx, _cache) => {
return { return {};
a: common_vendor.p({
title: "废品回收助手"
}),
b: common_vendor.p({
type: "right",
size: "13",
color: "#3da605"
})
};
}; };
} }
}); });

View File

@ -2,11 +2,6 @@
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"hs-custom-title": "../../components/hs-custom-title/hs-custom-title", "cc-root-view": "../../common/components/cc-root-view/cc-root-view"
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"hs-order-items": "../../components/hs-order-items/hs-order-items",
"cc-root-view": "../../common/components/cc-root-view/cc-root-view",
"my-show-data": "./components/showData",
"my-user-info": "./components/useInfo"
} }
} }

View File

@ -1 +1 @@
<cc-root-view u-s="{{['d']}}" u-i="76f3138a-0" bind:__l="__l"><view class="HomePage"><hs-custom-title wx:if="{{a}}" u-i="76f3138a-1,76f3138a-0" bind:__l="__l" u-p="{{a}}"/><my-user-info u-i="76f3138a-2,76f3138a-0" bind:__l="__l"/><my-show-data u-i="76f3138a-3,76f3138a-0" bind:__l="__l"/><view class="OrderTitle"> 最近订单 <view class="more_btn"> 更多<uni-icons wx:if="{{b}}" u-i="76f3138a-4,76f3138a-0" bind:__l="__l" u-p="{{b}}"></uni-icons></view></view><hs-order-items u-i="76f3138a-5,76f3138a-0" bind:__l="__l"/></view></cc-root-view> <cc-root-view u-s="{{['d']}}" u-i="76f3138a-0" bind:__l="__l"><view class="HomePage"> 2 </view></cc-root-view>

View File

@ -1,8 +1,7 @@
"use strict"; "use strict";
const common_vendor = require("../../common/vendor.js"); const common_vendor = require("../../common/vendor.js");
const common_libraries_day = require("../../common/libraries/day.js"); const common_libraries_day = require("../../common/libraries/day.js");
const useModel = { ({
formData: common_vendor.reactive({ day: common_libraries_day.getDay() }), formData: common_vendor.reactive({ day: common_libraries_day.getDay() }),
data: common_vendor.ref() data: common_vendor.ref()
}; });
exports.useModel = useModel;

View File

@ -5,38 +5,33 @@ const common_store_useWeAppAuthStore = require("../common/store/useWeAppAuthStor
require("../gen/Apis.js"); require("../gen/Apis.js");
require("../common/libraries/apiLoading.js"); require("../common/libraries/apiLoading.js");
if (!Array) { if (!Array) {
const _easycom_hs_input2 = common_vendor.resolveComponent("hs-input");
const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button"); const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
const _easycom_hs_private_policy2 = common_vendor.resolveComponent("hs-private-policy"); const _easycom_hs_private_policy2 = common_vendor.resolveComponent("hs-private-policy");
(_easycom_hs_input2 + _easycom_hs_button2 + _easycom_hs_private_policy2)(); (_easycom_hs_button2 + _easycom_hs_private_policy2)();
} }
const _easycom_hs_input = () => "../components/hs-input/hs-input.js";
const _easycom_hs_button = () => "../components/hs-button/hs-button.js"; const _easycom_hs_button = () => "../components/hs-button/hs-button.js";
const _easycom_hs_private_policy = () => "../components/hs-private-policy/hs-private-policy.js"; const _easycom_hs_private_policy = () => "../components/hs-private-policy/hs-private-policy.js";
if (!Math) { if (!Math) {
(_easycom_hs_input + _easycom_hs_button + _easycom_hs_private_policy)(); (_easycom_hs_button + _easycom_hs_private_policy)();
} }
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "login", __name: "login",
setup(__props) { setup(__props) {
const from_data = common_vendor.ref({ common_vendor.ref({
username: "", username: "",
password: "" password: ""
}); });
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore(); const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
let CheckedVal = common_vendor.ref(false); let CheckedVal = common_vendor.ref(false);
const onSubmit = () => { const handleGetPhoneNumber = async (data) => {
if (!privacyToast()) { if (!CheckedVal.value) {
return false; return false;
} }
if (!from_data.value.username || !from_data.value.password) { common_vendor.index.showLoading({
common_vendor.index.showToast({ title: "正在登录...",
title: "请输入帐号和密码!", mask: true
icon: "none" });
}); auth == null ? void 0 : auth.handleUserLogin({ code: data.detail.code });
return;
}
auth.handleUserLogin(from_data.value);
}; };
const privacyToast = () => { const privacyToast = () => {
if (!CheckedVal.value) { if (!CheckedVal.value) {
@ -54,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
mask: true mask: true
}); });
common_vendor.index.downloadFile({ common_vendor.index.downloadFile({
url: "https://nchl-dev.oss-cn-shenzhen.aliyuncs.com/uploads/cs-test/01JTM6CBGHTYPB7E4D4XENA2P7.pdf", url: "",
success: function(e) { success: function(e) {
const filePath = e.tempFilePath; const filePath = e.tempFilePath;
common_vendor.index.hideLoading(); common_vendor.index.hideLoading();
@ -67,27 +62,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
}; };
return (_ctx, _cache) => { return (_ctx, _cache) => {
return { return {
a: common_vendor.o(($event) => from_data.value.username = $event), a: common_vendor.o(handleGetPhoneNumber),
b: common_vendor.p({ b: common_vendor.o(privacyToast),
placeholder: "请输入帐号", c: common_vendor.p({
textAlign: "left", type: "primary",
valueModel: from_data.value.username size: "md",
label: "快捷登录",
openType: common_vendor.unref(CheckedVal) ? "getPhoneNumber" : ""
}), }),
c: common_vendor.o(($event) => from_data.value.password = $event), d: common_vendor.o(previewPdf),
d: common_vendor.p({ e: common_vendor.o(($event) => common_vendor.isRef(CheckedVal) ? CheckedVal.value = $event : CheckedVal = $event),
placeholder: "请输入密码",
textAlign: "left",
password: true,
valueModel: from_data.value.password
}),
e: common_vendor.o(onSubmit),
f: common_vendor.p({ f: common_vendor.p({
label: "登录",
size: "md"
}),
g: common_vendor.o(previewPdf),
h: common_vendor.o(($event) => common_vendor.isRef(CheckedVal) ? CheckedVal.value = $event : CheckedVal = $event),
i: common_vendor.p({
policyName: "《用户协议》", policyName: "《用户协议》",
isAgree: common_vendor.unref(CheckedVal) isAgree: common_vendor.unref(CheckedVal)
}) })

View File

@ -2,7 +2,6 @@
"navigationBarTitleText": "登录/注册", "navigationBarTitleText": "登录/注册",
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"hs-input": "../components/hs-input/hs-input",
"hs-button": "../components/hs-button/hs-button", "hs-button": "../components/hs-button/hs-button",
"hs-private-policy": "../components/hs-private-policy/hs-private-policy" "hs-private-policy": "../components/hs-private-policy/hs-private-policy"
} }

View File

@ -1 +1 @@
<view class="login_content"><view class="header"><image src="/static/svg/logo.svg" mode="heightFix" lazy-load="false"/></view><view class="group_des"><view class="label"> 废品回收助手 </view><view class="des"><text>还没有账号?</text> 请在公众号联系管理员 </view></view><view class="group_from"><view class="form_input"><hs-input wx:if="{{b}}" u-i="499dbccf-0" bind:__l="__l" bindupdateValueModel="{{a}}" u-p="{{b}}"/></view><view class="form_input"><hs-input wx:if="{{d}}" u-i="499dbccf-1" bind:__l="__l" bindupdateValueModel="{{c}}" u-p="{{d}}"/></view></view><view class="footer_btn"><hs-button wx:if="{{f}}" bindclick="{{e}}" u-i="499dbccf-2" bind:__l="__l" u-p="{{f}}"/><view class="footer_des"> 小程序只供合作企业用户使用,无法登录请联系管理员 </view></view><view class="PrivacyPolicy"><hs-private-policy wx:if="{{i}}" bindclickPolicy="{{g}}" u-i="499dbccf-3" bind:__l="__l" bindupdateIsAgree="{{h}}" u-p="{{i}}"/></view></view> <view class="login_content"><view class="header"></view><view class="group_des"><view class="label"> 助手 </view><view class="des"><text>还没有账号?</text> 请在公众号联系管理员 </view></view><view class="group_from"></view><view class="footer_btn"><hs-button wx:if="{{c}}" bindonGetPhoneNumber="{{a}}" bindclick="{{b}}" u-i="499dbccf-0" bind:__l="__l" u-p="{{c}}"/><view class="footer_des"> 小程序只供合作企业用户使用,无法登录请联系管理员 </view></view><view class="PrivacyPolicy"><hs-private-policy wx:if="{{f}}" bindclickPolicy="{{d}}" u-i="499dbccf-1" bind:__l="__l" bindupdateIsAgree="{{e}}" u-p="{{f}}"/></view></view>

View File

@ -32,8 +32,5 @@
"current": -1, "current": -1,
"list": [] "list": []
} }
},
"simulatorPluginLibVersion": {
"qywx_simulator_plugin": "2.20.3"
} }
} }

View File

@ -1,648 +1,648 @@
"use strict"; "use strict";
const fontData = [ const fontData = [
{ {
"font_class": "arrow-down", font_class: "arrow-down",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "arrow-left", font_class: "arrow-left",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "arrow-right", font_class: "arrow-right",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "arrow-up", font_class: "arrow-up",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "auth", font_class: "auth",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "auth-filled", font_class: "auth-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "back", font_class: "back",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "bars", font_class: "bars",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "calendar", font_class: "calendar",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "calendar-filled", font_class: "calendar-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "camera", font_class: "camera",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "camera-filled", font_class: "camera-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cart", font_class: "cart",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cart-filled", font_class: "cart-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chat", font_class: "chat",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chat-filled", font_class: "chat-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chatboxes", font_class: "chatboxes",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chatboxes-filled", font_class: "chatboxes-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chatbubble", font_class: "chatbubble",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "chatbubble-filled", font_class: "chatbubble-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "checkbox", font_class: "checkbox",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "checkbox-filled", font_class: "checkbox-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "checkmarkempty", font_class: "checkmarkempty",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "circle", font_class: "circle",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "circle-filled", font_class: "circle-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "clear", font_class: "clear",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "close", font_class: "close",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "closeempty", font_class: "closeempty",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cloud-download", font_class: "cloud-download",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cloud-download-filled", font_class: "cloud-download-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cloud-upload", font_class: "cloud-upload",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "cloud-upload-filled", font_class: "cloud-upload-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "color", font_class: "color",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "color-filled", font_class: "color-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "compose", font_class: "compose",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "contact", font_class: "contact",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "contact-filled", font_class: "contact-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "down", font_class: "down",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "bottom", font_class: "bottom",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "download", font_class: "download",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "download-filled", font_class: "download-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "email", font_class: "email",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "email-filled", font_class: "email-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "eye", font_class: "eye",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "eye-filled", font_class: "eye-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "eye-slash", font_class: "eye-slash",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "eye-slash-filled", font_class: "eye-slash-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "fire", font_class: "fire",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "fire-filled", font_class: "fire-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "flag", font_class: "flag",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "flag-filled", font_class: "flag-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "folder-add", font_class: "folder-add",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "folder-add-filled", font_class: "folder-add-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "font", font_class: "font",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "forward", font_class: "forward",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "gear", font_class: "gear",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "gear-filled", font_class: "gear-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "gift", font_class: "gift",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "gift-filled", font_class: "gift-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "hand-down", font_class: "hand-down",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "hand-down-filled", font_class: "hand-down-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "hand-up", font_class: "hand-up",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "hand-up-filled", font_class: "hand-up-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "headphones", font_class: "headphones",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "heart", font_class: "heart",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "heart-filled", font_class: "heart-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "help", font_class: "help",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "help-filled", font_class: "help-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "home", font_class: "home",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "home-filled", font_class: "home-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "image", font_class: "image",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "image-filled", font_class: "image-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "images", font_class: "images",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "images-filled", font_class: "images-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "info", font_class: "info",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "info-filled", font_class: "info-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "left", font_class: "left",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "link", font_class: "link",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "list", font_class: "list",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "location", font_class: "location",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "location-filled", font_class: "location-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "locked", font_class: "locked",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "locked-filled", font_class: "locked-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "loop", font_class: "loop",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "mail-open", font_class: "mail-open",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "mail-open-filled", font_class: "mail-open-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "map", font_class: "map",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "map-filled", font_class: "map-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "map-pin", font_class: "map-pin",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "map-pin-ellipse", font_class: "map-pin-ellipse",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "medal", font_class: "medal",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "medal-filled", font_class: "medal-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "mic", font_class: "mic",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "mic-filled", font_class: "mic-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "micoff", font_class: "micoff",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "micoff-filled", font_class: "micoff-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "minus", font_class: "minus",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "minus-filled", font_class: "minus-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "more", font_class: "more",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "more-filled", font_class: "more-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "navigate", font_class: "navigate",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "navigate-filled", font_class: "navigate-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "notification", font_class: "notification",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "notification-filled", font_class: "notification-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "paperclip", font_class: "paperclip",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "paperplane", font_class: "paperplane",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "paperplane-filled", font_class: "paperplane-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "person", font_class: "person",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "person-filled", font_class: "person-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "personadd", font_class: "personadd",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "personadd-filled", font_class: "personadd-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "personadd-filled-copy", font_class: "personadd-filled-copy",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "phone", font_class: "phone",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "phone-filled", font_class: "phone-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "plus", font_class: "plus",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "plus-filled", font_class: "plus-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "plusempty", font_class: "plusempty",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "pulldown", font_class: "pulldown",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "pyq", font_class: "pyq",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "qq", font_class: "qq",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "redo", font_class: "redo",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "redo-filled", font_class: "redo-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "refresh", font_class: "refresh",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "refresh-filled", font_class: "refresh-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "refreshempty", font_class: "refreshempty",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "reload", font_class: "reload",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "right", font_class: "right",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "scan", font_class: "scan",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "search", font_class: "search",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "settings", font_class: "settings",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "settings-filled", font_class: "settings-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "shop", font_class: "shop",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "shop-filled", font_class: "shop-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "smallcircle", font_class: "smallcircle",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "smallcircle-filled", font_class: "smallcircle-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "sound", font_class: "sound",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "sound-filled", font_class: "sound-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "spinner-cycle", font_class: "spinner-cycle",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "staff", font_class: "staff",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "staff-filled", font_class: "staff-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "star", font_class: "star",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "star-filled", font_class: "star-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "starhalf", font_class: "starhalf",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "trash", font_class: "trash",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "trash-filled", font_class: "trash-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "tune", font_class: "tune",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "tune-filled", font_class: "tune-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "undo", font_class: "undo",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "undo-filled", font_class: "undo-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "up", font_class: "up",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "top", font_class: "top",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "upload", font_class: "upload",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "upload-filled", font_class: "upload-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "videocam", font_class: "videocam",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "videocam-filled", font_class: "videocam-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "vip", font_class: "vip",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "vip-filled", font_class: "vip-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "wallet", font_class: "wallet",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "wallet-filled", font_class: "wallet-filled",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "weibo", font_class: "weibo",
"unicode": "" unicode: ""
}, },
{ {
"font_class": "weixin", font_class: "weixin",
"unicode": "" unicode: ""
} }
]; ];
exports.fontData = fontData; exports.fontData = fontData;

17
package-lock.json generated
View File

@ -41,6 +41,7 @@
"@nichozuo/gencode-ts-cli": "^1.0.2", "@nichozuo/gencode-ts-cli": "^1.0.2",
"@vue/runtime-core": "^3.2.45", "@vue/runtime-core": "^3.2.45",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"prettier": "^3.6.2",
"sass": "1.63.2", "sass": "1.63.2",
"sass-loader": "10.4.1", "sass-loader": "10.4.1",
"typescript": "^4.9.4", "typescript": "^4.9.4",
@ -19335,6 +19336,22 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/prettier": {
"version": "3.6.2",
"resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.6.2.tgz",
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pretty-format": { "node_modules/pretty-format": {
"version": "27.5.1", "version": "27.5.1",
"resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-27.5.1.tgz", "resolved": "https://registry.npmmirror.com/pretty-format/-/pretty-format-27.5.1.tgz",

View File

@ -8,7 +8,9 @@
"prod": "uni -p mp-weixin --mode prod", "prod": "uni -p mp-weixin --mode prod",
"build:test": "uni build -p mp-weixin --mode test", "build:test": "uni build -p mp-weixin --mode test",
"type-check": "vue-tsc --noEmit", "type-check": "vue-tsc --noEmit",
"init-dir": "node init-dir.js $(pwd)" "init-dir": "node init-dir.js $(pwd)",
"format": "prettier --write \"src/**/*.{js,ts,vue,wxss,json}\"",
"format:check": "prettier --check \"src/**/*.{js,ts,vue,wxss,json}\""
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-3081220230817001", "@dcloudio/uni-app": "3.0.0-3081220230817001",
@ -44,6 +46,7 @@
"@nichozuo/gencode-ts-cli": "^1.0.2", "@nichozuo/gencode-ts-cli": "^1.0.2",
"@vue/runtime-core": "^3.2.45", "@vue/runtime-core": "^3.2.45",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"prettier": "^3.6.2",
"sass": "1.63.2", "sass": "1.63.2",
"sass-loader": "10.4.1", "sass-loader": "10.4.1",
"typescript": "^4.9.4", "typescript": "^4.9.4",

View File

@ -1,35 +1,35 @@
<script setup lang="ts"> <script setup lang="ts">
import { onHide, onLaunch, onShow } from "@dcloudio/uni-app"; import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
import { getCurrentInstance } from "vue"; import { getCurrentInstance } from 'vue'
import { useWeAppAuthStore } from "./common"; import { useWeAppAuthStore } from './common'
import { CheckUpdate } from "./common/libraries/updateManager"; import { CheckUpdate } from './common/libraries/updateManager'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
const globalData = { const globalData = {
// //
selectProject: {}, selectProject: {},
// //
selectedOrg: {}, selectedOrg: {}
}; }
onLaunch(async () => { onLaunch(async () => {
const app = getCurrentInstance(); const app = getCurrentInstance()
await auth.login(app); await auth.login(app)
console.log("App Launch"); console.log('App Launch')
// //
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
CheckUpdate(); CheckUpdate()
// #endif // #endif
}); })
onShow(async () => { onShow(async () => {
console.log("App Show"); console.log('App Show')
}); })
onHide(() => { onHide(() => {
console.log("App Hide"); console.log('App Hide')
}); })
</script> </script>
<style lang="scss"> <style lang="scss">
@import "uview-plus/index.scss"; @import 'uview-plus/index.scss';
// .tab_page { // .tab_page {
// padding-bottom: calc(48px + constant(safe-area-inset-bottom)); // padding-bottom: calc(48px + constant(safe-area-inset-bottom));
// padding-bottom: calc(48px + env(safe-area-inset-bottom)); // padding-bottom: calc(48px + env(safe-area-inset-bottom));

View File

@ -4,8 +4,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import NoRight from "./NoRight.vue"; import NoRight from './NoRight.vue'
const auth: any = useWeAppAuthStore(); const auth: any = useWeAppAuthStore()
</script> </script>

View File

@ -3,16 +3,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from 'vue'
const props = defineProps<{ const props = defineProps<{
enums: MyEnumItemProps[]; enums: MyEnumItemProps[]
value: any; value: any
}>(); }>()
const item = computed(() => { const item = computed(() => {
return props.enums.find((data: MyEnumItemProps) => { return props.enums.find((data: MyEnumItemProps) => {
return data.value === String(props.value); return data.value === String(props.value)
}); })
}); })
</script> </script>

View File

@ -7,36 +7,36 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common/store/useWeAppAuthStore"; import { useWeAppAuthStore } from '@/common/store/useWeAppAuthStore'
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from '@dcloudio/uni-app'
import { ref } from "vue"; import { ref } from 'vue'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
const query = ref(); const query = ref()
onLoad((options) => { onLoad(options => {
query.value = options; query.value = options
}); })
function refreshPage() { function refreshPage() {
// //
const pages = getCurrentPages(); const pages = getCurrentPages()
const currentPage: any = pages[pages.length - 1]; const currentPage: any = pages[pages.length - 1]
console.log("currentPage", currentPage); console.log('currentPage', currentPage)
const path = currentPage.$page.fullPath; const path = currentPage.$page.fullPath
if (currentPage.$page.options) { if (currentPage.$page.options) {
const options = currentPage.$page.options; const options = currentPage.$page.options
const fullPath = `${path}?${Object.keys(options) const fullPath = `${path}?${Object.keys(options)
.map((key) => `${key}=${encodeURIComponent(options[key])}`) .map(key => `${key}=${encodeURIComponent(options[key])}`)
.join("&")}`; .join('&')}`
uni.reLaunch({ uni.reLaunch({
url: fullPath, url: fullPath
}); })
console.log(fullPath); console.log(fullPath)
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: path, url: path
}); })
} }
} }
</script> </script>

View File

@ -9,26 +9,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import { onLoad, onShow } from "@dcloudio/uni-app"; import { onLoad, onShow } from '@dcloudio/uni-app'
import { getCurrentInstance } from "vue"; import { getCurrentInstance } from 'vue'
import Loading from "./Loading.vue"; import Loading from './Loading.vue'
import NetworkError from "./NetworkError.vue"; import NetworkError from './NetworkError.vue'
import useUser from "@/common/libraries/userUserLogin"; import useUser from '@/common/libraries/userUserLogin'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
onLoad(async () => { onLoad(async () => {
console.log("cc-root-view onLoad 1", auth?.loading, auth?.hasError); console.log('cc-root-view onLoad 1', auth?.loading, auth?.hasError)
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
console.log("cc-root-view onLoad 2"); console.log('cc-root-view onLoad 2')
}); })
onShow(async () => { onShow(async () => {
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
if (!useUser.getLoginStatus()) { if (!useUser.getLoginStatus()) {
uni.redirectTo({ uni.redirectTo({
url: "/pages/login", url: '/pages/login'
}); })
} }
}); })
</script> </script>

View File

@ -4,12 +4,7 @@
<nchl-empty v-if="!props.meta?.total" /> <nchl-empty v-if="!props.meta?.total" />
<view v-else class="scrollLoadingContainer"> <view v-else class="scrollLoadingContainer">
<!-- 加载状态提示 --> <!-- 加载状态提示 -->
<u-loading-icon <u-loading-icon :text="loadingStatusTest" mode="circle" size="30rpx" :show="loadingStatus" />
:text="loadingStatusTest"
mode="circle"
size="30rpx"
:show="loadingStatus"
/>
<view class="showLoadingText" v-if="!loadingStatus"> <view class="showLoadingText" v-if="!loadingStatus">
{{ loadingStatusTest }} {{ loadingStatusTest }}
</view> </view>
@ -17,60 +12,60 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onReachBottom } from "@dcloudio/uni-app"; import { onReachBottom } from '@dcloudio/uni-app'
import { defineProps, ref, watch } from "vue"; import { defineProps, ref, watch } from 'vue'
const loadingStatusTest = ref(""); const loadingStatusTest = ref('')
const loadingStatus = ref(false); const loadingStatus = ref(false)
const params = ref({ const params = ref({
page: 1, page: 1,
perPage: 20, perPage: 20
}); })
const props = defineProps({ const props = defineProps({
meta: { meta: {
type: Object, type: Object,
default: {}, // default: {} //
}, },
showLoad: { showLoad: {
type: Boolean, type: Boolean,
default: true, // default: true //
}, }
}); })
const emit = defineEmits(["load"]); const emit = defineEmits(['load'])
watch( watch(
() => props?.meta, () => props?.meta,
() => { () => {
const { current_page, last_page } = props.meta; const { current_page, last_page } = props.meta
const hasNextPage = current_page < last_page; const hasNextPage = current_page < last_page
loadingStatus.value = hasNextPage; loadingStatus.value = hasNextPage
loadingStatusTest.value = hasNextPage ? "上拉加载更多" : "已经到底啦~"; loadingStatusTest.value = hasNextPage ? '上拉加载更多' : '已经到底啦~'
console.log(props?.meta, "meta数据变化"); console.log(props?.meta, 'meta数据变化')
} }
); )
// //
const handleLoad = () => { const handleLoad = () => {
const { current_page, last_page } = props.meta; const { current_page, last_page } = props.meta
// //
const hasNextPage = current_page < last_page; const hasNextPage = current_page < last_page
loadingStatus.value = hasNextPage; loadingStatus.value = hasNextPage
loadingStatusTest.value = hasNextPage ? "上拉加载更多" : "已经到底啦~"; loadingStatusTest.value = hasNextPage ? '上拉加载更多' : '已经到底啦~'
if (hasNextPage) { if (hasNextPage) {
params.value.page = current_page + 1; params.value.page = current_page + 1
// //
emit("load", params.value); emit('load', params.value)
setTimeout(() => { setTimeout(() => {
loadingStatus.value = false; loadingStatus.value = false
loadingStatusTest.value = ""; loadingStatusTest.value = ''
}, 1000); }, 1000)
} }
}; }
onReachBottom(handleLoad); onReachBottom(handleLoad)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,7 +1,7 @@
// export * from "./libraries/pinia/auth"; // export * from "./libraries/pinia/auth";
// export * from "./hooks/useMyWebSocket"; // export * from "./hooks/useMyWebSocket";
export * from "./libraries/request"; export * from './libraries/request'
export * from "./store/useWeAppAuthStore"; export * from './store/useWeAppAuthStore'
// export * from "./store/auth"; // export * from "./store/auth";
// export * from "./store/goods"; // export * from "./store/goods";

View File

@ -1,8 +1,8 @@
export async function getApiLoading(Apis: any, data: any) { export async function getApiLoading(Apis: any, data: any) {
uni.showLoading({ title: "加载中...", mask: true }); uni.showLoading({ title: '加载中...', mask: true })
let res = await Apis(data); let res = await Apis(data)
uni.hideLoading(); uni.hideLoading()
if (res.success) { if (res.success) {
return res; return res
} }
} }

View File

@ -1,56 +1,56 @@
import dayjs from "dayjs"; import dayjs from 'dayjs'
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.locale("zh-cn"); // 设置为中文 dayjs.locale('zh-cn') // 设置为中文
// 使用相对时间插件 // 使用相对时间插件
dayjs.extend(relativeTime); dayjs.extend(relativeTime)
export function RelativeTime(time: number) { export function RelativeTime(time: number) {
return dayjs(time * 1000).fromNow(); return dayjs(time * 1000).fromNow()
} }
export function showDay(time: number) { export function showDay(time: number) {
return dayjs(time).format("YYYY-MM-DD"); return dayjs(time).format('YYYY-MM-DD')
} }
export function getDay(num?: number) { export function getDay(num?: number) {
if (num) { if (num) {
const yesterday = dayjs().subtract(num, "day"); const yesterday = dayjs().subtract(num, 'day')
console.log(yesterday.format("YYYY-MM-DD")); console.log(yesterday.format('YYYY-MM-DD'))
return yesterday.format("YYYY-MM-DD"); return yesterday.format('YYYY-MM-DD')
} }
return dayjs().format("YYYY-MM-DD"); return dayjs().format('YYYY-MM-DD')
} }
export function getOverDay(num: number, type: string) { export function getOverDay(num: number, type: string) {
const currentDate = dayjs(); const currentDate = dayjs()
const formattedCurrentDate = currentDate.format("YYYY-MM-DD"); const formattedCurrentDate = currentDate.format('YYYY-MM-DD')
console.log("当前日期:", formattedCurrentDate); console.log('当前日期:', formattedCurrentDate)
if (type === "day") { if (type === 'day') {
//获取过去num天的日期 //获取过去num天的日期
const pastFifteenDays = dayjs().subtract(num, "day"); const pastFifteenDays = dayjs().subtract(num, 'day')
const formattedPastFifteenDays = pastFifteenDays.format("YYYY-MM-DD"); const formattedPastFifteenDays = pastFifteenDays.format('YYYY-MM-DD')
return [formattedPastFifteenDays, formattedCurrentDate]; return [formattedPastFifteenDays, formattedCurrentDate]
} }
if (type === "month") { if (type === 'month') {
// 获取过去num个月的日期 // 获取过去num个月的日期
const pastTwelveMonths = dayjs().subtract(num, "month"); const pastTwelveMonths = dayjs().subtract(num, 'month')
const formattedPastTwelveMonths = pastTwelveMonths.format("YYYY-MM-DD"); const formattedPastTwelveMonths = pastTwelveMonths.format('YYYY-MM-DD')
return [formattedPastTwelveMonths, formattedCurrentDate]; return [formattedPastTwelveMonths, formattedCurrentDate]
} }
} }
export function getThreeMonthsLater(num = 3, dateString: string) { export function getThreeMonthsLater(num = 3, dateString: string) {
const date = dayjs(dateString); const date = dayjs(dateString)
const threeMonthsLater = date.add(num || 3, "month"); const threeMonthsLater = date.add(num || 3, 'month')
return threeMonthsLater.format("YYYY-MM-DD"); return threeMonthsLater.format('YYYY-MM-DD')
} }
export function isSameDay(day: string) { export function isSameDay(day: string) {
//是否是当天-还款日期 //是否是当天-还款日期
const date1 = new Date(day); const date1 = new Date(day)
const date2 = new Date(); const date2 = new Date()
return ( return (
date1.getFullYear() === date2.getFullYear() && date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() && date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate() date1.getDate() === date2.getDate()
); )
} }

View File

@ -1,18 +1,18 @@
// 如果url是tab的页面使用switchTab否则使用navigateTo // 如果url是tab的页面使用switchTab否则使用navigateTo
export function goto(url: string) { export function goto(url: string) {
uni.navigateTo({ url, fail: () => uni.switchTab({ url }) }); uni.navigateTo({ url, fail: () => uni.switchTab({ url }) })
} }
export function showToastBack(label?: string, delta = 1, back = true) { export function showToastBack(label?: string, delta = 1, back = true) {
uni.showToast({ uni.showToast({
title: label || "提交成功!", title: label || '提交成功!',
duration: 1000, duration: 1000,
icon: "none", icon: 'none',
success() { success() {
if (back) { if (back) {
setTimeout(() => { setTimeout(() => {
uni.navigateBack({ delta }); uni.navigateBack({ delta })
}, 1000); }, 1000)
} }
}, }
}); })
} }

View File

@ -1,6 +1,6 @@
export const payType = { export const payType = {
ALIPAY: { label: "支付宝支付", icon: "alipay" }, ALIPAY: { label: '支付宝支付', icon: 'alipay' },
WXPAY: { label: "微信支付", icon: "wxpay" }, WXPAY: { label: '微信支付', icon: 'wxpay' },
WEIXIN: { label: "微信支付", icon: "wxpay" }, WEIXIN: { label: '微信支付', icon: 'wxpay' },
CCB: { label: "建行", icon: "ccbPay" }, CCB: { label: '建行', icon: 'ccbPay' }
}; }

View File

@ -1,75 +1,73 @@
export const monthsDifferenceEndDay = (str: string, num: number) => { export const monthsDifferenceEndDay = (str: string, num: number) => {
// 获取当前日期 // 获取当前日期
const currentDate = new Date(str); const currentDate = new Date(str)
// 创建一个新的日期对象用于存储加3个月后的日期 // 创建一个新的日期对象用于存储加3个月后的日期
const futureDate = new Date(currentDate); const futureDate = new Date(currentDate)
// 加3个月 // 加3个月
futureDate.setMonth(futureDate.getMonth() + num); futureDate.setMonth(futureDate.getMonth() + num)
// 减去1天 // 减去1天
futureDate.setDate(futureDate.getDate() - 1); futureDate.setDate(futureDate.getDate() - 1)
// 格式化为 YYYY-MM-DD // 格式化为 YYYY-MM-DD
const formattedDate = futureDate.toISOString().split("T")[0]; const formattedDate = futureDate.toISOString().split('T')[0]
return formattedDate; return formattedDate
}; }
export const getNextYearDate = (date: string) => { export const getNextYearDate = (date: string) => {
//获取一年后日期 //获取一年后日期
if (date) { if (date) {
// 设置目标日期为2023-07-11 // 设置目标日期为2023-07-11
const targetDate = new Date(date); const targetDate = new Date(date)
targetDate.setDate(targetDate.getDate() - 1); //方法一 targetDate.setDate(targetDate.getDate() - 1) //方法一
// 获取一年后的日期 // 获取一年后的日期
targetDate.setFullYear(targetDate.getFullYear() + 1); targetDate.setFullYear(targetDate.getFullYear() + 1)
return targetDate.toISOString().split("T")[0]; return targetDate.toISOString().split('T')[0]
} else { } else {
return undefined; return undefined
} }
}; }
export const compareDates = (date1: string, date2: string): number => { export const compareDates = (date1: string, date2: string): number => {
// 创建日期对象 // 创建日期对象
const dateObj1 = new Date(date1); const dateObj1 = new Date(date1)
const dateObj2 = new Date(date2); const dateObj2 = new Date(date2)
// 比较日期 // 比较日期
if (dateObj1 > dateObj2) { if (dateObj1 > dateObj2) {
return 1; // date1 大于 date2 return 1 // date1 大于 date2
} else if (dateObj1 < dateObj2) { } else if (dateObj1 < dateObj2) {
return -1; // date1 小于 date2 return -1 // date1 小于 date2
} else { } else {
return 0; // date1 等于 date2 return 0 // date1 等于 date2
} }
}; }
export const calculateDaysDifference = (selectedDate: string) => { export const calculateDaysDifference = (selectedDate: string) => {
//获取选择的日期与当前的日期相差多少天 //获取选择的日期与当前的日期相差多少天
// 创建当前日期对象 // 创建当前日期对象
const currentDate: any = new Date(); const currentDate: any = new Date()
// 创建选择的日期对象 // 创建选择的日期对象
const selectedDateObj: any = new Date(selectedDate); const selectedDateObj: any = new Date(selectedDate)
// 计算两个日期的毫秒差 // 计算两个日期的毫秒差
const timeDifference = currentDate - selectedDateObj; const timeDifference = currentDate - selectedDateObj
// 将毫秒差转换为天数差 // 将毫秒差转换为天数差
const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24))
return daysDifference; return daysDifference
}; }
export const DaysDifference = (selectedDate: string) => { export const DaysDifference = (selectedDate: string) => {
//获取选择的日期与当前的日期相差多少天 //获取选择的日期与当前的日期相差多少天
// 创建当前日期对象 // 创建当前日期对象
const currentDate: any = new Date(); const currentDate: any = new Date()
// 创建选择的日期对象 // 创建选择的日期对象
const selectedDateObj: any = new Date(selectedDate); const selectedDateObj: any = new Date(selectedDate)
// 计算两个日期的毫秒差 // 计算两个日期的毫秒差
const timeDifference = selectedDateObj - currentDate; const timeDifference = selectedDateObj - currentDate
// 将毫秒差转换为天数差 // 将毫秒差转换为天数差
const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); const daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24))
return daysDifference; return daysDifference
}; }
export const onSplitArray = (val: string, type: string) => { export const onSplitArray = (val: string, type: string) => {
let resultArray = val.split(type); let resultArray = val.split(type)
return resultArray; return resultArray
}; }

View File

@ -1,55 +1,54 @@
import Request from "luch-request"; import Request from 'luch-request'
import { useWeAppAuthStore } from "../store/useWeAppAuthStore"; import { useWeAppAuthStore } from '../store/useWeAppAuthStore'
const http = new Request(); const http = new Request()
http.setConfig((config) => { http.setConfig(config => {
config.baseURL = import.meta.env.VITE_HTTP_BASE_URL; config.baseURL = import.meta.env.VITE_HTTP_BASE_URL
config.header = { config.header = {
...config.header, ...config.header
}; }
return config; return config
}); })
http.interceptors.request.use( http.interceptors.request.use(
(config) => { config => {
config.header = { config.header = {
...config.header, ...config.header,
Authorization: Authorization: 'Bearer ' + uni.getStorageSync(import.meta.env.VITE_ACCESS_TOKEN_KEY)
"Bearer " + uni.getStorageSync(import.meta.env.VITE_ACCESS_TOKEN_KEY), }
}; return config
return config;
}, },
(config) => { config => {
return Promise.reject(config); return Promise.reject(config)
} }
); )
http.interceptors.response.use( http.interceptors.response.use(
(response) => { response => {
// console.log("response", response); // console.log("response", response);
const data = response.data; const data = response.data
uni.hideLoading(); uni.hideLoading()
if (data.success !== true) { if (data.success !== true) {
if (data.errorCode === 10001) { if (data.errorCode === 10001) {
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
auth.loading = false; auth.loading = false
uni.showToast({ title: data.errorMessage, icon: "none" }); uni.showToast({ title: data.errorMessage, icon: 'none' })
} else { } else {
uni.showToast({ title: data.errorMessage, icon: "none" }); uni.showToast({ title: data.errorMessage, icon: 'none' })
} }
return Promise.reject(response.data); return Promise.reject(response.data)
} }
return response.data; return response.data
}, },
(response) => { response => {
console.log("error", response); console.log('error', response)
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
auth.loading = false; auth.loading = false
return Promise.reject(response); return Promise.reject(response)
} }
); )
export function request(url: string, data: Record<string, any>) { export function request(url: string, data: Record<string, any>) {
return http.post(url, data.data); return http.post(url, data.data)
} }

View File

@ -1,58 +1,58 @@
import { Merchant, Investor, Agent } from "./updateMenu"; import { Merchant, Investor, Agent } from './updateMenu'
export function setTabBar(res: { id?: number; name?: string; type?: string }) { export function setTabBar(res: { id?: number; name?: string; type?: string }) {
const App: any = getApp(); const App: any = getApp()
App.globalData.selectedOrg = res; App.globalData.selectedOrg = res
if (res?.type === "boss") { if (res?.type === 'boss') {
//商户-首页 //商户-首页
uni.switchTab({ url: "/pages/MERCHANT/index/index" }); uni.switchTab({ url: '/pages/MERCHANT/index/index' })
} }
if (res?.type === "investor") { if (res?.type === 'investor') {
//投资方-首页 //投资方-首页
uni.switchTab({ url: "/pages/INVESTOR/index/index" }); uni.switchTab({ url: '/pages/INVESTOR/index/index' })
} }
if (res?.type === "agent") { if (res?.type === 'agent') {
//代理商-首页 //代理商-首页
uni.switchTab({ url: "/pages/AGENT/index/index" }); uni.switchTab({ url: '/pages/AGENT/index/index' })
} }
console.log("App.globalData.selectedOrg", App.globalData.selectedOrg); console.log('App.globalData.selectedOrg', App.globalData.selectedOrg)
} }
export function setTabBarData(idx: number, type?: string) { export function setTabBarData(idx: number, type?: string) {
const pages = getCurrentPages(); const pages = getCurrentPages()
const currentPage: any = pages[pages.length - 1]; const currentPage: any = pages[pages.length - 1]
// 检查是否有TabBar并设置选中的菜单 // 检查是否有TabBar并设置选中的菜单
if (currentPage) { if (currentPage) {
const tabBar = currentPage.getTabBar ? currentPage.getTabBar() : null; const tabBar = currentPage.getTabBar ? currentPage.getTabBar() : null
if (tabBar) { if (tabBar) {
if (idx === 3) { if (idx === 3) {
if (type === "boss") { if (type === 'boss') {
//商户菜单 //商户菜单
tabBar.setData({ tabBar.setData({
selected: 3, selected: 3,
list: Merchant, list: Merchant
}); })
} }
if (type === "investor") { if (type === 'investor') {
//投资方菜单 //投资方菜单
tabBar.setData({ tabBar.setData({
selected: 3, selected: 3,
list: Investor, list: Investor
}); })
} }
if (type === "agent") { if (type === 'agent') {
//代理商 //代理商
tabBar.setData({ tabBar.setData({
selected: 3, selected: 3,
list: Agent, list: Agent
}); })
} }
return; return
} }
tabBar.setData({ tabBar.setData({
selected: idx, selected: idx
}); })
} else { } else {
console.error("当前页面没有TabBar"); console.error('当前页面没有TabBar')
} }
} }
} }

View File

@ -8,19 +8,19 @@ export function debounce<T extends (...args: any[]) => void>(
fn: T, fn: T,
delay: number delay: number
): (...args: Parameters<T>) => void { ): (...args: Parameters<T>) => void {
let timer: ReturnType<typeof setTimeout> | null = null; let timer: ReturnType<typeof setTimeout> | null = null
return (...args: Parameters<T>): void => { return (...args: Parameters<T>): void => {
// 如果上次的定时器还存在,清除它 // 如果上次的定时器还存在,清除它
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer)
} }
// 设置新的定时器 // 设置新的定时器
timer = setTimeout(() => { timer = setTimeout(() => {
fn(...args); // 执行传入的函数 fn(...args) // 执行传入的函数
}, delay); }, delay)
}; }
} }
/** /**
@ -33,127 +33,126 @@ export function throttle<T extends (...args: any[]) => void>(
fn: T, fn: T,
delay: number delay: number
): (...args: Parameters<T>) => void { ): (...args: Parameters<T>) => void {
let lastTime = 0; let lastTime = 0
return (...args: Parameters<T>): void => { return (...args: Parameters<T>): void => {
const now = Date.now(); const now = Date.now()
if (now - lastTime >= delay) { if (now - lastTime >= delay) {
lastTime = now; lastTime = now
fn(...args); fn(...args)
} }
}; }
} }
export const downloadAndSaveImage = (url: string) => { export const downloadAndSaveImage = (url: string) => {
uni.downloadFile({ uni.downloadFile({
url: url, url: url,
success: (downloadResult) => { success: downloadResult => {
if (downloadResult.statusCode === 200) { if (downloadResult.statusCode === 200) {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: downloadResult.tempFilePath, filePath: downloadResult.tempFilePath,
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: "保存成功", title: '保存成功',
icon: "success", icon: 'success'
}); })
}, },
fail: () => { fail: () => {
uni.showToast({ uni.showToast({
title: "保存失败", title: '保存失败',
icon: "error", icon: 'error'
}); })
}, }
}); })
} }
}, },
fail: () => { fail: () => {
uni.showToast({ uni.showToast({
title: "下载失败", title: '下载失败',
icon: "error", icon: 'error'
}); })
}, }
}); })
}; }
export const saveBase64Image = (base64Data: any) => { export const saveBase64Image = (base64Data: any) => {
const fileSystemManager = uni.getFileSystemManager(); const fileSystemManager = uni.getFileSystemManager()
const [, format, bodyData] = const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64Data) || []
/data:image\/(\w+);base64,(.*)/.exec(base64Data) || []; const filePath = `${wx.env.USER_DATA_PATH}/temp_image.${format}`
const filePath = `${wx.env.USER_DATA_PATH}/temp_image.${format}`;
fileSystemManager.writeFile({ fileSystemManager.writeFile({
filePath, filePath,
data: bodyData, data: bodyData,
encoding: "base64", encoding: 'base64',
success: () => { success: () => {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath, filePath,
success: () => { success: () => {
uni.showToast({ uni.showToast({
title: "保存成功", title: '保存成功',
icon: "success", icon: 'success'
}); })
}, },
fail: () => { fail: () => {
uni.showToast({ uni.showToast({
title: "保存失败", title: '保存失败',
icon: "error", icon: 'error'
}); })
}, }
}); })
}, },
fail: () => { fail: () => {
uni.showToast({ uni.showToast({
title: "文件写入失败", title: '文件写入失败',
icon: "error", icon: 'error'
}); })
}, }
}); })
}; }
export const getFormatTime = (t: Date, f?: string) => { export const getFormatTime = (t: Date, f?: string) => {
const pad = (num: number) => String(num).padStart(2, "0"); const pad = (num: number) => String(num).padStart(2, '0')
const year = t.getFullYear(); const year = t.getFullYear()
const month = pad(t.getMonth() + 1); const month = pad(t.getMonth() + 1)
const date = pad(t.getDate()); const date = pad(t.getDate())
const hours = pad(t.getHours()); const hours = pad(t.getHours())
const minutes = pad(t.getMinutes()); const minutes = pad(t.getMinutes())
const seconds = pad(t.getSeconds()); const seconds = pad(t.getSeconds())
switch (f) { switch (f) {
case "YYYY-MM-DD": case 'YYYY-MM-DD':
return `${year}-${month}-${date}`; return `${year}-${month}-${date}`
case "YYYY-MM-DD HH:mm:ss": case 'YYYY-MM-DD HH:mm:ss':
return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`
case "YYYY/MM/DD": case 'YYYY/MM/DD':
return `${year}/${month}/${date}`; return `${year}/${month}/${date}`
case "HH:mm:ss": case 'HH:mm:ss':
return `${hours}:${minutes}:${seconds}`; return `${hours}:${minutes}:${seconds}`
case "HH:mm": case 'HH:mm':
return `${hours}:${minutes}`; return `${hours}:${minutes}`
default: default:
return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`; // 默认格式YYYY-MM-DD HH:mm:ss return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}` // 默认格式YYYY-MM-DD HH:mm:ss
} }
}; }
export class TimeRecorder { export class TimeRecorder {
private startTime: number = 0; // 记录开始时间的时间戳 private startTime: number = 0 // 记录开始时间的时间戳
private elapsedTime: number = 0; // 累计的浏览时间(单位:毫秒) private elapsedTime: number = 0 // 累计的浏览时间(单位:毫秒)
private running: boolean = false; // 标记是否正在计时 private running: boolean = false // 标记是否正在计时
/** /**
* *
*/ */
start(): void { start(): void {
if (this.running) { if (this.running) {
console.warn("计时器已经在运行中"); console.warn('计时器已经在运行中')
return; return
} }
this.startTime = Date.now(); // 记录当前时间作为起始时间 this.startTime = Date.now() // 记录当前时间作为起始时间
this.elapsedTime = 0; // 重置已用时间 this.elapsedTime = 0 // 重置已用时间
this.running = true; this.running = true
} }
/** /**
@ -161,11 +160,11 @@ export class TimeRecorder {
*/ */
pause(): void { pause(): void {
if (!this.running) { if (!this.running) {
console.warn("计时器尚未启动"); console.warn('计时器尚未启动')
return; return
} }
this.elapsedTime += Date.now() - this.startTime; // 累加已用时间 this.elapsedTime += Date.now() - this.startTime // 累加已用时间
this.running = false; this.running = false
} }
/** /**
@ -173,19 +172,19 @@ export class TimeRecorder {
*/ */
renew(): void { renew(): void {
if (this.running) { if (this.running) {
console.warn("计时器已经在运行中"); console.warn('计时器已经在运行中')
return; return
} }
this.startTime = Date.now(); // 重新记录开始时间 this.startTime = Date.now() // 重新记录开始时间
this.running = true; this.running = true
} }
/** /**
* *
*/ */
abort(): void { abort(): void {
this.elapsedTime = 0; // 放弃当前累计的时间 this.elapsedTime = 0 // 放弃当前累计的时间
this.running = false; this.running = false
} }
/** /**
@ -194,10 +193,8 @@ export class TimeRecorder {
*/ */
getElapsedTime(): string { getElapsedTime(): string {
if (this.running) { if (this.running) {
return (this.elapsedTime + (Date.now() - this.startTime) / 1000).toFixed( return (this.elapsedTime + (Date.now() - this.startTime) / 1000).toFixed(0) // 计算当前时间到起始时间的差值
0
); // 计算当前时间到起始时间的差值
} }
return (this.elapsedTime / 1000).toFixed(0); // 如果计时器已停止,返回累计的时间 return (this.elapsedTime / 1000).toFixed(0) // 如果计时器已停止,返回累计的时间
} }
} }

View File

@ -1,25 +1,25 @@
export function CheckUpdate() { export function CheckUpdate() {
const updateManager = uni.getUpdateManager(); const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调 // 请求完新版本信息的回调
console.log(res.hasUpdate); console.log(res.hasUpdate)
}); })
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function () {
uni.showModal({ uni.showModal({
title: "更新提示", title: '更新提示',
content: "新版本已经准备好,是否重启应用?", content: '新版本已经准备好,是否重启应用?',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate(); updateManager.applyUpdate()
} }
}, }
}); })
}); })
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
// 新版本下载失败 // 新版本下载失败
}); })
} }

View File

@ -1,83 +1,83 @@
export const Merchant = [ export const Merchant = [
//商户 //商户
{ {
pagePath: "/pages/MERCHANT/index/index", pagePath: '/pages/MERCHANT/index/index',
text: "首页", text: '首页',
iconPath: "/static/tabbar/home.png", iconPath: '/static/tabbar/home.png',
selectedIconPath: "/static/tabbar/homeAct.png", selectedIconPath: '/static/tabbar/homeAct.png'
}, },
{ {
pagePath: "/pages/MERCHANT/pay/index", pagePath: '/pages/MERCHANT/pay/index',
text: "支付", text: '支付',
iconPath: "/static/tabbar/pay.png", iconPath: '/static/tabbar/pay.png',
selectedIconPath: "/static/tabbar/payAct.png", selectedIconPath: '/static/tabbar/payAct.png'
}, },
{ {
pagePath: "/pages/MERCHANT/loans/index", pagePath: '/pages/MERCHANT/loans/index',
text: "支出", text: '支出',
iconPath: "/static/tabbar/expenses.png", iconPath: '/static/tabbar/expenses.png',
selectedIconPath: "/static/tabbar/expensesAct.png", selectedIconPath: '/static/tabbar/expensesAct.png'
}, },
{ {
pagePath: "/pages/Me/index", pagePath: '/pages/Me/index',
text: "我的", text: '我的',
iconPath: "/static/tabbar/me.png", iconPath: '/static/tabbar/me.png',
selectedIconPath: "/static/tabbar/meAct.png", selectedIconPath: '/static/tabbar/meAct.png'
}, }
]; ]
export const Investor = [ export const Investor = [
//投资方 //投资方
{ {
pagePath: "/pages/INVESTOR/index/index", pagePath: '/pages/INVESTOR/index/index',
text: "首页", text: '首页',
iconPath: "/static/tabbar/home.png", iconPath: '/static/tabbar/home.png',
selectedIconPath: "/static/tabbar/homeAct.png", selectedIconPath: '/static/tabbar/homeAct.png'
}, },
{ {
pagePath: "/pages/INVESTOR/loans/index", pagePath: '/pages/INVESTOR/loans/index',
text: "分期", text: '分期',
iconPath: "/static/tabbar/expenses.png", iconPath: '/static/tabbar/expenses.png',
selectedIconPath: "/static/tabbar/expensesAct.png", selectedIconPath: '/static/tabbar/expensesAct.png'
}, },
{ {
pagePath: "/pages/INVESTOR/stages_det/index", pagePath: '/pages/INVESTOR/stages_det/index',
text: "明细", text: '明细',
iconPath: "/static/tabbar/pay.png", iconPath: '/static/tabbar/pay.png',
selectedIconPath: "/static/tabbar/payAct.png", selectedIconPath: '/static/tabbar/payAct.png'
}, },
{ {
pagePath: "/pages/Me/index", pagePath: '/pages/Me/index',
text: "我的", text: '我的',
iconPath: "/static/tabbar/me.png", iconPath: '/static/tabbar/me.png',
selectedIconPath: "/static/tabbar/meAct.png", selectedIconPath: '/static/tabbar/meAct.png'
}, }
]; ]
export const Agent = [ export const Agent = [
//代理商 //代理商
{ {
pagePath: "/pages/AGENT/index/index", pagePath: '/pages/AGENT/index/index',
text: "首页", text: '首页',
iconPath: "/static/tabbar/home.png", iconPath: '/static/tabbar/home.png',
selectedIconPath: "/static/tabbar/homeAct.png", selectedIconPath: '/static/tabbar/homeAct.png'
}, },
{ {
pagePath: "/pages/AGENT/pay/index", pagePath: '/pages/AGENT/pay/index',
text: "支付", text: '支付',
iconPath: "/static/tabbar/pay.png", iconPath: '/static/tabbar/pay.png',
selectedIconPath: "/static/tabbar/payAct.png", selectedIconPath: '/static/tabbar/payAct.png'
}, },
{ {
pagePath: "/pages/AGENT/loans/index", pagePath: '/pages/AGENT/loans/index',
text: "支出", text: '支出',
iconPath: "/static/tabbar/expenses.png", iconPath: '/static/tabbar/expenses.png',
selectedIconPath: "/static/tabbar/expensesAct.png", selectedIconPath: '/static/tabbar/expensesAct.png'
}, },
{ {
pagePath: "/pages/Me/index", pagePath: '/pages/Me/index',
text: "我的", text: '我的',
iconPath: "/static/tabbar/me.png", iconPath: '/static/tabbar/me.png',
selectedIconPath: "/static/tabbar/meAct.png", selectedIconPath: '/static/tabbar/meAct.png'
}, }
]; ]

View File

@ -1,130 +1,125 @@
import { Apis } from "@/gen/Apis"; import { Apis } from '@/gen/Apis'
// #region pre_upload // #region pre_upload
export interface IPreUploadResult { export interface IPreUploadResult {
success: boolean; success: boolean
data: { data: {
cosHost: string; cosHost: string
cosKey: string; cosKey: string
authorization: string; authorization: string
}; }
} }
export interface IPreUploadData { export interface IPreUploadData {
/** /**
* - * -
*/ */
file_ext?: string; file_ext?: string
} }
const handlePreUpload = async (val: { const handlePreUpload = async (val: { file_ext: string; upload_type: string }) => {
file_ext: string; const res = await Apis.Common.Auth.PreUpload(val)
upload_type: string; return res
}) => { }
const res = await Apis.Common.Auth.PreUpload(val);
return res;
};
export const upload = (count = 1, size = 2, mediaType = ["image"]) => { export const upload = (count = 1, size = 2, mediaType = ['image']) => {
return new Promise<{ url: string; status: string; type: string | undefined }>( return new Promise<{ url: string; status: string; type: string | undefined }>(
(resolve, reject) => { (resolve, reject) => {
let currentCount = 0; let currentCount = 0
let ArrImgList: any = []; let ArrImgList: any = []
uni.chooseMedia({ uni.chooseMedia({
count: count > 9 ? 9 : count, //默认9 count: count > 9 ? 9 : count, //默认9
mediaType: mediaType as ["image"], mediaType: mediaType as ['image'],
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
success: async function (i) { success: async function (i) {
console.log("filePath", i.tempFiles); console.log('filePath', i.tempFiles)
i.tempFiles?.map((k: any) => { i.tempFiles?.map((k: any) => {
console.log(k, "??kj"); console.log(k, '??kj')
const filePath = k.tempFilePath; const filePath = k.tempFilePath
const extIndex = filePath.lastIndexOf("."); const extIndex = filePath.lastIndexOf('.')
const filePathName = filePath.substring( const filePathName = filePath.substring(filePath.lastIndexOf('.') + 1)
filePath.lastIndexOf(".") + 1 const fileExt = extIndex >= -1 ? filePath.substr(extIndex + 1) : ''
); const img_size = i.tempFiles[0].size
const fileExt = extIndex >= -1 ? filePath.substr(extIndex + 1) : ""; const max_size = 1024 * 1024 * (size || 2) // 默认2M
const img_size = i.tempFiles[0].size;
const max_size = 1024 * 1024 * (size || 2); // 默认2M
if (img_size > max_size) { if (img_size > max_size) {
uni.showToast({ uni.showToast({
title: `${filePathName}文件大小不能超过${size}M`, title: `${filePathName}文件大小不能超过${size}M`,
icon: "none", icon: 'none'
}); })
return false; return false
} }
handlePreUpload({ handlePreUpload({
file_ext: fileExt, file_ext: fileExt,
upload_type: k?.fileType, upload_type: k?.fileType
}).then((res) => { }).then(res => {
if (res.success) { if (res.success) {
const prefix = res.data.cosHost; const prefix = res.data.cosHost
const key = res.data.cosKey; const key = res.data.cosKey
const wxfs = uni.getFileSystemManager(); const wxfs = uni.getFileSystemManager()
const timestamp = Date.now(); const timestamp = Date.now()
wxfs.readFile({ wxfs.readFile({
filePath: filePath, filePath: filePath,
complete(e) { complete(e) {
if (e?.errMsg === "readFile:ok") { if (e?.errMsg === 'readFile:ok') {
currentCount = currentCount + 1; currentCount = currentCount + 1
const url: string = "https://" + prefix + key; const url: string = 'https://' + prefix + key
let data = { let data = {
url: url, url: url,
status: "done", status: 'done',
type: `${k?.fileType}/${filePath.split(".")[1]}`, type: `${k?.fileType}/${filePath.split('.')[1]}`,
uid: timestamp, uid: timestamp,
size: k?.size, size: k?.size
}; }
console.log(data, "url"); console.log(data, 'url')
ArrImgList?.push(data); ArrImgList?.push(data)
} }
uni.showLoading({ uni.showLoading({
title: `${i.tempFiles?.length}张/${currentCount}`, title: `${i.tempFiles?.length}张/${currentCount}`,
mask: true, mask: true
}); })
if (currentCount === i.tempFiles?.length) { if (currentCount === i.tempFiles?.length) {
setTimeout(() => { setTimeout(() => {
uni.hideLoading(); uni.hideLoading()
}, 500); }, 500)
} }
console.log("complete", e); console.log('complete', e)
}, },
success: function (fileRes) { success: function (fileRes) {
uni.request({ uni.request({
url: "https://" + prefix + key, url: 'https://' + prefix + key,
method: "PUT", method: 'PUT',
header: { header: {
"Content-Type": "image/" + fileExt, 'Content-Type': 'image/' + fileExt,
Authorization: res.data.authorization, Authorization: res.data.authorization
}, },
data: fileRes.data, data: fileRes.data,
success: function success(res) { success: function success(res) {
console.log(res, "resUpadte"); console.log(res, 'resUpadte')
if (res.statusCode !== 200) { if (res.statusCode !== 200) {
uni.showToast({ uni.showToast({
title: "上传失败", title: '上传失败',
icon: "none", icon: 'none'
}); })
reject(); reject()
} else { } else {
resolve(ArrImgList); resolve(ArrImgList)
} }
}, },
fail: function fail() { fail: function fail() {
uni.showToast({ uni.showToast({
title: "上传失败", title: '上传失败',
icon: "none", icon: 'none'
}); })
reject(); reject()
}, }
}); })
}, }
}); })
} }
}); })
}); })
}, }
}); })
} }
); )
}; }

View File

@ -1,36 +1,36 @@
import { Apis } from "@/gen/Apis"; import { Apis } from '@/gen/Apis'
import { useWeAppAuthStore } from "../store/useWeAppAuthStore"; import { useWeAppAuthStore } from '../store/useWeAppAuthStore'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
export default { export default {
onBindPhone() { onBindPhone() {
console.log("auth?.userInfo:", auth?.data); console.log('auth?.userInfo:', auth?.data)
if (!auth?.data?.user) { if (!auth?.data?.user) {
// 未绑定手机号 // 未绑定手机号
uni.showModal({ uni.showModal({
title: "登录", title: '登录',
content: "请先登录体验更多功能!", content: '请先登录体验更多功能!',
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/login", url: '/pages/login'
}); })
console.log("用户点击确定"); console.log('用户点击确定')
} else if (res.cancel) { } else if (res.cancel) {
console.log("用户点击取消"); console.log('用户点击取消')
} }
}, }
}); })
return false; return false
} else { } else {
return true; return true
} }
}, },
getLoginStatus() { getLoginStatus() {
if (!auth?.data?.user) { if (!auth?.data?.user) {
// 是否登录 // 是否登录
return false; return false
} else { } else {
return true; return true
} }
}, }
}; }

View File

@ -1,59 +1,59 @@
export default { export default {
addWatermark(imagePath: string, watermarkTxt: string) { addWatermark(imagePath: string, watermarkTxt: string) {
//图片预览带水印 //图片预览带水印
const ctx = uni.createCanvasContext("myCanvas"); const ctx = uni.createCanvasContext('myCanvas')
// 获取图片信息 // 获取图片信息
uni.getImageInfo({ uni.getImageInfo({
src: imagePath, src: imagePath,
success: (imageInfo) => { success: imageInfo => {
const { width, height } = imageInfo; const { width, height } = imageInfo
console.log(imageInfo, "imageInfo"); console.log(imageInfo, 'imageInfo')
// 计算等比缩放后的尺寸 // 计算等比缩放后的尺寸
const canvasWidth = 390; const canvasWidth = 390
const canvasHeight = (height * canvasWidth) / width; const canvasHeight = (height * canvasWidth) / width
// 绘制原图片 // 绘制原图片
ctx.drawImage(imagePath, 0, 0, canvasWidth, canvasHeight); // 这里设置绘制的大小 ctx.drawImage(imagePath, 0, 0, canvasWidth, canvasHeight) // 这里设置绘制的大小
// 设置水印样式 // 设置水印样式
ctx.setFontSize(17); ctx.setFontSize(17)
ctx.setFillStyle("#FFD415"); // 设置字体颜色 ctx.setFillStyle('#FFD415') // 设置字体颜色
// 添加水印文字 // 添加水印文字
ctx.rotate(-Math.PI / 4); // 逆时针旋转 45 度 ctx.rotate(-Math.PI / 4) // 逆时针旋转 45 度
ctx.fillText(watermarkTxt, -500, 400); // 设置水印位置 ctx.fillText(watermarkTxt, -500, 400) // 设置水印位置
ctx.fillText(watermarkTxt, -200, 200); // 设置水印位置 ctx.fillText(watermarkTxt, -200, 200) // 设置水印位置
ctx.fillText(watermarkTxt, -200, 300); // 设置水印位置 ctx.fillText(watermarkTxt, -200, 300) // 设置水印位置
ctx.fillText(watermarkTxt, -200, 400); // 设置水印位置 ctx.fillText(watermarkTxt, -200, 400) // 设置水印位置
ctx.fillText(watermarkTxt, -200, 600); // 设置水印位置 ctx.fillText(watermarkTxt, -200, 600) // 设置水印位置
ctx.fillText(watermarkTxt, -550, 800); // 设置水印位置 ctx.fillText(watermarkTxt, -550, 800) // 设置水印位置
// 绘制完成 // 绘制完成
ctx.draw(false, () => { ctx.draw(false, () => {
// 转换画布为图片 // 转换画布为图片
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: "myCanvas", canvasId: 'myCanvas',
success: (res) => { success: res => {
console.log("水印图片地址:", res.tempFilePath); console.log('水印图片地址:', res.tempFilePath)
uni.hideLoading(); uni.hideLoading()
uni.previewMedia({ uni.previewMedia({
sources: [ sources: [
{ {
url: res.tempFilePath, url: res.tempFilePath,
type: "image", type: 'image'
}, }
], ],
current: 0, current: 0
}); })
// 可以将水印图片的路径保存或显示在界面上 // 可以将水印图片的路径保存或显示在界面上
}, },
fail: (err) => { fail: err => {
uni.showToast({ uni.showToast({
title: "获取失败", title: '获取失败',
duration: 1000, duration: 1000
}); })
console.error(err); console.error(err)
}, }
}); })
}); })
}, }
}); })
}, }
}; }

View File

@ -1,74 +1,109 @@
import { Apis } from "@/gen/Apis"; import { Apis } from '@/gen/Apis'
import { defineStore } from "pinia"; import { defineStore } from 'pinia'
import { ref } from "vue"; import { ref } from 'vue'
import { getApiLoading } from "../libraries/apiLoading"; import { getApiLoading } from '../libraries/apiLoading'
import { setTabBar } from "../libraries/setTabBar"; import { setTabBar } from '../libraries/setTabBar'
type DataType = { type DataType = {
user?: { user?: {
id: number; id: number
username: string; username: string
}; }
orgs?: { id?: number; name?: string }[]; orgs?: { id?: number; name?: string }[]
selectedOrg?: { id?: number; name?: string; is_show_procedure?: number }; selectedOrg?: { id?: number; name?: string; is_show_procedure?: number }
}; }
export const useWeAppAuthStore = defineStore("we_app_auth", () => { export const useWeAppAuthStore = defineStore('we_app_auth', () => {
const loading = ref<boolean>(true); const loading = ref<boolean>(true)
const hasError = ref<boolean>(false); const hasError = ref<boolean>(false)
const data = ref<DataType>({ const data = ref<DataType>({
user: { id: 0, username: "" }, user: { id: 0, username: '' }
}); })
function login(app: any) { function login(app: any) {
uni.login({ const res = uni.getSystemInfoSync()
provider: "weixin", //使用微信登录 if (res?.environment === 'wxwork') {
success: function (loginRes) { uni?.qy?.login({
console.log(loginRes.code) success: function (loginRes) {
return false console.log(loginRes)
Apis.Login.Auth.Login({ code: loginRes.code }) getWorkToken(app, loginRes.code)
.then((res) => { }
console.log("登录", res?.data); })
data.value.user = res.data?.user; } else {
loading.value = false; uni?.login({
uni.setStorageSync( provider: 'weixin', //使用微信登录
import.meta.env.VITE_ACCESS_TOKEN_KEY, success: function (loginRes) {
res?.data?.token?.token console.log(loginRes)
); getWXToken(app, loginRes.code)
app?.appContext.config.globalProperties.$isResolve(); }
if (!res.data?.user) { })
//未绑定账号 }
uni.redirectTo({ }
url: "/pages/login", const getWorkToken = (app: any, code: string) => {
}); Apis.Login.Auth.WorkLogin({ code: code, app_id: 'ww8e14f3d20774c997' })
return false; .then(res => {
} console.log('登录', res?.data)
data.value.user = res.data?.user
loading.value = false
uni.setStorageSync(import.meta.env.VITE_ACCESS_TOKEN_KEY, res?.data?.token?.token)
app?.appContext.config.globalProperties.$isResolve()
if (!res.data?.user) {
//未绑定账号
uni.redirectTo({
url: '/pages/login'
}) })
.catch(() => { return false
loading.value = false; }
hasError.value = true; })
}); .catch(() => {
}, loading.value = false
}); hasError.value = true
})
}
const getWXToken = (app: any, code: string) => {
Apis.Login.Auth.Login({ code: code, app_id: 'wx09b52ea34b5e8855' })
.then(res => {
console.log('登录', res?.data)
data.value.user = res.data?.user
loading.value = false
uni.setStorageSync(import.meta.env.VITE_ACCESS_TOKEN_KEY, res?.data?.token?.token)
app?.appContext.config.globalProperties.$isResolve()
if (!res.data?.user) {
//未绑定账号
uni.redirectTo({
url: '/pages/login'
})
return false
}
})
.catch(() => {
loading.value = false
hasError.value = true
})
} }
function me() { function me() {
getApiLoading(Apis.Login.Auth.Me, {}).then((res) => { getApiLoading(Apis.Login.Auth.Me, {}).then(res => {
data.value.user = res.data.user; data.value.user = res.data.user
console.log("me", res.data); console.log('me', res.data)
loading.value = false; loading.value = false
hasError.value = false; hasError.value = false
}); })
} }
const handleUserLogin = async (from_data: { const handleUserLogin = async (from_data: {
username: string; code?: string
password: string; phone?: string
phone_validate_code?: string
}) => { }) => {
getApiLoading(Apis.Login.Auth.BindPhoneNumber, from_data).then((res) => { getApiLoading(Apis.Login.Auth.BindPhoneNumber, {
me(); app_id: 'wx09b52ea34b5e8855',
}); ...from_data
}; }).then(res => {
me()
})
}
return { return {
loading, loading,
@ -76,6 +111,6 @@ export const useWeAppAuthStore = defineStore("we_app_auth", () => {
data, data,
login, login,
me, me,
handleUserLogin, handleUserLogin
}; }
}); })

View File

@ -1,15 +1,15 @@
type MyResponseType = { type MyResponseType = {
success?: boolean; success?: boolean
data?: any; data?: any
errorCode?: number; errorCode?: number
errorMessage?: string; errorMessage?: string
showType?: any; showType?: any
meta?: any; meta?: any
}; }
type MyEnumItemProps = { type MyEnumItemProps = {
label: string; label: string
value: string | number; value: string | number
color: string; color: string
textColor: string; textColor: string
}; }

View File

@ -9,7 +9,7 @@
@click="handleShowFile(i)" @click="handleShowFile(i)"
> >
<view class="name"> <view class="name">
{{ i?.name || "-" }} {{ i?.name || '-' }}
</view> </view>
<view class="btn">查看</view> <view class="btn">查看</view>
</view> </view>
@ -17,75 +17,71 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getApiLoading } from "@/common/libraries/apiLoading"; import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from "@/gen/Apis"; import { Apis } from '@/gen/Apis'
const props = defineProps(["list"]); const props = defineProps(['list'])
const handleShowFile = (e: { url?: string; name?: string }) => { const handleShowFile = (e: { url?: string; name?: string }) => {
console.log(e, "e"); console.log(e, 'e')
if (!e?.url) { if (!e?.url) {
return uni.showToast({ title: "文件不存在", icon: "none" }); return uni.showToast({ title: '文件不存在', icon: 'none' })
} }
let showimg = false; let showimg = false
let parts = e?.url.split("/"); let parts = e?.url.split('/')
let fileName = parts[parts.length - 1]; let fileName = parts[parts.length - 1]
if ( if (fileName.endsWith('.jpg') || fileName.endsWith('.png') || fileName.endsWith('.jpeg')) {
fileName.endsWith(".jpg") || showimg = true
fileName.endsWith(".png") ||
fileName.endsWith(".jpeg")
) {
showimg = true;
} }
console.log(fileName, "fileName"); console.log(fileName, 'fileName')
getApiLoading(Apis.Auth.TemporaryUrl, { getApiLoading(Apis.Auth.TemporaryUrl, {
filename: fileName, filename: fileName,
alc: "private", alc: 'private'
}).then((res) => { }).then(res => {
uni.showLoading({ uni.showLoading({
title: "正在打开中..", title: '正在打开中..'
}); })
console.log(res, "res图片"); console.log(res, 'res图片')
if (showimg) { if (showimg) {
uni.downloadFile({ uni.downloadFile({
url: res?.data?.url, url: res?.data?.url,
success: function (e) { success: function (e) {
uni.hideLoading(); uni.hideLoading()
console.log("文件是jpg、png或jpeg格式"); console.log('文件是jpg、png或jpeg格式')
uni.previewImage({ uni.previewImage({
current: 0, current: 0,
urls: [e?.tempFilePath || ""], urls: [e?.tempFilePath || '']
}); })
console.log(e, "e"); console.log(e, 'e')
}, }
}); })
return; return
} }
uni.downloadFile({ uni.downloadFile({
url: res?.data?.url, url: res?.data?.url,
filePath: `${uni.env.USER_DATA_PATH}/${e?.name}`, filePath: `${uni.env.USER_DATA_PATH}/${e?.name}`,
success: function (e: { filePath?: string }) { success: function (e: { filePath?: string }) {
const filePath = e.filePath; const filePath = e.filePath
console.log(e, "filePath"); console.log(e, 'filePath')
uni.hideLoading(); uni.hideLoading()
uni.openDocument({ uni.openDocument({
filePath: filePath as string, filePath: filePath as string,
showMenu: true, showMenu: true
}); })
}, },
fail() { fail() {
uni.hideLoading(); uni.hideLoading()
uni.showToast({ uni.showToast({
title: "打开文件失败!", title: '打开文件失败!',
duration: 2000, duration: 2000,
icon: "none", icon: 'none'
}); })
}, }
}); })
console.log(res, "res"); console.log(res, 'res')
}); })
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -6,21 +6,21 @@
@click="handleClick" @click="handleClick"
@getphonenumber="handleGetPhoneNumber" @getphonenumber="handleGetPhoneNumber"
> >
{{ props?.label || "我是按钮" }} {{ props?.label || '我是按钮' }}
</button> </button>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, defineEmits } from "vue"; import { defineProps, defineEmits } from 'vue'
const props = defineProps(["type", "label", "size", "openType", "buttonStyle"]); const props = defineProps(['type', 'label', 'size', 'openType', 'buttonStyle'])
const emit = defineEmits(["click", "onGetPhoneNumber"]); const emit = defineEmits(['click', 'onGetPhoneNumber'])
const handleClick = () => { const handleClick = () => {
emit("click"); emit('click')
}; }
const handleGetPhoneNumber = (e: any) => { const handleGetPhoneNumber = (e: any) => {
if (e?.detail?.errMsg === "getPhoneNumber:ok") { if (e?.detail?.errMsg === 'getPhoneNumber:ok') {
emit("onGetPhoneNumber", e); emit('onGetPhoneNumber', e)
} }
}; }
</script> </script>
<style leng="scss" scoped> <style leng="scss" scoped>
button::after { button::after {

View File

@ -7,14 +7,14 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps(["title", "status", "value", "itemStyle", "url"]); const props = defineProps(['title', 'status', 'value', 'itemStyle', 'url'])
const emit = defineEmits(["click"]); const emit = defineEmits(['click'])
const toPage = () => { const toPage = () => {
if (props?.url) { if (props?.url) {
uni.navigateTo({ url: props.url }); uni.navigateTo({ url: props.url })
} }
emit("click"); emit('click')
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.card_cell_item { .card_cell_item {

View File

@ -1,11 +1,9 @@
<template> <template>
<view <view
:style="{ :style="{
background: props.backgroundUrl background: props.backgroundUrl ? `url(${props.backgroundUrl || ''})` : '#fff',
? `url(${props.backgroundUrl || ''})`
: '#fff',
backgroundSize: '100% 100%', backgroundSize: '100% 100%',
...styles, ...styles
}" }"
class="card_content" class="card_content"
@click="$emit('click')" @click="$emit('click')"
@ -28,14 +26,14 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, useSlots } from "vue"; import { ref, useSlots } from 'vue'
const props = defineProps(["title", "backgroundUrl", "styles", "borderHead"]); const props = defineProps(['title', 'backgroundUrl', 'styles', 'borderHead'])
const slots = useSlots(); const slots = useSlots()
const handleGetRelationNodes = () => { const handleGetRelationNodes = () => {
// //
let show = slots.default; let show = slots.default
return show; return show
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.card_content { .card_content {

View File

@ -6,34 +6,23 @@
{{ props?.subTitle }} {{ props?.subTitle }}
</text> </text>
</view> </view>
<view <view v-if="props?.showBtn" class="customer_create_card_add" @click="handleClick">
v-if="props?.showBtn" {{ props?.btnLabel || '添加' }}
class="customer_create_card_add"
@click="handleClick"
>
{{ props?.btnLabel || "添加" }}
</view> </view>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { defineProps, defineEmits } from "vue"; import { defineProps, defineEmits } from 'vue'
import { goto } from "@/common/libraries/naviHelper"; import { goto } from '@/common/libraries/naviHelper'
const props = defineProps([ const props = defineProps(['label', 'subTitle', 'showBtn', 'btnLabel', 'url', 'styles'])
"label", const emit = defineEmits(['handleClick'])
"subTitle",
"showBtn",
"btnLabel",
"url",
"styles",
]);
const emit = defineEmits(["handleClick"]);
const handleClick = () => { const handleClick = () => {
if (props?.url) { if (props?.url) {
goto(props?.url); goto(props?.url)
} else { } else {
emit("handleClick"); emit('handleClick')
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.customer_create_card { .customer_create_card {

View File

@ -3,7 +3,7 @@
<view class="left_label"> <view class="left_label">
<view class="border_left"> </view> <view class="border_left"> </view>
<view class="label"> <view class="label">
{{ props?.label || "标题" }} {{ props?.label || '标题' }}
</view> </view>
</view> </view>
<view class="right_value"> <view class="right_value">
@ -12,7 +12,7 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps(["label"]); const props = defineProps(['label'])
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wl_title { .wl_title {

View File

@ -3,13 +3,13 @@
class="wl_cell" class="wl_cell"
:style="{ :style="{
borderTop: props.borderTop ? '1rpx solid #eee' : '', borderTop: props.borderTop ? '1rpx solid #eee' : '',
padding: props?.padding || '10rpx 0', padding: props?.padding || '10rpx 0'
}" }"
@click="handleClick" @click="handleClick"
> >
<view class="wl_cell_header"> <view class="wl_cell_header">
<view :style="props.titleStyle" class="title"> <view :style="props.titleStyle" class="title">
{{ props?.title || "标题" }} {{ props?.title || '标题' }}
<text v-if="required"> * </text> <text v-if="required"> * </text>
</view> </view>
<view v-if="props?.value" class="right_value"> <view v-if="props?.value" class="right_value">
@ -19,9 +19,7 @@
<slot></slot> <slot></slot>
</view> </view>
<view class="isLabelRight" v-if="props?.isLink"> <view class="isLabelRight" v-if="props?.isLink">
{{ {{ !props?.value && props?.isPlaceholder ? props?.tip || '请选择' : '' }}
!props?.value && props?.isPlaceholder ? props?.tip || "请选择" : ""
}}
<uni-icons type="right" size="15" color="#333"></uni-icons> <uni-icons type="right" size="15" color="#333"></uni-icons>
</view> </view>
</view> </view>
@ -32,30 +30,30 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { goto } from "@/common/libraries/naviHelper"; import { goto } from '@/common/libraries/naviHelper'
const props = defineProps([ const props = defineProps([
"title", 'title',
"required", 'required',
"borderTop", 'borderTop',
"isLink", 'isLink',
"tip", 'tip',
"value", 'value',
"url", 'url',
"isPlaceholder", 'isPlaceholder',
"padding", 'padding',
"des", 'des',
"rightStyle", 'rightStyle',
"titleStyle", 'titleStyle'
]); ])
const emit = defineEmits(["click"]); const emit = defineEmits(['click'])
const handleClick = () => { const handleClick = () => {
if (props?.url) { if (props?.url) {
goto(props.url); goto(props.url)
} else { } else {
emit("click"); emit('click')
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wl_cell { .wl_cell {

View File

@ -1,10 +1,5 @@
<template> <template>
<picker <picker mode="multiSelector" :value="pIndex" :range="props.Enums" @change="onChange">
mode="multiSelector"
:value="pIndex"
:range="props.Enums"
@change="onChange"
>
<wl-cell <wl-cell
:title="props?.title" :title="props?.title"
isLink isLink
@ -17,28 +12,21 @@
</picker> </picker>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from "vue"; import { computed, ref } from 'vue'
const props = defineProps([ const props = defineProps(['Enums', 'value', 'tip', 'title', 'required', 'borderTop'])
"Enums", const emit = defineEmits(['change'])
"value",
"tip",
"title",
"required",
"borderTop",
]);
const emit = defineEmits(["change"]);
const onChange = (e: any) => { const onChange = (e: any) => {
emit("change", e?.detail.value); emit('change', e?.detail.value)
}; }
const pIndex = computed(() => { const pIndex = computed(() => {
return props.Enums.map((item: any) => return props.Enums.map((item: any) =>
Object.values(item) Object.values(item)
.filter((item: any) => item.text === props.value) .filter((item: any) => item.text === props.value)
.map((_: any, i: number) => i) .map((_: any, i: number) => i)
); )
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,100 +1,103 @@
<template> <template>
<view :class="`radio_body ${props?.display ? 'displayStyle' : ''}`" :style="props?.radioStyle"> <view :class="`radio_body ${props?.display ? 'displayStyle' : ''}`" :style="props?.radioStyle">
<view v-for="(i, index) in getEnums()" :key="`item_${index}`" :class="`item item_${props?.size} ${selectEd(i?.value, props?.valueModel) || selectEd(i?.value, selectValue) <view
? 'active' v-for="(i, index) in getEnums()"
: '' :key="`item_${index}`"
}`" :style="selectEd(i?.value, props?.valueModel) || selectEd(i?.value, selectValue) :class="`item item_${props?.size} ${
selectEd(i?.value, props?.valueModel) || selectEd(i?.value, selectValue) ? 'active' : ''
}`"
:style="
selectEd(i?.value, props?.valueModel) || selectEd(i?.value, selectValue)
? props?.selectStyle ? props?.selectStyle
: '' : ''
" @click="onClick(i)"> "
@click="onClick(i)"
>
{{ i?.text }} {{ i?.text }}
</view> </view>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
interface EnumItem { interface EnumItem {
text?: string; text?: string
value?: string; value?: string
} }
const props = defineProps([ const props = defineProps([
"valueModel", 'valueModel',
"Enums", 'Enums',
"size", 'size',
"display", 'display',
"radioStyle", 'radioStyle',
"selectStyle", 'selectStyle',
"valueLabel", 'valueLabel'
]); ])
const selectValue = ref<any>([]); const selectValue = ref<any>([])
const selectValueLabel = ref<any>([]); const selectValueLabel = ref<any>([])
const selectEd = (val?: string, list?: any[]) => { const selectEd = (val?: string, list?: any[]) => {
if (list?.includes(val)) { if (list?.includes(val)) {
return true; return true
} else { } else {
return false; return false
} }
}; }
const getEnums = () => { const getEnums = () => {
let list: EnumItem[] = Object.entries( let list: EnumItem[] = Object.entries(props?.Enums as Record<string, EnumItem>).map(
props?.Enums as Record<string, EnumItem> ([key, value]) => ({
).map(([key, value]) => ({ text: value.text,
text: value.text, value: value.value
value: value.value, })
})); )
return list; return list
}; }
const emit = defineEmits(["update:valueModel", "onChange"]); const emit = defineEmits(['update:valueModel', 'onChange'])
const onClick = (e: any) => { const onClick = (e: any) => {
if (props?.display) { if (props?.display) {
return false; return false
} }
if (selectValue.value?.includes(e?.value)) { if (selectValue.value?.includes(e?.value)) {
// //
const newList = selectValue.value.filter((i: string) => i !== e?.value); const newList = selectValue.value.filter((i: string) => i !== e?.value)
const newValLabelList = selectValueLabel.value.filter( const newValLabelList = selectValueLabel.value.filter(
(i: { value?: string }) => i?.value !== e?.value (i: { value?: string }) => i?.value !== e?.value
); )
selectValue.value = newList; selectValue.value = newList
selectValueLabel.value = newValLabelList; selectValueLabel.value = newValLabelList
} else { } else {
// //
selectValue.value = [...selectValue.value, ...[e?.value]]; selectValue.value = [...selectValue.value, ...[e?.value]]
selectValueLabel.value = [...selectValueLabel.value, ...[e]]; selectValueLabel.value = [...selectValueLabel.value, ...[e]]
} }
emit("update:valueModel", selectValue.value); emit('update:valueModel', selectValue.value)
emit( emit('onChange', props?.valueLabel ? selectValueLabel.value : selectValue.value)
"onChange", }
props?.valueLabel ? selectValueLabel.value : selectValue.value
);
};
watch( watch(
() => props?.valueModel, () => props?.valueModel,
() => { () => {
if (props?.valueModel) { if (props?.valueModel) {
selectValue.value = props?.valueModel; selectValue.value = props?.valueModel
handleFilter(); handleFilter()
} }
} }
); )
const handleFilter = () => { const handleFilter = () => {
selectValueLabel.value = Object.values(props?.Enums).filter((i) => { selectValueLabel.value = Object.values(props?.Enums).filter(i => {
let item = i as { value?: string }; let item = i as { value?: string }
return props?.valueModel?.includes(item?.value); return props?.valueModel?.includes(item?.value)
}); })
console.log("selectValueLabel.value", selectValueLabel.value); console.log('selectValueLabel.value', selectValueLabel.value)
}; }
onMounted(() => { onMounted(() => {
if (props?.valueModel) { if (props?.valueModel) {
selectValue.value = props?.valueModel; selectValue.value = props?.valueModel
handleFilter(); handleFilter()
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.radio_body { .radio_body {
@ -105,7 +108,7 @@ onMounted(() => {
.item { .item {
min-width: 120rpx; min-width: 120rpx;
padding:0 10rpx; padding: 0 10rpx;
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
height: 60rpx; height: 60rpx;
@ -123,11 +126,14 @@ onMounted(() => {
// } // }
} }
.item_sm {} .item_sm {
}
.item_md {} .item_md {
}
.item_lg {} .item_lg {
}
.active { .active {
color: #333; color: #333;

View File

@ -4,7 +4,7 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps(["value"]); const props = defineProps(['value'])
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.nchl_copy { .nchl_copy {

View File

@ -3,26 +3,26 @@
class="custom-title" class="custom-title"
:style="`padding-top:${capsuleRect.top}px;height:${capsuleRect.height}px;line-height:${capsuleRect.height}px;${props?.objStyle}`" :style="`padding-top:${capsuleRect.top}px;height:${capsuleRect.height}px;line-height:${capsuleRect.height}px;${props?.objStyle}`"
> >
{{ titleValue || "标题" }} {{ titleValue || '标题' }}
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
const titleValue = ref<string>("标题"); const titleValue = ref<string>('标题')
const capsuleRect = ref<any>({}); const capsuleRect = ref<any>({})
const props = defineProps(["title", "objStyle"]); const props = defineProps(['title', 'objStyle'])
watch( watch(
() => props.title, () => props.title,
(newVal) => { newVal => {
titleValue.value = newVal; titleValue.value = newVal
console.log(newVal, "title"); console.log(newVal, 'title')
} }
); )
onMounted(() => { onMounted(() => {
titleValue.value = props.title; titleValue.value = props.title
capsuleRect.value = uni.getMenuButtonBoundingClientRect(); capsuleRect.value = uni.getMenuButtonBoundingClientRect()
console.log(capsuleRect.value, "capsuleRect"); console.log(capsuleRect.value, 'capsuleRect')
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.custom-title { .custom-title {

View File

@ -8,35 +8,35 @@
> >
<view style="display: flex"> <view style="display: flex">
<view :class="`picker_${props?.valueModel ? 'value' : 'tip'}`"> <view :class="`picker_${props?.valueModel ? 'value' : 'tip'}`">
{{ props?.valueModel || props?.tip || "请选择" }} {{ props?.valueModel || props?.tip || '请选择' }}
<uni-icons type="right" size="15" color="#333"></uni-icons> <uni-icons type="right" size="15" color="#333"></uni-icons>
</view> </view>
</view> </view>
</picker> </picker>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } from 'vue'
// hasFutureDate: // hasFutureDate:
const props = defineProps(["valueModel", "tip", "hasFutureDate"]); const props = defineProps(['valueModel', 'tip', 'hasFutureDate'])
const emit = defineEmits(["change", "update:valueModel"]); const emit = defineEmits(['change', 'update:valueModel'])
const startDate = ref(""); const startDate = ref('')
const endDate = ref(""); const endDate = ref('')
const onChange = (e: any) => { const onChange = (e: any) => {
emit("update:valueModel", e?.detail.value); emit('update:valueModel', e?.detail.value)
emit("change", e?.detail.value); emit('change', e?.detail.value)
}; }
onMounted(() => { onMounted(() => {
const date = new Date(); const date = new Date()
let year = date.getFullYear(); let year = date.getFullYear()
let month: string | number = date.getMonth() + 1; let month: string | number = date.getMonth() + 1
let day: string | number = date.getDate(); let day: string | number = date.getDate()
month = month > 9 ? month : "0" + month; month = month > 9 ? month : '0' + month
day = day > 9 ? day : "0" + day; day = day > 9 ? day : '0' + day
startDate.value = props?.hasFutureDate startDate.value = props?.hasFutureDate
? `${year}-${month}-${day}` ? `${year}-${month}-${day}`
: `${year - 60}-${month}-${day}`; : `${year - 60}-${month}-${day}`
endDate.value = `${year + 60}-${month}-${day}`; endDate.value = `${year + 60}-${month}-${day}`
}); })
</script> </script>

View File

@ -23,45 +23,45 @@
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
import { getDay } from "@/common/libraries/day"; import { getDay } from '@/common/libraries/day'
interface EnumItem { interface EnumItem {
text?: string; text?: string
value?: string; value?: string
} }
const props = defineProps([ const props = defineProps([
"Enums", 'Enums',
"title", 'title',
"pickerIndex", 'pickerIndex',
"value", 'value',
"borderTop", 'borderTop',
"required", 'required',
"valueModel", 'valueModel',
"icon", 'icon',
"iconSize", 'iconSize'
]); ])
const selectValue = ref(""); const selectValue = ref('')
const emit = defineEmits(["change", "update:valueModel"]); const emit = defineEmits(['change', 'update:valueModel'])
const onChange = (e: any) => { const onChange = (e: any) => {
selectValue.value = e?.detail?.value; selectValue.value = e?.detail?.value
emit("update:valueModel", e?.detail?.value); emit('update:valueModel', e?.detail?.value)
emit("change", e?.detail?.value); emit('change', e?.detail?.value)
}; }
watch( watch(
() => props?.valueModel, () => props?.valueModel,
(val) => { val => {
selectValue.value = val; selectValue.value = val
} }
); )
onMounted(() => { onMounted(() => {
if (props?.valueModel) { if (props?.valueModel) {
selectValue.value = props?.valueModel; selectValue.value = props?.valueModel
} else { } else {
selectValue.value = getDay(); selectValue.value = getDay()
} }
}); })
</script> </script>

View File

@ -10,19 +10,19 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps } from "vue"; import { defineProps } from 'vue'
const props = defineProps<{ const props = defineProps<{
mode?: string; mode?: string
text?: string; // text?: string //
height?: string; height?: string
iconSize?: string | number; iconSize?: string | number
textSize?: string | number; textSize?: string | number
}>(); }>()
const baseStyle = { const baseStyle = {
height: props.height || "40vh", height: props.height || '40vh'
}; }
</script> </script>
<style scoped> <style scoped>

View File

@ -4,12 +4,12 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } from 'vue'
const styleObj = ref(); const styleObj = ref()
const props = defineProps(["Enums", "value", "type", "size"]); const props = defineProps(['Enums', 'value', 'type', 'size'])
onMounted(() => { onMounted(() => {
styleObj.value = { color: props?.Enums?.[props.value]?.color }; styleObj.value = { color: props?.Enums?.[props.value]?.color }
}); })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.wl_enum_tag { .wl_enum_tag {

View File

@ -10,32 +10,23 @@
<wl-button :label="props?.btnOtherName || '返回'" size="md" /> <wl-button :label="props?.btnOtherName || '返回'" size="md" />
</view> </view>
<view class="wl_footer_item" @click="handleParmaryClick"> <view class="wl_footer_item" @click="handleParmaryClick">
<wl-button <wl-button :label="props?.btnParimaryName || '提交'" type="primary" size="md" />
:label="props?.btnParimaryName || '提交'"
type="primary"
size="md"
/>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const props = defineProps([ const props = defineProps(['btnParimaryName', 'btnOtherName', 'btnOtherShow', 'back'])
"btnParimaryName", const emit = defineEmits(['handleParmaryClick', 'handleOtherClick'])
"btnOtherName",
"btnOtherShow",
"back",
]);
const emit = defineEmits(["handleParmaryClick", "handleOtherClick"]);
const handleParmaryClick = () => { const handleParmaryClick = () => {
emit("handleParmaryClick"); emit('handleParmaryClick')
}; }
const handleOtherClick = () => { const handleOtherClick = () => {
emit("handleOtherClick"); emit('handleOtherClick')
if (props?.back) { if (props?.back) {
uni.navigateBack({ delta: 1 }); uni.navigateBack({ delta: 1 })
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wl_footer { .wl_footer {

View File

@ -8,7 +8,7 @@
:placeholder-style="props.placeholderStyle" :placeholder-style="props.placeholderStyle"
:style="{ :style="{
width: props?.width || '300rpx', width: props?.width || '300rpx',
textAlign: props?.textAlign, textAlign: props?.textAlign
}" }"
@change="onChange" @change="onChange"
:placeholder="props?.placeholder || '请输入'" :placeholder="props?.placeholder || '请输入'"
@ -21,69 +21,58 @@
:password="props?.password || false" :password="props?.password || false"
/> />
<view v-if="valueModel.length" class="close"> <view v-if="valueModel.length" class="close">
<uni-icons <uni-icons @click="emptyInput" type="closeempty" color="#999999" size="12" />
@click="emptyInput"
type="closeempty"
color="#999999"
size="12"
/>
</view> </view>
<view v-if="suffix" class="suffix">{{ suffix }}</view> <view v-if="suffix" class="suffix">{{ suffix }}</view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { watch, ref, onMounted } from "vue"; import { watch, ref, onMounted } from 'vue'
import { wlInputProps } from "./reducer"; import { wlInputProps } from './reducer'
const valueModel = ref(""); const valueModel = ref('')
// ======================= props & emit ======================= // ======================= props & emit =======================
const props = defineProps(wlInputProps); const props = defineProps(wlInputProps)
const emit = defineEmits([ const emit = defineEmits(['update:valueModel', 'input', 'blur', 'bindconfirm', 'onClose'])
"update:valueModel",
"input",
"blur",
"bindconfirm",
"onClose",
]);
watch( watch(
() => props.valueModel, () => props.valueModel,
(val) => { val => {
valueModel.value = val; valueModel.value = val
handleChange(val); handleChange(val)
} }
); )
onMounted(() => { onMounted(() => {
valueModel.value = props.valueModel; valueModel.value = props.valueModel
handleChange(props.valueModel); handleChange(props.valueModel)
}); })
const onChange = (e: Event) => { const onChange = (e: Event) => {
const target = e.target as HTMLInputElement; const target = e.target as HTMLInputElement
let value = target.value; let value = target.value
handleChange(value); handleChange(value)
}; }
const handleChange = (value: string) => { const handleChange = (value: string) => {
emit("update:valueModel", value); emit('update:valueModel', value)
emit("input", value); emit('input', value)
}; }
const onBlur = () => { const onBlur = () => {
emit("blur", props.valueModel); emit('blur', props.valueModel)
}; }
const onConfirm = (e: any) => { const onConfirm = (e: any) => {
const target = e.target as HTMLInputElement; const target = e.target as HTMLInputElement
let value = target.value; let value = target.value
emit("bindconfirm", value); emit('bindconfirm', value)
}; }
const emptyInput = () => { const emptyInput = () => {
valueModel.value = ""; valueModel.value = ''
onChange({ target: { value: "" } }); onChange({ target: { value: '' } })
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.input_content { .input_content {

View File

@ -1,81 +1,74 @@
// 定义默认值 // 定义默认值
export const defInputProps = { export const defInputProps = {
valueModel: "", valueModel: '',
placeholder: "请输入内容", placeholder: '请输入内容',
width: "100%", width: '100%',
suffix: "", suffix: '',
maxLength: 255, maxLength: 255,
type: "text", type: 'text',
className: "", className: '',
placeholderStyle: "color: #ccc;font-size:25rpx;", placeholderStyle: 'color: #ccc;font-size:25rpx;',
classInputName: "", classInputName: '',
textAlign: "left", textAlign: 'left',
confirmType: "done", confirmType: 'done',
hasClose: false, hasClose: false
}; }
export const wlInputProps = { export const wlInputProps = {
valueModel: { valueModel: {
type: String, type: String,
default: defInputProps.valueModel, default: defInputProps.valueModel
}, },
placeholder: { placeholder: {
type: String, type: String,
default: defInputProps.placeholder, default: defInputProps.placeholder
}, },
width: { width: {
type: String, type: String,
default: defInputProps.width, default: defInputProps.width
}, },
suffix: { suffix: {
type: String, type: String,
default: defInputProps.suffix, default: defInputProps.suffix
}, },
maxLength: { maxLength: {
type: Number, type: Number,
default: defInputProps.maxLength, default: defInputProps.maxLength
}, },
type: { type: {
type: String, type: String,
default: defInputProps.type, default: defInputProps.type
}, },
className: { className: {
type: String, type: String,
default: defInputProps.className, default: defInputProps.className
}, },
placeholderStyle: { placeholderStyle: {
type: String, type: String,
default: defInputProps.placeholderStyle, default: defInputProps.placeholderStyle
}, },
classInputName: { classInputName: {
type: String, type: String,
default: defInputProps.classInputName, default: defInputProps.classInputName
}, },
password: { password: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
textAlign: { textAlign: {
type: String as () => any, type: String as () => any,
default: defInputProps.textAlign, default: defInputProps.textAlign
}, },
confirmType: { confirmType: {
type: String as () => type: String as () => 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send',
| "enter" default: defInputProps.confirmType
| "done"
| "go"
| "next"
| "previous"
| "search"
| "send",
default: defInputProps.confirmType,
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
hasClose: { hasClose: {
type: Boolean, type: Boolean,
default: defInputProps.hasClose, default: defInputProps.hasClose
}, }
}; }

View File

@ -3,9 +3,7 @@
<view class="select_day_btn" @click="onPopupShow"> <view class="select_day_btn" @click="onPopupShow">
<template v-if="custom_date_select?.length > 1"> <template v-if="custom_date_select?.length > 1">
<text> <text>
{{ custom_date_select[0] }}{{ {{ custom_date_select[0] }}{{ custom_date_select[1] ? custom_date_select[1] : '' }}
custom_date_select[1] ? custom_date_select[1] : ""
}}
</text> </text>
<uni-icons type="down" color="#333" size="12" /> <uni-icons type="down" color="#333" size="12" />
</template> </template>
@ -14,13 +12,7 @@
<uni-icons type="down" color="#333" size="12" /> <uni-icons type="down" color="#333" size="12" />
</template> </template>
</view> </view>
<nchl-popup <nchl-popup :show="popupShow" @close="onPopupShow" mode="bottom" closeable :round="20">
:show="popupShow"
@close="onPopupShow"
mode="bottom"
closeable
:round="20"
>
<view class="popup_day_select_body"> <view class="popup_day_select_body">
<view class="popup_day_select_title"> 日期选择 </view> <view class="popup_day_select_title"> 日期选择 </view>
@ -40,12 +32,10 @@
<view class="popup_day_select_right"> <view class="popup_day_select_right">
<view class="select_date_group_btn"> <view class="select_date_group_btn">
<view <view
v-for="(i,idx) in dateSelect[dayType?.value as keyof typeof dateSelect]" v-for="(i, idx) in dateSelect[dayType?.value as keyof typeof dateSelect]"
:key="`key_${idx}`" :key="`key_${idx}`"
:class="`select_date_btn ${ :class="`select_date_btn ${
i?.value === dateSelectEd?.value i?.value === dateSelectEd?.value ? 'select_date_btn_active' : ''
? 'select_date_btn_active'
: ''
}`" }`"
@click="onSelectDateValue(i)" @click="onSelectDateValue(i)"
> >
@ -82,94 +72,85 @@
</view> </view>
</view> </view>
<view class="popup_day_footer"> <view class="popup_day_footer">
<nchl-button <nchl-button style="width: 100%" label="确定" size="md" @click="onSubmit" />
style="width: 100%"
label="确定"
size="md"
@click="onSubmit"
/>
</view> </view>
</view> </view>
</nchl-popup> </nchl-popup>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from 'vue'
import { getOverDay, getThreeMonthsLater } from "@/common/libraries/day"; import { getOverDay, getThreeMonthsLater } from '@/common/libraries/day'
const emit = defineEmits(["close", "change"]); const emit = defineEmits(['close', 'change'])
const okShowDayInfo = ref({ label: "按日", value: "近7天" }); const okShowDayInfo = ref({ label: '按日', value: '近7天' })
const dayType = ref({ label: "按日", value: "day" }); const dayType = ref({ label: '按日', value: 'day' })
const dateSelectEd = ref({ label: "近7天", value: 7 }); const dateSelectEd = ref({ label: '近7天', value: 7 })
const popupShow = ref(false); const popupShow = ref(false)
const custom_date_select = ref<any>([]); const custom_date_select = ref<any>([])
const custom_end_day = ref(""); const custom_end_day = ref('')
const onPopupShow = () => { const onPopupShow = () => {
popupShow.value = !popupShow.value; popupShow.value = !popupShow.value
}; }
const onSelectType = (e: { label: string; value: string }) => { const onSelectType = (e: { label: string; value: string }) => {
dayType.value = e; dayType.value = e
dateSelectEd.value = dateSelectEd.value = dateSelect[dayType?.value?.value as keyof typeof dateSelect][0]
dateSelect[dayType?.value?.value as keyof typeof dateSelect][0]; }
};
const onSelectDateValue = (e: { label: string; value: number }) => { const onSelectDateValue = (e: { label: string; value: number }) => {
dateSelectEd.value = e; dateSelectEd.value = e
custom_date_select.value = []; custom_date_select.value = []
}; }
const onChangeStart = (e: any) => { const onChangeStart = (e: any) => {
custom_date_select.value[0] = e.detail.value; custom_date_select.value[0] = e.detail.value
custom_end_day.value = getThreeMonthsLater(3, e.detail.value); custom_end_day.value = getThreeMonthsLater(3, e.detail.value)
console.log("onChangeEnd", e.detail.value, custom_end_day.value); console.log('onChangeEnd', e.detail.value, custom_end_day.value)
}; }
const onChangeEnd = (e: any) => { const onChangeEnd = (e: any) => {
custom_date_select.value[1] = e.detail.value; custom_date_select.value[1] = e.detail.value
console.log("onChangeEnd", custom_date_select.value); console.log('onChangeEnd', custom_date_select.value)
}; }
const dayTypeList = [ const dayTypeList = [
{ label: "按日", value: "day" }, { label: '按日', value: 'day' },
{ label: "按月", value: "month" }, { label: '按月', value: 'month' }
]; ]
const dateSelect = { const dateSelect = {
day: [ day: [
{ label: "近7天", value: 7 }, { label: '近7天', value: 7 },
{ label: "近14天", value: 14 }, { label: '近14天', value: 14 },
{ label: "近30天", value: 30 }, { label: '近30天', value: 30 }
], ],
month: [ month: [
{ label: "近6月", value: 6 }, { label: '近6月', value: 6 },
{ label: "近12月", value: 12 }, { label: '近12月', value: 12 }
], ]
}; }
const onSubmit = () => { const onSubmit = () => {
if (custom_date_select?.value?.length > 1) { if (custom_date_select?.value?.length > 1) {
emit("change", custom_date_select.value); emit('change', custom_date_select.value)
onPopupShow(); onPopupShow()
return; return
} }
if (dateSelectEd?.value?.value) { if (dateSelectEd?.value?.value) {
let day = getOverDay( let day = getOverDay(dateSelectEd?.value?.value as number, dayType?.value?.value as string)
dateSelectEd?.value?.value as number,
dayType?.value?.value as string
);
okShowDayInfo.value = { okShowDayInfo.value = {
label: dayType?.value?.label, label: dayType?.value?.label,
value: dateSelectEd?.value?.label, value: dateSelectEd?.value?.label
}; }
emit("change", day); emit('change', day)
onPopupShow(); onPopupShow()
} else { } else {
uni.showToast({ uni.showToast({
title: "请选择日期!", title: '请选择日期!',
icon: "none", icon: 'none'
}); })
} }
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -4,13 +4,7 @@
<view class="name">{{ selectEd?.name }}</view> <view class="name">{{ selectEd?.name }}</view>
<uni-icons type="down" color="#333" size="12" /> <uni-icons type="down" color="#333" size="12" />
</view> </view>
<nchl-popup <nchl-popup :show="popupShow" @close="onPopupShow" mode="bottom" closeable :round="20">
:show="popupShow"
@close="onPopupShow"
mode="bottom"
closeable
:round="20"
>
<view class="popup_merchant_select_body"> <view class="popup_merchant_select_body">
<view class="popup_merchant_select_title"> 选择商户 </view> <view class="popup_merchant_select_title"> 选择商户 </view>
@ -37,34 +31,34 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from 'vue'
import { getApiLoading } from "@/common/libraries/apiLoading"; import { getApiLoading } from '@/common/libraries/apiLoading'
import { getOverDay } from "@/common/libraries/day"; import { getOverDay } from '@/common/libraries/day'
const props = defineProps(["Apis"]); const props = defineProps(['Apis'])
const emit = defineEmits(["close", "change"]); const emit = defineEmits(['close', 'change'])
const selectEd = ref({ name: "全部商户", id: 0 }); const selectEd = ref({ name: '全部商户', id: 0 })
const pickerList = ref<any>([]); const pickerList = ref<any>([])
const popupShow = ref(false); const popupShow = ref(false)
const onPopupShow = () => { const onPopupShow = () => {
popupShow.value = !popupShow.value; popupShow.value = !popupShow.value
if (popupShow.value) { if (popupShow.value) {
getPickerList(); getPickerList()
} }
}; }
const getPickerList = () => { const getPickerList = () => {
getApiLoading(props?.Apis, {}).then((res) => { getApiLoading(props?.Apis, {}).then(res => {
pickerList.value = [...[{ name: "全部商户", id: 0 }], ...res?.data]; pickerList.value = [...[{ name: '全部商户', id: 0 }], ...res?.data]
console.log(res); console.log(res)
}); })
}; }
const onSelectMerchant = (i: { name: string; id: number }) => { const onSelectMerchant = (i: { name: string; id: number }) => {
selectEd.value = i; selectEd.value = i
emit("change", i); emit('change', i)
onPopupShow(); onPopupShow()
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,15 +1,7 @@
<template> <template>
<up-popup <up-popup
:customStyle=" :customStyle="props?.insetBottom ? { bottom: 'calc(env(safe-area-inset-bottom) + 48px)' } : {}"
props?.insetBottom :overlayStyle="props?.insetBottom ? { bottom: 'calc(env(safe-area-inset-bottom) + 48px)' } : {}"
? { bottom: 'calc(env(safe-area-inset-bottom) + 48px)' }
: {}
"
:overlayStyle="
props?.insetBottom
? { bottom: 'calc(env(safe-area-inset-bottom) + 48px)' }
: {}
"
:show="props.show" :show="props.show"
@close="onClose" @close="onClose"
:mode="props?.mode || 'top'" :mode="props?.mode || 'top'"
@ -21,18 +13,12 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps([ const props = defineProps(['show', 'mode', 'insetBottom', 'round', 'closeable'])
"show", const emit = defineEmits(['close'])
"mode",
"insetBottom",
"round",
"closeable",
]);
const emit = defineEmits(["close"]);
const onClose = () => { const onClose = () => {
emit("close"); emit('close')
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,16 +1,8 @@
<template> <template>
<view class="privatePolicy"> <view class="privatePolicy">
<view class="scal-box" @click="handleAgreePrivatePolicy"> <view class="scal-box" @click="handleAgreePrivatePolicy">
<u-checkbox-group <u-checkbox-group :modelValue="isAgree" @change="handleAgreePrivatePolicy">
:modelValue="isAgree" <u-checkbox shape="circle" :activeColor="props?.activeColor" name="isAgree"> </u-checkbox>
@change="handleAgreePrivatePolicy"
>
<u-checkbox
shape="circle"
:activeColor="props?.activeColor"
name="isAgree"
>
</u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<view class="t-l">我已阅读并同意</view> <view class="t-l">我已阅读并同意</view>
</view> </view>
@ -22,72 +14,72 @@
<script setup lang="ts"> <script setup lang="ts">
// //
import { defineEmits, defineProps, ref, watch } from "vue"; import { defineEmits, defineProps, ref, watch } from 'vue'
const isAgree = ref<string[]>([]); const isAgree = ref<string[]>([])
const props = defineProps({ const props = defineProps({
isAgree: { isAgree: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
isDisabled: { isDisabled: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
policyName: { policyName: {
type: String, type: String,
default: "隐私政策名称", default: '隐私政策名称'
}, },
activeColor: { activeColor: {
type: String, type: String,
default: "#3b65a9", default: '#3b65a9'
}, }
}); })
const emit = defineEmits<{ const emit = defineEmits<{
(e: "update:isAgree", data: boolean): void; (e: 'update:isAgree', data: boolean): void
(e: "clickPolicy"): void; (e: 'clickPolicy'): void
(e: "clickCheckbox"): void; (e: 'clickCheckbox'): void
}>(); }>()
if (props.isAgree) { if (props.isAgree) {
isAgree.value = ["isAgree"]; isAgree.value = ['isAgree']
} else { } else {
isAgree.value = []; isAgree.value = []
} }
watch( watch(
() => props?.isAgree, () => props?.isAgree,
() => { () => {
if (isAgree.value) { if (isAgree.value) {
isAgree.value = ["isAgree"]; isAgree.value = ['isAgree']
} else { } else {
isAgree.value = []; isAgree.value = []
} }
} }
); )
const onPolicy = () => { const onPolicy = () => {
emit("clickPolicy"); emit('clickPolicy')
}; }
const handleAgreePrivatePolicy = () => { const handleAgreePrivatePolicy = () => {
if (props.isDisabled) { if (props.isDisabled) {
// //
emit("clickCheckbox"); emit('clickCheckbox')
isAgree.value = []; isAgree.value = []
emit("update:isAgree", false); emit('update:isAgree', false)
return; return
} }
let checkbox = false; let checkbox = false
if (isAgree.value?.length) { if (isAgree.value?.length) {
isAgree.value = []; isAgree.value = []
checkbox = false; checkbox = false
} else { } else {
isAgree.value = ["isAgree"]; isAgree.value = ['isAgree']
checkbox = true; checkbox = true
} }
emit("update:isAgree", checkbox); emit('update:isAgree', checkbox)
}; }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -9,56 +9,56 @@
</picker> </picker>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
interface EnumItem { interface EnumItem {
text?: string; text?: string
value?: string; value?: string
type?: string; type?: string
} }
const props = defineProps([ const props = defineProps([
"Enums", 'Enums',
"title", 'title',
"pickerIndex", 'pickerIndex',
"value", 'value',
"borderTop", 'borderTop',
"required", 'required',
"tip", 'tip',
"key", 'key',
"des", 'des',
"padding", 'padding',
"valueModel", 'valueModel',
"disabled", 'disabled'
]); ])
const pickerList = ref<any>([]); const pickerList = ref<any>([])
const emit = defineEmits(["change", "update:valueModel"]); const emit = defineEmits(['change', 'update:valueModel'])
const onChange = (e: any) => { const onChange = (e: any) => {
let selectData: any = pickerList.value[e?.detail.value]; let selectData: any = pickerList.value[e?.detail.value]
emit("update:valueModel", selectData?.value); emit('update:valueModel', selectData?.value)
emit("change", selectData); emit('change', selectData)
}; }
const getEnums = (): any => { const getEnums = (): any => {
let list: EnumItem[] = Object.entries( let list: EnumItem[] = Object.entries(props?.Enums as Record<string, EnumItem>).map(
props?.Enums as Record<string, EnumItem> ([key, value]) => ({
).map(([key, value]) => ({ text: value.text,
text: value.text, value: value.value,
value: value.value, type: value?.type || ''
type: value?.type || "", })
})); )
pickerList.value = list; pickerList.value = list
}; }
watch( watch(
() => props?.Enums, () => props?.Enums,
() => { () => {
getEnums(); getEnums()
} }
); )
onMounted(() => { onMounted(() => {
getEnums(); getEnums()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.rent_des { .rent_des {

View File

@ -12,44 +12,44 @@
</picker> </picker>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getApiLoading } from "@/common/libraries/apiLoading"; import { getApiLoading } from '@/common/libraries/apiLoading'
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
const props = defineProps([ const props = defineProps([
"Enums", 'Enums',
"title", 'title',
"pickerIndex", 'pickerIndex',
"value", 'value',
"borderTop", 'borderTop',
"required", 'required',
"disabled", 'disabled',
"tip", 'tip',
"key", 'key',
"des", 'des',
"padding", 'padding',
"valueModel", 'valueModel',
"placeholder", 'placeholder',
"Apis", 'Apis'
]); ])
const pickerList = ref<any>([]); const pickerList = ref<any>([])
const selectValue = ref(""); const selectValue = ref('')
const emit = defineEmits(["change", "update:valueModel"]); const emit = defineEmits(['change', 'update:valueModel'])
const onChange = (e: any) => { const onChange = (e: any) => {
let selectData: any = pickerList.value[e?.detail.value]; let selectData: any = pickerList.value[e?.detail.value]
selectValue.value = selectData?.name; selectValue.value = selectData?.name
emit("update:valueModel", selectData?.id || ""); emit('update:valueModel', selectData?.id || '')
emit("change", selectData); emit('change', selectData)
}; }
const getPickerList = () => { const getPickerList = () => {
getApiLoading(props?.Apis, {}).then((res) => { getApiLoading(props?.Apis, {}).then(res => {
pickerList.value = [...[{ name: props?.placeholder, id: 0 }], ...res?.data]; pickerList.value = [...[{ name: props?.placeholder, id: 0 }], ...res?.data]
console.log(res); console.log(res)
}); })
}; }
onMounted(() => { onMounted(() => {
getPickerList(); getPickerList()
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -11,21 +11,21 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref } from 'vue'
const props = defineProps(["Enums"]); const props = defineProps(['Enums'])
const typeEnums = ref<any>([]); const typeEnums = ref<any>([])
const selectEd = ref("BankLoan"); const selectEd = ref('BankLoan')
const emit = defineEmits(["change"]); const emit = defineEmits(['change'])
const handleSelect = (e: any) => { const handleSelect = (e: any) => {
selectEd.value = e.value; selectEd.value = e.value
emit("change", e.value); emit('change', e.value)
}; }
onMounted(() => { onMounted(() => {
const LoansBizTypeEnumArray = Object.values(props.Enums); const LoansBizTypeEnumArray = Object.values(props.Enums)
typeEnums.value = LoansBizTypeEnumArray; typeEnums.value = LoansBizTypeEnumArray
console.log(props.Enums); console.log(props.Enums)
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -4,15 +4,9 @@
v-for="(i, index) in getEnums()" v-for="(i, index) in getEnums()"
:key="`item_${index}`" :key="`item_${index}`"
:class="`item item_${props?.size} ${ :class="`item item_${props?.size} ${
i?.value === props?.valueModel || i?.value === selectValue i?.value === props?.valueModel || i?.value === selectValue ? 'active' : ''
? 'active'
: ''
} ${props?.disableds?.includes(i?.value) ? 'disabled' : ''}`" } ${props?.disableds?.includes(i?.value) ? 'disabled' : ''}`"
:style=" :style="i?.value === props?.valueModel || i?.value === selectValue ? props?.selectStyle : ''"
i?.value === props?.valueModel || i?.value === selectValue
? props?.selectStyle
: ''
"
@click="onClick(i)" @click="onClick(i)"
> >
{{ i?.text }} {{ i?.text }}
@ -20,54 +14,54 @@
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from 'vue'
interface EnumItem { interface EnumItem {
text?: string; text?: string
value?: string; value?: string
} }
const props = defineProps([ const props = defineProps([
"valueModel", 'valueModel',
"Enums", 'Enums',
"size", 'size',
"radioStyle", 'radioStyle',
"selectStyle", 'selectStyle',
"disableds", // 6-7 kfyy 7.40 cook 'disableds' // 6-7 kfyy 7.40 cook
]); ])
const selectValue = ref(""); const selectValue = ref('')
const getEnums = (): any => { const getEnums = (): any => {
let list: EnumItem[] = Object.entries( let list: EnumItem[] = Object.entries(props?.Enums as Record<string, EnumItem>).map(
props?.Enums as Record<string, EnumItem> ([_key, value]) => ({
).map(([_key, value]) => ({ text: value.text,
text: value.text, value: value.value
value: value.value, })
})); )
return list; return list
}; }
watch( watch(
() => props?.valueModel, () => props?.valueModel,
() => { () => {
console.log("mounted2", props?.valueModel); console.log('mounted2', props?.valueModel)
selectValue.value = props?.valueModel; selectValue.value = props?.valueModel
} }
); )
const emit = defineEmits(["update:valueModel", "onChange"]); const emit = defineEmits(['update:valueModel', 'onChange'])
const onClick = (e: { value: string }) => { const onClick = (e: { value: string }) => {
if (props?.disableds?.includes(e?.value)) { if (props?.disableds?.includes(e?.value)) {
return false; return false
} }
selectValue.value = e?.value; selectValue.value = e?.value
emit("update:valueModel", e?.value); emit('update:valueModel', e?.value)
emit("onChange", e); emit('onChange', e)
}; }
onMounted(() => { onMounted(() => {
console.log("mounted1", props?.valueModel); console.log('mounted1', props?.valueModel)
if (props?.valueModel) { if (props?.valueModel) {
selectValue.value = props?.valueModel; selectValue.value = props?.valueModel
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.radio_body { .radio_body {

View File

@ -12,11 +12,11 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps(["current", "list"]); const props = defineProps(['current', 'list'])
const emit = defineEmits(["onChange"]); const emit = defineEmits(['onChange'])
const handleClick = (idx: number) => { const handleClick = (idx: number) => {
emit("onChange", idx); emit('onChange', idx)
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.tabs_content { .tabs_content {

View File

@ -1,11 +1,6 @@
<template> <template>
<view class="upload_body"> <view class="upload_body">
<view <view v-for="(i, index) in list" :key="index" class="upload_item" :style="props?.styles">
v-for="(i, index) in list"
:key="index"
class="upload_item"
:style="props?.styles"
>
<view v-if="i?.type?.includes('video')"> <view v-if="i?.type?.includes('video')">
<up-icon name="play-circle-fill" size="30"></up-icon> <up-icon name="play-circle-fill" size="30"></up-icon>
</view> </view>
@ -52,89 +47,83 @@
v-else v-else
></up-icon> ></up-icon>
</view> </view>
<view class="no_data" v-if="props?.display && !list?.length"> <view class="no_data" v-if="props?.display && !list?.length"> 无媒体文件 </view>
无媒体文件
</view>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import watermark from "@/common/libraries/watermark"; import watermark from '@/common/libraries/watermark'
import { upload } from "@/common/libraries/upload"; import { upload } from '@/common/libraries/upload'
import { onMounted, ref, watch, defineProps, defineEmits } from "vue"; import { onMounted, ref, watch, defineProps, defineEmits } from 'vue'
const props = defineProps([ const props = defineProps([
"valueModel", 'valueModel',
"size", 'size',
"display", 'display',
"length", 'length',
"mediaType", 'mediaType',
"labelTitle", 'labelTitle',
"count", 'count',
"styles", 'styles',
"hasCover", 'hasCover',
"iconName", 'iconName',
"iconSize", 'iconSize'
]); ])
const emit = defineEmits(["update:valueModel"]); const emit = defineEmits(['update:valueModel'])
const list = ref<{ url?: string; type?: string }[]>([]); const list = ref<{ url?: string; type?: string }[]>([])
const handleUpload = async () => { const handleUpload = async () => {
const res: any = await upload( const res: any = await upload(props.count || 1, props?.size, props?.mediaType || ['image'])
props.count || 1, console.log(res, 'res')
props?.size, list.value = [...list.value, ...res]
props?.mediaType || ["image"] emit('update:valueModel', list.value)
); }
console.log(res, "res");
list.value = [...list.value, ...res];
emit("update:valueModel", list.value);
};
const onDelete = (idx: number) => { const onDelete = (idx: number) => {
if (props?.display) { if (props?.display) {
return false; return false
} }
list.value.splice(idx, 1); list.value.splice(idx, 1)
}; }
watch( watch(
() => props?.valueModel, () => props?.valueModel,
() => { () => {
if (props.valueModel) { if (props.valueModel) {
list.value = props.valueModel || []; list.value = props.valueModel || []
} }
} }
); )
const onPreviewMedia = (url?: string) => { const onPreviewMedia = (url?: string) => {
console.log(url, "url1"); console.log(url, 'url1')
if (url) { if (url) {
uni.showLoading({ uni.showLoading({
title: "获取图片中...", title: '获取图片中...',
mask: true, mask: true
}); })
console.log(url, "url2"); console.log(url, 'url2')
uni.downloadFile({ uni.downloadFile({
url: url, url: url,
success: (res) => { success: res => {
const imagePath = res.tempFilePath; // const imagePath = res.tempFilePath //
console.log(imagePath, "imagePath"); console.log(imagePath, 'imagePath')
watermark.addWatermark(imagePath, "仅用于内部查看,请勿外传"); watermark.addWatermark(imagePath, '仅用于内部查看,请勿外传')
}, },
fail: (err) => { fail: err => {
uni.showToast({ uni.showToast({
title: "获取失败", title: '获取失败',
duration: 1000, duration: 1000
}); })
console.error("下载图片失败:", err); console.error('下载图片失败:', err)
}, }
}); })
} }
}; }
onMounted(() => { onMounted(() => {
if (props.valueModel) { if (props.valueModel) {
list.value = props.valueModel || []; list.value = props.valueModel || []
} }
}); })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.upload_body { .upload_body {

22
src/env.d.ts vendored
View File

@ -1,22 +1,22 @@
/// <reference types="vite/client" /> /// <reference types="vite/client" />
declare module "*.vue" { declare module '*.vue' {
import { DefineComponent } from "vue"; import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>; const component: DefineComponent<{}, {}, any>
export default component; export default component
} }
declare namespace wx { declare namespace wx {
interface OpenPrivacyContractOption { interface OpenPrivacyContractOption {
success?: (res: any) => void; success?: (res: any) => void
fail?: (err: any) => void; fail?: (err: any) => void
complete?: (res: any) => void; complete?: (res: any) => void
chooseMessageFile?: (res: any) => void; chooseMessageFile?: (res: any) => void
} }
interface Env { interface Env {
USER_DATA_PATH: string; USER_DATA_PATH: string
} }
const env: Env; const env: Env
function openPrivacyContract(options: OpenPrivacyContractOption): void; function openPrivacyContract(options: OpenPrivacyContractOption): void
} }

12
src/gen/ApiTypes.d.ts vendored
View File

@ -3,11 +3,13 @@ declare namespace ApiTypes {
namespace Auth { namespace Auth {
type Login = { type Login = {
"code": string; // 微信code "code": string; // 微信code
"app_id": string; // 小程序app_id
}; };
type BindPhoneNumber = { type BindPhoneNumber = {
"code"?: string; // 微信code "code"?: string; // 微信code
"phone"?: string; // 手机号 "phone"?: string; // 手机号
"phone_validate_code"?: string; // 手机验证码 "phone_validate_code"?: string; // 手机验证码
"app_id": string; // 小程序app_id
}; };
type GetAccessToken = { type GetAccessToken = {
"user_name": string; // 用户名 "user_name": string; // 用户名
@ -15,14 +17,15 @@ declare namespace ApiTypes {
}; };
type WorkLogin = { type WorkLogin = {
"code": string; // 企业微信code "code": string; // 企业微信code
"work_marker": string; // 企业标记
"phone"?: string; // 手机号 "phone"?: string; // 手机号
"real_name"?: string; // 真实姓名 "real_name"?: string; // 真实姓名
"app_id": string; // 企业微信CorpID
}; };
type BindWork = { type BindWork = {
"session_key": string; // - "session_key": string; // -
"iv": string; // - "iv": string; // -
"encrypted_data": string; // - "encrypted_data": string; // -
"app_id": string; // 小程序app_id
}; };
type GetWorkAccessToken = { type GetWorkAccessToken = {
"user_name": string; // 用户名 "user_name": string; // 用户名
@ -30,10 +33,11 @@ declare namespace ApiTypes {
"work_marker": string; // 企业标记 "work_marker": string; // 企业标记
}; };
type PreUpload = { type PreUpload = {
"file_ext": string; // - "filename": string; // 文件名称
"alc": string; // 访问限制 public-read, private
}; };
type DoUpload = { type TemporaryUrl = {
"upload_file": File; // 上传文件 "filename": string; // 文件名称
}; };
} }
} }

View File

@ -12,7 +12,7 @@ export const Apis = {
Me(): Promise<MyResponseType> { Me(): Promise<MyResponseType> {
return request('employee/login/auth/me', {}); return request('employee/login/auth/me', {});
}, },
BindPhoneNumber(data?: ApiTypes.Login.Auth.BindPhoneNumber): Promise<MyResponseType> { BindPhoneNumber(data: ApiTypes.Login.Auth.BindPhoneNumber): Promise<MyResponseType> {
return request('employee/login/auth/bind_phone_number', { data }); return request('employee/login/auth/bind_phone_number', { data });
}, },
GetAccessToken(data: ApiTypes.Login.Auth.GetAccessToken): Promise<MyResponseType> { GetAccessToken(data: ApiTypes.Login.Auth.GetAccessToken): Promise<MyResponseType> {
@ -30,11 +30,8 @@ export const Apis = {
PreUpload(data: ApiTypes.Login.Auth.PreUpload): Promise<MyResponseType> { PreUpload(data: ApiTypes.Login.Auth.PreUpload): Promise<MyResponseType> {
return request('employee/login/auth/pre_upload', { data }); return request('employee/login/auth/pre_upload', { data });
}, },
DoUpload(data: ApiTypes.Login.Auth.DoUpload): Promise<MyResponseType> { TemporaryUrl(data: ApiTypes.Login.Auth.TemporaryUrl): Promise<MyResponseType> {
return request('employee/login/auth/do_upload', { data }); return request('employee/login/auth/temporary_url', { data });
},
ImLogin(): Promise<MyResponseType> {
return request('employee/login/auth/im_login', {});
}, },
}, },
}, },

View File

@ -94,6 +94,11 @@ export const AssetUnitsBuildingTypeEnum = {
'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"}, 'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"},
}; };
// 缓存类型
export const CacheTypeEnum = {
'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#49c289","value":"MobilePhoneVerificationCode"},
};
// CompaniesMerchantTypeEnum // CompaniesMerchantTypeEnum
export const CompaniesMerchantTypeEnum = { export const CompaniesMerchantTypeEnum = {
'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"}, 'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"},
@ -107,6 +112,12 @@ export const CompanyAppsAppTypeEnum = {
'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"},
}; };
// CompanyAppsModuleEnum
export const CompanyAppsModuleEnum = {
'Employee': {"text":"员工","color":"#3b82f6","value":"Employee"},
'Customer': {"text":"客户","color":"#10b981","value":"Customer"},
};
// CompanyReceiptAccountsPayChannelEnum // CompanyReceiptAccountsPayChannelEnum
export const CompanyReceiptAccountsPayChannelEnum = { export const CompanyReceiptAccountsPayChannelEnum = {
'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"},

27
src/libs/amap-wx.d.ts vendored
View File

@ -1,24 +1,21 @@
// src/types/amap-wx.d.ts // src/types/amap-wx.d.ts
declare module "@/libs/amap-wx.js" { declare module '@/libs/amap-wx.js' {
export class AMapWX { export class AMapWX {
constructor(options: { key: string }); constructor(options: { key: string })
getRegeo(options: { getRegeo(options: {
location: string; location: string
success?: (json: any) => void; success?: (json: any) => void
fail?: (err: any) => void; fail?: (err: any) => void
}): void; }): void
getWeather(options: { getWeather(options: { success?: (data: any) => void; fail?: (error: any) => void }): void
success?: (data: any) => void;
fail?: (error: any) => void;
}): void;
getPoiAround(options: { getPoiAround(options: {
querykeywords?: any; querykeywords?: any
location?: any; location?: any
success?: (data: any) => void; success?: (data: any) => void
fail?: (error: any) => void; fail?: (error: any) => void
}): void; }): void
} }
} }

View File

@ -1,261 +1,259 @@
/* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/no-this-alias */
/* eslint-disable no-undef */ /* eslint-disable no-undef */
function AMapWX(a) { function AMapWX(a) {
this.key = a.key; this.key = a.key
this.requestConfig = { this.requestConfig = {
key: a.key, key: a.key,
s: "rsx", s: 'rsx',
platform: "WXJS", platform: 'WXJS',
appname: a.key, appname: a.key,
sdkversion: "1.2.0", sdkversion: '1.2.0',
logversion: "2.0", logversion: '2.0'
}; }
this.MeRequestConfig = { this.MeRequestConfig = {
key: a.key, key: a.key,
serviceName: "https://restapi.amap.com/rest/me", serviceName: 'https://restapi.amap.com/rest/me'
}; }
} }
AMapWX.prototype.getWxLocation = function (a, b) { AMapWX.prototype.getWxLocation = function (a, b) {
wx.getLocation({ wx.getLocation({
type: "gcj02", type: 'gcj02',
success: function (c) { success: function (c) {
c = c.longitude + "," + c.latitude; c = c.longitude + ',' + c.latitude
wx.setStorage({ key: "userLocation", data: c }); wx.setStorage({ key: 'userLocation', data: c })
b(c); b(c)
}, },
fail: function (c) { fail: function (c) {
wx.getStorage({ wx.getStorage({
key: "userLocation", key: 'userLocation',
success: function (d) { success: function (d) {
d.data && b(d.data); d.data && b(d.data)
}, }
}); })
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getMEKeywordsSearch = function (a) { AMapWX.prototype.getMEKeywordsSearch = function (a) {
if (!a.options) if (!a.options)
return a.fail({ return a.fail({
errCode: "0", errCode: '0',
errMsg: "\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570", errMsg: '\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570'
}); })
const b = a.options, const b = a.options,
c = this.MeRequestConfig, c = this.MeRequestConfig,
d = { d = {
key: c.key, key: c.key,
s: "rsx", s: 'rsx',
platform: "WXJS", platform: 'WXJS',
appname: a.key, appname: a.key,
sdkversion: "1.2.0", sdkversion: '1.2.0',
logversion: "2.0", logversion: '2.0'
}; }
b.layerId && (d.layerId = b.layerId); b.layerId && (d.layerId = b.layerId)
b.keywords && (d.keywords = b.keywords); b.keywords && (d.keywords = b.keywords)
b.city && (d.city = b.city); b.city && (d.city = b.city)
b.filter && (d.filter = b.filter); b.filter && (d.filter = b.filter)
b.sortrule && (d.sortrule = b.sortrule); b.sortrule && (d.sortrule = b.sortrule)
b.pageNum && (d.pageNum = b.pageNum); b.pageNum && (d.pageNum = b.pageNum)
b.pageSize && (d.pageSize = b.pageSize); b.pageSize && (d.pageSize = b.pageSize)
b.sig && (d.sig = b.sig); b.sig && (d.sig = b.sig)
wx.request({ wx.request({
url: c.serviceName + "/cpoint/datasearch/local", url: c.serviceName + '/cpoint/datasearch/local',
data: d, data: d,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (e) { success: function (e) {
(e = e.data) && e.status && "1" === e.status && 0 === e.code ;(e = e.data) && e.status && '1' === e.status && 0 === e.code
? a.success(e.data) ? a.success(e.data)
: a.fail({ errCode: "0", errMsg: e }); : a.fail({ errCode: '0', errMsg: e })
}, },
fail: function (e) { fail: function (e) {
a.fail({ errCode: "0", errMsg: e.errMsg || "" }); a.fail({ errCode: '0', errMsg: e.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getMEIdSearch = function (a) { AMapWX.prototype.getMEIdSearch = function (a) {
if (!a.options) if (!a.options)
return a.fail({ return a.fail({
errCode: "0", errCode: '0',
errMsg: "\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570", errMsg: '\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570'
}); })
const b = a.options, const b = a.options,
c = this.MeRequestConfig, c = this.MeRequestConfig,
d = { d = {
key: c.key, key: c.key,
s: "rsx", s: 'rsx',
platform: "WXJS", platform: 'WXJS',
appname: a.key, appname: a.key,
sdkversion: "1.2.0", sdkversion: '1.2.0',
logversion: "2.0", logversion: '2.0'
}; }
b.layerId && (d.layerId = b.layerId); b.layerId && (d.layerId = b.layerId)
b.id && (d.id = b.id); b.id && (d.id = b.id)
b.sig && (d.sig = b.sig); b.sig && (d.sig = b.sig)
wx.request({ wx.request({
url: c.serviceName + "/cpoint/datasearch/id", url: c.serviceName + '/cpoint/datasearch/id',
data: d, data: d,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (e) { success: function (e) {
(e = e.data) && e.status && "1" === e.status && 0 === e.code ;(e = e.data) && e.status && '1' === e.status && 0 === e.code
? a.success(e.data) ? a.success(e.data)
: a.fail({ errCode: "0", errMsg: e }); : a.fail({ errCode: '0', errMsg: e })
}, },
fail: function (e) { fail: function (e) {
a.fail({ errCode: "0", errMsg: e.errMsg || "" }); a.fail({ errCode: '0', errMsg: e.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getMEPolygonSearch = function (a) { AMapWX.prototype.getMEPolygonSearch = function (a) {
if (!a.options) if (!a.options)
return a.fail({ return a.fail({
errCode: "0", errCode: '0',
errMsg: "\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570", errMsg: '\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570'
}); })
const b = a.options, const b = a.options,
c = this.MeRequestConfig, c = this.MeRequestConfig,
d = { d = {
key: c.key, key: c.key,
s: "rsx", s: 'rsx',
platform: "WXJS", platform: 'WXJS',
appname: a.key, appname: a.key,
sdkversion: "1.2.0", sdkversion: '1.2.0',
logversion: "2.0", logversion: '2.0'
}; }
b.layerId && (d.layerId = b.layerId); b.layerId && (d.layerId = b.layerId)
b.keywords && (d.keywords = b.keywords); b.keywords && (d.keywords = b.keywords)
b.polygon && (d.polygon = b.polygon); b.polygon && (d.polygon = b.polygon)
b.filter && (d.filter = b.filter); b.filter && (d.filter = b.filter)
b.sortrule && (d.sortrule = b.sortrule); b.sortrule && (d.sortrule = b.sortrule)
b.pageNum && (d.pageNum = b.pageNum); b.pageNum && (d.pageNum = b.pageNum)
b.pageSize && (d.pageSize = b.pageSize); b.pageSize && (d.pageSize = b.pageSize)
b.sig && (d.sig = b.sig); b.sig && (d.sig = b.sig)
wx.request({ wx.request({
url: c.serviceName + "/cpoint/datasearch/polygon", url: c.serviceName + '/cpoint/datasearch/polygon',
data: d, data: d,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (e) { success: function (e) {
(e = e.data) && e.status && "1" === e.status && 0 === e.code ;(e = e.data) && e.status && '1' === e.status && 0 === e.code
? a.success(e.data) ? a.success(e.data)
: a.fail({ errCode: "0", errMsg: e }); : a.fail({ errCode: '0', errMsg: e })
}, },
fail: function (e) { fail: function (e) {
a.fail({ errCode: "0", errMsg: e.errMsg || "" }); a.fail({ errCode: '0', errMsg: e.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getMEaroundSearch = function (a) { AMapWX.prototype.getMEaroundSearch = function (a) {
if (!a.options) if (!a.options)
return a.fail({ return a.fail({
errCode: "0", errCode: '0',
errMsg: "\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570", errMsg: '\u7f3a\u5c11\u5fc5\u8981\u53c2\u6570'
}); })
const b = a.options, const b = a.options,
c = this.MeRequestConfig, c = this.MeRequestConfig,
d = { d = {
key: c.key, key: c.key,
s: "rsx", s: 'rsx',
platform: "WXJS", platform: 'WXJS',
appname: a.key, appname: a.key,
sdkversion: "1.2.0", sdkversion: '1.2.0',
logversion: "2.0", logversion: '2.0'
}; }
b.layerId && (d.layerId = b.layerId); b.layerId && (d.layerId = b.layerId)
b.keywords && (d.keywords = b.keywords); b.keywords && (d.keywords = b.keywords)
b.center && (d.center = b.center); b.center && (d.center = b.center)
b.radius && (d.radius = b.radius); b.radius && (d.radius = b.radius)
b.filter && (d.filter = b.filter); b.filter && (d.filter = b.filter)
b.sortrule && (d.sortrule = b.sortrule); b.sortrule && (d.sortrule = b.sortrule)
b.pageNum && (d.pageNum = b.pageNum); b.pageNum && (d.pageNum = b.pageNum)
b.pageSize && (d.pageSize = b.pageSize); b.pageSize && (d.pageSize = b.pageSize)
b.sig && (d.sig = b.sig); b.sig && (d.sig = b.sig)
wx.request({ wx.request({
url: c.serviceName + "/cpoint/datasearch/around", url: c.serviceName + '/cpoint/datasearch/around',
data: d, data: d,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (e) { success: function (e) {
(e = e.data) && e.status && "1" === e.status && 0 === e.code ;(e = e.data) && e.status && '1' === e.status && 0 === e.code
? a.success(e.data) ? a.success(e.data)
: a.fail({ errCode: "0", errMsg: e }); : a.fail({ errCode: '0', errMsg: e })
}, },
fail: function (e) { fail: function (e) {
a.fail({ errCode: "0", errMsg: e.errMsg || "" }); a.fail({ errCode: '0', errMsg: e.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getGeo = function (a) { AMapWX.prototype.getGeo = function (a) {
let b = this.requestConfig; let b = this.requestConfig
const c = a.options; const c = a.options
b = { b = {
key: this.key, key: this.key,
extensions: "all", extensions: 'all',
s: b.s, s: b.s,
platform: b.platform, platform: b.platform,
appname: this.key, appname: this.key,
sdkversion: b.sdkversion, sdkversion: b.sdkversion,
logversion: b.logversion, logversion: b.logversion
}; }
c.address && (b.address = c.address); c.address && (b.address = c.address)
c.city && (b.city = c.city); c.city && (b.city = c.city)
c.batch && (b.batch = c.batch); c.batch && (b.batch = c.batch)
c.sig && (b.sig = c.sig); c.sig && (b.sig = c.sig)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/geocode/geo", url: 'https://restapi.amap.com/v3/geocode/geo',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (d) { success: function (d) {
(d = d.data) && d.status && "1" === d.status ;(d = d.data) && d.status && '1' === d.status
? a.success(d) ? a.success(d)
: a.fail({ errCode: "0", errMsg: d }); : a.fail({ errCode: '0', errMsg: d })
}, },
fail: function (d) { fail: function (d) {
a.fail({ errCode: "0", errMsg: d.errMsg || "" }); a.fail({ errCode: '0', errMsg: d.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getRegeo = function (a) { AMapWX.prototype.getRegeo = function (a) {
function b(d) { function b(d) {
const e = c.requestConfig; const e = c.requestConfig
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/geocode/regeo", url: 'https://restapi.amap.com/v3/geocode/regeo',
data: { data: {
key: c.key, key: c.key,
location: d, location: d,
extensions: "all", extensions: 'all',
s: e.s, s: e.s,
platform: e.platform, platform: e.platform,
appname: c.key, appname: c.key,
sdkversion: e.sdkversion, sdkversion: e.sdkversion,
logversion: e.logversion, logversion: e.logversion
}, },
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (g) { success: function (g) {
if (g.data.status && "1" === g.data.status) { if (g.data.status && '1' === g.data.status) {
g = g.data.regeocode; g = g.data.regeocode
const h = g.addressComponent; const h = g.addressComponent
let f = []; let f = []
let k = g.roads.length ? g.roads[0].name : "" + "\u9644\u8fd1"; let k = g.roads.length ? g.roads[0].name : '' + '\u9644\u8fd1'
let m = d.split(",")[0]; let m = d.split(',')[0]
let n = d.split(",")[1]; let n = d.split(',')[1]
if (g.pois && g.pois[0]) { if (g.pois && g.pois[0]) {
k = g.pois[0].name + "\u9644\u8fd1"; k = g.pois[0].name + '\u9644\u8fd1'
const l = g.pois[0].location; const l = g.pois[0].location
l && l && ((m = parseFloat(l.split(',')[0])), (n = parseFloat(l.split(',')[1])))
((m = parseFloat(l.split(",")[0])),
(n = parseFloat(l.split(",")[1])));
} }
h.provice && f.push(h.provice); h.provice && f.push(h.provice)
h.city && f.push(h.city); h.city && f.push(h.city)
h.district && f.push(h.district); h.district && f.push(h.district)
h.streetNumber && h.streetNumber.street && h.streetNumber.number h.streetNumber && h.streetNumber.street && h.streetNumber.number
? (f.push(h.streetNumber.street), f.push(h.streetNumber.number)) ? (f.push(h.streetNumber.street), f.push(h.streetNumber.number))
: f.push(g.roads[0].name); : f.push(g.roads[0].name)
f = f.join(""); f = f.join('')
a.success([ a.success([
{ {
iconPath: a.iconPath, iconPath: a.iconPath,
@ -266,29 +264,29 @@ AMapWX.prototype.getRegeo = function (a) {
longitude: m, longitude: m,
latitude: n, latitude: n,
id: 0, id: 0,
regeocodeData: g, regeocodeData: g
}, }
]); ])
} else a.fail({ errCode: g.data.infocode, errMsg: g.data.info }); } else a.fail({ errCode: g.data.infocode, errMsg: g.data.info })
}, },
fail: function (g) { fail: function (g) {
a.fail({ errCode: "0", errMsg: g.errMsg || "" }); a.fail({ errCode: '0', errMsg: g.errMsg || '' })
}, }
}); })
} }
const c = this; const c = this
a.location a.location
? b(a.location) ? b(a.location)
: c.getWxLocation(a, function (d) { : c.getWxLocation(a, function (d) {
b(d); b(d)
}); })
}; }
AMapWX.prototype.getWeather = function (a) { AMapWX.prototype.getWeather = function (a) {
function b(g) { function b(g) {
let h = "base"; let h = 'base'
a.type && "forecast" === a.type && (h = "all"); a.type && 'forecast' === a.type && (h = 'all')
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/weather/weatherInfo", url: 'https://restapi.amap.com/v3/weather/weatherInfo',
data: { data: {
key: d.key, key: d.key,
city: g, city: g,
@ -297,83 +295,81 @@ AMapWX.prototype.getWeather = function (a) {
platform: e.platform, platform: e.platform,
appname: d.key, appname: d.key,
sdkversion: e.sdkversion, sdkversion: e.sdkversion,
logversion: e.logversion, logversion: e.logversion
}, },
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (f) { success: function (f) {
if (f.data.status && "1" === f.data.status) if (f.data.status && '1' === f.data.status)
if (f.data.lives) { if (f.data.lives) {
if ((f = f.data.lives) && 0 < f.length) { if ((f = f.data.lives) && 0 < f.length) {
f = f[0]; f = f[0]
const k = { const k = {
city: { text: "\u57ce\u5e02", data: f.city }, city: { text: '\u57ce\u5e02', data: f.city },
weather: { text: "\u5929\u6c14", data: f.weather }, weather: { text: '\u5929\u6c14', data: f.weather },
temperature: { text: "\u6e29\u5ea6", data: f.temperature }, temperature: { text: '\u6e29\u5ea6', data: f.temperature },
winddirection: { winddirection: {
text: "\u98ce\u5411", text: '\u98ce\u5411',
data: f.winddirection + "\u98ce", data: f.winddirection + '\u98ce'
}, },
windpower: { windpower: {
text: "\u98ce\u529b", text: '\u98ce\u529b',
data: f.windpower + "\u7ea7", data: f.windpower + '\u7ea7'
}, },
humidity: { text: "\u6e7f\u5ea6", data: f.humidity + "%" }, humidity: { text: '\u6e7f\u5ea6', data: f.humidity + '%' }
}; }
k.liveData = f; k.liveData = f
a.success(k); a.success(k)
} }
} else } else
f.data.forecasts && f.data.forecasts && f.data.forecasts[0] && a.success({ forecast: f.data.forecasts[0] })
f.data.forecasts[0] && else a.fail({ errCode: f.data.infocode, errMsg: f.data.info })
a.success({ forecast: f.data.forecasts[0] });
else a.fail({ errCode: f.data.infocode, errMsg: f.data.info });
}, },
fail: function (f) { fail: function (f) {
a.fail({ errCode: "0", errMsg: f.errMsg || "" }); a.fail({ errCode: '0', errMsg: f.errMsg || '' })
}, }
}); })
} }
function c(g) { function c(g) {
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/geocode/regeo", url: 'https://restapi.amap.com/v3/geocode/regeo',
data: { data: {
key: d.key, key: d.key,
location: g, location: g,
extensions: "all", extensions: 'all',
s: e.s, s: e.s,
platform: e.platform, platform: e.platform,
appname: d.key, appname: d.key,
sdkversion: e.sdkversion, sdkversion: e.sdkversion,
logversion: e.logversion, logversion: e.logversion
}, },
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (h) { success: function (h) {
if (h.data.status && "1" === h.data.status) { if (h.data.status && '1' === h.data.status) {
h = h.data.regeocode; h = h.data.regeocode
let f = ""; let f = ''
if (h.addressComponent) { if (h.addressComponent) {
f = h.addressComponent.adcode; f = h.addressComponent.adcode
} else { } else {
h.aois && 0 < h.aois.length && (f = h.aois[0].adcode); h.aois && 0 < h.aois.length && (f = h.aois[0].adcode)
} }
b(f); b(f)
} else a.fail({ errCode: h.data.infocode, errMsg: h.data.info }); } else a.fail({ errCode: h.data.infocode, errMsg: h.data.info })
}, },
fail: function (h) { fail: function (h) {
a.fail({ errCode: "0", errMsg: h.errMsg || "" }); a.fail({ errCode: '0', errMsg: h.errMsg || '' })
}, }
}); })
} }
const d = this, const d = this,
e = d.requestConfig; e = d.requestConfig
a.city a.city
? b(a.city) ? b(a.city)
: d.getWxLocation(a, function (g) { : d.getWxLocation(a, function (g) {
c(g); c(g)
}); })
}; }
AMapWX.prototype.getPoiAround = function (a) { AMapWX.prototype.getPoiAround = function (a) {
function b(e) { function b(e) {
e = { e = {
@ -383,185 +379,185 @@ AMapWX.prototype.getPoiAround = function (a) {
platform: d.platform, platform: d.platform,
appname: c.key, appname: c.key,
sdkversion: d.sdkversion, sdkversion: d.sdkversion,
logversion: d.logversion, logversion: d.logversion
}; }
a.querytypes && (e.types = a.querytypes); a.querytypes && (e.types = a.querytypes)
a.querykeywords && (e.keywords = a.querykeywords); a.querykeywords && (e.keywords = a.querykeywords)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/place/around", url: 'https://restapi.amap.com/v3/place/around',
data: e, data: e,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (g) { success: function (g) {
console.log(g, "g"); console.log(g, 'g')
if (g.data.status && "1" === g.data.status) { if (g.data.status && '1' === g.data.status) {
if ((g = g.data) && g.pois) { if ((g = g.data) && g.pois) {
const h = []; const h = []
for (let f = 0; f < g.pois.length; f++) { for (let f = 0; f < g.pois.length; f++) {
const k = 0 === f ? a.iconPathSelected : a.iconPath; const k = 0 === f ? a.iconPathSelected : a.iconPath
h.push({ h.push({
latitude: parseFloat(g.pois[f].location.split(",")[1]), latitude: parseFloat(g.pois[f].location.split(',')[1]),
longitude: parseFloat(g.pois[f].location.split(",")[0]), longitude: parseFloat(g.pois[f].location.split(',')[0]),
iconPath: k, iconPath: k,
width: 22, width: 22,
height: 32, height: 32,
id: f, id: f,
name: g.pois[f].name, name: g.pois[f].name,
address: g.pois[f].address, address: g.pois[f].address
}); })
} }
a.success({ markers: h, poisData: g.pois }); a.success({ markers: h, poisData: g.pois })
} }
} else a.fail({ errCode: g.data.infocode, errMsg: g.data.info }); } else a.fail({ errCode: g.data.infocode, errMsg: g.data.info })
}, },
fail: function (g) { fail: function (g) {
a.fail({ errCode: "0", errMsg: g.errMsg || "" }); a.fail({ errCode: '0', errMsg: g.errMsg || '' })
}, }
}); })
} }
const c = this, const c = this,
d = c.requestConfig; d = c.requestConfig
a.location a.location
? b(a.location) ? b(a.location)
: c.getWxLocation(a, function (e) { : c.getWxLocation(a, function (e) {
b(e); b(e)
}); })
}; }
AMapWX.prototype.getStaticmap = function (a) { AMapWX.prototype.getStaticmap = function (a) {
function b(e) { function b(e) {
c.push("location=" + e); c.push('location=' + e)
a.zoom && c.push("zoom=" + a.zoom); a.zoom && c.push('zoom=' + a.zoom)
a.size && c.push("size=" + a.size); a.size && c.push('size=' + a.size)
a.scale && c.push("scale=" + a.scale); a.scale && c.push('scale=' + a.scale)
a.markers && c.push("markers=" + a.markers); a.markers && c.push('markers=' + a.markers)
a.labels && c.push("labels=" + a.labels); a.labels && c.push('labels=' + a.labels)
a.paths && c.push("paths=" + a.paths); a.paths && c.push('paths=' + a.paths)
a.traffic && c.push("traffic=" + a.traffic); a.traffic && c.push('traffic=' + a.traffic)
e = "https://restapi.amap.com/v3/staticmap?" + c.join("&"); e = 'https://restapi.amap.com/v3/staticmap?' + c.join('&')
a.success({ url: e }); a.success({ url: e })
} }
const c = []; const c = []
c.push("key=" + this.key); c.push('key=' + this.key)
const d = this.requestConfig; const d = this.requestConfig
c.push("s=" + d.s); c.push('s=' + d.s)
c.push("platform=" + d.platform); c.push('platform=' + d.platform)
c.push("appname=" + d.appname); c.push('appname=' + d.appname)
c.push("sdkversion=" + d.sdkversion); c.push('sdkversion=' + d.sdkversion)
c.push("logversion=" + d.logversion); c.push('logversion=' + d.logversion)
a.location a.location
? b(a.location) ? b(a.location)
: this.getWxLocation(a, function (e) { : this.getWxLocation(a, function (e) {
b(e); b(e)
}); })
}; }
AMapWX.prototype.getInputtips = function (a) { AMapWX.prototype.getInputtips = function (a) {
const b = Object.assign({}, this.requestConfig); const b = Object.assign({}, this.requestConfig)
a.location && (b.location = a.location); a.location && (b.location = a.location)
a.keywords && (b.keywords = a.keywords); a.keywords && (b.keywords = a.keywords)
a.type && (b.type = a.type); a.type && (b.type = a.type)
a.city && (b.city = a.city); a.city && (b.city = a.city)
a.citylimit && (b.citylimit = a.citylimit); a.citylimit && (b.citylimit = a.citylimit)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/assistant/inputtips", url: 'https://restapi.amap.com/v3/assistant/inputtips',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (c) { success: function (c) {
c && c.data && c.data.tips && a.success({ tips: c.data.tips }); c && c.data && c.data.tips && a.success({ tips: c.data.tips })
}, },
fail: function (c) { fail: function (c) {
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getDrivingRoute = function (a) { AMapWX.prototype.getDrivingRoute = function (a) {
const b = Object.assign({}, this.requestConfig); const b = Object.assign({}, this.requestConfig)
a.origin && (b.origin = a.origin); a.origin && (b.origin = a.origin)
a.destination && (b.destination = a.destination); a.destination && (b.destination = a.destination)
a.strategy && (b.strategy = a.strategy); a.strategy && (b.strategy = a.strategy)
a.waypoints && (b.waypoints = a.waypoints); a.waypoints && (b.waypoints = a.waypoints)
a.avoidpolygons && (b.avoidpolygons = a.avoidpolygons); a.avoidpolygons && (b.avoidpolygons = a.avoidpolygons)
a.avoidroad && (b.avoidroad = a.avoidroad); a.avoidroad && (b.avoidroad = a.avoidroad)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/direction/driving", url: 'https://restapi.amap.com/v3/direction/driving',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (c) { success: function (c) {
c && c &&
c.data && c.data &&
c.data.route && c.data.route &&
a.success({ a.success({
paths: c.data.route.paths, paths: c.data.route.paths,
taxi_cost: c.data.route.taxi_cost || "", taxi_cost: c.data.route.taxi_cost || ''
}); })
}, },
fail: function (c) { fail: function (c) {
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getWalkingRoute = function (a) { AMapWX.prototype.getWalkingRoute = function (a) {
const b = Object.assign({}, this.requestConfig); const b = Object.assign({}, this.requestConfig)
a.origin && (b.origin = a.origin); a.origin && (b.origin = a.origin)
a.destination && (b.destination = a.destination); a.destination && (b.destination = a.destination)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/direction/walking", url: 'https://restapi.amap.com/v3/direction/walking',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (c) { success: function (c) {
c && c.data && c.data.route && a.success({ paths: c.data.route.paths }); c && c.data && c.data.route && a.success({ paths: c.data.route.paths })
}, },
fail: function (c) { fail: function (c) {
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getTransitRoute = function (a) { AMapWX.prototype.getTransitRoute = function (a) {
const b = Object.assign({}, this.requestConfig); const b = Object.assign({}, this.requestConfig)
a.origin && (b.origin = a.origin); a.origin && (b.origin = a.origin)
a.destination && (b.destination = a.destination); a.destination && (b.destination = a.destination)
a.strategy && (b.strategy = a.strategy); a.strategy && (b.strategy = a.strategy)
a.city && (b.city = a.city); a.city && (b.city = a.city)
a.cityd && (b.cityd = a.cityd); a.cityd && (b.cityd = a.cityd)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/direction/transit/integrated", url: 'https://restapi.amap.com/v3/direction/transit/integrated',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (c) { success: function (c) {
c && c &&
c.data && c.data &&
c.data.route && c.data.route &&
((c = c.data.route), ((c = c.data.route),
a.success({ a.success({
distance: c.distance || "", distance: c.distance || '',
taxi_cost: c.taxi_cost || "", taxi_cost: c.taxi_cost || '',
transits: c.transits, transits: c.transits
})); }))
}, },
fail: function (c) { fail: function (c) {
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
AMapWX.prototype.getRidingRoute = function (a) { AMapWX.prototype.getRidingRoute = function (a) {
const b = Object.assign({}, this.requestConfig); const b = Object.assign({}, this.requestConfig)
a.origin && (b.origin = a.origin); a.origin && (b.origin = a.origin)
a.destination && (b.destination = a.destination); a.destination && (b.destination = a.destination)
wx.request({ wx.request({
url: "https://restapi.amap.com/v3/direction/riding", url: 'https://restapi.amap.com/v3/direction/riding',
data: b, data: b,
method: "GET", method: 'GET',
header: { "content-type": "application/json" }, header: { 'content-type': 'application/json' },
success: function (c) { success: function (c) {
c && c.data && c.data.route && a.success({ paths: c.data.route.paths }); c && c.data && c.data.route && a.success({ paths: c.data.route.paths })
}, },
fail: function (c) { fail: function (c) {
a.fail({ errCode: "0", errMsg: c.errMsg || "" }); a.fail({ errCode: '0', errMsg: c.errMsg || '' })
}, }
}); })
}; }
// module.exports.AMapWX=AMapWX; // module.exports.AMapWX=AMapWX;
export default { AMapWX }; export default { AMapWX }

View File

@ -1,25 +1,25 @@
import * as Pinia from "pinia"; import * as Pinia from 'pinia'
import uviewPlus from "uview-plus"; import uviewPlus from 'uview-plus'
import { createSSRApp } from "vue"; import { createSSRApp } from 'vue'
import App from "./App.vue"; import App from './App.vue'
import "./colorconfig.scss"; import './colorconfig.scss'
export function createApp() { export function createApp() {
const app = createSSRApp(App); const app = createSSRApp(App)
// uview-plus // uview-plus
app.use(uviewPlus); app.use(uviewPlus)
// onLaunch 同步阻塞 // onLaunch 同步阻塞
app.config.globalProperties.$onLaunched = new Promise((resolve) => { app.config.globalProperties.$onLaunched = new Promise(resolve => {
app.config.globalProperties.$isResolve = resolve; app.config.globalProperties.$isResolve = resolve
}); })
// pinia // pinia
app.use(Pinia.createPinia()); app.use(Pinia.createPinia())
return { return {
app, app,
Pinia, Pinia
}; }
} }

View File

@ -5,15 +5,15 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from '@dcloudio/uni-app'
import { getCurrentInstance } from "vue"; import { getCurrentInstance } from 'vue'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
onLoad(async () => { onLoad(async () => {
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
console.log("detail.vue onLoad"); console.log('detail.vue onLoad')
// auth.hasError = true; // auth.hasError = true;
}); })
</script> </script>

View File

@ -2,46 +2,37 @@
<cc-root-view> <cc-root-view>
<image src="/static/logo.png" /> <image src="/static/logo.png" />
<up-button type="primary" text="确定" @click="handleClick" /> <up-button type="primary" text="确定" @click="handleClick" />
<up-button <up-button type="primary" text="需要权限" @click="handleClickAccess" class="my-7" />
type="primary" <up-button type="primary" text="不需要权限" @click="handleClickNotNeedAccess" />
text="需要权限"
@click="handleClickAccess"
class="my-7"
/>
<up-button
type="primary"
text="不需要权限"
@click="handleClickNotNeedAccess"
/>
</cc-root-view> </cc-root-view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import { goto } from "@/common/libraries/naviHelper"; import { goto } from '@/common/libraries/naviHelper'
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from '@dcloudio/uni-app'
import { getCurrentInstance } from "vue"; import { getCurrentInstance } from 'vue'
const auth: any = useWeAppAuthStore(); const auth: any = useWeAppAuthStore()
function handleClick() { function handleClick() {
goto("/pages/detail?id=123"); goto('/pages/detail?id=123')
} }
// //
function handleClickAccess() { function handleClickAccess() {
auth.checkRight(() => { auth.checkRight(() => {
goto("/pages/mine"); goto('/pages/mine')
}); })
} }
function handleClickNotNeedAccess() { function handleClickNotNeedAccess() {
goto("/pages/mine"); goto('/pages/mine')
} }
onLoad(async () => { onLoad(async () => {
console.log("index.vue onLoad 1"); console.log('index.vue onLoad 1')
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
console.log("index.vue onLoad 2"); console.log('index.vue onLoad 2')
}); })
</script> </script>

View File

@ -11,27 +11,27 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from 'vue'
const props = defineProps(["day"]); const props = defineProps(['day'])
import { getDay } from "@/common/libraries/day"; import { getDay } from '@/common/libraries/day'
const emit = defineEmits(["update:valueModel"]); const emit = defineEmits(['update:valueModel'])
const handleSelect = (day: string) => { const handleSelect = (day: string) => {
emit("update:valueModel", day); emit('update:valueModel', day)
}; }
const listDay = ref([ const listDay = ref([
{ {
label: "今天", label: '今天',
value: getDay(), value: getDay()
}, },
{ {
label: "昨天", label: '昨天',
value: getDay(1), value: getDay(1)
}, },
{ {
label: "前天", label: '前天',
value: getDay(2), value: getDay(2)
}, }
]); ])
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.day_select { .day_select {

View File

@ -2,14 +2,8 @@
<hs-card> <hs-card>
<view> <view>
<view class="data_header"> <view class="data_header">
<MyDaySelect <MyDaySelect :day="useModel.formData.day" v-model:valueModel="useModel.formData.day" />
:day="useModel.formData.day" <hs-day-picker v-model:valueModel="useModel.formData.day" icon="calendar" />
v-model:valueModel="useModel.formData.day"
/>
<hs-day-picker
v-model:valueModel="useModel.formData.day"
icon="calendar"
/>
</view> </view>
<view class="data_total_price"> <view class="data_total_price">
<view class="data_title">交易金额()</view> <view class="data_title">交易金额()</view>
@ -33,10 +27,10 @@
</hs-card> </hs-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { watch } from "vue"; import { watch } from 'vue'
import MyDaySelect from "./daySelect.vue"; import MyDaySelect from './daySelect.vue'
import useModel from "../model"; import useModel from '../model'
import method from "../method"; import method from '../method'
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.data_header { .data_header {

View File

@ -1,53 +1,39 @@
<template> <template>
<cc-root-view> <cc-root-view>
<view class="HomePage"> <view class="HomePage"> 2 </view>
<hs-custom-title title="废品回收助手" />
<MyUserInfo />
<MyShowData />
<view class="OrderTitle">
最近订单
<view class="more_btn">
更多<uni-icons type="right" size="13" color="#3da605"></uni-icons>
</view>
</view>
<hs-order-items />
<!-- <view class="footer_group_btn">
<hs-button label="新增收货单" size="md" />
</view> -->
</view>
</cc-root-view> </cc-root-view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const App = getApp(); const App = getApp()
import MyShowData from "./components/showData.vue"; import MyShowData from './components/showData.vue'
import MyUserInfo from "./components/useInfo.vue"; import MyUserInfo from './components/useInfo.vue'
import { onShareAppMessage, onShareTimeline, onShow } from "@dcloudio/uni-app"; import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app'
import { setTabBarData } from "@/common/libraries/setTabBar"; import { setTabBarData } from '@/common/libraries/setTabBar'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
import useModel from "./model"; import useModel from './model'
import method from "./method"; import method from './method'
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import { getCurrentInstance, ref } from "vue"; import { getCurrentInstance, ref } from 'vue'
import useUser from "@/common/libraries/userUserLogin"; import useUser from '@/common/libraries/userUserLogin'
onShow(async () => { onShow(async () => {
setTabBarData(0); setTabBarData(0)
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
}); })
onShareAppMessage(() => { onShareAppMessage(() => {
return { return {
title: "废品回收助手", title: '废品回收助手',
path: "/pages/index/index", path: '/pages/index/index'
}; }
}); })
onShareTimeline(() => { onShareTimeline(() => {
return { return {
title: "废品回收助手", title: '废品回收助手',
path: "/pages/index/index", path: '/pages/index/index'
}; }
}); })
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./style.scss"; @import './style.scss';
</style> </style>

View File

@ -1,6 +1,6 @@
import { getApiLoading } from "@/common/libraries/apiLoading"; import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from "@/gen/Apis"; import { Apis } from '@/gen/Apis'
import useModel from "./model"; import useModel from './model'
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
const auth = useWeAppAuthStore(); const auth = useWeAppAuthStore()
export default {}; export default {}

View File

@ -1,6 +1,6 @@
import { reactive, ref } from "vue"; import { reactive, ref } from 'vue'
import { getDay } from "@/common/libraries/day"; import { getDay } from '@/common/libraries/day'
export default { export default {
formData: reactive({ day: getDay() }), formData: reactive({ day: getDay() }),
data: ref<any>(), data: ref<any>()
}; }

View File

@ -1,20 +1,20 @@
<template></template> <template></template>
<script setup lang="ts"> <script setup lang="ts">
import { useWeAppAuthStore } from "@/common"; import { useWeAppAuthStore } from '@/common'
import { onShow } from "@dcloudio/uni-app"; import { onShow } from '@dcloudio/uni-app'
import { getCurrentInstance } from "vue"; import { getCurrentInstance } from 'vue'
import useUser from "@/common/libraries/userUserLogin"; import useUser from '@/common/libraries/userUserLogin'
onShow(async () => { onShow(async () => {
uni.showLoading({ uni.showLoading({
title: "加载中...", title: '加载中...',
mask: true, mask: true
}); })
await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched; await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
uni.hideLoading(); uni.hideLoading()
if (useUser.getLoginStatus()) { if (useUser.getLoginStatus()) {
uni.switchTab({ uni.switchTab({
url: "/pages/index/index", url: '/pages/index/index'
}); })
} }
}); })
</script> </script>

Some files were not shown because too many files have changed in this diff Show More