Browse Source

渲染小程序

main
maochaoying 2 years ago
parent
commit
7c8053f023
  1. 63
      pages/index/index.vue
  2. 38
      unpackage/dist/dev/mp-weixin/common/vendor.js
  3. 66
      unpackage/dist/dev/mp-weixin/pages/index/index.js
  4. 2
      unpackage/dist/dev/mp-weixin/pages/index/index.wxml
  5. 3
      unpackage/dist/dev/mp-weixin/project.private.config.json

63
pages/index/index.vue

@ -4,11 +4,11 @@
<view class="info_container">
<view class="name_wrap">
<image src="/static/user.png" class="name_logo"></image>
<text class="name">姓名 : 张三</text>
<text class="name">姓名 : {{username}}</text>
</view>
<view class="idcard_wrap">
<image src="/static/card.png" class="card_logo"></image>
<text class="card_number">身份证号 : 123456202301010000</text>
<text class="card_number">身份证号 : {{idcard}}</text>
</view>
</view>
</view>
@ -16,65 +16,65 @@
<view class="grid_box background1">
<text class="main_title">L-乳酸</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c1 : '0'}}mmol / L</text>
</view>
</view>
<view class="grid_box background2">
<text class="main_title">肌酸</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c2 : '0'}}mmol / L</text>
</view>
</view>
<view class="grid_box background3">
<text class="main_title">肌酐</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c3 : '0'}}mmol / L</text>
</view>
</view>
<view class="grid_box background4">
<text class="main_title">尿素</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c4 : '0'}}mmol / L</text>
</view>
</view>
<view class="grid_box background5">
<text class="main_title">β-羟丁酸</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c5 : '0'}}mmol / L</text>
</view>
</view>
<view class="grid_box background6">
<text class="main_title">L-谷氨酸</text>
<view class="capacity_btn">
<text class="unit">00mmol / L</text>
<text class="unit">{{resultList?.length > 0 ? resultList[0]?.c6 : '0'}}mmol / L</text>
</view>
</view>
</view>
<view class="content" v-if="activeTab == 1">
<view class="card_wrap" v-for="item in 10" :key="item">
<view class="card_wrap" v-for="item in resultList" :key="item.id">
<view class="time_wrap">
<image src="/static/time.png" class="time_logo"></image>
<text class="date">2023-07-01</text>
<text class="time">14:20</text>
<text class="date">{{ item.testDate?.split(' ')[0] }}</text>
<text class="time">{{ item.testDate?.split(' ')[1] }}</text>
</view>
<view class="info_grid">
<view class="info bg1">
<text>L-乳酸 00mmol/L</text>
<text>L-乳酸 {{item.c1}}mmol/L</text>
</view>
<view class="info bg2">
<text>肌酸 00mmol/L</text>
<text>肌酸 {{item.c2}}mmol/L</text>
</view>
<view class="info bg3">
<text>肌酐 00mmol/L</text>
<text>肌酐 {{item.c3}}mmol/L</text>
</view>
<view class="info bg4">
<text>尿素 00mmol/L</text>
<text>尿素 {{item.c4}}mmol/L</text>
</view>
<view class="info bg5">
<text>β-羟丁酸 00mmol/L</text>
<text>β-羟丁酸 {{item.c5}}mmol/L</text>
</view>
<view class="info bg6">
<text>L-谷氨酸 00mmol/L</text>
<text>L-谷氨酸 {{item.c6}}mmol/L</text>
</view>
</view>
</view>
@ -92,27 +92,36 @@
</view>
</template>
<script>
<script>
export default {
data() {
return {
activeTab: 0
activeTab: 0,
idcard: '',
username: '',
resultList: []
}
},
onLoad() {
const self = this
// tab
// tab
// username idcard
uni.request({
url: 'https://www.example.com/request', //
data: {
text: 'uni.request'
},
header: {
'custom-header': 'hello' //
},
url: 'http://localhost:8080/zsjyadmin/detection/current',
method:"GET",
success: (res) => {
console.log(res.data);
if (res?.data?.code == 0){
const data = res?.data?.data
const {idcard, username, resultList} = data || {}
self.idcard = idcard
self.username = username
// resultList id
resultList.sort((a, b) => {
return b.id - a.id
})
self.resultList = resultList
}
}
});
},

38
unpackage/dist/dev/mp-weixin/common/vendor.js

@ -34,6 +34,28 @@ function normalizeClass(value) {
}
return res.trim();
}
const toDisplayString = (val) => {
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
};
const replacer = (_key, val) => {
if (val && val.__v_isRef) {
return replacer(_key, val.value);
} else if (isMap(val)) {
return {
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
entries[`${key} =>`] = val2;
return entries;
}, {})
};
} else if (isSet(val)) {
return {
[`Set(${val.size})`]: [...val.values()]
};
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
return String(val);
}
return val;
};
const EMPTY_OBJ = Object.freeze({});
const EMPTY_ARR = Object.freeze([]);
const NOOP = () => {
@ -442,9 +464,9 @@ function assertType$1(value, type) {
let valid;
const expectedType = getType$1(type);
if (isSimpleType$1(expectedType)) {
const t = typeof value;
valid = t === expectedType.toLowerCase();
if (!valid && t === "object") {
const t2 = typeof value;
valid = t2 === expectedType.toLowerCase();
if (!valid && t2 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
@ -4420,7 +4442,7 @@ function isSameType(a, b) {
}
function getTypeIndex(type, expectedTypes) {
if (isArray(expectedTypes)) {
return expectedTypes.findIndex((t) => isSameType(t, type));
return expectedTypes.findIndex((t2) => isSameType(t2, type));
} else if (isFunction(expectedTypes)) {
return isSameType(expectedTypes, type) ? 0 : -1;
}
@ -4468,9 +4490,9 @@ function assertType(value, type) {
let valid;
const expectedType = getType(type);
if (isSimpleType(expectedType)) {
const t = typeof value;
valid = t === expectedType.toLowerCase();
if (!valid && t === "object") {
const t2 = typeof value;
valid = t2 === expectedType.toLowerCase();
if (!valid && t2 === "object") {
valid = value instanceof type;
}
} else if (expectedType === "Object") {
@ -5878,6 +5900,7 @@ const o = (value, key) => vOn(value, key);
const f = (source, renderItem) => vFor(source, renderItem);
const e = (target, ...sources) => extend(target, ...sources);
const n = (value) => normalizeClass(value);
const t = (val) => toDisplayString(val);
function createApp$1(rootComponent, rootProps = null) {
rootComponent && (rootComponent.mpType = "app");
return createVueApp(rootComponent, rootProps).use(plugin);
@ -6708,3 +6731,4 @@ exports.f = f;
exports.index = index;
exports.n = n;
exports.o = o;
exports.t = t;

66
unpackage/dist/dev/mp-weixin/pages/index/index.js

@ -3,22 +3,29 @@ const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
data() {
return {
activeTab: 0
activeTab: 0,
idcard: "",
username: "",
resultList: []
};
},
onLoad() {
const self = this;
common_vendor.index.request({
url: "https://www.example.com/request",
//仅为示例,并非真实接口地址。
data: {
text: "uni.request"
},
header: {
"custom-header": "hello"
//自定义请求头信息
},
url: "http://localhost:8080/zsjyadmin/detection/current",
method: "GET",
success: (res) => {
console.log(res.data);
var _a, _b;
if (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.code) == 0) {
const data = (_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data;
const { idcard, username, resultList } = data || {};
self.idcard = idcard;
self.username = username;
resultList.sort((a, b) => {
return b.id - a.id;
});
self.resultList = resultList;
}
}
});
},
@ -29,21 +36,40 @@ const _sfc_main = {
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
return common_vendor.e({
a: $data.activeTab == 0
}, $data.activeTab == 0 ? {} : {}, {
b: $data.activeTab == 1
a: common_vendor.t($data.username),
b: common_vendor.t($data.idcard),
c: $data.activeTab == 0
}, $data.activeTab == 0 ? {
d: common_vendor.t(((_a = $data.resultList) == null ? void 0 : _a.length) > 0 ? (_b = $data.resultList[0]) == null ? void 0 : _b.c1 : "0"),
e: common_vendor.t(((_c = $data.resultList) == null ? void 0 : _c.length) > 0 ? (_d = $data.resultList[0]) == null ? void 0 : _d.c2 : "0"),
f: common_vendor.t(((_e = $data.resultList) == null ? void 0 : _e.length) > 0 ? (_f = $data.resultList[0]) == null ? void 0 : _f.c3 : "0"),
g: common_vendor.t(((_g = $data.resultList) == null ? void 0 : _g.length) > 0 ? (_h = $data.resultList[0]) == null ? void 0 : _h.c4 : "0"),
h: common_vendor.t(((_i = $data.resultList) == null ? void 0 : _i.length) > 0 ? (_j = $data.resultList[0]) == null ? void 0 : _j.c5 : "0"),
i: common_vendor.t(((_k = $data.resultList) == null ? void 0 : _k.length) > 0 ? (_l = $data.resultList[0]) == null ? void 0 : _l.c6 : "0")
} : {}, {
j: $data.activeTab == 1
}, $data.activeTab == 1 ? {
c: common_vendor.f(10, (item, k0, i0) => {
k: common_vendor.f($data.resultList, (item, k0, i0) => {
var _a2, _b2;
return {
a: item
a: common_vendor.t((_a2 = item.testDate) == null ? void 0 : _a2.split(" ")[0]),
b: common_vendor.t((_b2 = item.testDate) == null ? void 0 : _b2.split(" ")[1]),
c: common_vendor.t(item.c1),
d: common_vendor.t(item.c2),
e: common_vendor.t(item.c3),
f: common_vendor.t(item.c4),
g: common_vendor.t(item.c5),
h: common_vendor.t(item.c6),
i: item.id
};
})
} : {}, {
d: common_vendor.n($data.activeTab == 0 ? "btn active" : "btn"),
e: common_vendor.o(($event) => $options.changeActiveTab(0)),
f: common_vendor.n($data.activeTab == 1 ? "btn active" : "btn"),
g: common_vendor.o(($event) => $options.changeActiveTab(1))
l: common_vendor.n($data.activeTab == 0 ? "btn active" : "btn"),
m: common_vendor.o(($event) => $options.changeActiveTab(0)),
n: common_vendor.n($data.activeTab == 1 ? "btn active" : "btn"),
o: common_vendor.o(($event) => $options.changeActiveTab(1))
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/cool/Desktop/code/gold-field/pages/index/index.vue"]]);

2
unpackage/dist/dev/mp-weixin/pages/index/index.wxml

@ -1 +1 @@
<view class="main_content"><view class="header_info"><view class="info_container"><view class="name_wrap"><image src="/static/user.png" class="name_logo"></image><text class="name">姓名 : 张三</text></view><view class="idcard_wrap"><image src="/static/card.png" class="card_logo"></image><text class="card_number">身份证号 : 123456202301010000</text></view></view></view><view wx:if="{{a}}" class="grid_layout content"><view class="grid_box background1"><text class="main_title">L-乳酸</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view><view class="grid_box background2"><text class="main_title">肌酸</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view><view class="grid_box background3"><text class="main_title">肌酐</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view><view class="grid_box background4"><text class="main_title">尿素</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view><view class="grid_box background5"><text class="main_title">β-羟丁酸</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view><view class="grid_box background6"><text class="main_title">L-谷氨酸</text><view class="capacity_btn"><text class="unit">00mmol / L</text></view></view></view><view wx:if="{{b}}" class="content"><view wx:for="{{c}}" wx:for-item="item" wx:key="a" class="card_wrap"><view class="time_wrap"><image src="/static/time.png" class="time_logo"></image><text class="date">2023-07-01</text><text class="time">14:20</text></view><view class="info_grid"><view class="info bg1"><text>L-乳酸 00mmol/L</text></view><view class="info bg2"><text>肌酸 00mmol/L</text></view><view class="info bg3"><text>肌酐 00mmol/L</text></view><view class="info bg4"><text>尿素 00mmol/L</text></view><view class="info bg5"><text>β-羟丁酸 00mmol/L</text></view><view class="info bg6"><text>L-谷氨酸 00mmol/L</text></view></view></view></view><view class="footer_tab"><view class="{{d}}" bindtap="{{e}}"><image src="/static/result.png" class="result_logo"></image><text class="font_btn">当前结果</text></view><view class="{{f}}" bindtap="{{g}}"><image src="/static/data.png" class="history_logo"></image><text class="font_btn">历史数据</text></view></view></view>
<view class="main_content"><view class="header_info"><view class="info_container"><view class="name_wrap"><image src="/static/user.png" class="name_logo"></image><text class="name">姓名 : {{a}}</text></view><view class="idcard_wrap"><image src="/static/card.png" class="card_logo"></image><text class="card_number">身份证号 : {{b}}</text></view></view></view><view wx:if="{{c}}" class="grid_layout content"><view class="grid_box background1"><text class="main_title">L-乳酸</text><view class="capacity_btn"><text class="unit">{{d}}mmol / L</text></view></view><view class="grid_box background2"><text class="main_title">肌酸</text><view class="capacity_btn"><text class="unit">{{e}}mmol / L</text></view></view><view class="grid_box background3"><text class="main_title">肌酐</text><view class="capacity_btn"><text class="unit">{{f}}mmol / L</text></view></view><view class="grid_box background4"><text class="main_title">尿素</text><view class="capacity_btn"><text class="unit">{{g}}mmol / L</text></view></view><view class="grid_box background5"><text class="main_title">β-羟丁酸</text><view class="capacity_btn"><text class="unit">{{h}}mmol / L</text></view></view><view class="grid_box background6"><text class="main_title">L-谷氨酸</text><view class="capacity_btn"><text class="unit">{{i}}mmol / L</text></view></view></view><view wx:if="{{j}}" class="content"><view wx:for="{{k}}" wx:for-item="item" wx:key="i" class="card_wrap"><view class="time_wrap"><image src="/static/time.png" class="time_logo"></image><text class="date">{{item.a}}</text><text class="time">{{item.b}}</text></view><view class="info_grid"><view class="info bg1"><text>L-乳酸 {{item.c}}mmol/L</text></view><view class="info bg2"><text>肌酸 {{item.d}}mmol/L</text></view><view class="info bg3"><text>肌酐 {{item.e}}mmol/L</text></view><view class="info bg4"><text>尿素 {{item.f}}mmol/L</text></view><view class="info bg5"><text>β-羟丁酸 {{item.g}}mmol/L</text></view><view class="info bg6"><text>L-谷氨酸 {{item.h}}mmol/L</text></view></view></view></view><view class="footer_tab"><view class="{{l}}" bindtap="{{m}}"><image src="/static/result.png" class="result_logo"></image><text class="font_btn">当前结果</text></view><view class="{{n}}" bindtap="{{o}}"><image src="/static/data.png" class="history_logo"></image><text class="font_btn">历史数据</text></view></view></view>

3
unpackage/dist/dev/mp-weixin/project.private.config.json

@ -2,6 +2,7 @@
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "gold-field",
"setting": {
"compileHotReLoad": true
"compileHotReLoad": true,
"urlCheck": false
}
}
Loading…
Cancel
Save