Browse Source

兼容app,修改海报生成的问题

master
gaoxs 5 years ago
parent
commit
9ae2a1d223
  1. 8
      api/store.js
  2. 116
      components/StorePoster.vue
  3. 2
      components/SwitchWindow.vue
  4. 1
      config/index.js
  5. 2
      manifest.json
  6. 2
      pages/activity/DargainDetails/index.vue
  7. 2
      pages/activity/GroupDetails/index.vue
  8. 2
      pages/activity/GroupRule/index.vue
  9. 2
      pages/activity/SeckillDetails/index.vue
  10. 93
      pages/home/index.vue
  11. 6
      pages/order/GoodsReturn/index.vue
  12. 6
      pages/order/Logistics/index.vue
  13. 2
      pages/orderAdmin/OrderCancellation/index.vue
  14. 4
      pages/orderAdmin/OrderIndex/index.vue
  15. 2
      pages/orderAdmin/Statistics/index.vue
  16. 10
      pages/shop/GoodsCon/index.vue
  17. 2
      pages/shop/GoodsEvaluate/index.vue
  18. 2
      pages/shop/GoodsPromotion/index.vue
  19. 2
      pages/shop/HotNewGoods/index.vue
  20. 83
      pages/user/Login/index.vue
  21. 4
      pages/user/PersonalData/index.vue
  22. 4
      pages/user/Recharge/index.vue
  23. 4
      pages/user/RetrievePassword/index.vue
  24. 4
      pages/user/UserAccount/index.vue
  25. 2
      pages/user/UserBill/index.vue
  26. 4
      pages/user/UserVip/index.vue
  27. 2
      pages/user/address/AddAddress/index.vue
  28. 2
      pages/user/address/AddressManagement/index.vue
  29. 2
      pages/user/coupon/GetCoupon/index.vue
  30. 4
      pages/user/promotion/CashRecord/index.vue
  31. 4
      pages/user/promotion/CommissionDetails/index.vue
  32. 2
      pages/user/promotion/Poster/index.vue
  33. 2
      pages/user/promotion/PromoterList/index.vue
  34. 2
      pages/user/promotion/PromoterOrder/index.vue
  35. 4
      pages/user/promotion/UserCash/index.vue
  36. 2
      pages/user/promotion/UserPromotion/index.vue
  37. 4
      pages/user/signIn/Integral/index.vue
  38. 6
      utils/dialog.js
  39. 17
      utils/index.js

8
api/store.js

@ -72,6 +72,14 @@ export function getGroomList(type) {
login: true login: true
}); });
} }
/*
* 获取商品海报
* */
export function getProductPoster(id) {
return request.get("/product/poster/" + id, {}, {
login: true
});
}
/* /*
* 购物车 添加 * 购物车 添加

116
components/StorePoster.vue

@ -47,6 +47,80 @@
<view class="mask"></view> <view class="mask"></view>
</view> </view>
</template> </template>
<script>
// import html2canvas from "html2canvas";
import { PosterCanvas } from "@/utils";
import { getProductPoster } from "@/api/store";
export default {
name: "StorePoster",
props: {
posterImageStatus: Boolean,
posterData: Object,
goodId: String
},
data: function() {
return {
canvasStatus: false,
posterImage: ""
};
},
watch: {
posterImageStatus: function() {
var that = this;
if (that.posterImageStatus === true) {
that.$nextTick(function() {
that.savePosterPath();
});
}
}
},
mounted: function() {},
methods: {
posterImageClose: function() {
this.posterImageStatus = false;
this.canvasStatus = false;
this.$emit("setPosterImageStatus");
},
savePosterPath: function() {
const that = this;
uni.showLoading({ title: "海报生成中", mask: true });
getProductPoster(this.goodId)
.then(res => {
this.canvasStatus = true;
this.posterImage = res.data;
})
.finally(() => {
uni.hideLoading();
});
// return;
// //
// that.posterImage = "";
// uni.showLoading({ title: "", mask: true });
// console.log(this);
// var prodId = that.$yrouter.currentRoute.query.id;
// uni.downloadFile({
// url:
// this.$VUE_APP_API_URL +
// "/shareImg/" +
// prodId +
// "?shareImgName=" +
// this.posterData.code,
// fail: function(res) {},
// success: function(res) {
// console.log(res);
// that.canvasStatus = true;
// that.posterImage = res.tempFilePath;
// uni.hideLoading();
// }
// });
}
}
};
</script>
<style scoped lang="less" lang="less"> <style scoped lang="less" lang="less">
.poster-first { .poster-first {
overscroll-behavior: contain; overscroll-behavior: contain;
@ -135,45 +209,3 @@
z-index: 9; z-index: 9;
} }
</style> </style>
<script>
// import html2canvas from "html2canvas";
import { PosterCanvas } from "@/utils";
export default {
name: "StorePoster",
props: {
posterImageStatus: Boolean,
posterData: Object
},
data: function() {
return {
canvasStatus: false,
posterImage: ""
};
},
watch: {
posterImageStatus: function() {
var that = this;
if (that.posterImageStatus === true) {
that.$nextTick(function() {
that.savePosterPath();
});
}
}
},
mounted: function() {},
methods: {
posterImageClose: function() {
this.posterImageStatus = false;
this.canvasStatus = false;
this.$emit("setPosterImageStatus");
},
savePosterPath: function() {
PosterCanvas(this.posterData, posterImage => {
this.canvasStatus = true;
this.posterImage = posterImage;
});
}
}
};
</script>

2
components/SwitchWindow.vue

@ -145,7 +145,7 @@ export default {
.catch(err => { .catch(err => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

1
config/index.js

@ -1,3 +1,4 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
export const VUE_APP_API_URL = 'https://h5api.dayouqiantu.cn/api'; export const VUE_APP_API_URL = 'https://h5api.dayouqiantu.cn/api';
export const VUE_APP_RESOURCES_URL = 'https://h5.dayouqiantu.cn/static'; export const VUE_APP_RESOURCES_URL = 'https://h5.dayouqiantu.cn/static';

2
manifest.json

@ -12,7 +12,7 @@
"compilerVersion" : 3, "compilerVersion" : 3,
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender" : true,
"waiting" : true, "waiting" : false,
"autoclose" : true, "autoclose" : true,
"delay" : 0 "delay" : 0
}, },

2
pages/activity/DargainDetails/index.vue

@ -279,7 +279,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/activity/GroupDetails/index.vue

@ -338,7 +338,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/activity/GroupRule/index.vue

@ -155,7 +155,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/activity/SeckillDetails/index.vue

@ -214,7 +214,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

93
pages/home/index.vue

@ -5,19 +5,25 @@
<text class="iconfont icon-xiazai5"></text> <text class="iconfont icon-xiazai5"></text>
搜索商品 搜索商品
</view> </view>
<view class="qr" @click="startQr()"><image src="@/static/images/qr.png" /></view> <view class="qr" @click="startQr()">
<image src="@/static/images/qr.png" />
</view>
</view> </view>
<view class="slider-banner banner"> <view class="slider-banner banner">
<swiper indicatorDots="true" v-if="banner.length > 0"> <swiper indicatorDots="true" v-if="banner.length > 0">
<block v-for="(item, bannerIndex) in banner" :key="bannerIndex"> <block v-for="(item, bannerIndex) in banner" :key="bannerIndex">
<swiper-item> <swiper-item>
<view @click="item.url ? $yrouter.push('/' + item.url) : ''" class="swiper-item"><image :src="item.pic" /></view> <view @click="item.url ? $yrouter.push('/' + item.url) : ''" class="swiper-item">
<image :src="item.pic" />
</view>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
</view> </view>
<view class="news acea-row row-between-wrapper"> <view class="news acea-row row-between-wrapper">
<view class="pictrue" v-if="$VUE_APP_RESOURCES_URL"><image src="@/static/images/news.png" /></view> <view class="pictrue" v-if="$VUE_APP_RESOURCES_URL">
<image src="@/static/images/news.png" />
</view>
<view class="swiper-no-swiping new-banner"> <view class="swiper-no-swiping new-banner">
<swiper class="swiper-wrapper" v-if="roll.length > 0" :indicator-dots="false" autoplay circular vertical> <swiper class="swiper-wrapper" v-if="roll.length > 0" :indicator-dots="false" autoplay circular vertical>
<block v-for="(item, rollIndex) in roll" :key="rollIndex"> <block v-for="(item, rollIndex) in roll" :key="rollIndex">
@ -36,14 +42,18 @@
</view> </view>
<view class="nav acea-row"> <view class="nav acea-row">
<view @click="goWxappUrl(item)" class="item" v-for="(item, menusIndex) in menus" :key="menusIndex"> <view @click="goWxappUrl(item)" class="item" v-for="(item, menusIndex) in menus" :key="menusIndex">
<view class="pictrue"><image :src="item.pic" /></view> <view class="pictrue">
<image :src="item.pic" />
</view>
<view>{{ item.name }}</view> <view>{{ item.name }}</view>
</view> </view>
</view> </view>
<view class="wrapper hot" v-if="bastList.length > 0"> <view class="wrapper hot" v-if="bastList.length > 0">
<image class="bg" src="../../static/images/index-bg.png" mode="widthFix"></image> <image class="bg" src="../../static/images/index-bg.png" mode="widthFix"></image>
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view class="text"><view class="name line1">热门榜单</view></view> <view class="text">
<view class="name line1">热门榜单</view>
</view>
<view @click="goHotNewGoods(2)" class="more"> <view @click="goHotNewGoods(2)" class="more">
更多 更多
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
@ -53,7 +63,9 @@
<scroll-view scroll-y="false" scroll-x="true"> <scroll-view scroll-y="false" scroll-x="true">
<view class="newProductsScroll"> <view class="newProductsScroll">
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, likeInfoIndex) in likeInfo" :key="likeInfoIndex"> <view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, likeInfoIndex) in likeInfo" :key="likeInfoIndex">
<view class="img-box"><image :src="item.image" /></view> <view class="img-box">
<image :src="item.image" />
</view>
<view class="pro-info line1"><text>{{ item.storeName }}</text></view> <view class="pro-info line1"><text>{{ item.storeName }}</text></view>
<view class="money font-color-red"><text>{{ item.price }}</text></view> <view class="money font-color-red"><text>{{ item.price }}</text></view>
</view> </view>
@ -63,7 +75,9 @@
</view> </view>
<view class="wrapper" v-if="bastList.length > 0"> <view class="wrapper" v-if="bastList.length > 0">
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view class="text"><view class="name line1">精品推荐</view></view> <view class="text">
<view class="name line1">精品推荐</view>
</view>
<view @click="goHotNewGoods(1)" class="more"> <view @click="goHotNewGoods(1)" class="more">
更多 更多
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
@ -89,7 +103,9 @@
<scroll-view scroll-y="false" scroll-x="true"> <scroll-view scroll-y="false" scroll-x="true">
<view class="newProductsScroll"> <view class="newProductsScroll">
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, firstListIndex) in firstList" :key="firstListIndex"> <view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, firstListIndex) in firstList" :key="firstListIndex">
<view class="img-box"><image :src="item.image" /></view> <view class="img-box">
<image :src="item.image" />
</view>
<view class="pro-info line1">{{ item.storeName }}</view> <view class="pro-info line1">{{ item.storeName }}</view>
<view class="money font-color-red">{{ item.price }}</view> <view class="money font-color-red">{{ item.price }}</view>
</view> </view>
@ -99,7 +115,9 @@
</view> </view>
<view class="wrapper" v-if="benefit.length > 0"> <view class="wrapper" v-if="benefit.length > 0">
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view class="text"><view class="name line1">促销单品</view></view> <view class="text">
<view class="name line1">促销单品</view>
</view>
<view @click="goGoodsPromotion(4)" class="more"> <view @click="goGoodsPromotion(4)" class="more">
更多 更多
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
@ -116,9 +134,15 @@
import GoodList from '@/components/GoodList'; import GoodList from '@/components/GoodList';
import PromotionGood from '@/components/PromotionGood'; import PromotionGood from '@/components/PromotionGood';
import CouponWindow from '@/components/CouponWindow'; import CouponWindow from '@/components/CouponWindow';
import { getHomeData, getShare } from '@/api/public'; import {
getHomeData,
getShare
} from '@/api/public';
import cookie from '@/utils/store/cookie'; import cookie from '@/utils/store/cookie';
import { isWeixin } from '@/utils/index'; import {
isWeixin,
handleUrlParam
} from '@/utils/index';
const HAS_COUPON_WINDOW = 'has_coupon_window'; const HAS_COUPON_WINDOW = 'has_coupon_window';
@ -242,13 +266,17 @@ export default {
goHotNewGoods(type) { goHotNewGoods(type) {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/HotNewGoods/index', path: '/pages/shop/HotNewGoods/index',
query: { type } query: {
type
}
}); });
}, },
goGoodsCon(item) { goGoodsCon(item) {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/GoodsCon/index', path: '/pages/shop/GoodsCon/index',
query: { id: item.id } query: {
id: item.id
}
}); });
}, },
goGoodsPromotion() { goGoodsPromotion() {
@ -257,12 +285,44 @@ export default {
setOpenShare: function() {}, setOpenShare: function() {},
startQr: function() { startQr: function() {
uni.scanCode({ uni.scanCode({
success:function(res){ success: (res) =>{
console.log(JSON.stringify(res)); let option = handleUrlParam(res.result)
console.log(option)
// {productId: "19", spread: "21", codeType: "routine"}
// {productId: "19", spread: "21", pageType: "good", codeType: "routine"}
switch (option.pageType) {
case 'good':
//
this.$yrouter.push({path:'/pages/shop/GoodsCon/index',query:{
q:res.result
}});
break;
case 'group':
//
this.$yrouter.push({path:'/pages/activity/GroupRule/index',query:{
q:res.result
}});
break;
case 'dargain':
//
this.$yrouter.push({path:'/pages/activity/DargainDetails/index',query:{
q:res.result
}});
break;
default:
//
this.$yrouter.push({path:'/pages/Loading/index',query:{
}});
break;
}
} }
}); });
} }
} }
}; };
</script> </script>
@ -270,6 +330,7 @@ export default {
.index { .index {
background-color: #fff; background-color: #fff;
} }
.swiper-item { .swiper-item {
height: 100%; height: 100%;
} }

6
pages/order/GoodsReturn/index.vue

@ -82,7 +82,7 @@
imageuploaded(res) { imageuploaded(res) {
if (res.status !== 200) { if (res.status !== 200) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -97,7 +97,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -137,7 +137,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

6
pages/order/Logistics/index.vue

@ -140,7 +140,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -149,7 +149,7 @@
getExpress() { getExpress() {
if (!this.id) { if (!this.id) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -172,7 +172,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/orderAdmin/OrderCancellation/index.vue

@ -112,7 +112,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

4
pages/orderAdmin/OrderIndex/index.vue

@ -130,7 +130,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -150,7 +150,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/orderAdmin/Statistics/index.vue

@ -400,7 +400,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

10
pages/shop/GoodsCon/index.vue

@ -135,6 +135,7 @@
v-on:setPosterImageStatus="setPosterImageStatus" v-on:setPosterImageStatus="setPosterImageStatus"
:posterImageStatus="posterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData" :posterData="posterData"
:goodId="id"
></StorePoster> ></StorePoster>
<ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo> <ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
<view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''"> <view class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
@ -258,6 +259,7 @@ export default {
computed: mapGetters(["isLogin"]), computed: mapGetters(["isLogin"]),
mounted: function() { mounted: function() {
let url = handleQrCode(); let url = handleQrCode();
console.log(url);
if (url && url.productId) { if (url && url.productId) {
this.id = url.productId; this.id = url.productId;
} else { } else {
@ -327,6 +329,7 @@ export default {
if (this.$deviceType == "app") { if (this.$deviceType == "app") {
form.form = "app"; form.form = "app";
} }
uni.showLoading({ title: "加载中", mask: true });
getProductDetail(that.id, form) getProductDetail(that.id, form)
.then(res => { .then(res => {
that.$set(that, "storeInfo", res.data.storeInfo); that.$set(that, "storeInfo", res.data.storeInfo);
@ -370,6 +373,9 @@ export default {
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
})
.finally(() => {
uni.hideLoading();
}); });
}, },
// //
@ -498,14 +504,14 @@ export default {
}, },
changeattr: function(msg) { changeattr: function(msg) {
// //
console.log(msg) console.log(msg);
this.attr.cartAttr = msg; this.attr.cartAttr = msg;
this.isOpen = false; this.isOpen = false;
}, },
// //
ChangeAttr: function(res) { ChangeAttr: function(res) {
// //
console.log(res) console.log(res);
let productSelect = this.productValue[res.value]; let productSelect = this.productValue[res.value];
if (productSelect) { if (productSelect) {
this.attr.productAttr[res.indexw].index = res.indexn; this.attr.productAttr[res.indexw].index = res.indexn;

2
pages/shop/GoodsEvaluate/index.vue

@ -205,7 +205,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/shop/GoodsPromotion/index.vue

@ -67,7 +67,7 @@
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/shop/HotNewGoods/index.vue

@ -73,7 +73,7 @@ export default {
}) })
.catch((err)=> { .catch((err)=> {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

83
pages/user/Login/index.vue

@ -7,8 +7,13 @@
</view> </view>
<view class="whiteBg" v-if="formItem === 1"> <view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row row-center-wrapper"> <view class="title acea-row row-center-wrapper">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)" <view
:key="index">{{ item }}</view> class="item"
:class="current === index ? 'on' : ''"
v-for="(item, index) in navList"
@click="navTap(index)"
:key="index"
>{{ item }}</view>
</view> </view>
<view class="list" :hidden="current !== 0"> <view class="list" :hidden="current !== 0">
<form @submit.prevent="submit"> <form @submit.prevent="submit">
@ -45,7 +50,12 @@
<use xlink:href="#icon-code_1" /> <use xlink:href="#icon-code_1" />
</svg>--> </svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button> <button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</view> </view>
</view> </view>
</view> </view>
@ -73,7 +83,12 @@
<use xlink:href="#icon-code_1" /> <use xlink:href="#icon-code_1" />
</svg>--> </svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button> <button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -104,26 +119,13 @@
</template> </template>
<script> <script>
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from "@/mixins/SendVerifyCode";
import { import { login, loginMobile, registerVerify, register } from "@/api/user";
login, import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
loginMobile, import { validatorDefaultCatch } from "@/utils/dialog";
registerVerify,
register
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import dayjs from "dayjs"; import dayjs from "dayjs";
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie";
import { import { handleGetUserInfo } from "@/utils";
handleGetUserInfo
} from '@/utils'
const BACK_URL = "login_back_url"; const BACK_URL = "login_back_url";
@ -145,10 +147,7 @@
methods: { methods: {
async loginMobile() { async loginMobile() {
var that = this; var that = this;
const { const { account, captcha } = that;
account,
captcha
} = that;
try { try {
await that await that
.$validator({ .$validator({
@ -176,23 +175,19 @@
.then(res => { .then(res => {
var data = res.data; var data = res.data;
that.$store.commit("LOGIN", data.token, dayjs(data.expires_time)); that.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
handleGetUserInfo() handleGetUserInfo();
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: "none",
duration: 2000 duration: 2000
}); });
}); });
}, },
async register() { async register() {
var that = this; var that = this;
const { const { account, captcha, password } = that;
account,
captcha,
password
} = that;
try { try {
await that await that
.$validator({ .$validator({
@ -235,7 +230,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -243,9 +238,7 @@
}, },
async code() { async code() {
var that = this; var that = this;
const { const { account } = that;
account
} = that;
try { try {
await that await that
.$validator({ .$validator({
@ -275,7 +268,7 @@
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -285,10 +278,7 @@
this.current = index; this.current = index;
}, },
async submit() { async submit() {
const { const { account, password } = this;
account,
password
} = this;
try { try {
await this.$validator({ await this.$validator({
account: [ account: [
@ -314,11 +304,9 @@
password, password,
spread: cookie.get("spread") spread: cookie.get("spread")
}) })
.then(({ .then(({ data }) => {
data
}) => {
this.$store.commit("LOGIN", data.token, dayjs(data.expires_time)); this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
handleGetUserInfo() handleGetUserInfo();
// let replace=this.$yroute.query.replace // let replace=this.$yroute.query.replace
// if(replace){ // if(replace){
@ -328,8 +316,9 @@
// }); // });
}) })
.catch(err => { .catch(err => {
console.log(err);
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/PersonalData/index.vue

@ -156,7 +156,7 @@ export default {
.catch(err => { .catch(err => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -214,7 +214,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/Recharge/index.vue

@ -97,7 +97,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -174,7 +174,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/RetrievePassword/index.vue

@ -109,7 +109,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -141,7 +141,7 @@ export default {
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/UserAccount/index.vue

@ -75,7 +75,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -92,7 +92,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/user/UserBill/index.vue

@ -97,7 +97,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

4
pages/user/UserVip/index.vue

@ -165,7 +165,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -182,7 +182,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/user/address/AddAddress/index.vue

@ -201,7 +201,7 @@ export default {
}); });
} catch (err) { } catch (err) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/user/address/AddressManagement/index.vue

@ -211,7 +211,7 @@ export default {
// .catch(err => { // .catch(err => {
// uni.hideLoading(); // uni.hideLoading();
// uni.showToast({ // uni.showToast({
// title: err.msg || err.response.data.msg, // title: err.msg || err.response.data.msg|| err.response.data.message,
// icon: 'none', // icon: 'none',
// duration: 2000 // duration: 2000
// }); // });

2
pages/user/coupon/GetCoupon/index.vue

@ -76,7 +76,7 @@ export default {
}) })
.catch(function(err) { .catch(function(err) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/promotion/CashRecord/index.vue

@ -76,7 +76,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -91,7 +91,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/promotion/CommissionDetails/index.vue

@ -77,7 +77,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -92,7 +92,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/user/promotion/Poster/index.vue

@ -74,7 +74,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/user/promotion/PromoterList/index.vue

@ -157,7 +157,7 @@
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

2
pages/user/promotion/PromoterOrder/index.vue

@ -92,7 +92,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

4
pages/user/promotion/UserCash/index.vue

@ -103,7 +103,7 @@ export default {
}, },
function(err) { function(err) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
@ -200,7 +200,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });

2
pages/user/promotion/UserPromotion/index.vue

@ -84,7 +84,7 @@ export default {
}, },
function(err) { function(err) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

4
pages/user/signIn/Integral/index.vue

@ -135,7 +135,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
@ -150,7 +150,7 @@ export default {
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

6
utils/dialog.js

@ -27,9 +27,9 @@ const dialog = {
// notify, // notify,
loading: { loading: {
open: () => { open: () => {
uni.showLoading({ // uni.showLoading({
title: '加载中' // title: '加载中'
}) // })
}, },
close: () => { close: () => {
uni.hideLoading() uni.hideLoading()

17
utils/index.js

@ -459,6 +459,7 @@ export function handleQrCode() {
try { try {
var urlSpread = parseQuery()["q"]; var urlSpread = parseQuery()["q"];
if (urlSpread) { if (urlSpread) {
if (urlSpread.indexOf('%3F') != -1) {
// 通过海报二维码进来 // 通过海报二维码进来
urlSpread = urlSpread urlSpread = urlSpread
.split("%3F")[1] .split("%3F")[1]
@ -472,6 +473,9 @@ export function handleQrCode() {
.join(","); .join(",");
urlSpread = JSON.parse("{" + urlSpread + "}"); urlSpread = JSON.parse("{" + urlSpread + "}");
return urlSpread return urlSpread
} else {
return handleUrlParam(urlSpread)
}
} }
return null return null
} catch { } catch {
@ -480,6 +484,19 @@ export function handleQrCode() {
} }
export function handleUrlParam(path) {
console.log(path)
var url = path.split("?")[1]; //获取url中"?"符后的字串
console.log(url)
var theRequest = new Object();
let strs = url.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
return theRequest;
}
const getImageInfo = (images) => { const getImageInfo = (images) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let imageAry = {} let imageAry = {}

Loading…
Cancel
Save