333
This commit is contained in:
parent
e474d68188
commit
717197b897
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
unpackage/*
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"app.js","sources":["App.vue","main.js"],"sourcesContent":["<script>\r\n\texport default {\r\n\t\tonLaunch: function() {\r\n\t\t\tconsole.log('App Launch')\r\n\t\t},\r\n\t\tonShow: function() {\r\n\t\t\tconsole.log('App Show')\r\n\t\t},\r\n\t\tonHide: function() {\r\n\t\t\tconsole.log('App Hide')\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style>\r\n\t/*每个页面公共css */\r\n\t.column {\r\n\t\tdisplay: flex;\r\n\t\tflex-direction: column;\r\n\t}\r\n\r\n\t.row {\r\n\t\tdisplay: flex;\r\n\t\tflex-direction: row;\r\n\t}\r\n\t\r\n\t.row-reverse {\r\n\t\tdisplay: flex;\r\n\t\tflex-direction: row-reverse;\r\n\t}\r\n\r\n\t.center {\r\n\t\tdisplay: flex;\r\n\t\talign-items: center;\r\n\t\tjustify-content: center;\r\n\t}\r\n</style>","import App from './App'\r\n\r\n// #ifndef VUE3\r\nimport Vue from 'vue'\r\nimport './uni.promisify.adaptor'\r\nVue.config.productionTip = false\r\nApp.mpType = 'app'\r\nconst app = new Vue({\r\n ...App\r\n})\r\napp.$mount()\r\n// #endif\r\n\r\n// #ifdef VUE3\r\nimport { createSSRApp } from 'vue'\r\nexport function createApp() {\r\n const app = createSSRApp(App)\r\n return {\r\n app\r\n }\r\n}\r\n// #endif"],"names":["uni","createSSRApp","App"],"mappings":";;;;;;AACC,MAAK,YAAU;AAAA,EACd,UAAU,WAAW;AACpBA,kBAAAA,MAAA,MAAA,OAAA,gBAAY,YAAY;AAAA,EACxB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,gBAAA,UAAU;AAAA,EACtB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACvB;AACD;ACIM,SAAS,YAAY;AAC1B,QAAM,MAAMC,cAAY,aAACC,SAAG;AAC5B,SAAO;AAAA,IACL;AAAA,EACD;AACH;;;"}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"file":"assets.js","sources":["static/ic_close.png"],"sourcesContent":["export default \"__VITE_ASSET__96212905__\""],"names":[],"mappings":";AAAA,MAAe,aAAA;;"}
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
26
unpackage/dist/dev/mp-weixin/app.js
vendored
26
unpackage/dist/dev/mp-weixin/app.js
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
||||||
const common_vendor = require("./common/vendor.js");
|
|
||||||
if (!Math) {
|
|
||||||
"./pages/index/index.js";
|
|
||||||
}
|
|
||||||
const _sfc_main = {
|
|
||||||
onLaunch: function() {
|
|
||||||
common_vendor.index.__f__("log", "at App.vue:4", "App Launch");
|
|
||||||
},
|
|
||||||
onShow: function() {
|
|
||||||
common_vendor.index.__f__("log", "at App.vue:7", "App Show");
|
|
||||||
},
|
|
||||||
onHide: function() {
|
|
||||||
common_vendor.index.__f__("log", "at App.vue:10", "App Hide");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function createApp() {
|
|
||||||
const app = common_vendor.createSSRApp(_sfc_main);
|
|
||||||
return {
|
|
||||||
app
|
|
||||||
};
|
|
||||||
}
|
|
||||||
createApp().app.mount("#app");
|
|
||||||
exports.createApp = createApp;
|
|
||||||
//# sourceMappingURL=../.sourcemap/mp-weixin/app.js.map
|
|
||||||
12
unpackage/dist/dev/mp-weixin/app.json
vendored
12
unpackage/dist/dev/mp-weixin/app.json
vendored
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"pages": [
|
|
||||||
"pages/index/index"
|
|
||||||
],
|
|
||||||
"window": {
|
|
||||||
"navigationBarTextStyle": "black",
|
|
||||||
"navigationBarTitleText": "uni-app",
|
|
||||||
"navigationBarBackgroundColor": "#F8F8F8",
|
|
||||||
"backgroundColor": "#F8F8F8"
|
|
||||||
},
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
20
unpackage/dist/dev/mp-weixin/app.wxss
vendored
20
unpackage/dist/dev/mp-weixin/app.wxss
vendored
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
/*每个页面公共css */
|
|
||||||
.column {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.row {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
.row-reverse {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
}
|
|
||||||
.center {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
page{--status-bar-height:25px;--top-window-height:0px;--window-top:0px;--window-bottom:0px;--window-left:0px;--window-right:0px;--window-magin:0px}[data-c-h="true"]{display: none !important;}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const _imports_0 = "/static/ic_close.png";
|
|
||||||
exports._imports_0 = _imports_0;
|
|
||||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/assets.js.map
|
|
||||||
173
unpackage/dist/dev/mp-weixin/common/utils.js
vendored
173
unpackage/dist/dev/mp-weixin/common/utils.js
vendored
|
|
@ -1,173 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const common_vendor = require("./vendor.js");
|
|
||||||
const getFileSize = async (filePath) => {
|
|
||||||
try {
|
|
||||||
const res = await new Promise((resolve, reject) => {
|
|
||||||
common_vendor.wx$1.getFileSystemManager().getFileInfo({
|
|
||||||
filePath,
|
|
||||||
success: resolve,
|
|
||||||
fail: reject
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return res.size || Infinity;
|
|
||||||
} catch (err) {
|
|
||||||
common_vendor.index.__f__("error", "at common/utils.js:34", "获取文件大小失败:", err);
|
|
||||||
return Infinity;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const doCompressImage = (src, quality) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
common_vendor.index.compressImage({
|
|
||||||
src,
|
|
||||||
quality,
|
|
||||||
success: (res) => resolve(res.tempFilePath),
|
|
||||||
fail: () => resolve(src)
|
|
||||||
// 失败返回原路径
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const preciseCompress = async (tempFilePath, targetSize = 500 * 1024, initialQuality = 85) => {
|
|
||||||
let quality = initialQuality;
|
|
||||||
let compressedPath = tempFilePath;
|
|
||||||
let currentSize = Infinity;
|
|
||||||
let iterations = 0;
|
|
||||||
const maxIterations = 10;
|
|
||||||
const history = [];
|
|
||||||
const originalSize = await getFileSize(tempFilePath);
|
|
||||||
if (originalSize <= targetSize) {
|
|
||||||
return { path: tempFilePath, quality: 100, iterations: 0, finalSize: originalSize };
|
|
||||||
}
|
|
||||||
const predictQualityRange = (originalSize2, targetSize2) => {
|
|
||||||
const ratio = targetSize2 / originalSize2;
|
|
||||||
if (ratio > 0.8)
|
|
||||||
return { low: 70, high: 95 };
|
|
||||||
if (ratio > 0.5)
|
|
||||||
return { low: 45, high: 75 };
|
|
||||||
if (ratio > 0.3)
|
|
||||||
return { low: 25, high: 50 };
|
|
||||||
if (ratio > 0.1)
|
|
||||||
return { low: 10, high: 30 };
|
|
||||||
return { low: 5, high: 15 };
|
|
||||||
};
|
|
||||||
const { low: predictedLow, high: predictedHigh } = predictQualityRange(originalSize, targetSize);
|
|
||||||
let low = predictedLow;
|
|
||||||
let high = Math.min(predictedHigh, initialQuality);
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:132", `预测质量范围: ${low}-${high} (原图${(originalSize / 1024).toFixed(2)}KB → 目标${(targetSize / 1024).toFixed(2)}KB)`);
|
|
||||||
const adjustBounds = (currentQuality, currentSize2, targetSize2) => {
|
|
||||||
const sizeRatio = currentSize2 / targetSize2;
|
|
||||||
const qualityDelta = Math.max(2, Math.floor(currentQuality * 0.1));
|
|
||||||
if (sizeRatio > 2.5) {
|
|
||||||
return { lowDelta: -qualityDelta * 2, highDelta: -qualityDelta };
|
|
||||||
} else if (sizeRatio > 1.5) {
|
|
||||||
return { lowDelta: -qualityDelta, highDelta: -Math.floor(qualityDelta / 2) };
|
|
||||||
} else if (sizeRatio > 1.1) {
|
|
||||||
return { lowDelta: -3, highDelta: -1 };
|
|
||||||
} else {
|
|
||||||
return { lowDelta: -1, highDelta: 0 };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let bestResult = null;
|
|
||||||
while (iterations < maxIterations && low <= high) {
|
|
||||||
iterations++;
|
|
||||||
quality = Math.floor((low + high) / 2);
|
|
||||||
if (history.some((item) => item.quality === quality)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
compressedPath = await doCompressImage(tempFilePath, quality);
|
|
||||||
currentSize = await getFileSize(compressedPath);
|
|
||||||
history.push({ quality, size: currentSize });
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:165", `第${iterations}次尝试: quality=${quality} → ${(currentSize / 1024).toFixed(2)}KB (目标${(targetSize / 1024).toFixed(2)}KB)`);
|
|
||||||
if (!bestResult || Math.abs(currentSize - targetSize) < Math.abs(bestResult.size - targetSize)) {
|
|
||||||
bestResult = { quality, size: currentSize, path: compressedPath };
|
|
||||||
}
|
|
||||||
if (Math.abs(currentSize - targetSize) < targetSize * 0.03) {
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:174", "✅ 达到精准匹配,提前结束");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (currentSize > targetSize) {
|
|
||||||
const { lowDelta, highDelta } = adjustBounds(quality, currentSize, targetSize);
|
|
||||||
high = Math.max(5, quality + highDelta);
|
|
||||||
} else {
|
|
||||||
low = quality + 1;
|
|
||||||
}
|
|
||||||
if (high - low <= 1)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (bestResult && bestResult.size > targetSize * 1.1) {
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:191", "🔥 尝试极限压缩...");
|
|
||||||
const extremePath = await doCompressImage(tempFilePath, 5);
|
|
||||||
const extremeSize = await getFileSize(extremePath);
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:194", `极限压缩结果: quality=5 → ${(extremeSize / 1024).toFixed(2)}KB`);
|
|
||||||
if (extremeSize < bestResult.size) {
|
|
||||||
bestResult = { quality: 5, size: extremeSize, path: extremePath };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const finalResult = bestResult || { quality: 10, size: currentSize, path: compressedPath };
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:203", `🎯 最终结果:quality=${finalResult.quality} → ${(finalResult.size / 1024).toFixed(2)}KB(迭代${iterations}次,压缩率${((1 - finalResult.size / originalSize) * 100).toFixed(1)}%)`);
|
|
||||||
return {
|
|
||||||
path: finalResult.path,
|
|
||||||
quality: finalResult.quality,
|
|
||||||
iterations,
|
|
||||||
finalSize: finalResult.size
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const imageToBase64 = (filePath) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
common_vendor.index.getImageInfo({
|
|
||||||
src: filePath,
|
|
||||||
success: (info) => {
|
|
||||||
const type = info.type || "jpeg";
|
|
||||||
common_vendor.index.getFileSystemManager().readFile({
|
|
||||||
filePath,
|
|
||||||
encoding: "base64",
|
|
||||||
success: (res) => resolve(`data:image/${type};base64,${res.data}`),
|
|
||||||
fail: reject
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
common_vendor.index.getFileSystemManager().readFile({
|
|
||||||
filePath,
|
|
||||||
encoding: "base64",
|
|
||||||
success: (res) => resolve(`data:image/jpeg;base64,${res.data}`),
|
|
||||||
fail: reject
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const processImage = async (maxSize = 500 * 1024) => {
|
|
||||||
const chooseRes = await new Promise((resolve) => {
|
|
||||||
common_vendor.index.chooseImage({
|
|
||||||
count: 1,
|
|
||||||
sizeType: ["original", "compressed"],
|
|
||||||
success: resolve,
|
|
||||||
fail: () => resolve(null)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (!chooseRes)
|
|
||||||
throw new Error("选择图片失败");
|
|
||||||
const tempFilePath = chooseRes.tempFilePaths[0];
|
|
||||||
let finalPath = tempFilePath;
|
|
||||||
let isCompressed = false;
|
|
||||||
const fileSize = await getFileSize(tempFilePath);
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:272", `原图大小: ${(fileSize / 1024).toFixed(2)}KB`);
|
|
||||||
if (fileSize > maxSize) {
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:276", "🔄 开始智能压缩...");
|
|
||||||
const compressResult = await preciseCompress(tempFilePath, maxSize);
|
|
||||||
finalPath = compressResult.path;
|
|
||||||
isCompressed = true;
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:282", `✅ 压缩完成: ${(fileSize / 1024).toFixed(2)}KB → ${(compressResult.finalSize / 1024).toFixed(2)}KB (节省${((1 - compressResult.finalSize / fileSize) * 100).toFixed(1)}%)`);
|
|
||||||
}
|
|
||||||
const base64 = await imageToBase64(finalPath);
|
|
||||||
common_vendor.index.__f__("log", "at common/utils.js:288", `📄 Base64长度: ${base64.length} 字符`);
|
|
||||||
return {
|
|
||||||
base64,
|
|
||||||
// Base64字符串
|
|
||||||
path: finalPath,
|
|
||||||
// 最终文件路径(可能是原图或压缩图)
|
|
||||||
compressed: isCompressed
|
|
||||||
// 是否经过压缩
|
|
||||||
};
|
|
||||||
};
|
|
||||||
exports.processImage = processImage;
|
|
||||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/utils.js.map
|
|
||||||
8010
unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
8010
unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
File diff suppressed because it is too large
Load Diff
384
unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
384
unpackage/dist/dev/mp-weixin/pages/index/index.js
vendored
|
|
@ -1,384 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const common_vendor = require("../../common/vendor.js");
|
|
||||||
const common_utils = require("../../common/utils.js");
|
|
||||||
const common_assets = require("../../common/assets.js");
|
|
||||||
const uniNoticeBar = () => "../../uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.js";
|
|
||||||
const _sfc_main = {
|
|
||||||
components: {
|
|
||||||
uniNoticeBar
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
this.getConfig();
|
|
||||||
var userId = common_vendor.index.getStorageSync("user_id");
|
|
||||||
if (!userId || userId == 0) {
|
|
||||||
this.login();
|
|
||||||
}
|
|
||||||
this.userId = userId;
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
bg: "",
|
|
||||||
userId: 0,
|
|
||||||
imagePath: "",
|
|
||||||
name: "",
|
|
||||||
phone: "",
|
|
||||||
base64: "",
|
|
||||||
workUnit: "",
|
|
||||||
address: "",
|
|
||||||
createTime: "",
|
|
||||||
number: "",
|
|
||||||
model: "",
|
|
||||||
recordList: []
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
request(url, method, data) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const header = {};
|
|
||||||
if (method == "post") {
|
|
||||||
header["content-type"] = "application/json";
|
|
||||||
}
|
|
||||||
common_vendor.index.request({
|
|
||||||
url: "https://gift.zpc-xy.com/" + url,
|
|
||||||
method,
|
|
||||||
data,
|
|
||||||
header,
|
|
||||||
timeout: 1e4,
|
|
||||||
success: (res) => {
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:193", "API响应:", res);
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
resolve(res.data);
|
|
||||||
} else {
|
|
||||||
reject(new Error(`请求失败,状态码: ${res.statusCode}`));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:201", "API请求失败:", err);
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async getConfig() {
|
|
||||||
const res = await this.request("config", "get", {});
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:209", res);
|
|
||||||
if (res.home != "") {
|
|
||||||
this.bg = res.home;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
wxLogin() {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
common_vendor.index.login({
|
|
||||||
provider: "weixin",
|
|
||||||
//使用微信登录
|
|
||||||
onlyAuthorize: true,
|
|
||||||
success: async function(res) {
|
|
||||||
resolve(res.code);
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async login() {
|
|
||||||
try {
|
|
||||||
const wxCode = await this.wxLogin();
|
|
||||||
if (wxCode) {
|
|
||||||
const res = await this.request("userLogin?code=" + wxCode, "post", {});
|
|
||||||
if (res.code == 200) {
|
|
||||||
common_vendor.index.setStorageSync("user_id", res.data.user_id);
|
|
||||||
this.userId = res.data.user_id;
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:238", "登录成功, userId:", this.userId);
|
|
||||||
} else {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:240", "登录失败:", res.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:244", "登录过程出错:", error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
openReceivePop() {
|
|
||||||
this.$refs.receivePop.open();
|
|
||||||
},
|
|
||||||
closeReceivePop() {
|
|
||||||
this.$refs.receivePop.close();
|
|
||||||
},
|
|
||||||
getUserId() {
|
|
||||||
if (this.userId == 0) {
|
|
||||||
var userId = common_vendor.index.getStorageSync("user_id");
|
|
||||||
if (!userId || userId == 0) {
|
|
||||||
this.login();
|
|
||||||
} else {
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.userId;
|
|
||||||
},
|
|
||||||
async openRecordPop() {
|
|
||||||
await this.loadRecordList();
|
|
||||||
this.$refs.recordPop.open();
|
|
||||||
},
|
|
||||||
async loadRecordList() {
|
|
||||||
try {
|
|
||||||
common_vendor.index.showLoading({
|
|
||||||
title: "加载中..."
|
|
||||||
});
|
|
||||||
const result = await this.request("getRecord?userId=" + this.getUserId(), "GET", {});
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:280", result);
|
|
||||||
if (result.data.length > 0) {
|
|
||||||
let isShow = true;
|
|
||||||
let record = [];
|
|
||||||
for (var index = 0; index < result.data.length; index++) {
|
|
||||||
var element = result.data[index];
|
|
||||||
if (element.status == 1) {
|
|
||||||
record.push(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.recordList = record;
|
|
||||||
}
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:293", "加载领取记录...");
|
|
||||||
} catch (error) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:295", "加载领取记录失败:", error);
|
|
||||||
}
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
},
|
|
||||||
closeRecordPop() {
|
|
||||||
this.$refs.recordPop.close();
|
|
||||||
},
|
|
||||||
async seleImg() {
|
|
||||||
try {
|
|
||||||
common_vendor.index.showLoading({
|
|
||||||
title: "处理中..."
|
|
||||||
});
|
|
||||||
const {
|
|
||||||
base64,
|
|
||||||
path
|
|
||||||
} = await common_utils.processImage();
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:314", "最终Base64长度:", base64.length, path);
|
|
||||||
this.imagePath = path;
|
|
||||||
this.base64 = base64;
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "上传成功"
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:321", "处理失败", err);
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "处理失败",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
validateForm() {
|
|
||||||
if (!this.name.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写姓名",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.phone.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写联系方式",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.workUnit.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写工作单位",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.address.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写收货地址",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.model.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写设备型号",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.number.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写出品编号",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.createTime.trim()) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请填写出品年月",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!this.imagePath) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "请上传产品铭牌照片",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
async submitForm() {
|
|
||||||
if (!this.validateForm()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
common_vendor.index.showLoading({
|
|
||||||
title: "提交中..."
|
|
||||||
});
|
|
||||||
try {
|
|
||||||
const formData = {
|
|
||||||
UserId: this.userId,
|
|
||||||
Name: this.name,
|
|
||||||
Phone: this.phone,
|
|
||||||
Company: this.workUnit,
|
|
||||||
Address: this.address,
|
|
||||||
ProductModel: this.model,
|
|
||||||
ProductSerialNumber: this.number,
|
|
||||||
ProductDate: this.createTime,
|
|
||||||
ProductImage: this.base64
|
|
||||||
};
|
|
||||||
const result = await this.request("addRecord", "POST", formData);
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:416", result);
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
if (result.code == 200) {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "提交成功,请等待审核",
|
|
||||||
icon: "success"
|
|
||||||
});
|
|
||||||
this.closeReceivePop();
|
|
||||||
this.clearForm();
|
|
||||||
} else {
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "提交失败,请重试",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
common_vendor.index.hideLoading();
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "提交失败,请重试",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:440", "提交失败:", error);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clearForm() {
|
|
||||||
this.name = "";
|
|
||||||
this.phone = "";
|
|
||||||
this.workUnit = "";
|
|
||||||
this.address = "";
|
|
||||||
this.model = "";
|
|
||||||
this.number = "";
|
|
||||||
this.createTime = "";
|
|
||||||
this.imagePath = "";
|
|
||||||
this.base64 = "";
|
|
||||||
},
|
|
||||||
previewImage() {
|
|
||||||
if (this.imagePath) {
|
|
||||||
common_vendor.index.previewImage({
|
|
||||||
current: this.imagePath,
|
|
||||||
urls: [this.imagePath],
|
|
||||||
success: function(res) {
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:462", "预览图片成功");
|
|
||||||
},
|
|
||||||
fail: function(err) {
|
|
||||||
common_vendor.index.__f__("error", "at pages/index/index.vue:465", "预览图片失败:", err);
|
|
||||||
common_vendor.index.showToast({
|
|
||||||
title: "预览失败",
|
|
||||||
icon: "none"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async getBannerList() {
|
|
||||||
const res = await this.request("getBannerList", "GET", {});
|
|
||||||
common_vendor.index.__f__("log", "at pages/index/index.vue:476", res);
|
|
||||||
if (res.code == 200) {
|
|
||||||
this.bannerList = res.data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!Array) {
|
|
||||||
const _component_uniNoticeBar = common_vendor.resolveComponent("uniNoticeBar");
|
|
||||||
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
||||||
(_component_uniNoticeBar + _easycom_uni_popup2)();
|
|
||||||
}
|
|
||||||
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
||||||
if (!Math) {
|
|
||||||
_easycom_uni_popup();
|
|
||||||
}
|
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
||||||
return common_vendor.e({
|
|
||||||
a: $data.bg,
|
|
||||||
b: common_vendor.p({
|
|
||||||
showIcon: true,
|
|
||||||
single: true,
|
|
||||||
scrollable: true,
|
|
||||||
text: "赠品仅限线下购买设备的用户领取,需人工审核,预计3个工作日内完成!",
|
|
||||||
["background-color"]: "transparent",
|
|
||||||
color: "#000"
|
|
||||||
}),
|
|
||||||
c: common_vendor.o((...args) => $options.openReceivePop && $options.openReceivePop(...args)),
|
|
||||||
d: common_vendor.o((...args) => $options.openRecordPop && $options.openRecordPop(...args)),
|
|
||||||
e: $data.name,
|
|
||||||
f: common_vendor.o(($event) => $data.name = $event.detail.value),
|
|
||||||
g: $data.phone,
|
|
||||||
h: common_vendor.o(($event) => $data.phone = $event.detail.value),
|
|
||||||
i: $data.workUnit,
|
|
||||||
j: common_vendor.o(($event) => $data.workUnit = $event.detail.value),
|
|
||||||
k: -1,
|
|
||||||
l: $data.address,
|
|
||||||
m: common_vendor.o(($event) => $data.address = $event.detail.value),
|
|
||||||
n: $data.model,
|
|
||||||
o: common_vendor.o(($event) => $data.model = $event.detail.value),
|
|
||||||
p: $data.number,
|
|
||||||
q: common_vendor.o(($event) => $data.number = $event.detail.value),
|
|
||||||
r: $data.createTime,
|
|
||||||
s: common_vendor.o(($event) => $data.createTime = $event.detail.value),
|
|
||||||
t: common_vendor.o((...args) => $options.seleImg && $options.seleImg(...args)),
|
|
||||||
v: $data.imagePath
|
|
||||||
}, $data.imagePath ? {
|
|
||||||
w: $data.imagePath,
|
|
||||||
x: common_vendor.o((...args) => $options.previewImage && $options.previewImage(...args))
|
|
||||||
} : {}, {
|
|
||||||
y: common_vendor.o((...args) => $options.closeReceivePop && $options.closeReceivePop(...args)),
|
|
||||||
z: common_vendor.o((...args) => $options.submitForm && $options.submitForm(...args)),
|
|
||||||
A: common_vendor.sr("receivePop", "6e486efd-1"),
|
|
||||||
B: common_vendor.p({
|
|
||||||
type: "center",
|
|
||||||
["is-mask-click"]: false
|
|
||||||
}),
|
|
||||||
C: common_assets._imports_0,
|
|
||||||
D: common_vendor.o(($event) => $options.closeRecordPop()),
|
|
||||||
E: common_vendor.f($data.recordList, (item, k0, i0) => {
|
|
||||||
return {
|
|
||||||
a: common_vendor.t(item.name),
|
|
||||||
b: common_vendor.t(item.phone),
|
|
||||||
c: common_vendor.t(item.time),
|
|
||||||
d: common_vendor.t(item.address),
|
|
||||||
e: item.phone + item.time
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
F: common_vendor.sr("recordPop", "6e486efd-2"),
|
|
||||||
G: common_vendor.p({
|
|
||||||
type: "center"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
||||||
wx.createPage(MiniProgramPage);
|
|
||||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
"navigationBarTitleText": "",
|
|
||||||
"usingComponents": {
|
|
||||||
"uni-notice-bar": "../../uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar",
|
|
||||||
"uni-popup": "../../uni_modules/uni-popup/components/uni-popup/uni-popup"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.line {
|
|
||||||
width: 90%;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
border-bottom: 0.86px solid #e3e3e3;
|
|
||||||
}
|
|
||||||
29
unpackage/dist/dev/mp-weixin/project.config.json
vendored
29
unpackage/dist/dev/mp-weixin/project.config.json
vendored
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"description": "项目配置文件。",
|
|
||||||
"packOptions": {
|
|
||||||
"ignore": [],
|
|
||||||
"include": []
|
|
||||||
},
|
|
||||||
"setting": {
|
|
||||||
"urlCheck": false,
|
|
||||||
"es6": true,
|
|
||||||
"postcss": false,
|
|
||||||
"minified": false,
|
|
||||||
"newFeature": true,
|
|
||||||
"bigPackageSizeSupport": true,
|
|
||||||
"babelSetting": {
|
|
||||||
"ignore": [],
|
|
||||||
"disablePlugins": [],
|
|
||||||
"outputPath": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"compileType": "miniprogram",
|
|
||||||
"libVersion": "3.8.12",
|
|
||||||
"appid": "wx595ec949c6efd72b",
|
|
||||||
"projectname": "gift",
|
|
||||||
"condition": {},
|
|
||||||
"editorSetting": {
|
|
||||||
"tabIndent": "insertSpaces",
|
|
||||||
"tabSize": 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
||||||
"projectname": "gift",
|
|
||||||
"setting": {
|
|
||||||
"compileHotReLoad": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BIN
unpackage/dist/dev/mp-weixin/static/ic_close.png
vendored
BIN
unpackage/dist/dev/mp-weixin/static/ic_close.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB |
|
|
@ -1,204 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const common_vendor = require("../../../../common/vendor.js");
|
|
||||||
const _sfc_main = {
|
|
||||||
name: "UniNoticeBar",
|
|
||||||
emits: ["click", "getmore", "close"],
|
|
||||||
props: {
|
|
||||||
text: {
|
|
||||||
type: String,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
moreText: {
|
|
||||||
type: String,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
backgroundColor: {
|
|
||||||
type: String,
|
|
||||||
default: "#FFF9EA"
|
|
||||||
},
|
|
||||||
speed: {
|
|
||||||
// 默认1s滚动100px
|
|
||||||
type: Number,
|
|
||||||
default: 100
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: "#FF9A43"
|
|
||||||
},
|
|
||||||
fontSize: {
|
|
||||||
type: Number,
|
|
||||||
default: 14
|
|
||||||
},
|
|
||||||
moreColor: {
|
|
||||||
type: String,
|
|
||||||
default: "#FF9A43"
|
|
||||||
},
|
|
||||||
single: {
|
|
||||||
// 是否单行
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
scrollable: {
|
|
||||||
// 是否滚动,添加后控制单行效果取消
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
showIcon: {
|
|
||||||
// 是否显示左侧icon
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
showGetMore: {
|
|
||||||
// 是否显示右侧查看更多
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
showClose: {
|
|
||||||
// 是否显示左侧关闭按钮
|
|
||||||
type: [Boolean, String],
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
const elId = `Uni_${Math.ceil(Math.random() * 1e6).toString(36)}`;
|
|
||||||
const elIdBox = `Uni_${Math.ceil(Math.random() * 1e6).toString(36)}`;
|
|
||||||
return {
|
|
||||||
textWidth: 0,
|
|
||||||
boxWidth: 0,
|
|
||||||
wrapWidth: "",
|
|
||||||
webviewHide: false,
|
|
||||||
elId,
|
|
||||||
elIdBox,
|
|
||||||
show: true,
|
|
||||||
animationDuration: "none",
|
|
||||||
animationPlayState: "paused",
|
|
||||||
animationDelay: "0s"
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
text(newValue, oldValue) {
|
|
||||||
this.initSize();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShowGetMore() {
|
|
||||||
return this.showGetMore === true || this.showGetMore === "true";
|
|
||||||
},
|
|
||||||
isShowClose() {
|
|
||||||
return (this.showClose === true || this.showClose === "true") && (this.showGetMore === false || this.showGetMore === "false");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.initSize();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
initSize() {
|
|
||||||
if (this.scrollable) {
|
|
||||||
let query = [];
|
|
||||||
let textQuery = new Promise((resolve, reject) => {
|
|
||||||
common_vendor.index.createSelectorQuery().in(this).select(`#${this.elId}`).boundingClientRect().exec((ret) => {
|
|
||||||
this.textWidth = ret[0].width;
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
let boxQuery = new Promise((resolve, reject) => {
|
|
||||||
common_vendor.index.createSelectorQuery().in(this).select(`#${this.elIdBox}`).boundingClientRect().exec((ret) => {
|
|
||||||
this.boxWidth = ret[0].width;
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
query.push(textQuery);
|
|
||||||
query.push(boxQuery);
|
|
||||||
Promise.all(query).then(() => {
|
|
||||||
this.animationDuration = `${this.textWidth / this.speed}s`;
|
|
||||||
this.animationDelay = `-${this.boxWidth / this.speed}s`;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.animationPlayState = "running";
|
|
||||||
}, 1e3);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loopAnimation() {
|
|
||||||
},
|
|
||||||
clickMore() {
|
|
||||||
this.$emit("getmore");
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.show = false;
|
|
||||||
this.$emit("close");
|
|
||||||
},
|
|
||||||
onClick() {
|
|
||||||
this.$emit("click");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!Array) {
|
|
||||||
const _component_uni_icons = common_vendor.resolveComponent("uni-icons");
|
|
||||||
_component_uni_icons();
|
|
||||||
}
|
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
||||||
return common_vendor.e({
|
|
||||||
a: $data.show
|
|
||||||
}, $data.show ? common_vendor.e({
|
|
||||||
b: $props.showIcon === true || $props.showIcon === "true"
|
|
||||||
}, $props.showIcon === true || $props.showIcon === "true" ? {
|
|
||||||
c: common_vendor.p({
|
|
||||||
type: "sound",
|
|
||||||
color: $props.color,
|
|
||||||
size: $props.fontSize * 1.5
|
|
||||||
})
|
|
||||||
} : {}, {
|
|
||||||
d: common_vendor.t($props.text),
|
|
||||||
e: $data.elId,
|
|
||||||
f: $props.scrollable ? 1 : "",
|
|
||||||
g: !$props.scrollable && ($props.single || $props.showGetMore) ? 1 : "",
|
|
||||||
h: $props.color,
|
|
||||||
i: $props.fontSize + "px",
|
|
||||||
j: $props.fontSize * 1.5 + "px",
|
|
||||||
k: $data.wrapWidth + "px",
|
|
||||||
l: $data.animationDuration,
|
|
||||||
m: $data.animationDuration,
|
|
||||||
n: $data.webviewHide ? "paused" : $data.animationPlayState,
|
|
||||||
o: $data.webviewHide ? "paused" : $data.animationPlayState,
|
|
||||||
p: $data.animationDelay,
|
|
||||||
q: $data.animationDelay,
|
|
||||||
r: $data.elIdBox,
|
|
||||||
s: $props.scrollable ? 1 : "",
|
|
||||||
t: !$props.scrollable && ($props.single || $props.moreText) ? 1 : "",
|
|
||||||
v: $props.scrollable ? 1 : "",
|
|
||||||
w: !$props.scrollable && ($props.single || $props.moreText) ? 1 : "",
|
|
||||||
x: $props.scrollable ? $props.fontSize * 1.5 + "px" : "auto",
|
|
||||||
y: $options.isShowGetMore
|
|
||||||
}, $options.isShowGetMore ? common_vendor.e({
|
|
||||||
z: $props.moreText.length > 0
|
|
||||||
}, $props.moreText.length > 0 ? {
|
|
||||||
A: common_vendor.t($props.moreText),
|
|
||||||
B: $props.moreColor,
|
|
||||||
C: $props.fontSize + "px"
|
|
||||||
} : {
|
|
||||||
D: common_vendor.p({
|
|
||||||
type: "right",
|
|
||||||
color: $props.moreColor,
|
|
||||||
size: $props.fontSize * 1.1
|
|
||||||
})
|
|
||||||
}, {
|
|
||||||
E: common_vendor.o((...args) => $options.clickMore && $options.clickMore(...args))
|
|
||||||
}) : {}, {
|
|
||||||
F: $options.isShowClose
|
|
||||||
}, $options.isShowClose ? {
|
|
||||||
G: common_vendor.o($options.close),
|
|
||||||
H: common_vendor.p({
|
|
||||||
type: "closeempty",
|
|
||||||
color: $props.color,
|
|
||||||
size: $props.fontSize * 1.1
|
|
||||||
})
|
|
||||||
} : {}, {
|
|
||||||
I: $props.backgroundColor,
|
|
||||||
J: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
|
|
||||||
}) : {});
|
|
||||||
}
|
|
||||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c3453ea3"]]);
|
|
||||||
wx.createComponent(Component);
|
|
||||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-notice-bar/components/uni-notice-bar/uni-notice-bar.js.map
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<view wx:if="{{a}}" class="uni-noticebar data-v-c3453ea3" style="{{'background-color:' + I}}" bindtap="{{J}}"><block wx:if="{{b}}"><block wx:if="{{$slots.noticebarIcon}}"><slot name="noticebarIcon"></slot></block><block wx:else><uni-icons wx:if="{{c}}" class="uni-noticebar-icon data-v-c3453ea3" u-i="c3453ea3-0" bind:__l="__l" u-p="{{c}}"/></block></block><view ref="textBox" class="{{['uni-noticebar__content-wrapper', 'data-v-c3453ea3', v && 'uni-noticebar__content-wrapper--scrollable', w && 'uni-noticebar__content-wrapper--single']}}" style="{{'height:' + x}}"><view id="{{r}}" class="{{['uni-noticebar__content', 'data-v-c3453ea3', s && 'uni-noticebar__content--scrollable', t && 'uni-noticebar__content--single']}}"><text id="{{e}}" ref="animationEle" class="{{['uni-noticebar__content-text', 'data-v-c3453ea3', f && 'uni-noticebar__content-text--scrollable', g && 'uni-noticebar__content-text--single']}}" style="{{'color:' + h + ';' + ('font-size:' + i) + ';' + ('line-height:' + j) + ';' + ('width:' + k) + ';' + ('animation-duration:' + l) + ';' + ('-webkit-animation-duration:' + m) + ';' + ('animation-play-state:' + n) + ';' + ('-webkit-animation-play-state:' + o) + ';' + ('animation-delay:' + p) + ';' + ('-webkit-animation-delay:' + q)}}">{{d}}</text></view></view><view wx:if="{{y}}" class="uni-noticebar__more uni-cursor-point data-v-c3453ea3" bindtap="{{E}}"><text wx:if="{{z}}" class="data-v-c3453ea3" style="{{'color:' + B + ';' + ('font-size:' + C)}}">{{A}}</text><uni-icons wx:else class="data-v-c3453ea3" u-i="c3453ea3-1" bind:__l="__l" u-p="{{D||''}}"/></view><view wx:if="{{F}}" class="uni-noticebar-close uni-cursor-point data-v-c3453ea3"><uni-icons wx:if="{{H}}" class="data-v-c3453ea3" bindclick="{{G}}" u-i="c3453ea3-2" bind:__l="__l" u-p="{{H}}"/></view></view>
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
/**
|
|
||||||
* 这里是uni-app内置的常用样式变量
|
|
||||||
*
|
|
||||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
|
||||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
|
||||||
*
|
|
||||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
|
||||||
*/
|
|
||||||
/* 颜色变量 */
|
|
||||||
/* 行为相关颜色 */
|
|
||||||
/* 文字基本颜色 */
|
|
||||||
/* 背景颜色 */
|
|
||||||
/* 边框颜色 */
|
|
||||||
/* 尺寸变量 */
|
|
||||||
/* 文字尺寸 */
|
|
||||||
/* 图片尺寸 */
|
|
||||||
/* Border Radius */
|
|
||||||
/* 水平间距 */
|
|
||||||
/* 垂直间距 */
|
|
||||||
/* 透明度 */
|
|
||||||
/* 文章场景相关 */
|
|
||||||
.uni-noticebar.data-v-c3453ea3 {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
padding: 10px 12px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.uni-noticebar-close.data-v-c3453ea3 {
|
|
||||||
margin-left: 8px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
.uni-noticebar-icon.data-v-c3453ea3 {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-wrapper.data-v-c3453ea3 {
|
|
||||||
flex: 1;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-wrapper--single.data-v-c3453ea3 {
|
|
||||||
line-height: 18px;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-wrapper--single.data-v-c3453ea3,
|
|
||||||
.uni-noticebar__content-wrapper--scrollable.data-v-c3453ea3 {
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-wrapper--scrollable.data-v-c3453ea3 {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content--scrollable.data-v-c3453ea3 {
|
|
||||||
flex: 1;
|
|
||||||
display: block;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content--single.data-v-c3453ea3 {
|
|
||||||
display: flex;
|
|
||||||
flex: none;
|
|
||||||
width: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-text.data-v-c3453ea3 {
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 18px;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-text--single.data-v-c3453ea3 {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
.uni-noticebar__content-text--scrollable.data-v-c3453ea3 {
|
|
||||||
position: absolute;
|
|
||||||
display: block;
|
|
||||||
height: 18px;
|
|
||||||
line-height: 18px;
|
|
||||||
white-space: nowrap;
|
|
||||||
padding-left: 100%;
|
|
||||||
animation: notice-c3453ea3 10s 0s linear infinite both;
|
|
||||||
animation-play-state: paused;
|
|
||||||
}
|
|
||||||
.uni-noticebar__more.data-v-c3453ea3 {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-items: center;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
@keyframes notice-c3453ea3 {
|
|
||||||
100% {
|
|
||||||
transform: translate3d(-100%, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,397 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const common_vendor = require("../../../../common/vendor.js");
|
|
||||||
const _sfc_main = {
|
|
||||||
name: "uniPopup",
|
|
||||||
components: {},
|
|
||||||
emits: ["change", "maskClick"],
|
|
||||||
props: {
|
|
||||||
// 开启动画
|
|
||||||
animation: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
|
||||||
// message: 消息提示 ; dialog : 对话框
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: "center"
|
|
||||||
},
|
|
||||||
// maskClick
|
|
||||||
isMaskClick: {
|
|
||||||
type: Boolean,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
|
|
||||||
maskClick: {
|
|
||||||
type: Boolean,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
backgroundColor: {
|
|
||||||
type: String,
|
|
||||||
default: "none"
|
|
||||||
},
|
|
||||||
safeArea: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
maskBackgroundColor: {
|
|
||||||
type: String,
|
|
||||||
default: "rgba(0, 0, 0, 0.4)"
|
|
||||||
},
|
|
||||||
borderRadius: {
|
|
||||||
type: String
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
/**
|
|
||||||
* 监听type类型
|
|
||||||
*/
|
|
||||||
type: {
|
|
||||||
handler: function(type) {
|
|
||||||
if (!this.config[type])
|
|
||||||
return;
|
|
||||||
this[this.config[type]](true);
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
},
|
|
||||||
isDesktop: {
|
|
||||||
handler: function(newVal) {
|
|
||||||
if (!this.config[newVal])
|
|
||||||
return;
|
|
||||||
this[this.config[this.type]](true);
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 监听遮罩是否可点击
|
|
||||||
* @param {Object} val
|
|
||||||
*/
|
|
||||||
maskClick: {
|
|
||||||
handler: function(val) {
|
|
||||||
this.mkclick = val;
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
},
|
|
||||||
isMaskClick: {
|
|
||||||
handler: function(val) {
|
|
||||||
this.mkclick = val;
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
},
|
|
||||||
// H5 下禁止底部滚动
|
|
||||||
showPopup(show) {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
duration: 300,
|
|
||||||
ani: [],
|
|
||||||
showPopup: false,
|
|
||||||
showTrans: false,
|
|
||||||
popupWidth: 0,
|
|
||||||
popupHeight: 0,
|
|
||||||
config: {
|
|
||||||
top: "top",
|
|
||||||
bottom: "bottom",
|
|
||||||
center: "center",
|
|
||||||
left: "left",
|
|
||||||
right: "right",
|
|
||||||
message: "top",
|
|
||||||
dialog: "center",
|
|
||||||
share: "bottom"
|
|
||||||
},
|
|
||||||
maskClass: {
|
|
||||||
position: "fixed",
|
|
||||||
bottom: 0,
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
|
||||||
},
|
|
||||||
transClass: {
|
|
||||||
backgroundColor: "transparent",
|
|
||||||
borderRadius: this.borderRadius || "0",
|
|
||||||
position: "fixed",
|
|
||||||
left: 0,
|
|
||||||
right: 0
|
|
||||||
},
|
|
||||||
maskShow: true,
|
|
||||||
mkclick: true,
|
|
||||||
popupstyle: "top"
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
getStyles() {
|
|
||||||
let res = { backgroundColor: this.bg };
|
|
||||||
if (this.borderRadius || "0") {
|
|
||||||
res = Object.assign(res, { borderRadius: this.borderRadius });
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
},
|
|
||||||
isDesktop() {
|
|
||||||
return this.popupWidth >= 500 && this.popupHeight >= 500;
|
|
||||||
},
|
|
||||||
bg() {
|
|
||||||
if (this.backgroundColor === "" || this.backgroundColor === "none") {
|
|
||||||
return "transparent";
|
|
||||||
}
|
|
||||||
return this.backgroundColor;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
const fixSize = () => {
|
|
||||||
const {
|
|
||||||
windowWidth,
|
|
||||||
windowHeight,
|
|
||||||
windowTop,
|
|
||||||
safeArea,
|
|
||||||
screenHeight,
|
|
||||||
safeAreaInsets
|
|
||||||
} = common_vendor.index.getWindowInfo();
|
|
||||||
this.popupWidth = windowWidth;
|
|
||||||
this.popupHeight = windowHeight + (windowTop || 0);
|
|
||||||
if (safeArea && this.safeArea) {
|
|
||||||
this.safeAreaInsets = screenHeight - safeArea.bottom;
|
|
||||||
} else {
|
|
||||||
this.safeAreaInsets = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
fixSize();
|
|
||||||
},
|
|
||||||
// TODO vue3
|
|
||||||
unmounted() {
|
|
||||||
this.setH5Visible();
|
|
||||||
},
|
|
||||||
activated() {
|
|
||||||
this.setH5Visible(!this.showPopup);
|
|
||||||
},
|
|
||||||
deactivated() {
|
|
||||||
this.setH5Visible(true);
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
if (this.isMaskClick === null && this.maskClick === null) {
|
|
||||||
this.mkclick = true;
|
|
||||||
} else {
|
|
||||||
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
|
|
||||||
}
|
|
||||||
if (this.animation) {
|
|
||||||
this.duration = 300;
|
|
||||||
} else {
|
|
||||||
this.duration = 0;
|
|
||||||
}
|
|
||||||
this.messageChild = null;
|
|
||||||
this.clearPropagation = false;
|
|
||||||
this.maskClass.backgroundColor = this.maskBackgroundColor;
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
setH5Visible(visible = true) {
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 公用方法,不显示遮罩层
|
|
||||||
*/
|
|
||||||
closeMask() {
|
|
||||||
this.maskShow = false;
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 公用方法,遮罩层禁止点击
|
|
||||||
*/
|
|
||||||
disableMask() {
|
|
||||||
this.mkclick = false;
|
|
||||||
},
|
|
||||||
// TODO nvue 取消冒泡
|
|
||||||
clear(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
this.clearPropagation = true;
|
|
||||||
},
|
|
||||||
open(direction) {
|
|
||||||
if (this.showPopup) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
|
|
||||||
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
|
||||||
direction = this.type;
|
|
||||||
}
|
|
||||||
if (!this.config[direction]) {
|
|
||||||
common_vendor.index.__f__("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:310", "缺少类型:", direction);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this[this.config[direction]]();
|
|
||||||
this.$emit("change", {
|
|
||||||
show: true,
|
|
||||||
type: direction
|
|
||||||
});
|
|
||||||
},
|
|
||||||
close(type) {
|
|
||||||
this.showTrans = false;
|
|
||||||
this.$emit("change", {
|
|
||||||
show: false,
|
|
||||||
type: this.type
|
|
||||||
});
|
|
||||||
clearTimeout(this.timer);
|
|
||||||
this.timer = setTimeout(() => {
|
|
||||||
this.showPopup = false;
|
|
||||||
}, 300);
|
|
||||||
},
|
|
||||||
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
|
|
||||||
touchstart() {
|
|
||||||
this.clearPropagation = false;
|
|
||||||
},
|
|
||||||
onTap() {
|
|
||||||
if (this.clearPropagation) {
|
|
||||||
this.clearPropagation = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.$emit("maskClick");
|
|
||||||
if (!this.mkclick)
|
|
||||||
return;
|
|
||||||
this.close();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 顶部弹出样式处理
|
|
||||||
*/
|
|
||||||
top(type) {
|
|
||||||
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
|
|
||||||
this.ani = ["slide-top"];
|
|
||||||
this.transClass = {
|
|
||||||
position: "fixed",
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
backgroundColor: this.bg,
|
|
||||||
borderRadius: this.borderRadius || "0"
|
|
||||||
};
|
|
||||||
if (type)
|
|
||||||
return;
|
|
||||||
this.showPopup = true;
|
|
||||||
this.showTrans = true;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.showPoptrans();
|
|
||||||
if (this.messageChild && this.type === "message") {
|
|
||||||
this.messageChild.timerClose();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 底部弹出样式处理
|
|
||||||
*/
|
|
||||||
bottom(type) {
|
|
||||||
this.popupstyle = "bottom";
|
|
||||||
this.ani = ["slide-bottom"];
|
|
||||||
this.transClass = {
|
|
||||||
position: "fixed",
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
bottom: 0,
|
|
||||||
paddingBottom: this.safeAreaInsets + "px",
|
|
||||||
backgroundColor: this.bg,
|
|
||||||
borderRadius: this.borderRadius || "0"
|
|
||||||
};
|
|
||||||
if (type)
|
|
||||||
return;
|
|
||||||
this.showPoptrans();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 中间弹出样式处理
|
|
||||||
*/
|
|
||||||
center(type) {
|
|
||||||
this.popupstyle = "center";
|
|
||||||
this.ani = ["fade"];
|
|
||||||
this.transClass = {
|
|
||||||
position: "fixed",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
top: 0,
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
borderRadius: this.borderRadius || "0"
|
|
||||||
};
|
|
||||||
if (type)
|
|
||||||
return;
|
|
||||||
this.showPoptrans();
|
|
||||||
},
|
|
||||||
left(type) {
|
|
||||||
this.popupstyle = "left";
|
|
||||||
this.ani = ["slide-left"];
|
|
||||||
this.transClass = {
|
|
||||||
position: "fixed",
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
top: 0,
|
|
||||||
backgroundColor: this.bg,
|
|
||||||
borderRadius: this.borderRadius || "0",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column"
|
|
||||||
};
|
|
||||||
if (type)
|
|
||||||
return;
|
|
||||||
this.showPoptrans();
|
|
||||||
},
|
|
||||||
right(type) {
|
|
||||||
this.popupstyle = "right";
|
|
||||||
this.ani = ["slide-right"];
|
|
||||||
this.transClass = {
|
|
||||||
position: "fixed",
|
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
top: 0,
|
|
||||||
backgroundColor: this.bg,
|
|
||||||
borderRadius: this.borderRadius || "0",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column"
|
|
||||||
};
|
|
||||||
if (type)
|
|
||||||
return;
|
|
||||||
this.showPoptrans();
|
|
||||||
},
|
|
||||||
showPoptrans() {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.showPopup = true;
|
|
||||||
this.showTrans = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (!Array) {
|
|
||||||
const _easycom_uni_transition2 = common_vendor.resolveComponent("uni-transition");
|
|
||||||
_easycom_uni_transition2();
|
|
||||||
}
|
|
||||||
const _easycom_uni_transition = () => "../../../uni-transition/components/uni-transition/uni-transition.js";
|
|
||||||
if (!Math) {
|
|
||||||
_easycom_uni_transition();
|
|
||||||
}
|
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
||||||
return common_vendor.e({
|
|
||||||
a: $data.showPopup
|
|
||||||
}, $data.showPopup ? common_vendor.e({
|
|
||||||
b: $data.maskShow
|
|
||||||
}, $data.maskShow ? {
|
|
||||||
c: common_vendor.o($options.onTap),
|
|
||||||
d: common_vendor.p({
|
|
||||||
name: "mask",
|
|
||||||
["mode-class"]: "fade",
|
|
||||||
styles: $data.maskClass,
|
|
||||||
duration: $data.duration,
|
|
||||||
show: $data.showTrans
|
|
||||||
})
|
|
||||||
} : {}, {
|
|
||||||
e: common_vendor.s($options.getStyles),
|
|
||||||
f: common_vendor.n($data.popupstyle),
|
|
||||||
g: common_vendor.o((...args) => $options.clear && $options.clear(...args)),
|
|
||||||
h: common_vendor.o($options.onTap),
|
|
||||||
i: common_vendor.p({
|
|
||||||
["mode-class"]: $data.ani,
|
|
||||||
name: "content",
|
|
||||||
styles: $data.transClass,
|
|
||||||
duration: $data.duration,
|
|
||||||
show: $data.showTrans
|
|
||||||
}),
|
|
||||||
j: common_vendor.o((...args) => $options.touchstart && $options.touchstart(...args)),
|
|
||||||
k: common_vendor.n($data.popupstyle),
|
|
||||||
l: common_vendor.n($options.isDesktop ? "fixforpc-z-index" : "")
|
|
||||||
}) : {});
|
|
||||||
}
|
|
||||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
||||||
wx.createComponent(Component);
|
|
||||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-popup/components/uni-popup/uni-popup.js.map
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {
|
|
||||||
"uni-transition": "../../../uni-transition/components/uni-transition/uni-transition"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<view wx:if="{{a}}" class="{{['uni-popup', k, l]}}"><view bindtouchstart="{{j}}"><uni-transition wx:if="{{b}}" key="1" bindclick="{{c}}" u-i="15c4226a-0" bind:__l="__l" u-p="{{d}}"/><uni-transition wx:if="{{i}}" u-s="{{['d']}}" key="2" bindclick="{{h}}" u-i="15c4226a-1" bind:__l="__l" u-p="{{i}}"><view style="{{e}}" class="{{['uni-popup__wrapper', f]}}" bindtap="{{g}}"><slot/></view></uni-transition></view></view>
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
* 这里是uni-app内置的常用样式变量
|
|
||||||
*
|
|
||||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
|
||||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
|
||||||
*
|
|
||||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
|
||||||
*/
|
|
||||||
/* 颜色变量 */
|
|
||||||
/* 行为相关颜色 */
|
|
||||||
/* 文字基本颜色 */
|
|
||||||
/* 背景颜色 */
|
|
||||||
/* 边框颜色 */
|
|
||||||
/* 尺寸变量 */
|
|
||||||
/* 文字尺寸 */
|
|
||||||
/* 图片尺寸 */
|
|
||||||
/* Border Radius */
|
|
||||||
/* 水平间距 */
|
|
||||||
/* 垂直间距 */
|
|
||||||
/* 透明度 */
|
|
||||||
/* 文章场景相关 */
|
|
||||||
.uni-popup {
|
|
||||||
position: fixed;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
|
||||||
.uni-popup.top, .uni-popup.left, .uni-popup.right {
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
.uni-popup .uni-popup__wrapper {
|
|
||||||
display: block;
|
|
||||||
position: relative;
|
|
||||||
/* iphonex 等安全区设置,底部安全区适配 */
|
|
||||||
}
|
|
||||||
.uni-popup .uni-popup__wrapper.left, .uni-popup .uni-popup__wrapper.right {
|
|
||||||
padding-top: 0;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.fixforpc-z-index {
|
|
||||||
z-index: 999;
|
|
||||||
}
|
|
||||||
.fixforpc-top {
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const common_vendor = require("../../../../common/vendor.js");
|
|
||||||
class MPAnimation {
|
|
||||||
constructor(options, _this) {
|
|
||||||
this.options = options;
|
|
||||||
this.animation = common_vendor.index.createAnimation({
|
|
||||||
...options
|
|
||||||
});
|
|
||||||
this.currentStepAnimates = {};
|
|
||||||
this.next = 0;
|
|
||||||
this.$ = _this;
|
|
||||||
}
|
|
||||||
_nvuePushAnimates(type, args) {
|
|
||||||
let aniObj = this.currentStepAnimates[this.next];
|
|
||||||
let styles = {};
|
|
||||||
if (!aniObj) {
|
|
||||||
styles = {
|
|
||||||
styles: {},
|
|
||||||
config: {}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
styles = aniObj;
|
|
||||||
}
|
|
||||||
if (animateTypes1.includes(type)) {
|
|
||||||
if (!styles.styles.transform) {
|
|
||||||
styles.styles.transform = "";
|
|
||||||
}
|
|
||||||
let unit = "";
|
|
||||||
if (type === "rotate") {
|
|
||||||
unit = "deg";
|
|
||||||
}
|
|
||||||
styles.styles.transform += `${type}(${args + unit}) `;
|
|
||||||
} else {
|
|
||||||
styles.styles[type] = `${args}`;
|
|
||||||
}
|
|
||||||
this.currentStepAnimates[this.next] = styles;
|
|
||||||
}
|
|
||||||
_animateRun(styles = {}, config = {}) {
|
|
||||||
let ref = this.$.$refs["ani"].ref;
|
|
||||||
if (!ref)
|
|
||||||
return;
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
nvueAnimation.transition(ref, {
|
|
||||||
styles,
|
|
||||||
...config
|
|
||||||
}, (res) => {
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_nvueNextAnimate(animates, step = 0, fn) {
|
|
||||||
let obj = animates[step];
|
|
||||||
if (obj) {
|
|
||||||
let {
|
|
||||||
styles,
|
|
||||||
config
|
|
||||||
} = obj;
|
|
||||||
this._animateRun(styles, config).then(() => {
|
|
||||||
step += 1;
|
|
||||||
this._nvueNextAnimate(animates, step, fn);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.currentStepAnimates = {};
|
|
||||||
typeof fn === "function" && fn();
|
|
||||||
this.isEnd = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
step(config = {}) {
|
|
||||||
this.animation.step(config);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
run(fn) {
|
|
||||||
this.$.animationData = this.animation.export();
|
|
||||||
this.$.timer = setTimeout(() => {
|
|
||||||
typeof fn === "function" && fn();
|
|
||||||
}, this.$.durationTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const animateTypes1 = [
|
|
||||||
"matrix",
|
|
||||||
"matrix3d",
|
|
||||||
"rotate",
|
|
||||||
"rotate3d",
|
|
||||||
"rotateX",
|
|
||||||
"rotateY",
|
|
||||||
"rotateZ",
|
|
||||||
"scale",
|
|
||||||
"scale3d",
|
|
||||||
"scaleX",
|
|
||||||
"scaleY",
|
|
||||||
"scaleZ",
|
|
||||||
"skew",
|
|
||||||
"skewX",
|
|
||||||
"skewY",
|
|
||||||
"translate",
|
|
||||||
"translate3d",
|
|
||||||
"translateX",
|
|
||||||
"translateY",
|
|
||||||
"translateZ"
|
|
||||||
];
|
|
||||||
const animateTypes2 = ["opacity", "backgroundColor"];
|
|
||||||
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
|
|
||||||
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
|
|
||||||
MPAnimation.prototype[type] = function(...args) {
|
|
||||||
this.animation[type](...args);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
function createAnimation(option, _this) {
|
|
||||||
if (!_this)
|
|
||||||
return;
|
|
||||||
clearTimeout(_this.timer);
|
|
||||||
return new MPAnimation(option, _this);
|
|
||||||
}
|
|
||||||
exports.createAnimation = createAnimation;
|
|
||||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-transition/components/uni-transition/createAnimation.js.map
|
|
||||||
|
|
@ -1,257 +0,0 @@
|
||||||
"use strict";
|
|
||||||
const uni_modules_uniTransition_components_uniTransition_createAnimation = require("./createAnimation.js");
|
|
||||||
const common_vendor = require("../../../../common/vendor.js");
|
|
||||||
const _sfc_main = {
|
|
||||||
name: "uniTransition",
|
|
||||||
emits: ["click", "change"],
|
|
||||||
props: {
|
|
||||||
show: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
modeClass: {
|
|
||||||
type: [Array, String],
|
|
||||||
default() {
|
|
||||||
return "fade";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
duration: {
|
|
||||||
type: Number,
|
|
||||||
default: 300
|
|
||||||
},
|
|
||||||
styles: {
|
|
||||||
type: Object,
|
|
||||||
default() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
customClass: {
|
|
||||||
type: String,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
onceRender: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isShow: false,
|
|
||||||
transform: "",
|
|
||||||
opacity: 0,
|
|
||||||
animationData: {},
|
|
||||||
durationTime: 300,
|
|
||||||
config: {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
show: {
|
|
||||||
handler(newVal) {
|
|
||||||
if (newVal) {
|
|
||||||
this.open();
|
|
||||||
} else {
|
|
||||||
if (this.isShow) {
|
|
||||||
this.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
// 生成样式数据
|
|
||||||
stylesObject() {
|
|
||||||
let styles = {
|
|
||||||
...this.styles,
|
|
||||||
"transition-duration": this.duration / 1e3 + "s"
|
|
||||||
};
|
|
||||||
let transform = "";
|
|
||||||
for (let i in styles) {
|
|
||||||
let line = this.toLine(i);
|
|
||||||
transform += line + ":" + styles[i] + ";";
|
|
||||||
}
|
|
||||||
return transform;
|
|
||||||
},
|
|
||||||
// 初始化动画条件
|
|
||||||
transformStyles() {
|
|
||||||
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.config = {
|
|
||||||
duration: this.duration,
|
|
||||||
timingFunction: "ease",
|
|
||||||
transformOrigin: "50% 50%",
|
|
||||||
delay: 0
|
|
||||||
};
|
|
||||||
this.durationTime = this.duration;
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/**
|
|
||||||
* ref 触发 初始化动画
|
|
||||||
*/
|
|
||||||
init(obj = {}) {
|
|
||||||
if (obj.duration) {
|
|
||||||
this.durationTime = obj.duration;
|
|
||||||
}
|
|
||||||
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(Object.assign(this.config, obj), this);
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 点击组件触发回调
|
|
||||||
*/
|
|
||||||
onClick() {
|
|
||||||
this.$emit("click", {
|
|
||||||
detail: this.isShow
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* ref 触发 动画分组
|
|
||||||
* @param {Object} obj
|
|
||||||
*/
|
|
||||||
step(obj, config = {}) {
|
|
||||||
if (!this.animation)
|
|
||||||
return this;
|
|
||||||
Object.keys(obj).forEach((key) => {
|
|
||||||
const value = obj[key];
|
|
||||||
if (typeof this.animation[key] === "function") {
|
|
||||||
Array.isArray(value) ? this.animation[key](...value) : this.animation[key](value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.animation.step(config);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* ref 触发 执行动画
|
|
||||||
*/
|
|
||||||
run(fn) {
|
|
||||||
if (!this.animation)
|
|
||||||
return;
|
|
||||||
this.animation.run(fn);
|
|
||||||
},
|
|
||||||
// 开始过度动画
|
|
||||||
open() {
|
|
||||||
clearTimeout(this.timer);
|
|
||||||
this.isShow = true;
|
|
||||||
this.transform = this.styleInit(false).transform || "";
|
|
||||||
this.opacity = this.styleInit(false).opacity || 0;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.timer = setTimeout(() => {
|
|
||||||
this.animation = uni_modules_uniTransition_components_uniTransition_createAnimation.createAnimation(this.config, this);
|
|
||||||
this.tranfromInit(false).step();
|
|
||||||
this.animation.run(() => {
|
|
||||||
this.transform = "";
|
|
||||||
this.opacity = this.styleInit(false).opacity || 1;
|
|
||||||
this.$emit("change", {
|
|
||||||
detail: this.isShow
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, 80);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 关闭过度动画
|
|
||||||
close(type) {
|
|
||||||
if (!this.animation)
|
|
||||||
return;
|
|
||||||
this.tranfromInit(true).step().run(() => {
|
|
||||||
this.isShow = false;
|
|
||||||
this.animationData = null;
|
|
||||||
this.animation = null;
|
|
||||||
let { opacity, transform } = this.styleInit(false);
|
|
||||||
this.opacity = opacity || 1;
|
|
||||||
this.transform = transform;
|
|
||||||
this.$emit("change", {
|
|
||||||
detail: this.isShow
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 处理动画开始前的默认样式
|
|
||||||
styleInit(type) {
|
|
||||||
let styles = { transform: "", opacity: 1 };
|
|
||||||
const buildStyle = (type2, mode) => {
|
|
||||||
const value = this.animationType(type2)[mode];
|
|
||||||
if (mode.startsWith("fade")) {
|
|
||||||
styles.opacity = value;
|
|
||||||
} else {
|
|
||||||
styles.transform += value + " ";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (typeof this.modeClass === "string") {
|
|
||||||
buildStyle(type, this.modeClass);
|
|
||||||
} else {
|
|
||||||
this.modeClass.forEach((mode) => buildStyle(type, mode));
|
|
||||||
}
|
|
||||||
return styles;
|
|
||||||
},
|
|
||||||
// 处理内置组合动画
|
|
||||||
tranfromInit(type) {
|
|
||||||
let buildTranfrom = (type2, mode) => {
|
|
||||||
let aniNum = null;
|
|
||||||
if (mode === "fade") {
|
|
||||||
aniNum = type2 ? 0 : 1;
|
|
||||||
} else {
|
|
||||||
aniNum = type2 ? "-100%" : "0";
|
|
||||||
if (mode === "zoom-in") {
|
|
||||||
aniNum = type2 ? 0.8 : 1;
|
|
||||||
}
|
|
||||||
if (mode === "zoom-out") {
|
|
||||||
aniNum = type2 ? 1.2 : 1;
|
|
||||||
}
|
|
||||||
if (mode === "slide-right") {
|
|
||||||
aniNum = type2 ? "100%" : "0";
|
|
||||||
}
|
|
||||||
if (mode === "slide-bottom") {
|
|
||||||
aniNum = type2 ? "100%" : "0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.animation[this.animationMode()[mode]](aniNum);
|
|
||||||
};
|
|
||||||
if (typeof this.modeClass === "string") {
|
|
||||||
buildTranfrom(type, this.modeClass);
|
|
||||||
} else {
|
|
||||||
this.modeClass.forEach((mode) => {
|
|
||||||
buildTranfrom(type, mode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.animation;
|
|
||||||
},
|
|
||||||
animationType(type) {
|
|
||||||
return {
|
|
||||||
fade: type ? 1 : 0,
|
|
||||||
"slide-top": `translateY(${type ? "0" : "-100%"})`,
|
|
||||||
"slide-right": `translateX(${type ? "0" : "100%"})`,
|
|
||||||
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
|
|
||||||
"slide-left": `translateX(${type ? "0" : "-100%"})`,
|
|
||||||
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
|
|
||||||
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
|
|
||||||
};
|
|
||||||
},
|
|
||||||
// 内置动画类型与实际动画对应字典
|
|
||||||
animationMode() {
|
|
||||||
return {
|
|
||||||
fade: "opacity",
|
|
||||||
"slide-top": "translateY",
|
|
||||||
"slide-right": "translateX",
|
|
||||||
"slide-bottom": "translateY",
|
|
||||||
"slide-left": "translateX",
|
|
||||||
"zoom-in": "scale",
|
|
||||||
"zoom-out": "scale"
|
|
||||||
};
|
|
||||||
},
|
|
||||||
// 驼峰转中横线
|
|
||||||
toLine(name) {
|
|
||||||
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
||||||
return {
|
|
||||||
a: $data.isShow,
|
|
||||||
b: $data.animationData,
|
|
||||||
c: common_vendor.n($props.customClass),
|
|
||||||
d: common_vendor.s($options.transformStyles),
|
|
||||||
e: common_vendor.o((...args) => $options.onClick && $options.onClick(...args))
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
||||||
wx.createComponent(Component);
|
|
||||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-transition/components/uni-transition/uni-transition.js.map
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"component": true,
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<view hidden="{{!a}}" ref="ani" animation="{{b}}" class="{{c}}" style="{{d}}" bindtap="{{e}}"><slot></slot></view>
|
|
||||||
Loading…
Reference in New Issue
Block a user