|
@@ -14,7 +14,7 @@
|
|
|
/>
|
|
|
</wd-upload>
|
|
|
<view class="tips">最多上传5张照片</view>
|
|
|
- <!-- // <button class="btn" @click="onAdd" :loading="loading">{{loading ? '上传中' :'立即上传'}}</button> -->
|
|
|
+ <!-- // <button class="btn" @click="onAdd" :loading="loading">{{loading ? '上传中' :'立即上传'}}</button> -->
|
|
|
<view class="btn" @click="toAdd">立即上传</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -64,11 +64,13 @@ const handleRemove = (file: any) => {
|
|
|
imgList.value = imgList.value.filter((item) => item !== data.url);
|
|
|
};
|
|
|
|
|
|
-const loading = ref(false)
|
|
|
+const loading = ref(false);
|
|
|
const onAdd = () => {
|
|
|
- // if(loading.value) return
|
|
|
- // loading.value = true
|
|
|
- const location = uni.getStorageSync("location") ? JSON.parse(uni.getStorageSync("location")) : {};
|
|
|
+ // if(loading.value) return
|
|
|
+ // loading.value = true
|
|
|
+ const location = uni.getStorageSync("location")
|
|
|
+ ? JSON.parse(uni.getStorageSync("location"))
|
|
|
+ : {};
|
|
|
if (imgList.value.length === 0)
|
|
|
return uni.showToast({ title: "请上传图片", icon: "none" });
|
|
|
const params = {
|
|
@@ -90,12 +92,11 @@ const onAdd = () => {
|
|
|
if (
|
|
|
response["FWGvRFSZ65JVrMsTqeBoT9hJYyeN9Z_aFAacMxoPlhY"] === "accept"
|
|
|
) {
|
|
|
- uni.showToast({ title: "操作成功!", icon: "none" });
|
|
|
- setTimeout(()=>{
|
|
|
- uni.navigateBack();
|
|
|
- },1000)
|
|
|
+ uni.showToast({ title: "操作成功!", icon: "none" });
|
|
|
}
|
|
|
- // uni.showToast({ title: "订阅成功", icon: "success" });
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack();
|
|
|
+ }, 800);
|
|
|
},
|
|
|
fail(err) {
|
|
|
uni.showToast({ title: "订阅失败", icon: "error" });
|
|
@@ -103,35 +104,33 @@ const onAdd = () => {
|
|
|
},
|
|
|
});
|
|
|
} else {
|
|
|
- uni.showToast({ title: "上传图片失败", icon: "error" });
|
|
|
+ uni.showToast({ title: res.msg, icon: "none" });
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const throttle = (func: any, limit: any) => {
|
|
|
+ let lastFunc: any;
|
|
|
+ let lastRan: any;
|
|
|
+ return function (...args: any) {
|
|
|
+ const context = this;
|
|
|
+ const now = Date.now();
|
|
|
+ if (!lastRan) {
|
|
|
+ func.apply(context, args);
|
|
|
+ lastRan = now;
|
|
|
+ } else {
|
|
|
+ clearTimeout(lastFunc);
|
|
|
+ lastFunc = setTimeout(function () {
|
|
|
+ if (now - lastRan >= limit) {
|
|
|
+ func.apply(context, args);
|
|
|
+ lastRan = now;
|
|
|
+ }
|
|
|
+ }, limit - (now - lastRan));
|
|
|
+ }
|
|
|
+ };
|
|
|
+};
|
|
|
|
|
|
-
|
|
|
-const throttle=(func:any, limit:any) => {
|
|
|
- let lastFunc:any;
|
|
|
- let lastRan:any;
|
|
|
- return function (...args:any) {
|
|
|
- const context = this;
|
|
|
- const now = Date.now();
|
|
|
- if (!lastRan) {
|
|
|
- func.apply(context, args);
|
|
|
- lastRan = now;
|
|
|
- } else {
|
|
|
- clearTimeout(lastFunc);
|
|
|
- lastFunc = setTimeout(function () {
|
|
|
- if (now - lastRan >= limit) {
|
|
|
- func.apply(context, args);
|
|
|
- lastRan = now;
|
|
|
- }
|
|
|
- }, limit - (now - lastRan));
|
|
|
- }
|
|
|
- };
|
|
|
-}
|
|
|
-
|
|
|
-const toAdd = throttle(onAdd,3000)
|
|
|
+const toAdd = throttle(onAdd, 3000);
|
|
|
|
|
|
onLoad((options: any) => {
|
|
|
routerInfo.discountId = options.discountId;
|