调整微信小程序的报错。
This commit is contained in:
134
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.js
vendored
Normal file
134
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.js
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../common/vendor.js");
|
||||
const common_request = require("../../../common/request.js");
|
||||
const _sfc_main = {
|
||||
name: "DeviceBindPopup",
|
||||
data() {
|
||||
return {
|
||||
deviceBindForm: {
|
||||
deviceCode: "",
|
||||
salesPhone: "",
|
||||
dealershipName: ""
|
||||
},
|
||||
deviceBindSubmitting: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 打开设备绑定弹窗
|
||||
*/
|
||||
open() {
|
||||
this.deviceBindForm = {
|
||||
deviceCode: "",
|
||||
salesPhone: "",
|
||||
dealershipName: ""
|
||||
};
|
||||
if (this.$refs.deviceBindPopup) {
|
||||
this.$refs.deviceBindPopup.open();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 关闭设备绑定弹窗
|
||||
*/
|
||||
close() {
|
||||
if (this.$refs.deviceBindPopup) {
|
||||
this.$refs.deviceBindPopup.close();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 关闭设备绑定弹窗(内部方法)
|
||||
*/
|
||||
closeDeviceBindDialog() {
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
* 提交设备绑定
|
||||
*/
|
||||
async submitDeviceBind() {
|
||||
var _a, _b;
|
||||
if (this.deviceBindSubmitting)
|
||||
return;
|
||||
const { deviceCode, salesPhone, dealershipName } = this.deviceBindForm;
|
||||
if (!deviceCode || !deviceCode.trim()) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请输入设备编号",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
this.deviceBindSubmitting = true;
|
||||
try {
|
||||
const requestData = {
|
||||
deviceCode: deviceCode.trim(),
|
||||
salesPhone: salesPhone ? salesPhone.trim() : "",
|
||||
dealershipName: dealershipName ? dealershipName.trim() : "",
|
||||
bindStatus: true
|
||||
};
|
||||
const res = await common_request.post("/api/deviceManagement/add", requestData);
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
this.close();
|
||||
common_vendor.index.showToast({
|
||||
title: res.data.message || "设备绑定成功",
|
||||
icon: "success"
|
||||
});
|
||||
this.$emit("success");
|
||||
} else {
|
||||
const errorMessage = ((_a = res.data) == null ? void 0 : _a.message) || "设备绑定失败,请稍后重试";
|
||||
common_vendor.index.showToast({
|
||||
title: errorMessage,
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/components/DeviceBindPopup.vue:117", "设备绑定失败:", e);
|
||||
const errorMessage = ((_b = e == null ? void 0 : e.data) == null ? void 0 : _b.message) || (e == null ? void 0 : e.message) || "设备绑定失败,请稍后重试";
|
||||
common_vendor.index.showToast({
|
||||
title: errorMessage,
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
this.deviceBindSubmitting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||||
(_easycom_uni_easyinput2 + _easycom_uni_popup2)();
|
||||
}
|
||||
const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
||||
const _easycom_uni_popup = () => "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_easyinput + _easycom_uni_popup)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o(($event) => $data.deviceBindForm.deviceCode = $event),
|
||||
b: common_vendor.p({
|
||||
placeholder: "请输入设备编号",
|
||||
modelValue: $data.deviceBindForm.deviceCode
|
||||
}),
|
||||
c: common_vendor.o(($event) => $data.deviceBindForm.salesPhone = $event),
|
||||
d: common_vendor.p({
|
||||
placeholder: "请输入销售电话",
|
||||
type: "number",
|
||||
modelValue: $data.deviceBindForm.salesPhone
|
||||
}),
|
||||
e: common_vendor.o(($event) => $data.deviceBindForm.dealershipName = $event),
|
||||
f: common_vendor.p({
|
||||
placeholder: "请输入所属门店",
|
||||
modelValue: $data.deviceBindForm.dealershipName
|
||||
}),
|
||||
g: common_vendor.o((...args) => $options.closeDeviceBindDialog && $options.closeDeviceBindDialog(...args)),
|
||||
h: common_vendor.t($data.deviceBindSubmitting ? "提交中..." : "提交"),
|
||||
i: $data.deviceBindSubmitting,
|
||||
j: common_vendor.o((...args) => $options.submitDeviceBind && $options.submitDeviceBind(...args)),
|
||||
k: common_vendor.sr("deviceBindPopup", "e2e14e8e-0"),
|
||||
l: common_vendor.p({
|
||||
type: "dialog"
|
||||
})
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e2e14e8e"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/ucenter/components/DeviceBindPopup.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-easyinput": "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput",
|
||||
"uni-popup": "../../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<uni-popup wx:if="{{l}}" class="r data-v-e2e14e8e" u-s="{{['d']}}" u-r="deviceBindPopup" u-i="e2e14e8e-0" bind:__l="__l" u-p="{{l}}"><view class="device-bind-dialog data-v-e2e14e8e"><view class="device-bind-title data-v-e2e14e8e">设备绑定</view><view class="device-bind-field data-v-e2e14e8e"><text class="device-bind-label data-v-e2e14e8e">设备编号</text><uni-easyinput wx:if="{{b}}" class="data-v-e2e14e8e" u-i="e2e14e8e-1,e2e14e8e-0" bind:__l="__l" bindupdateModelValue="{{a}}" u-p="{{b}}"/></view><view class="device-bind-field data-v-e2e14e8e"><text class="device-bind-label data-v-e2e14e8e">家长电话</text><uni-easyinput wx:if="{{d}}" class="data-v-e2e14e8e" u-i="e2e14e8e-2,e2e14e8e-0" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"/></view><view class="device-bind-field data-v-e2e14e8e"><text class="device-bind-label data-v-e2e14e8e">所属门店</text><uni-easyinput wx:if="{{f}}" class="data-v-e2e14e8e" u-i="e2e14e8e-3,e2e14e8e-0" bind:__l="__l" bindupdateModelValue="{{e}}" u-p="{{f}}"/></view><view class="device-bind-actions data-v-e2e14e8e"><button class="dialog-btn cancel data-v-e2e14e8e" bindtap="{{g}}">取消</button><button class="dialog-btn confirm data-v-e2e14e8e" disabled="{{i}}" bindtap="{{j}}">{{h}}</button></view></view></uni-popup>
|
||||
72
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxss
vendored
Normal file
72
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceBindPopup.wxss
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.device-bind-dialog.data-v-e2e14e8e {
|
||||
padding: 40rpx 30rpx 30rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
width: 600rpx;
|
||||
}
|
||||
.device-bind-title.data-v-e2e14e8e {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.device-bind-field.data-v-e2e14e8e {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.device-bind-label.data-v-e2e14e8e {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.device-bind-actions.data-v-e2e14e8e {
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.dialog-btn.data-v-e2e14e8e {
|
||||
min-width: 140rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
.dialog-btn.cancel.data-v-e2e14e8e {
|
||||
background-color: #f5f5f5;
|
||||
color: #333333;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.dialog-btn.confirm.data-v-e2e14e8e {
|
||||
background-color: #007AFF;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.dialog-btn.data-v-e2e14e8e:after {
|
||||
border: none;
|
||||
}
|
||||
251
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.js
vendored
Normal file
251
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.js
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../common/vendor.js");
|
||||
const common_request = require("../../../common/request.js");
|
||||
const _sfc_main = {
|
||||
name: "DeviceListPopup",
|
||||
data() {
|
||||
return {
|
||||
statusOptions: ["全部状态", "已绑定", "未绑定"],
|
||||
statusIndex: 0,
|
||||
queryDeviceCode: "",
|
||||
queryPhone: "",
|
||||
deviceList: [],
|
||||
page: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
loading: false,
|
||||
total: 0,
|
||||
noMore: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 根据筛选条件过滤设备列表
|
||||
filteredDeviceList() {
|
||||
return this.deviceList.filter((item) => {
|
||||
if (this.statusIndex === 1 && !item.bindStatus)
|
||||
return false;
|
||||
if (this.statusIndex === 2 && item.bindStatus)
|
||||
return false;
|
||||
if (this.queryDeviceCode && !(item.deviceCode || "").includes(this.queryDeviceCode.trim())) {
|
||||
return false;
|
||||
}
|
||||
if (this.queryPhone && !(item.salesPhone || "").includes(this.queryPhone.trim())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 打开设备列表弹窗
|
||||
*/
|
||||
open() {
|
||||
if (this.$refs.deviceListPopup) {
|
||||
this.$refs.deviceListPopup.open();
|
||||
this.fetchDeviceList(true);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 关闭设备列表弹窗
|
||||
*/
|
||||
close() {
|
||||
if (this.$refs.deviceListPopup) {
|
||||
this.$refs.deviceListPopup.close();
|
||||
}
|
||||
},
|
||||
// 将 LocalDateTime 字符串格式化为 YYYY-MM-DD HH:mm:ss
|
||||
formatDateTime(value) {
|
||||
if (!value)
|
||||
return "-";
|
||||
try {
|
||||
const date = new Date(value);
|
||||
if (Number.isNaN(date.getTime()))
|
||||
return value;
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("warn", "at pages/ucenter/components/DeviceListPopup.vue:196", "格式化时间失败:", e, value);
|
||||
return value;
|
||||
}
|
||||
},
|
||||
buildQueryParams() {
|
||||
const params = {
|
||||
current: this.page.current,
|
||||
size: this.page.size
|
||||
};
|
||||
const trimmedDeviceCode = this.queryDeviceCode && this.queryDeviceCode.trim();
|
||||
const trimmedPhone = this.queryPhone && this.queryPhone.trim();
|
||||
if (trimmedDeviceCode) {
|
||||
params.deviceCode = trimmedDeviceCode;
|
||||
}
|
||||
if (trimmedPhone) {
|
||||
params.salesPhone = trimmedPhone;
|
||||
}
|
||||
if (this.statusIndex === 1) {
|
||||
params.bindStatus = true;
|
||||
} else if (this.statusIndex === 2) {
|
||||
params.bindStatus = false;
|
||||
}
|
||||
return params;
|
||||
},
|
||||
async fetchDeviceList(reset = false) {
|
||||
if (this.loading)
|
||||
return;
|
||||
this.loading = true;
|
||||
if (reset) {
|
||||
this.page.current = 1;
|
||||
this.noMore = false;
|
||||
}
|
||||
try {
|
||||
const queryParams = this.buildQueryParams();
|
||||
const res = await common_request.get("/api/deviceManagement/list", queryParams);
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
const records = Array.isArray(res.data.data) ? res.data.data : [];
|
||||
const mapped = records.map((item) => ({
|
||||
id: item.id,
|
||||
deviceCode: item.deviceCode,
|
||||
salesPhone: item.salesPhone,
|
||||
dealershipName: item.dealershipName,
|
||||
bindStatus: item.bindStatus,
|
||||
createTime: this.formatDateTime(item.createTime)
|
||||
}));
|
||||
if (reset) {
|
||||
this.deviceList = mapped;
|
||||
} else {
|
||||
this.deviceList = [...this.deviceList, ...mapped];
|
||||
}
|
||||
if (typeof res.data.current === "number") {
|
||||
this.page.current = res.data.current;
|
||||
}
|
||||
if (typeof res.data.size === "number") {
|
||||
this.page.size = res.data.size;
|
||||
}
|
||||
if (typeof res.data.total === "number") {
|
||||
this.total = res.data.total;
|
||||
}
|
||||
const pages = typeof res.data.pages === "number" ? res.data.pages : Math.ceil((this.total || 0) / this.page.size);
|
||||
this.noMore = pages > 0 && this.page.current >= pages;
|
||||
} else {
|
||||
this.deviceList = [];
|
||||
common_vendor.index.showToast({
|
||||
title: res.data && res.data.message || "获取设备列表失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/components/DeviceListPopup.vue:282", "获取设备列表失败:", error);
|
||||
if (reset) {
|
||||
this.deviceList = [];
|
||||
}
|
||||
let msg = "获取设备列表失败,请稍后重试";
|
||||
if (error.errMsg && error.errMsg.includes("timeout")) {
|
||||
msg = "请求超时,请检查网络后重试";
|
||||
}
|
||||
common_vendor.index.showToast({
|
||||
title: msg,
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
// 滚动到底部时加载更多
|
||||
onScrollToLower() {
|
||||
if (this.loading || this.noMore)
|
||||
return;
|
||||
this.page.current += 1;
|
||||
this.fetchDeviceList(false);
|
||||
},
|
||||
onStatusChange(e) {
|
||||
this.statusIndex = Number(e.detail.value || 0);
|
||||
this.onSearch();
|
||||
},
|
||||
onSearch() {
|
||||
this.fetchDeviceList(true);
|
||||
},
|
||||
async onRefresh() {
|
||||
await this.fetchDeviceList(true);
|
||||
common_vendor.index.showToast({
|
||||
title: "刷新成功",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||||
(_easycom_uni_icons2 + _easycom_uni_popup2)();
|
||||
}
|
||||
const _easycom_uni_icons = () => "../../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||
const _easycom_uni_popup = () => "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_icons + _easycom_uni_popup)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
type: "close",
|
||||
size: "20",
|
||||
color: "#666"
|
||||
}),
|
||||
b: common_vendor.o((...args) => $options.close && $options.close(...args)),
|
||||
c: common_vendor.t($options.filteredDeviceList.length),
|
||||
d: common_vendor.t($data.statusOptions[$data.statusIndex]),
|
||||
e: common_vendor.p({
|
||||
type: "down",
|
||||
size: "14",
|
||||
color: "#999"
|
||||
}),
|
||||
f: $data.statusOptions,
|
||||
g: $data.statusIndex,
|
||||
h: common_vendor.o((...args) => $options.onStatusChange && $options.onStatusChange(...args)),
|
||||
i: common_vendor.o((...args) => $options.onSearch && $options.onSearch(...args)),
|
||||
j: $data.queryDeviceCode,
|
||||
k: common_vendor.o(($event) => $data.queryDeviceCode = $event.detail.value),
|
||||
l: common_vendor.o((...args) => $options.onSearch && $options.onSearch(...args)),
|
||||
m: $data.queryPhone,
|
||||
n: common_vendor.o(($event) => $data.queryPhone = $event.detail.value),
|
||||
o: common_vendor.p({
|
||||
type: "refresh",
|
||||
size: "18",
|
||||
color: "#2A68FF"
|
||||
}),
|
||||
p: common_vendor.o((...args) => $options.onRefresh && $options.onRefresh(...args)),
|
||||
q: common_vendor.f($options.filteredDeviceList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.deviceCode || "未填写设备编号"),
|
||||
b: common_vendor.t(item.bindStatus ? "已绑定" : "未绑定"),
|
||||
c: common_vendor.n(item.bindStatus ? "bind-tag--on" : "bind-tag--off"),
|
||||
d: common_vendor.t(item.salesPhone || "-"),
|
||||
e: common_vendor.t(item.dealershipName || "-"),
|
||||
f: common_vendor.t(item.createTime || "-"),
|
||||
g: item.id || index
|
||||
};
|
||||
}),
|
||||
r: !$data.loading && $data.deviceList.length === 0
|
||||
}, !$data.loading && $data.deviceList.length === 0 ? {} : {}, {
|
||||
s: $data.deviceList.length > 0
|
||||
}, $data.deviceList.length > 0 ? common_vendor.e({
|
||||
t: $data.loading
|
||||
}, $data.loading ? {} : $data.noMore ? {} : {}, {
|
||||
v: $data.noMore
|
||||
}) : {}, {
|
||||
w: common_vendor.o((...args) => $options.onScrollToLower && $options.onScrollToLower(...args)),
|
||||
x: common_vendor.sr("deviceListPopup", "9bcf4750-0"),
|
||||
y: common_vendor.p({
|
||||
type: "bottom",
|
||||
["safe-area"]: false
|
||||
})
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9bcf4750"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/ucenter/components/DeviceListPopup.js.map
|
||||
7
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.json
vendored
Normal file
7
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"uni-icons": "../../../uni_modules/uni-icons/components/uni-icons/uni-icons",
|
||||
"uni-popup": "../../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<uni-popup wx:if="{{y}}" class="r data-v-9bcf4750" u-s="{{['d']}}" u-r="deviceListPopup" u-i="9bcf4750-0" bind:__l="__l" u-p="{{y}}"><view class="device-list-popup data-v-9bcf4750"><view class="popup-header data-v-9bcf4750"><text class="popup-title data-v-9bcf4750">设备列表</text><view class="popup-close data-v-9bcf4750" bindtap="{{b}}"><uni-icons wx:if="{{a}}" class="data-v-9bcf4750" u-i="9bcf4750-1,9bcf4750-0" bind:__l="__l" u-p="{{a}}"/></view></view><scroll-view class="device-list-content data-v-9bcf4750" scroll-y bindscrolltolower="{{w}}"><view class="device-toolbar data-v-9bcf4750"><text class="toolbar-total data-v-9bcf4750">{{c}}台</text><view class="toolbar-filters data-v-9bcf4750"><picker class="status-picker data-v-9bcf4750" mode="selector" range="{{f}}" value="{{g}}" bindchange="{{h}}"><view class="status-picker-inner data-v-9bcf4750"><text class="status-label data-v-9bcf4750">状态</text><text class="status-value data-v-9bcf4750">{{d}}</text><uni-icons wx:if="{{e}}" class="data-v-9bcf4750" u-i="9bcf4750-2,9bcf4750-0" bind:__l="__l" u-p="{{e}}"/></view></picker><input class="toolbar-input data-v-9bcf4750" placeholder="设备编号" placeholder-style="color:#B0B0B0" confirm-type="search" bindconfirm="{{i}}" value="{{j}}" bindinput="{{k}}"/><input class="toolbar-input data-v-9bcf4750" placeholder="电话" placeholder-style="color:#B0B0B0" confirm-type="search" bindconfirm="{{l}}" value="{{m}}" bindinput="{{n}}"/></view><view class="toolbar-actions data-v-9bcf4750"><view class="toolbar-btn data-v-9bcf4750" bindtap="{{p}}"><uni-icons wx:if="{{o}}" class="data-v-9bcf4750" u-i="9bcf4750-3,9bcf4750-0" bind:__l="__l" u-p="{{o}}"/><text class="data-v-9bcf4750">刷新</text></view></view></view><view wx:for="{{q}}" wx:for-item="item" wx:key="g" class="device-card data-v-9bcf4750"><view class="card-header data-v-9bcf4750"><text class="device-code data-v-9bcf4750">{{item.a}}</text><view class="{{['bind-tag', 'data-v-9bcf4750', item.c]}}"><text class="data-v-9bcf4750">{{item.b}}</text></view></view><view class="card-body data-v-9bcf4750"><view class="card-row data-v-9bcf4750"><text class="card-label data-v-9bcf4750">家长电话</text><text class="card-value data-v-9bcf4750">{{item.d}}</text></view><view class="card-row data-v-9bcf4750"><text class="card-label data-v-9bcf4750">所属门店</text><text class="card-value data-v-9bcf4750">{{item.e}}</text></view><view class="card-row data-v-9bcf4750"><text class="card-label data-v-9bcf4750">创建时间</text><text class="card-value data-v-9bcf4750">{{item.f}}</text></view></view></view><view wx:if="{{r}}" class="empty-box data-v-9bcf4750"><text class="empty-text data-v-9bcf4750">暂无设备记录</text></view><view wx:if="{{s}}" class="empty-box data-v-9bcf4750"><text wx:if="{{t}}" class="empty-text data-v-9bcf4750">加载中...</text><text wx:elif="{{v}}" class="empty-text data-v-9bcf4750">没有更多了</text></view></scroll-view></view></uni-popup>
|
||||
191
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.wxss
vendored
Normal file
191
unpackage/dist/dev/mp-weixin/pages/ucenter/components/DeviceListPopup.wxss
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.device-list-popup.data-v-9bcf4750 {
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.popup-header.data-v-9bcf4750 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx 32rpx;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
}
|
||||
.popup-title.data-v-9bcf4750 {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.popup-close.data-v-9bcf4750 {
|
||||
padding: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.device-list-content.data-v-9bcf4750 {
|
||||
flex: 1;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.device-toolbar.data-v-9bcf4750 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12rpx 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
background-color: #f8f8fa;
|
||||
border-radius: 8rpx;
|
||||
border: 1px solid #efeff2;
|
||||
}
|
||||
.toolbar-total.data-v-9bcf4750 {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.toolbar-filters.data-v-9bcf4750 {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.status-picker.data-v-9bcf4750 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.status-picker-inner.data-v-9bcf4750 {
|
||||
flex-direction: row;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 12rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 999rpx;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #d6e3ff;
|
||||
}
|
||||
.status-label.data-v-9bcf4750 {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-right: 6rpx;
|
||||
}
|
||||
.status-value.data-v-9bcf4750 {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
.toolbar-input.data-v-9bcf4750 {
|
||||
flex: 1;
|
||||
min-width: 120rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
background-color: #f5f6fa;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 12rpx;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.toolbar-actions.data-v-9bcf4750 {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.toolbar-btn.data-v-9bcf4750 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16rpx;
|
||||
height: 56rpx;
|
||||
border-radius: 28rpx;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #d6e3ff;
|
||||
}
|
||||
.toolbar-btn text.data-v-9bcf4750 {
|
||||
margin-left: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #2a68ff;
|
||||
}
|
||||
.device-card.data-v-9bcf4750 {
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx 24rpx 20rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
.card-header.data-v-9bcf4750 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.device-code.data-v-9bcf4750 {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.bind-tag.data-v-9bcf4750 {
|
||||
min-width: 104rpx;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 22rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.bind-tag--on.data-v-9bcf4750 {
|
||||
background-color: #e6f6ec;
|
||||
color: #2e7d32;
|
||||
}
|
||||
.bind-tag--off.data-v-9bcf4750 {
|
||||
background-color: #fff4e5;
|
||||
color: #ff9800;
|
||||
}
|
||||
.card-body.data-v-9bcf4750 {
|
||||
border-top: 1px solid #f0f0f0;
|
||||
padding-top: 16rpx;
|
||||
}
|
||||
.card-row.data-v-9bcf4750 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.card-label.data-v-9bcf4750 {
|
||||
width: 160rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.card-value.data-v-9bcf4750 {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
.empty-box.data-v-9bcf4750 {
|
||||
padding: 80rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
.empty-text.data-v-9bcf4750 {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
}
|
||||
583
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.js
vendored
Normal file
583
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.js
vendored
Normal file
@@ -0,0 +1,583 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const common_store = require("../../common/store.js");
|
||||
const common_request = require("../../common/request.js");
|
||||
const db = common_vendor.tr.database();
|
||||
common_vendor.tr.importObject("uni-id-co", {
|
||||
customUI: true
|
||||
});
|
||||
const DeviceBindPopup = () => "./components/DeviceBindPopup.js";
|
||||
const DeviceListPopup = () => "./components/DeviceListPopup.js";
|
||||
const CloudImage = () => "../../uni_modules/uni-id-pages/components/cloud-image/cloud-image.js";
|
||||
const _sfc_main = {
|
||||
components: {
|
||||
DeviceBindPopup,
|
||||
DeviceListPopup,
|
||||
CloudImage
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tenantId: "",
|
||||
loginUserInfo: {},
|
||||
totalDevices: 0,
|
||||
totalSales: 0,
|
||||
totalProjects: 0,
|
||||
gridList: [
|
||||
{
|
||||
"text": "设备总数",
|
||||
"icon": "gear"
|
||||
},
|
||||
{
|
||||
"text": "人员总数",
|
||||
"icon": "person-filled"
|
||||
},
|
||||
{
|
||||
"text": "项目总数",
|
||||
"icon": "list"
|
||||
},
|
||||
{
|
||||
"text": "修改密码",
|
||||
"icon": "locked"
|
||||
}
|
||||
],
|
||||
changePwdForm: {
|
||||
oldPassword: "",
|
||||
newPassword: "",
|
||||
confirmPassword: ""
|
||||
},
|
||||
changePwdSubmitting: false,
|
||||
ucenterList: [
|
||||
[
|
||||
{
|
||||
"title": "设备绑定",
|
||||
"event": "openDeviceBind",
|
||||
"icon": "compose"
|
||||
},
|
||||
{
|
||||
"title": "设备列表",
|
||||
"event": "openDeviceList",
|
||||
"icon": "paperplane"
|
||||
}
|
||||
],
|
||||
[{
|
||||
"title": this.$t("mine.settings"),
|
||||
"to": "/pages-subpackage/ucenter/settings/settings",
|
||||
"icon": "gear"
|
||||
}]
|
||||
],
|
||||
listStyles: {
|
||||
"height": "150rpx",
|
||||
// 边框高度
|
||||
"width": "150rpx",
|
||||
// 边框宽度
|
||||
"border": {
|
||||
// 如果为 Boolean 值,可以控制边框显示与否
|
||||
"color": "#eee",
|
||||
// 边框颜色
|
||||
"width": "1px",
|
||||
// 边框宽度
|
||||
"style": "solid",
|
||||
// 边框样式
|
||||
"radius": "100%"
|
||||
// 边框圆角,支持百分比
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.loadUserInfo();
|
||||
},
|
||||
onShow() {
|
||||
try {
|
||||
const storageUserInfo = common_vendor.index.getStorageSync("uni-id-pages-userInfo") || {};
|
||||
if (Object.keys(storageUserInfo).length > 0 && Object.keys(common_store.store.userInfo || {}).length === 0) {
|
||||
const synced = common_store.mutations.syncUserInfoFromStorage();
|
||||
if (!synced) {
|
||||
common_store.mutations.setUserInfo(storageUserInfo, { cover: true });
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
this.loadUserInfo();
|
||||
this.loadDeviceStatistics();
|
||||
this.loadSalesStatistics();
|
||||
this.loadProjectStatistics();
|
||||
},
|
||||
computed: {
|
||||
userInfo() {
|
||||
return common_store.store.userInfo || {};
|
||||
},
|
||||
hasLogin() {
|
||||
return common_store.store.hasLogin || false;
|
||||
},
|
||||
appConfig() {
|
||||
try {
|
||||
const app = getApp({ allowDefault: true });
|
||||
return app && app.globalData ? app.globalData.config : {};
|
||||
} catch (e) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 加载用户信息(租户ID和登录人信息)
|
||||
*/
|
||||
loadUserInfo() {
|
||||
try {
|
||||
this.tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || "";
|
||||
const loginResponse = common_vendor.index.getStorageSync("backend-login-response") || {};
|
||||
this.loginUserInfo = {
|
||||
userName: loginResponse.userName || "",
|
||||
phone: loginResponse.phone || "",
|
||||
email: loginResponse.email || "",
|
||||
userId: loginResponse.userId || ""
|
||||
};
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:298", "加载用户信息失败:", e);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 加载设备统计信息
|
||||
*/
|
||||
async loadDeviceStatistics() {
|
||||
var _a, _b;
|
||||
try {
|
||||
const res = await common_request.get("/api/deviceManagement/statistics");
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
this.totalDevices = ((_a = res.data.data) == null ? void 0 : _a.totalDevices) || 0;
|
||||
} else {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:311", "获取设备统计信息失败:", ((_b = res.data) == null ? void 0 : _b.message) || "未知错误");
|
||||
this.totalDevices = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:315", "获取设备统计信息异常:", e);
|
||||
this.totalDevices = 0;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 加载销售(人员)统计信息
|
||||
*/
|
||||
async loadSalesStatistics() {
|
||||
var _a, _b;
|
||||
try {
|
||||
const res = await common_request.get("/api/salesManagement/statistics");
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
this.totalSales = ((_a = res.data.data) == null ? void 0 : _a.totalSales) || 0;
|
||||
} else {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:329", "获取销售统计信息失败:", ((_b = res.data) == null ? void 0 : _b.message) || "未知错误");
|
||||
this.totalSales = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:333", "获取销售统计信息异常:", e);
|
||||
this.totalSales = 0;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 加载项目统计信息
|
||||
*/
|
||||
async loadProjectStatistics() {
|
||||
var _a, _b;
|
||||
try {
|
||||
const res = await common_request.get("/api/projectManagement/statistics");
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
this.totalProjects = ((_a = res.data.data) == null ? void 0 : _a.totalProjects) || 0;
|
||||
} else {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:347", "获取项目统计信息失败:", ((_b = res.data) == null ? void 0 : _b.message) || "未知错误");
|
||||
this.totalProjects = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:351", "获取项目统计信息异常:", e);
|
||||
this.totalProjects = 0;
|
||||
}
|
||||
},
|
||||
toSettings() {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages-subpackage/ucenter/settings/settings"
|
||||
});
|
||||
},
|
||||
signIn() {
|
||||
this.$refs.signIn.open();
|
||||
},
|
||||
signInByAd() {
|
||||
this.$refs.signIn.showRewardedVideoAd();
|
||||
},
|
||||
/**
|
||||
* 个人中心项目列表点击事件
|
||||
*/
|
||||
ucenterListClick(item) {
|
||||
if (!item.to && item.event) {
|
||||
this[item.event]();
|
||||
} else if (item.to) {
|
||||
const tabBarPages = ["/pages/furniture_reception/furniture_reception", "/pages/furniture_customer/furniture_customer", "/pages/furniture_top_sales/furniture_top_sales", "/pages/ucenter/ucenter"];
|
||||
if (tabBarPages.includes(item.to)) {
|
||||
common_vendor.index.switchTab({
|
||||
url: item.to
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.navigateTo({
|
||||
url: item.to
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
async checkVersion() {
|
||||
let res = await callCheckVersion();
|
||||
common_vendor.index.__f__("log", "at pages/ucenter/ucenter.vue:389", res);
|
||||
if (res.result.code > 0) {
|
||||
checkUpdate();
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.result.message,
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
},
|
||||
toUserInfo() {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/uni_modules/uni-id-pages/pages/userinfo/userinfo"
|
||||
});
|
||||
},
|
||||
tapGrid(index) {
|
||||
if (index === 3) {
|
||||
if (!this.hasLogin) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请先登录后再修改密码",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
this.openChangePasswordDialog();
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: this.$t("mine.clicked") + " " + (index + 1),
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 去应用市场评分
|
||||
*/
|
||||
gotoMarket() {
|
||||
},
|
||||
/**
|
||||
* 获取积分信息
|
||||
*/
|
||||
getScore() {
|
||||
if (!this.userInfo)
|
||||
return common_vendor.index.showToast({
|
||||
title: this.$t("mine.checkScore"),
|
||||
icon: "none"
|
||||
});
|
||||
common_vendor.index.showLoading({
|
||||
mask: true
|
||||
});
|
||||
db.collection("uni-id-scores").where('"user_id" == $env.uid').field("score,balance").orderBy("create_date", "desc").limit(1).get().then((res) => {
|
||||
common_vendor.index.__f__("log", "at pages/ucenter/ucenter.vue:462", res);
|
||||
const data = res.result.data[0];
|
||||
let msg = "";
|
||||
msg = data ? this.$t("mine.currentScore") + data.balance : this.$t("mine.noScore");
|
||||
common_vendor.index.showToast({
|
||||
title: msg,
|
||||
icon: "none"
|
||||
});
|
||||
}).finally(() => {
|
||||
common_vendor.index.hideLoading();
|
||||
});
|
||||
},
|
||||
async share() {
|
||||
let { result } = await db.collection("uni-id-users").where("'_id' == $cloudEnv_uid").field("my_invite_code").get();
|
||||
let myInviteCode = result.data[0].my_invite_code;
|
||||
if (!myInviteCode) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请检查uni-config-center中uni-id配置,是否已启用 autoSetInviteCode",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/ucenter/ucenter.vue:483", { myInviteCode });
|
||||
this.appConfig.about;
|
||||
},
|
||||
/**
|
||||
* 打开设备绑定弹窗
|
||||
*/
|
||||
openDeviceBind() {
|
||||
if (this.$refs.deviceBindPopup) {
|
||||
this.$refs.deviceBindPopup.open();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 设备绑定成功回调
|
||||
*/
|
||||
onDeviceBindSuccess() {
|
||||
this.loadDeviceStatistics();
|
||||
},
|
||||
/**
|
||||
* 打开设备列表弹窗
|
||||
*/
|
||||
openDeviceList() {
|
||||
if (this.$refs.deviceListPopup) {
|
||||
this.$refs.deviceListPopup.open();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 打开修改密码弹窗
|
||||
*/
|
||||
openChangePasswordDialog() {
|
||||
this.changePwdForm = {
|
||||
oldPassword: "",
|
||||
newPassword: "",
|
||||
confirmPassword: ""
|
||||
};
|
||||
if (this.$refs.changePwdPopup) {
|
||||
this.$refs.changePwdPopup.open();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 关闭修改密码弹窗
|
||||
*/
|
||||
closeChangePasswordDialog() {
|
||||
if (this.$refs.changePwdPopup) {
|
||||
this.$refs.changePwdPopup.close();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 提交修改密码
|
||||
*/
|
||||
async submitChangePassword() {
|
||||
var _a, _b;
|
||||
if (this.changePwdSubmitting)
|
||||
return;
|
||||
const { oldPassword, newPassword, confirmPassword } = this.changePwdForm;
|
||||
if (!oldPassword) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请输入原始密码",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
if (!newPassword) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "请输入新密码",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
if (newPassword.length < 6 || newPassword.length > 20) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "新密码长度需为 6-20 位",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
if (newPassword !== confirmPassword) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "两次输入的新密码不一致",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
this.changePwdSubmitting = true;
|
||||
try {
|
||||
if (!this.loginUserInfo.userId) {
|
||||
return common_vendor.index.showToast({
|
||||
title: "用户信息不完整,请重新登录",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
const requestData = {
|
||||
password: newPassword,
|
||||
originalPassword: oldPassword,
|
||||
userId: this.loginUserInfo.userId,
|
||||
tenantId: this.tenantId
|
||||
};
|
||||
if (this.loginUserInfo.phone) {
|
||||
requestData.phone = this.loginUserInfo.phone;
|
||||
}
|
||||
const res = await common_request.put("/api/sys/user/update", requestData);
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
this.closeChangePasswordDialog();
|
||||
common_vendor.index.showModal({
|
||||
content: res.data.message || "密码修改成功,请重新登录",
|
||||
showCancel: false,
|
||||
success: () => {
|
||||
common_vendor.index.removeStorageSync("backend-token");
|
||||
common_vendor.index.removeStorageSync("backend-login-response");
|
||||
common_vendor.index.removeStorageSync("backend-user-id");
|
||||
common_vendor.index.removeStorageSync("backend-tenant-id");
|
||||
common_vendor.index.removeStorageSync("uni_id_token");
|
||||
common_vendor.index.setStorageSync("uni_id_token_expired", 0);
|
||||
common_vendor.index.redirectTo({
|
||||
url: "/uni_modules/uni-id-pages/pages/login/login-withpwd"
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const errorMessage = ((_a = res.data) == null ? void 0 : _a.message) || "密码修改失败,请稍后重试";
|
||||
common_vendor.index.showModal({
|
||||
content: errorMessage,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ucenter/ucenter.vue:679", "密码修改失败:", e);
|
||||
const errorMessage = ((_b = e == null ? void 0 : e.data) == null ? void 0 : _b.message) || (e == null ? void 0 : e.message) || "密码修改失败,请稍后重试";
|
||||
common_vendor.index.showModal({
|
||||
content: errorMessage,
|
||||
showCancel: false
|
||||
});
|
||||
} finally {
|
||||
this.changePwdSubmitting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_sign_in2 = common_vendor.resolveComponent("uni-sign-in");
|
||||
const _easycom_cloud_image2 = common_vendor.resolveComponent("cloud-image");
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
const _easycom_uni_grid_item2 = common_vendor.resolveComponent("uni-grid-item");
|
||||
const _easycom_uni_grid2 = common_vendor.resolveComponent("uni-grid");
|
||||
const _easycom_uni_list_item2 = common_vendor.resolveComponent("uni-list-item");
|
||||
const _easycom_uni_list2 = common_vendor.resolveComponent("uni-list");
|
||||
const _component_device_bind_popup = common_vendor.resolveComponent("device-bind-popup");
|
||||
const _component_device_list_popup = common_vendor.resolveComponent("device-list-popup");
|
||||
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
||||
(_easycom_uni_sign_in2 + _easycom_cloud_image2 + _easycom_uni_icons2 + _easycom_uni_grid_item2 + _easycom_uni_grid2 + _easycom_uni_list_item2 + _easycom_uni_list2 + _component_device_bind_popup + _component_device_list_popup + _easycom_uni_easyinput2 + _easycom_uni_popup2)();
|
||||
}
|
||||
const _easycom_uni_sign_in = () => "../../uni_modules/uni-sign-in/components/uni-sign-in/uni-sign-in.js";
|
||||
const _easycom_cloud_image = () => "../../uni_modules/uni-id-pages/components/cloud-image/cloud-image.js";
|
||||
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||
const _easycom_uni_grid_item = () => "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item.js";
|
||||
const _easycom_uni_grid = () => "../../uni_modules/uni-grid/components/uni-grid/uni-grid.js";
|
||||
const _easycom_uni_list_item = () => "../../uni_modules/uni-list/components/uni-list-item/uni-list-item.js";
|
||||
const _easycom_uni_list = () => "../../uni_modules/uni-list/components/uni-list/uni-list.js";
|
||||
const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
||||
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_sign_in + _easycom_cloud_image + _easycom_uni_icons + _easycom_uni_grid_item + _easycom_uni_grid + _easycom_uni_list_item + _easycom_uni_list + _easycom_uni_easyinput + _easycom_uni_popup)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.sr("signIn", "b6546e32-0"),
|
||||
b: $options.hasLogin && $options.userInfo.avatar_file && $options.userInfo.avatar_file.url
|
||||
}, $options.hasLogin && $options.userInfo.avatar_file && $options.userInfo.avatar_file.url ? {
|
||||
c: common_vendor.p({
|
||||
width: "150rpx",
|
||||
height: "150rpx",
|
||||
src: $options.userInfo.avatar_file.url
|
||||
})
|
||||
} : {
|
||||
d: common_vendor.p({
|
||||
color: "#ffffff",
|
||||
size: "50",
|
||||
type: "person-filled"
|
||||
})
|
||||
}, {
|
||||
e: $options.hasLogin
|
||||
}, $options.hasLogin ? {
|
||||
f: common_vendor.t($options.userInfo.nickname || $options.userInfo.username || $options.userInfo.mobile)
|
||||
} : {
|
||||
g: common_vendor.t(_ctx.$t("mine.notLogged"))
|
||||
}, {
|
||||
h: common_vendor.o((...args) => $options.toUserInfo && $options.toUserInfo(...args)),
|
||||
i: $options.hasLogin
|
||||
}, $options.hasLogin ? common_vendor.e({
|
||||
j: common_vendor.t($data.tenantId || "未设置"),
|
||||
k: common_vendor.t($data.loginUserInfo.userName || "未设置"),
|
||||
l: $data.loginUserInfo.phone
|
||||
}, $data.loginUserInfo.phone ? {
|
||||
m: common_vendor.t($data.loginUserInfo.phone)
|
||||
} : {}, {
|
||||
n: $data.loginUserInfo.email
|
||||
}, $data.loginUserInfo.email ? {
|
||||
o: common_vendor.t($data.loginUserInfo.email)
|
||||
} : {}) : {}, {
|
||||
p: common_vendor.f($data.gridList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: "b6546e32-5-" + i0 + "," + ("b6546e32-4-" + i0),
|
||||
b: common_vendor.p({
|
||||
color: "#007AFF",
|
||||
type: item.icon,
|
||||
size: "26"
|
||||
}),
|
||||
c: index === 0
|
||||
}, index === 0 ? {
|
||||
d: common_vendor.t($data.totalDevices)
|
||||
} : index === 1 ? {
|
||||
f: common_vendor.t($data.totalSales)
|
||||
} : index === 2 ? {
|
||||
h: common_vendor.t($data.totalProjects)
|
||||
} : {
|
||||
i: common_vendor.t(item.text)
|
||||
}, {
|
||||
e: index === 1,
|
||||
g: index === 2,
|
||||
j: common_vendor.o(($event) => $options.tapGrid(index), index),
|
||||
k: index,
|
||||
l: "b6546e32-4-" + i0 + ",b6546e32-3"
|
||||
});
|
||||
}),
|
||||
q: common_vendor.p({
|
||||
column: 4,
|
||||
showBorder: false,
|
||||
square: true
|
||||
}),
|
||||
r: common_vendor.f($data.ucenterList, (sublist, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.f(sublist, (item, i, i1) => {
|
||||
return common_vendor.e({
|
||||
a: item.showBadge
|
||||
}, item.showBadge ? {
|
||||
b: common_vendor.t(item.rightText)
|
||||
} : {}, {
|
||||
c: i,
|
||||
d: common_vendor.o(($event) => $options.ucenterListClick(item), i),
|
||||
e: "b6546e32-7-" + i0 + "-" + i1 + "," + ("b6546e32-6-" + i0),
|
||||
f: common_vendor.p({
|
||||
title: item.title,
|
||||
link: true,
|
||||
rightText: item.rightText,
|
||||
clickable: true,
|
||||
to: item.to,
|
||||
["show-extra-icon"]: true,
|
||||
extraIcon: {
|
||||
type: item.icon,
|
||||
color: "#999"
|
||||
}
|
||||
})
|
||||
});
|
||||
}),
|
||||
b: index,
|
||||
c: "b6546e32-6-" + i0
|
||||
};
|
||||
}),
|
||||
s: common_vendor.sr("deviceBindPopup", "b6546e32-8"),
|
||||
t: common_vendor.o($options.onDeviceBindSuccess),
|
||||
v: common_vendor.sr("deviceListPopup", "b6546e32-9"),
|
||||
w: common_vendor.o(($event) => $data.changePwdForm.oldPassword = $event),
|
||||
x: common_vendor.p({
|
||||
type: "password",
|
||||
placeholder: "请输入原始密码",
|
||||
modelValue: $data.changePwdForm.oldPassword
|
||||
}),
|
||||
y: common_vendor.o(($event) => $data.changePwdForm.newPassword = $event),
|
||||
z: common_vendor.p({
|
||||
type: "password",
|
||||
placeholder: "请输入新密码(6-20位)",
|
||||
modelValue: $data.changePwdForm.newPassword
|
||||
}),
|
||||
A: common_vendor.o(($event) => $data.changePwdForm.confirmPassword = $event),
|
||||
B: common_vendor.p({
|
||||
type: "password",
|
||||
placeholder: "请再次输入新密码",
|
||||
modelValue: $data.changePwdForm.confirmPassword
|
||||
}),
|
||||
C: common_vendor.o((...args) => $options.closeChangePasswordDialog && $options.closeChangePasswordDialog(...args)),
|
||||
D: common_vendor.t($data.changePwdSubmitting ? "提交中..." : "提交"),
|
||||
E: $data.changePwdSubmitting,
|
||||
F: common_vendor.o((...args) => $options.submitChangePassword && $options.submitChangePassword(...args)),
|
||||
G: common_vendor.sr("changePwdPopup", "b6546e32-10"),
|
||||
H: common_vendor.p({
|
||||
type: "dialog"
|
||||
})
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b6546e32"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/ucenter/ucenter.js.map
|
||||
16
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.json
vendored
Normal file
16
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"device-bind-popup": "./components/DeviceBindPopup",
|
||||
"device-list-popup": "./components/DeviceListPopup",
|
||||
"cloud-image": "../../uni_modules/uni-id-pages/components/cloud-image/cloud-image",
|
||||
"uni-sign-in": "../../uni_modules/uni-sign-in/components/uni-sign-in/uni-sign-in",
|
||||
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
|
||||
"uni-grid-item": "../../uni_modules/uni-grid/components/uni-grid-item/uni-grid-item",
|
||||
"uni-grid": "../../uni_modules/uni-grid/components/uni-grid/uni-grid",
|
||||
"uni-list-item": "../../uni_modules/uni-list/components/uni-list-item/uni-list-item",
|
||||
"uni-list": "../../uni_modules/uni-list/components/uni-list/uni-list",
|
||||
"uni-easyinput": "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput",
|
||||
"uni-popup": "../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="center data-v-b6546e32"><uni-sign-in class="r data-v-b6546e32" u-r="signIn" u-i="b6546e32-0" bind:__l="__l"></uni-sign-in><view class="userInfo data-v-b6546e32" capture-bind:tap="{{h}}"><cloud-image wx:if="{{b}}" class="data-v-b6546e32" u-i="b6546e32-1" bind:__l="__l" u-p="{{c}}"></cloud-image><view wx:else class="defaultAvatarUrl data-v-b6546e32"><uni-icons wx:if="{{d}}" class="data-v-b6546e32" u-i="b6546e32-2" bind:__l="__l" u-p="{{d}}"/></view><view class="logo-title data-v-b6546e32"><text wx:if="{{e}}" class="uer-name data-v-b6546e32">{{f}}</text><text wx:else class="uer-name data-v-b6546e32">{{g}}</text></view></view><view wx:if="{{i}}" class="user-info-panel data-v-b6546e32"><view class="info-row data-v-b6546e32"><text class="info-label data-v-b6546e32">租户ID:</text><text class="info-value data-v-b6546e32">{{j}}</text></view><view class="info-row data-v-b6546e32"><text class="info-label data-v-b6546e32">用户名:</text><text class="info-value data-v-b6546e32">{{k}}</text></view><view wx:if="{{l}}" class="info-row data-v-b6546e32"><text class="info-label data-v-b6546e32">手机号:</text><text class="info-value data-v-b6546e32">{{m}}</text></view><view wx:if="{{n}}" class="info-row data-v-b6546e32"><text class="info-label data-v-b6546e32">邮箱:</text><text class="info-value data-v-b6546e32">{{o}}</text></view></view><uni-grid wx:if="{{q}}" u-s="{{['d']}}" class="grid data-v-b6546e32" u-i="b6546e32-3" bind:__l="__l" u-p="{{q}}"><uni-grid-item wx:for="{{p}}" wx:for-item="item" wx:key="k" u-s="{{['d']}}" class="item data-v-b6546e32" bindclick="{{item.j}}" u-i="{{item.l}}" bind:__l="__l"><uni-icons wx:if="{{item.b}}" class="icon data-v-b6546e32" u-i="{{item.a}}" bind:__l="__l" u-p="{{item.b}}"></uni-icons><view wx:if="{{item.c}}" class="device-text-wrapper data-v-b6546e32"><text class="device-label data-v-b6546e32">设备总数</text><text class="device-count data-v-b6546e32">{{item.d}}</text></view><view wx:elif="{{item.e}}" class="device-text-wrapper data-v-b6546e32"><text class="device-label data-v-b6546e32">人员总数</text><text class="device-count data-v-b6546e32">{{item.f}}</text></view><view wx:elif="{{item.g}}" class="device-text-wrapper data-v-b6546e32"><text class="device-label data-v-b6546e32">项目总数</text><text class="device-count data-v-b6546e32">{{item.h}}</text></view><text wx:else class="text data-v-b6546e32">{{item.i}}</text></uni-grid-item></uni-grid><uni-list wx:for="{{r}}" wx:for-item="sublist" wx:key="b" u-s="{{['d']}}" class="center-list data-v-b6546e32" u-i="{{sublist.c}}" bind:__l="__l"><uni-list-item wx:for="{{sublist.a}}" wx:for-item="item" wx:key="c" class="data-v-b6546e32" u-s="{{['footer']}}" bindclick="{{item.d}}" u-i="{{item.e}}" bind:__l="__l" u-p="{{item.f}}"><view slot="footer"><view wx:if="{{item.a}}" class="item-footer data-v-b6546e32"><text class="item-footer-text data-v-b6546e32">{{item.b}}</text><view class="item-footer-badge data-v-b6546e32"></view></view></view></uni-list-item></uni-list><device-bind-popup class="r data-v-b6546e32" u-r="deviceBindPopup" bindsuccess="{{t}}" u-i="b6546e32-8" bind:__l="__l"></device-bind-popup><device-list-popup class="r data-v-b6546e32" u-r="deviceListPopup" u-i="b6546e32-9" bind:__l="__l"></device-list-popup><uni-popup wx:if="{{H}}" class="r data-v-b6546e32" u-s="{{['d']}}" u-r="changePwdPopup" u-i="b6546e32-10" bind:__l="__l" u-p="{{H}}"><view class="change-pwd-dialog data-v-b6546e32"><view class="change-pwd-title data-v-b6546e32">修改密码</view><view class="change-pwd-field data-v-b6546e32"><text class="change-pwd-label data-v-b6546e32">原始密码</text><uni-easyinput wx:if="{{x}}" class="data-v-b6546e32" u-i="b6546e32-11,b6546e32-10" bind:__l="__l" bindupdateModelValue="{{w}}" u-p="{{x}}"/></view><view class="change-pwd-field data-v-b6546e32"><text class="change-pwd-label data-v-b6546e32">新密码</text><uni-easyinput wx:if="{{z}}" class="data-v-b6546e32" u-i="b6546e32-12,b6546e32-10" bind:__l="__l" bindupdateModelValue="{{y}}" u-p="{{z}}"/></view><view class="change-pwd-field data-v-b6546e32"><text class="change-pwd-label data-v-b6546e32">确认密码</text><uni-easyinput wx:if="{{B}}" class="data-v-b6546e32" u-i="b6546e32-13,b6546e32-10" bind:__l="__l" bindupdateModelValue="{{A}}" u-p="{{B}}"/></view><view class="change-pwd-actions data-v-b6546e32"><button class="dialog-btn cancel data-v-b6546e32" bindtap="{{C}}">取消</button><button class="dialog-btn confirm data-v-b6546e32" disabled="{{E}}" bindtap="{{F}}">{{D}}</button></view></view></uni-popup></view>
|
||||
205
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.wxss
vendored
Normal file
205
unpackage/dist/dev/mp-weixin/pages/ucenter/ucenter.wxss
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user