You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
459 lines
14 KiB
459 lines
14 KiB
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
(function(vue) {
|
|
"use strict";
|
|
function _interopNamespace(e) {
|
|
if (e && e.__esModule)
|
|
return e;
|
|
var n = { __proto__: null, [Symbol.toStringTag]: "Module" };
|
|
if (e) {
|
|
Object.keys(e).forEach(function(k) {
|
|
if (k !== "default") {
|
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
Object.defineProperty(n, k, d.get ? d : {
|
|
enumerable: true,
|
|
get: function() {
|
|
return e[k];
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
n["default"] = e;
|
|
return Object.freeze(n);
|
|
}
|
|
var vue__namespace = /* @__PURE__ */ _interopNamespace(vue);
|
|
Object.freeze({});
|
|
Object.freeze([]);
|
|
const objectToString = Object.prototype.toString;
|
|
const toTypeString = (value) => objectToString.call(value);
|
|
const toRawType = (value) => {
|
|
return toTypeString(value).slice(8, -1);
|
|
};
|
|
function isDebugMode() {
|
|
return typeof __channelId__ === "string" && __channelId__;
|
|
}
|
|
function jsonStringifyReplacer(k, p) {
|
|
switch (toRawType(p)) {
|
|
case "Function":
|
|
return "function() { [native code] }";
|
|
default:
|
|
return p;
|
|
}
|
|
}
|
|
function normalizeLog(type, filename, args) {
|
|
if (isDebugMode()) {
|
|
args.push(filename.replace("at ", "uni-app:///"));
|
|
return console[type].apply(console, args);
|
|
}
|
|
const msgs = args.map(function(v) {
|
|
const type2 = toTypeString(v).toLowerCase();
|
|
if (type2 === "[object object]" || type2 === "[object array]") {
|
|
try {
|
|
v = "---BEGIN:JSON---" + JSON.stringify(v, jsonStringifyReplacer) + "---END:JSON---";
|
|
} catch (e) {
|
|
v = type2;
|
|
}
|
|
} else {
|
|
if (v === null) {
|
|
v = "---NULL---";
|
|
} else if (v === void 0) {
|
|
v = "---UNDEFINED---";
|
|
} else {
|
|
const vType = toRawType(v).toUpperCase();
|
|
if (vType === "NUMBER" || vType === "BOOLEAN") {
|
|
v = "---BEGIN:" + vType + "---" + v + "---END:" + vType + "---";
|
|
} else {
|
|
v = String(v);
|
|
}
|
|
}
|
|
}
|
|
return v;
|
|
});
|
|
return msgs.join("---COMMA---") + " " + filename;
|
|
}
|
|
function formatAppLog(type, filename, ...args) {
|
|
const res = normalizeLog(type, filename, args);
|
|
res && console[type](res);
|
|
}
|
|
const toString = Object.prototype.toString;
|
|
function is(val, type) {
|
|
return toString.call(val) === `[object ${type}]`;
|
|
}
|
|
function isFunction(val) {
|
|
return is(val, "Function");
|
|
}
|
|
const urlEnv$1 = "";
|
|
const uplaodUrl = `https://api-ops-yyt${urlEnv$1}.qniao.cn/cloud-print-user-center/utils/uploadImage`;
|
|
class Http {
|
|
constructor(config2 = {}, {
|
|
reqInterceptor: reqInterceptor2,
|
|
resInterceptor: resInterceptor2,
|
|
tranformConfig: tranformConfig2
|
|
} = {}) {
|
|
this.baseUrl = config2.baseUrl;
|
|
this.header = config2.header || {
|
|
"content-type": "application/json;charset=UTF-8"
|
|
};
|
|
this.requestOption = config2.requestOption || {};
|
|
this.reqInterceptor = reqInterceptor2;
|
|
this.resInterceptor = resInterceptor2;
|
|
this.tranformConfig = tranformConfig2;
|
|
}
|
|
post(config2, options) {
|
|
return this.request(__spreadValues({
|
|
method: "POST"
|
|
}, config2), options);
|
|
}
|
|
get(config2, options) {
|
|
return this.request(__spreadValues({
|
|
method: "GET"
|
|
}, config2), options);
|
|
}
|
|
request(config2, options) {
|
|
let conf = Object.assign({}, config2);
|
|
const {
|
|
tranformConfig: tranformConfig2,
|
|
reqInterceptor: reqInterceptor2,
|
|
resInterceptor: resInterceptor2
|
|
} = this;
|
|
if (tranformConfig2 && isFunction(tranformConfig2)) {
|
|
conf = tranformConfig2(this, config2);
|
|
}
|
|
let opt = Object.assign({}, this.requestOption, options);
|
|
if (reqInterceptor2 && isFunction(reqInterceptor2)) {
|
|
conf = reqInterceptor2(conf, opt);
|
|
}
|
|
return new Promise((resolve, reject2) => {
|
|
uni.request({
|
|
url: conf.url,
|
|
data: conf.data,
|
|
header: conf.header,
|
|
success: (res) => {
|
|
formatAppLog("log", "at utils/http/http.js:57", "native response", res);
|
|
let data = resInterceptor2(res, opt);
|
|
resolve(data);
|
|
},
|
|
fail: (err) => {
|
|
uni.showToast({
|
|
title: "\u53D1\u751F\u672A\u77E5\u9519\u8BEF\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D"
|
|
});
|
|
reject2(err);
|
|
}
|
|
});
|
|
}).catch((err) => {
|
|
formatAppLog("log", "at utils/http/http.js:72", "native response error", err);
|
|
});
|
|
}
|
|
uploadFile(config2, options) {
|
|
return new Promise((resolve, rejetc) => {
|
|
let conf = Object.assign({}, config2);
|
|
conf.url = uplaodUrl;
|
|
const {
|
|
reqInterceptor: reqInterceptor2
|
|
} = this;
|
|
let opt = Object.assign({}, this.requestOption, options);
|
|
if (reqInterceptor2 && isFunction(reqInterceptor2)) {
|
|
conf = reqInterceptor2(conf, opt);
|
|
}
|
|
delete conf.header["Content-Type"];
|
|
uni.uploadFile({
|
|
url: conf.url,
|
|
header: __spreadProps(__spreadValues({}, conf.header), {
|
|
image: config2.data.filePath
|
|
}),
|
|
filePath: config2.data.filePath,
|
|
name: config2.data.fileName || "image",
|
|
formData: {
|
|
image: config2.data.filePath
|
|
},
|
|
success: (res) => {
|
|
uni.hideLoading();
|
|
resolve(res.data);
|
|
},
|
|
fail: (err) => {
|
|
reject(err);
|
|
}
|
|
});
|
|
}).catch((err) => {
|
|
formatAppLog("log", "at utils/http/http.js:109", "upload native err", err);
|
|
});
|
|
}
|
|
}
|
|
const urlEnv = "";
|
|
const xappid = "503258978847965388";
|
|
const prefixList = {
|
|
"/trading-center": `https://api-client-yyt${urlEnv}.qniao.cn`,
|
|
"/cloud-print-user-center": `https://api-client-yyt${urlEnv}.qniao.cn`,
|
|
"/uec": `https://api-client-uec${urlEnv}.qniao.cn`
|
|
};
|
|
const config = {
|
|
baseUrl: "",
|
|
header: {
|
|
"content-type": "application/json;charset=UTF-8"
|
|
},
|
|
requestOption: {
|
|
hideLoading: false,
|
|
isReturnNativeResponse: false,
|
|
isTransformResponse: true
|
|
}
|
|
};
|
|
const reqInterceptor = (config2, options) => {
|
|
const token = uni.getStorageSync("Qn_token");
|
|
config2.header = __spreadProps(__spreadValues({}, config2.header), {
|
|
"Authorization": token || "iHP4V/g6O5DXHixyNrf7tm/UsBwShEYjzGx1kBBPitXOsbrMnv5z4DHjhbgWwrgz/eyAbzsk0APv+gBprZdnNQ==",
|
|
"X-APP-ID": xappid
|
|
});
|
|
let newUrl = "";
|
|
const { url = "" } = config2;
|
|
if (url.startsWith("http")) {
|
|
newUrl = url;
|
|
} else {
|
|
for (let key in prefixList) {
|
|
if (url.startsWith(key)) {
|
|
newUrl = prefixList[key] + url;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
config2.url = newUrl;
|
|
if (!options.hideLoading) {
|
|
uni.showLoading({
|
|
title: "\u52A0\u8F7D\u4E2D..."
|
|
});
|
|
}
|
|
return config2;
|
|
};
|
|
const resInterceptor = (response, options) => {
|
|
if (options.isReturnNativeResponse) {
|
|
return response;
|
|
}
|
|
if (!options.isTransformResponse) {
|
|
return response.data;
|
|
}
|
|
const { statusCode } = response;
|
|
const res = response.data;
|
|
if (statusCode >= 200 && statusCode < 300) {
|
|
uni.hideLoading();
|
|
return res;
|
|
} else {
|
|
uni.showToast({
|
|
title: "\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D"
|
|
});
|
|
return null;
|
|
}
|
|
};
|
|
const tranformConfig = (ins, config2) => {
|
|
let conf = __spreadValues({}, config2);
|
|
conf.baseUrl = config2.baseUrl || ins.baseUrl || "";
|
|
conf.header = config2.header || ins.header;
|
|
conf.method = config2.method || "GET";
|
|
conf.data = config2.data || config2.params || {};
|
|
conf.dataType = config2.dataType || "json";
|
|
conf.responseType = config2.responseType || "text";
|
|
return conf;
|
|
};
|
|
const http = new Http(config, {
|
|
reqInterceptor,
|
|
resInterceptor,
|
|
tranformConfig
|
|
});
|
|
const upload = (data) => {
|
|
return http.uploadFile({
|
|
data
|
|
});
|
|
};
|
|
let userInfoString = uni.getStorageSync("userInfo") || "{}";
|
|
let userInfoStore = JSON.parse(userInfoString);
|
|
const userInfo = vue.reactive({
|
|
userId: userInfoStore.userId,
|
|
name: userInfoStore.name,
|
|
userType: userInfoStore.userType
|
|
});
|
|
let globalInfoString = uni.getStorageSync("userInfo") || "{}";
|
|
let globalInfoStore = JSON.parse(globalInfoString);
|
|
vue.reactive({
|
|
token: globalInfoStore["Qn_token"],
|
|
loginToken: globalInfoStore["loginToken"]
|
|
});
|
|
const userAction = {
|
|
getUserInfo: () => {
|
|
return vue.readonly(userInfo);
|
|
},
|
|
setUserInfo: (newValue) => {
|
|
let keys = Object.keys(newValue);
|
|
keys.forEach((key) => {
|
|
if (userInfo.hasOwnProperty(key)) {
|
|
userInfo[key] = newValue[key];
|
|
}
|
|
});
|
|
uni.setStorageSync("userInfo", JSON.stringify(userInfo));
|
|
}
|
|
};
|
|
var _imports_0 = "/static/logo.png";
|
|
var _export_sfc = (sfc, props) => {
|
|
for (const [key, val] of props) {
|
|
sfc[key] = val;
|
|
}
|
|
return sfc;
|
|
};
|
|
const _sfc_main$5 = {
|
|
setup() {
|
|
const title = vue.ref("12");
|
|
let name = "zhangsan";
|
|
const changeTitle = () => {
|
|
title.value = title.value === "12" ? "345" : "12";
|
|
uni.chooseImage({
|
|
success: (chooseImageRes) => {
|
|
const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
upload({ filePath: tempFilePaths[0] }).then((res) => {
|
|
formatAppLog("log", "at pages/client/index.vue:37", "res", res);
|
|
});
|
|
}
|
|
});
|
|
name == "zhangsan" ? name = "lisi" : name = "zhangsan";
|
|
userAction.setUserInfo({ name });
|
|
};
|
|
const userName = vue.computed(() => {
|
|
return userAction.getUserInfo().name;
|
|
});
|
|
vue.inject("$pubFn");
|
|
return {
|
|
title,
|
|
changeTitle,
|
|
userName
|
|
};
|
|
}
|
|
};
|
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
|
|
vue.createElementVNode("image", {
|
|
class: "logo",
|
|
src: _imports_0
|
|
}),
|
|
vue.createElementVNode("view", { class: "text-area" }, [
|
|
vue.createElementVNode("view", null, vue.toDisplayString($setup.userName), 1),
|
|
vue.createElementVNode("text", {
|
|
onClick: _cache[0] || (_cache[0] = (...args) => $setup.changeTitle && $setup.changeTitle(...args)),
|
|
class: "title"
|
|
}, "123")
|
|
])
|
|
]);
|
|
}
|
|
var PagesClientIndex = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4]]);
|
|
const _sfc_main$4 = {
|
|
setup() {
|
|
return {};
|
|
}
|
|
};
|
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, " trade ");
|
|
}
|
|
var PagesTradeIndex = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3]]);
|
|
const _sfc_main$3 = {
|
|
setup() {
|
|
return {};
|
|
}
|
|
};
|
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, " mall ");
|
|
}
|
|
var PagesMallIndex = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);
|
|
const _sfc_main$2 = {
|
|
setup() {
|
|
return {};
|
|
}
|
|
};
|
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, " mine ");
|
|
}
|
|
var PagesMineIndex = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
|
|
const _sfc_main$1 = {
|
|
setup() {
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return vue.openBlock(), vue.createElementBlock("view", null, " login ");
|
|
}
|
|
var PagesLoginIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
|
|
if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
|
|
Promise.prototype.finally = function(callback) {
|
|
const promise = this.constructor;
|
|
return this.then((value) => promise.resolve(callback()).then(() => value), (reason) => promise.resolve(callback()).then(() => {
|
|
throw reason;
|
|
}));
|
|
};
|
|
}
|
|
if (uni.restoreGlobal) {
|
|
uni.restoreGlobal(vue__namespace, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
|
|
}
|
|
__definePage("pages/client/index", PagesClientIndex);
|
|
__definePage("pages/trade/index", PagesTradeIndex);
|
|
__definePage("pages/mall/index", PagesMallIndex);
|
|
__definePage("pages/mine/index", PagesMineIndex);
|
|
__definePage("pages/login/index", PagesLoginIndex);
|
|
const _sfc_main = {
|
|
onLaunch: function() {
|
|
formatAppLog("log", "at App.vue:4", "App Launch");
|
|
},
|
|
onShow: function() {
|
|
formatAppLog("log", "at App.vue:7", "App Show");
|
|
},
|
|
onHide: function() {
|
|
formatAppLog("log", "at App.vue:10", "App Hide");
|
|
}
|
|
};
|
|
const dateTimeFormat = (date, fmt) => {
|
|
if (!date) {
|
|
throw new Error("\u65E5\u671F\u4E0D\u6B63\u786E");
|
|
}
|
|
let ret;
|
|
const opt = {
|
|
"y+": date.getFullYear().toString(),
|
|
"m+": (date.getMonth() + 1).toString(),
|
|
"d+": date.getDate().toString(),
|
|
"h+": date.getHours().toString(),
|
|
"M+": date.getMinutes().toString(),
|
|
"s+": date.getSeconds().toString()
|
|
};
|
|
for (let k in opt) {
|
|
ret = new RegExp("(" + k + ")").exec(fmt);
|
|
if (ret) {
|
|
fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
|
|
}
|
|
}
|
|
return fmt;
|
|
};
|
|
const pubFn = {
|
|
dateTimeFormat
|
|
};
|
|
function createApp() {
|
|
const app = vue.createVueApp(_sfc_main);
|
|
app.provide("$pubFn", pubFn);
|
|
return {
|
|
app
|
|
};
|
|
}
|
|
const __app__ = createApp().app;
|
|
__app__._component.mpType = "app";
|
|
__app__._component.render = () => {
|
|
};
|
|
__app__.use(uni.__vuePlugin).mount("#app");
|
|
})(Vue);
|