hupeng 5 years ago
parent
commit
6584c36afa
  1. 2
      README.md
  2. 2
      assets/css/style.css
  3. 2
      assets/css/style.css.map
  4. 2
      assets/css/style.less
  5. 91
      components/CountDown.vue
  6. 1
      config/index.js
  7. 36
      libs/wechat.js
  8. 109
      main.js
  9. 4
      manifest.json
  10. 1
      pages.json
  11. 56
      pages/Loading/index.vue
  12. 433
      pages/activity/DargainDetails/index.vue
  13. 27
      pages/shop/GoodsCon/index.vue
  14. 4
      pages/shop/ShoppingCart/index.vue
  15. 8
      pages/user/Login/index.vue
  16. 24
      pages/user/Register/index.vue
  17. 30
      pages/user/UserAccount/index.vue
  18. 2
      pages/user/UserVip/index.vue
  19. 50
      pages/user/promotion/PromoterList/index.vue
  20. 14
      store/index.js
  21. 77
      utils/index.js
  22. 2
      utils/request.js
  23. 11
      utils/store/cookie.js

2
README.md

@ -13,7 +13,7 @@
- uni会自动打开微信开发者工具并且打开uni的项目
## 注意事项
- 目前并不支持H5运行,需要运行H5模式的,请自行调整兼容
- uniapp v3.1版本已经兼容h5,另外yshop有自己的H5,uniappv3.1以下版本未对H5端进行处理,如果需要请自行兼容。
- manifest.json 中可以配置uni项目的一些信息
- 打开manifest.json可配置小程序的 appid
- 由于需要兼容app,公共样式由 main.js 迁移到了 App.vue,公共样式请在App.vue中进行编辑

2
assets/css/style.css

File diff suppressed because one or more lines are too long

2
assets/css/style.css.map

File diff suppressed because one or more lines are too long

2
assets/css/style.less

@ -2467,7 +2467,7 @@ page {
right: 0;
bottom: 0;
border-bottom: 1rpx solid #f5f5f5;
z-index: 999;
z-index: 99;
height: 1rpx;
}

91
components/CountDown.vue

@ -1,65 +1,67 @@
<template>
<view class="time">
<text v-if="rtipText">{{ rtipText }}</text>
<text class="styleAll" v-if="risDay === true">{{ rday }}</text>
<text class="timeTxt" v-if="rdayText">{{ rdayText }}</text>
{{ tipText }}
<text class="styleAll" v-if="isDay === true">{{ day }}</text>
<text class="timeTxt">{{ dayText }}</text>
<text class="styleAll">{{ hour }}</text>
<text class="timeTxt" v-if="rhourText">{{ rhourText }}</text>
<text class="timeTxt">{{ hourText }}</text>
<text class="styleAll">{{ minute }}</text>
<text class="timeTxt" v-if="rminuteText">{{ rminuteText }}</text>
<text class="timeTxt">{{ minuteText }}</text>
<text class="styleAll">{{ second }}</text>
<text class="timeTxt" v-if="rsecondText">{{ rsecondText }}</text>
<text class="timeTxt">{{ secondText }}</text>
</view>
</template>
<script>
export default {
export default {
name: "CountDown",
props: [
props: {
//
'tipText',
'dayText',
'hourText',
'minuteText',
'secondText',
'datatime',
'isDay'
],
data: function() {
tipText: {
type: String,
default: "倒计时"
},
dayText: {
type: String,
default: "天"
},
hourText: {
type: String,
default: "时"
},
minuteText: {
type: String,
default: "分"
},
secondText: {
type: String,
default: "秒"
},
datatime: {
type: Number,
default: 0
},
isDay: {
type: Boolean,
default: true
}
},
data: function () {
return {
day: "00",
hour: "00",
minute: "00",
second: "00",
rtipText: "倒计时",
rdayText: "天",
rhourText: "时",
rminuteText: "分",
rsecondText: "秒",
rdatatime: 0,
risDay: true
second: "00"
};
},
created: function() {
// this.show_time();
},
mounted: function() {
this.rtipText = this.$props.tipText;
this.rdayText = this.$props.dayText;
this.rhourText = this.$props.hourText;
this.rminuteText = this.$props.minuteText;
this.rsecondText = this.$props.secondText;
this.rdatatime = this.$props.datatime;
this.risDay = this.$props.isDay;
created: function () {
this.show_time();
},
mounted: function () {},
methods: {
show_time: function() {
let that = this;
this.runTime();
setInterval(this.runTime, 1000);
},
runTime() {
show_time: function () {
let that = this;
function runTime() {
//
let intDiff = that.datatime - Date.parse(new Date()) / 1000; //
let day = 0,
@ -94,6 +96,9 @@ export default {
that.second = "00";
}
}
runTime();
setInterval(runTime, 1000);
}
}
};
};
</script>

1
config/index.js

@ -5,4 +5,3 @@
export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

36
libs/wechat.js

@ -86,9 +86,11 @@ const LOGINTYPE = "loginType";
let instance;
let wechatObj;
let appId
let wechatLoading = false
export function wechat() {
console.log('初始化微信配置')
wechatLoading = false
return new Promise((resolve, reject) => {
if (instance) return resolve(instance);
getWechatConfig()
@ -107,12 +109,17 @@ export function wechat() {
})
.catch(error => {
console.log(error)
reject(error)
uni.showToast({
title: error,
icon: "none",
duration: 2000
});
reject()
});
})
.catch(err => {
console.log(err);
reject(err);
reject();
});
});
}
@ -122,9 +129,8 @@ export function clearAuthStatus() {
cookie.remove(STATE_KEY);
}
export function oAuth() {
export async function oAuth() {
console.log('处理微信授权')
console.log('处理微信授权cookie', cookie.get("spread"))
console.log(store)
console.log(store.state)
return new Promise((resolve, reject) => {
@ -137,6 +143,8 @@ export function oAuth() {
if (!code) {
toAuth();
return
} else {
auth(code)
}
resolve()
}).catch(error => {
@ -144,11 +152,12 @@ export function oAuth() {
})
}
export function auth(code) {
export async function auth(code) {
console.log('获取微信授权')
return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE);
let spread = cookie.get(spread);
let spread = cookie.get('spread');
console.log('微信授权登录前获取spread', spread)
wechatAuth(code, spread, loginType)
.then(({ data }) => {
console.log(data)
@ -158,15 +167,22 @@ export function auth(code) {
cookie.set(WX_AUTH, code, expires_time);
cookie.remove(STATE_KEY);
loginType && cookie.remove(LOGINTYPE);
console.log('微信公众号授权登录,获取用户信息')
store.dispatch('getUser').finally(() => {
resolve();
})
})
.catch(reject);
}).catch(error => {
console.log(error)
})
}
export function toAuth() {
export async function toAuth() {
if (wechatLoading) {
return
}
wechatLoading = true
wechat().then(wx => {
location.href = getAuthUrl(appId);
});
@ -179,9 +195,9 @@ function getAuthUrl(appId) {
// #ifdef H5
// #endif
const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index?path=${encodeURIComponent(window.location.href)}`);
cookie.set('redirect', window.location.href)
const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index?path=${encodeURIComponent(window.location.href)}`);
// const redirect_uri = encodeURIComponent(`${window.location.origin}${window.location.pathname}`)
// const redirect_uri = encodeURIComponent(`${location.origin}`)
cookie.remove(BACK_URL);

109
main.js

@ -38,14 +38,6 @@ Vue.prototype.$validator = function (rule) {
return new schema(rule);
};
// const CACHE_KEY = "clear_0.0.1";
// if (!cookie.has(CACHE_KEY)) {
// cookie.clearAll();
// cookie.set(CACHE_KEY, 1);
// }
Vue.config.productionTip = false
App.mpType = 'app'
Vue.prototype.$store = store
@ -82,6 +74,29 @@ Object.defineProperty(Vue.prototype, '$yroute', {
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
Vue.component('cu-custom', cuCustom);
// #ifdef APP-PLUS
// App平台编译的代码
Vue.prototype.$deviceType = 'app'
store.commit('updateDevicetype', 'app')
Vue.prototype.$platform = uni.getSystemInfoSync().platform
// #endif
// #ifdef MP-WEIXIN
// 微信小程序编译的代码
Vue.prototype.$deviceType = 'routine'
store.commit('updateDevicetype', 'routine')
// #endif
// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
// 建议通过 store 去获取 $deviceType 可以保证 template 中取到的值有效
// import { mapState, mapMutations, mapActions } from 'vuex';
// computed: {
// ...mapState(['$deviceType'])
// },
// #ifdef H5
// H5编译的代码
@ -102,72 +117,48 @@ import {
} from '@/libs/wechat'
import { isWeixin } from '@/utils'
const CACHE_KEY = "clear_0.0.1";
if (!cookie.has(CACHE_KEY)) {
cookie.clearAll();
cookie.clearAll()
cookie.set(CACHE_KEY, 1);
}
var urlSpread = parseQuery()["spread"];
if (urlSpread !== undefined) {
var spread = cookie.get("spread");
urlSpread = parseInt(urlSpread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0);
}
if (urlSpread) {
cookie.set("spread", urlSpread);
}
// #endif
// 判断是否是微信浏览器
if (isWeixin()) {
async function init() {
// #ifdef H5
// H5编译的代码
// 判断是否是微信浏览器
if (isWeixin()) {
Vue.prototype.$deviceType = 'weixin'
store.commit('updateDevicetype', 'weixin')
wechat().then(() => oAuth());
} else {
let wechatInit = await wechat()
console.log(wechatInit)
if (wechatInit) {
await oAuth()
app.$mount()
}
} else {
Vue.prototype.$deviceType = 'weixinh5'
store.commit('updateDevicetype', 'weixinh5')
}
Vue.prototype.wechat = wechat
Vue.prototype.clearAuthStatus = clearAuthStatus
Vue.prototype.oAuth = oAuth
Vue.prototype.auth = auth
Vue.prototype.toAuth = toAuth
Vue.prototype.pay = pay
Vue.prototype.openAddress = openAddress
Vue.prototype.openShareAll = openShareAll
Vue.prototype.openShareAppMessage = openShareAppMessage
Vue.prototype.openShareTimeline = openShareTimeline
Vue.prototype.wechatEvevt = wechatEvevt
Vue.prototype.ready = ready
Vue.prototype.wxShowLocation = wxShowLocation
app.$mount()
// #endif
// #ifdef APP-PLUS
// App平台编译的代码
Vue.prototype.$deviceType = 'app'
store.commit('updateDevicetype', 'app')
Vue.prototype.$platform = uni.getSystemInfoSync().platform
// #endif
}
// #endif
// #ifdef MP-WEIXIN
// 微信小程序编译的代码
Vue.prototype.$deviceType = 'routine'
store.commit('updateDevicetype', 'routine')
// #endif
// #ifndef H5
app.$mount()
// #endif
// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
// 建议通过 store 去获取 $deviceType 可以保证 template 中取到的值有效
// import { mapState, mapMutations, mapActions } from 'vuex';
// computed: {
// ...mapState(['$deviceType'])
// },
}
app.$mount()
init()

4
manifest.json

@ -141,12 +141,12 @@
}
},
"plugins" : {
// #ifdef MP-WEIXIN
"live-player-plugin" : {
//
"version" : "1.1.10",
// appidappid
"provider" : "wx2b03c6e691cd7370"
}
// #endif
}
},
"mp-alipay" : {

1
pages.json

@ -424,6 +424,7 @@
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "default"
},
"tabBar": {
"color": "#282828",

56
pages/Loading/index.vue

@ -16,16 +16,17 @@
// import request from "@//api/request";
import {
wxappAuth,
getUser
} from "@/api/user";
import dayjs from "dayjs";
import store from "@/store";
import cookie from "@/utils/store/cookie";
import {
parseQuery,
login,
handleQrCode,
getCurrentPageUrl,
handleUrlParam
handleUrlParam,
getCurrentPageUrlWithArgs
} from "@/utils";
export default {
@ -34,66 +35,55 @@
return {};
},
onShow() {
console.log('getUser')
var url = handleQrCode();
if (!url) {
url = handleUrlParam(getCurrentPageUrl())
url = handleUrlParam(getCurrentPageUrlWithArgs())
}
//
if (url) {
var spread = cookie.get("spread");
let urlSpread = parseInt(url.spread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
cookie.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
cookie.set("spread", urlSpread || 0);
if (urlSpread) {
cookie.set("spread", urlSpread);
}
if (this.$store.getters.token) {
this.toLaunch();
return;
}
// cookie.get("spread");
// if (this.$deviceType == "weixin") {
// let path = parseQuery().path
// console.log(this)
// if (path) {
// this.$yrouter.push({
// path
// });
// } else {
// if (this.$deviceType == "app" || this.$deviceType == "weixinh5") {
// this.$yrouter.switchTab({
// path: "/pages/home/index"
// });
// return;
// }
// return
// }
// this.toLaunch();
if (this.$deviceType == "app" || this.$deviceType == "h5") {
// this.toLaunch();
this.$yrouter.switchTab({
path: "/pages/home/index"
});
if (this.$store.getters.token) {
// token
console.log('登录状态存在,直接进页面')
this.toLaunch();
return;
}
console.log('进行登录操作')
login().finally(() => {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
});
}
},
methods: {
...mapActions(["changeAuthorization", "setUserInfo"]),
...mapActions(["changeAuthorization", "setUserInfo", "getUser"]),
toLaunch() {
console.log("loading home");
this.changeAuthorization(false);
let redirect = cookie.get('redirect')
if (redirect && redirect.indexOf('/pages') != -1) {
this.$yrouter.replace({
path: '/pages' + redirect.split('/pages')[1],
});
cookie.remove('redirect');
} else {
this.$yrouter.switchTab({
path: "/pages/home/index"
});
}
}
}
};
</script>

433
pages/activity/DargainDetails/index.vue

@ -1,10 +1,13 @@
<template>
<view class="bargain on">
<!-- 在header上加 on 为请求支援 -->
<view :class="[bargainPartake != userInfo.uid ? 'wrapper bargain-box on user' : 'wrapper bargain-box user']" v-if="bargainPartake != userInfo.uid">
<!-- <view class="people">{{ lookCount }}人查看 {{ shareCount }}人分享 {{ userCount }}人参与</view> -->
<!-- 当前登录的用户和url上携带的用户id不一致视为被邀请砍价 -->
<view class="wrapper bargain-box on user" v-if="bargainUserInfo && bargainUid != userInfo.uid">
<!-- <view class="people">
{{ bargainShare.lookCount }}人查看 {{ bargainShare.shareCount }}人分享 {{ bargainShare.userCount }}人参与
</view> -->
<!-- 帮助砍价帮砍成功-->
<view class="pictxt acea-row row-center-wrapper " >
<view class="pictxt acea-row row-center-wrapper ">
<div class="bargain-header">
<view class="pictrue">
<image :src="bargainUserInfo.avatar" />
@ -19,79 +22,70 @@
<view class="wrapper bargain-box time on">
<div class="pictxt ">
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
:secondText="' 秒'" :datatime="datatime"></count-down>
:secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
</div>
</view>
<view class="wrapper bargain-box bargain-product">
<view class="pictxt acea-row row-between-wrapper" @click="openAlone">
<view class="pictrue">
<image :src="bargain.image" />
<image :src="goodsDetail.image" />
<view class="bargain_view">
查看商品
<view class="iconfont icon-jiantou iconfonts"></view>
</view>
</view>
<view class="text acea-row row-column-around">
<view class="line2" v-text="bargain.title"></view>
<view class="line2" v-text="goodsDetail.title"></view>
<view class="money font-color-red">
已砍至:
<text class="num" v-text="price"></text>
<text class="num" v-text="bargainHelpCount.remainingPrice"></text>
</view>
<view class="acea-row row-middle">
<view class="successNum" v-text="'原价' + bargain.price"></view>
<view class="successNum" v-text="'原价' + goodsDetail.price"></view>
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
</view>
</view>
</view>
<!-- 砍价进度条 -->
<view class="cu-progress acea-row row-middle round margin-top">
<view class="acea-row row-middle bg-red" :style="{ width: loading ? pricePercent + '%' : '' }"></view>
<view class="acea-row row-middle bg-red" :style="{ width: bargainHelpCount.pricePercent + '%' }"></view>
</view>
<!-- 砍价进度条下的金额 -->
<view class="balance acea-row row-between-wrapper">
<view v-text="'已砍' + alreadyPrice + '元'"></view>
<view v-if="surplusPrice === 0">砍价成功</view>
<view v-else v-text="'还剩' + surplusPrice + '元'"></view>
<view v-text="'已砍' + bargainHelpCount.alreadyPrice + '元'"></view>
<view v-if="bargainHelpCount.remainingPrice === 0">砍价成功</view>
<view v-else v-text="'还剩' + bargainHelpCount.remainingPrice + '元'"></view>
</view>
<!-- 帮助砍价帮砍成功-->
<!-- <view class="bargainSuccess" v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading">
<span class="iconfont icon-xiaolian"></span>已成功帮助好友砍价
</view> -->
<!-- 砍价成功-->
<view class="bargainSuccess" v-if="
surplusPrice === 0 &&
bargainPartake === userInfo.uid &&
userBargainStatus === 1 &&
!helpListLoading
">
<!--
surplusPrice 砍价剩余金额为0
bargainUid 砍价人为发起砍价用户
userBargainStatus 砍价状态为
-->
<view class="bargainSuccess" v-if="pay">
<span class="iconfont icon-xiaolian"></span>恭喜您砍价成功快去支付吧~
</view>
<view v-if="userBargainStatus == 0 && bargainPartake === userInfo.uid" class="bargainBnt" @click="goParticipate">
立即参与砍价</view>
<view class="bargainBnt" @click="goPoster" v-if="
surplusPrice > 0 &&
bargainPartake === userInfo.uid &&
userBargainStatus === 1 &&
!helpListLoading
">邀请好友帮砍价</view>
<view class="bargainBnt" @click="getBargainHelp" v-else-if="
bargainPartake != userInfo.uid &&
userBargainStatus == 1 &&
statusUser &&
!helpListLoading
">帮好友砍一刀</view>
<view class="bargainBnt" @click="getBargainStart"
v-if="bargainPartake != userInfo.uid && !statusUser && !helpListLoading">我也要参与</view>
<view class="bargainBnt" @click="goPay" v-if="
surplusPrice === 0 &&
bargainPartake === userInfo.uid &&
userBargainStatus === 1
">立即支付</view>
<!-- 参与砍价按钮 同一人-->
<view v-if="participate" class="bargainBnt" @click="goParticipate">立即发起砍价</view>
<!-- 邀请好友按钮 -->
<view v-if="inviteFriends" class="bargainBnt" @click="goPoster">邀请好友帮砍价</view>
<!-- 帮砍好友砍按钮 -->
<view v-if="helpFriendsBargain" class="bargainBnt" @click="getBargainHelp">帮好友砍一刀</view>
<!-- 发起砍价按钮 非同一人-->
<view v-if="bargain" class="bargainBnt" @click="getBargainStart">我也要砍价</view>
<!-- 支付按钮 -->
<view class="bargainBnt" @click="goPay" v-if="pay">立即支付</view>
<view class="bargainBnt on" @click="goList">抢更多商品</view>
<view class="tip">
已有
<span class="font-color-red" v-text="helpCount"></span>
位好友成功帮您砍价
</view>
<view class="tip">已有<span class="font-color-red" v-text="bargainHelpCount.count"></span>位好友成功帮您砍价</view>
<view class="lock"></view>
</view>
<view class="bargainGang bargain-box">
@ -122,7 +116,7 @@
</view>
</view>
</view>
<view class="load font-color-red" v-if="!helpListStatus && !helpListLoading" @click="getBargainHelpList">点击加载更多
<view class="load font-color-red" v-if="!helpListStatus " @click="getBargainHelpList">点击加载更多
</view>
<view class="lock"></view>
</view>
@ -136,7 +130,7 @@
<image src="@/static/images/left.png" />
</view>
</view>
<view class="conter" v-html="bargain.description"></view>
<view class="conter" v-html="goodsDetail.description"></view>
<view class="lock"></view>
</view>
<view class="goodsDetails bargain-box">
@ -149,21 +143,17 @@
<image src="@/static/images/left.png" />
</view>
</view>
<view class="conter" v-html="bargain.rule"></view>
<view class="conter" v-html="goodsDetail.rule"></view>
</view>
<view class="bargainTip" :class="active === true ? 'on' : ''">
<!-- <view class="pictrue">
<image src="@/static/images/bargainBg.jpg" />
<view class="iconfont icon-guanbi" @click="close"></view>
</view>-->
<view class="cutOff" v-if="bargainPartake === userInfo.uid">
<view class="cutOff" v-if="bargainUid === userInfo.uid">
您已砍掉
<text class="font-color-red" v-text="bargainHelpPrice"></text>听说分享次数越多砍价成功的机会越大哦
</view>
<view class="cutOff on" v-else>
<view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>您也可以砍价低价拿哦快去挑选心仪的商品吧~
</view>
<view class="tipBnt" @click="goPoster" v-if="bargainPartake === userInfo.uid">邀请好友帮砍价</view>
<view class="tipBnt" @click="goPoster" v-if="bargainUid === userInfo.uid">邀请好友帮砍价</view>
<view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view>
</view>
<view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view>
@ -204,118 +194,83 @@
props: {},
data: function () {
return {
price: 0,
bargainId: 0, //
bargainPartake: 0, //
bargain: [], //
partake: null,
bargainSumCount: 0, //
activeMsg: "",
// ssssss
active: false,
loading: false,
datatime: 0,
lookCount: 0, //
shareCount: 0, //
userCount: 0, //
bargainHelpPrice: 0, //
bargainHelpList: [],
helpListStatus: false, // false true
helpListLoading: false, // false true
page: 1, //
limit: 2, //
helpCount: 0, //
surplusPrice: 0, //
alreadyPrice: 0, //
pricePercent: 0, //
bargainUserInfo: [], //
userBargainStatus: 2, //
statusUser: false // ,truefalse
bargainShare: {}, //
bargainHelpCount: {}, //
goodsDetail: {}, //
bargainUserInfo: [], //
bargainUid: 0, //
pay: false, //
bargain: false, //
participate: false, //
inviteFriends: false, //
helpFriendsBargain: false, //
bargainSuccess: false, //
mainBargainSuccess: false, //
};
},
computed: mapGetters(["userInfo", "isLogin"]),
// watch: {
// $yroute: function(n) {
// var that = this;
// if (n.name === NAME) {
// that.mountedStart();
// }
// }
// },
mounted: function () {
var that = this;
that.mountedStart();
setTimeout(function () {
that.loading = true;
}, 500);
this.mountedStart();
},
methods: {
onShareAppMessage: function () {
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
"uid"),
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
},
//
goParticipate() {
if (this.bargainPartake === this.userInfo.uid) this.getBargainStart();
else this.getBargainStartUser();
this.getBargainHelpCount();
},
openAlone: function () {
this.$yrouter.push({
path: "/detail/" + this.bargain.productId
});
},
//
mountedStart: function () {
var that = this;
console.log(this)
let url = handleQrCode();
console.log(url)
// bargainId id
// bargainUid
if (url) {
//
that.bargainId = url.bargainId;
that.partake = url.uid;
that.bargainUid = url.partake;
} else {
//
that.bargainId = that.$yroute.query.id;
that.partake = parseInt(that.$yroute.query.partake);
that.bargainUid = that.$yroute.query.partake
}
if (
this.partake === undefined ||
this.partake <= 0 ||
isNaN(this.partake)
) {
that.bargainPartake = that.userInfo.uid;
// that.$yrouter.push({
// path: "/pages/activity/DargainDetails/index",
// query: { id: that.bargainId, partake: that.bargainPartake }
// });
} else {
that.bargainPartake = parseInt(this.partake);
if (this.bargainUid == 0 || !this.bargainUid) {
// urluiduid
that.bargainUid = that.userInfo.uid;
}
console.log(this)
that.getBargainHelpCountStart();
//
that.getBargainDetail();
//
that.getBargainShare(0);
// if (that.bargainPartake !== that.userInfo.uid) that.getBargainStartUser();
if (that.bargainPartake === that.userInfo.uid) {
// that.getBargainStart();
} else {
if (that.bargainUid !== that.userInfo.uid) {
that.getBargainStartUser();
}
},
//
goParticipate() {
//
if (this.bargainUid === this.userInfo.uid) {
//
this.getBargainStart();
} else {
//
this.getBargainStartUser();
}
this.getBargainHelpCount();
},
//
openAlone: function () {
this.$yrouter.push({
path: "/detail/" + this.bargain.productId
});
},
//
goPay: function () {
var data = {};
var that = this;
@ -341,6 +296,7 @@
});
});
},
//
goPoster: function () {
var that = this;
that.getBargainShare(that.bargainId);
@ -352,6 +308,7 @@
}
});
},
//
goList: function () {
this.$yrouter.push({
path: "/pages/activity/GoodsBargain/index"
@ -365,31 +322,33 @@
getBargainShare({
bargainId: bargainId
}).then(res => {
that.lookCount = res.data.lookCount;
that.shareCount = res.data.shareCount;
that.userCount = res.data.userCount;
that.bargainShare = res.data
});
},
//
getBargainDetail: function () {
var that = this;
uni.showLoading({
title: "加载中",
mask: true
});
getBargainDetail(that.bargainId)
.then(res => {
that.bargain = res.data.bargain;
that.bargain.description = that.bargain.description.replace(
uni.hideLoading()
that.goodsDetail = res.data.bargain;
that.goodsDetail.description = that.goodsDetail.description.replace(
/\<img/gi,
'<img style="max-width:100%;height:auto;"'
);
that.bargain.rule = that.bargain.rule.replace(
that.goodsDetail.rule = that.goodsDetail.rule.replace(
/\<img/gi,
'<img style="max-width:100%;height:auto;"'
);
that.datatime = that.bargain.stopTime / 1000;
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
that.getBargainHelpCount();
// that.setOpenShare();
that.getBargainHelpList();
})
.catch(res => {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: "none",
@ -397,15 +356,16 @@
});
});
},
//
// -
getBargainStart: function () {
var that = this;
getBargainStart({
bargainId: that.bargainId
})
.then(() => {
that.bargainPartake = that.userInfo.uid;
that.bargainUid = that.userInfo.uid;
that.getBargainHelp();
that.getBargainHelpCount();
})
.catch(res => {
uni.showToast({
@ -415,12 +375,12 @@
});
});
},
//
//
getBargainHelp: function () {
var that = this;
if (
that.surplusPrice === 0 &&
that.bargainPartake !== that.userInfo.uid
this.bargainHelpCount.remainingPrice === 0 &&
that.bargainUid !== that.userInfo.uid
) {
return uni.showToast({
title: "好友已经砍价成功",
@ -430,15 +390,12 @@
}
var data = {
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
bargainUserUid: that.bargainUid
};
getBargainHelp(data)
.then(res => {
that.activeMsg = res.data.status;
if (
res.data.status === "SUCCESSFUL" &&
that.bargainPartake !== that.userInfo.uid
) {
if (res.data.status === "SUCCESSFUL" && that.bargainUid !== that.userInfo.uid) {
uni.showToast({
title: "您已经砍过了",
icon: "none",
@ -462,15 +419,12 @@
//
getBargainHelpPrice: function () {
var that = this;
that.helpListLoading = true;
getBargainHelpPrice({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
bargainUserUid: that.bargainUid
})
.then(res => {
that.bargainHelpPrice = res.data.price;
that.helpListLoading = false;
that.getBargainHelpCount();
that.getBargainHelpList();
switch (that.activeMsg) {
@ -489,79 +443,129 @@
});
});
},
//
//
getBargainHelpList: function () {
var that = this;
if (that.helpListLoading === true) return;
if (that.helpListStatus === true) return;
that.helpListLoading = true;
getBargainHelpList({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake,
bargainUserUid: that.bargainUid,
page: that.page,
limit: that.limit
})
.then(res => {
that.helpListStatus = res.data.length < that.limit;
that.helpListLoading = false;
that.page++;
if (res.data) {
that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
}
})
.catch(res => {
.catch(err => {
if (!err.msg) {
return
}
uni.showToast({
title: res.msg,
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
getBargainHelpCountStart: function () {
var that = this;
getBargainHelpCount({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
})
.then(() => {
})
.catch(() => {
// this.$yrouter.push({
// path: "/pages/activity/DargainDetails/index",
// query: {
// id: that.bargainId,
// partake: that.userInfo.uid
// }
// });
});
},
//
getBargainHelpCount: function () {
var that = this;
getBargainHelpCount({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
bargainId: this.bargainId,
bargainUserUid: this.bargainUid
})
.then(res => {
that.userBargainStatus = res.data.status;
that.helpCount = res.data.count;
that.surplusPrice = res.data.price;
that.alreadyPrice = res.data.alreadyPrice;
that.pricePercent = res.data.pricePercent;
that.price = (that.bargain.price - that.alreadyPrice).toFixed(2);
console.log(that);
// = -
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2)
this.bargainHelpCount = {
...res.data,
remainingPrice
}
this.handleButtonStatus()
})
.catch(() => {
that.bargainPartake = that.userInfo.uid;
// that.$yrouter.push({
// path: "/pages/activity/DargainDetails/index",
// query: { id: that.bargainId, partake: that.userInfo.uid }
// });
.catch(err => {
if (!err.msg) {
return
}
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
//
handleButtonStatus() {
//
// 1. ==> &&
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 0
) {
this.participate = true
} else {
this.participate = false
}
// 2. ==> && && >0
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
this.bargainHelpCount.remainingPrice > 0
) {
this.inviteFriends = true
} else {
this.inviteFriends = false
}
// 3. ==> && && >0 &&
if (
this.bargainUid != this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
// this.bargainHelpCount.userBargainStatus &&
this.bargainHelpCount.remainingPrice > 0
) {
this.helpFriendsBargain = true
} else {
this.helpFriendsBargain = false
}
// 4. ==> && && <=0
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
this.bargainHelpCount.remainingPrice <= 0
) {
this.pay = true
} else {
this.pay = false
}
// 5. ==> &&
if (
this.bargainUid != this.userInfo.uid
) {
this.bargain = true
} else {
this.bargain = false
}
//
// 1. ==> &&
// 2. ==> &&
// 3. ==> && true
},
//
//
getBargainStartUser: function () {
var that = this;
getBargainStartUser({
bargainId: that.bargainId,
bargainUserUid: that.bargainPartake
bargainUserUid: that.bargainUid
})
.then(res => {
that.bargainUserInfo = res.data;
@ -575,9 +579,30 @@
});
});
},
//
close: function () {
this.active = false;
},
//
onShareAppMessage: function () {
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
"uid"),
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
},
},
onShareAppMessage() {
return {

27
pages/shop/GoodsCon/index.vue

@ -135,7 +135,10 @@
</button>
</view>
<!-- #endif -->
<view class="item" @click="goHome" >
<view class="iconfont icon-shouye-xianxing"></view>
<text>首页</text>
</view>
<view class="item" @click="setCollect" v-if="storeInfo.userCollect">
<view class="iconfont icon-shoucang1"></view>
<text>收藏</text>
@ -217,10 +220,13 @@
getCollectDel,
getUserInfo,
} from "@/api/user";
import cookie from "@/utils/store/cookie";
import {
isWeixin,
PosterCanvas,
handleQrCode
handleQrCode,
handleUrlParam,
getCurrentPageUrlWithArgs
} from "@/utils";
import {
wechatEvevt
@ -303,8 +309,15 @@
computed: mapGetters(["isLogin", "location"]),
mounted: function () {
let url = handleQrCode();
if (url && url.productId) {
this.id = url.productId;
if (!url) {
url = handleUrlParam(getCurrentPageUrlWithArgs())
}
if (url && url.id) {
this.id = url.id;
let urlSpread = parseInt(url.spread);
if (urlSpread) {
cookie.set("spread", urlSpread);
}
} else {
this.id = this._route.query.id;
}
@ -326,7 +339,8 @@
return {
title: this.storeInfo.storeName,
imageUrl: this.storeInfo.image,
path: "pages/shop/GoodsCon/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid")+"&pageType=good&codeType=routine",
path: "pages/shop/GoodsCon/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid") +
"&pageType=good&codeType=routine",
success(res) {
uni.showToast({
title: '分享成功'
@ -340,6 +354,9 @@
}
}
},
goHome() {
this.$yrouter.switchTab("/pages/home/index");
},
goShoppingCart() {
this.$yrouter.switchTab("/pages/shop/ShoppingCart/index");
},

4
pages/shop/ShoppingCart/index.vue

@ -28,7 +28,7 @@
<view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)">
<label class="well-check">
<checkbox value :checked="item.checked+''"></checkbox>
<checkbox color="#eb3729" value :checked="item.checked"></checkbox>
</label>
</checkbox-group>
</view>
@ -113,7 +113,7 @@
<checkbox-group @change="allChecked">
<label class="well-check">
<checkbox value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
<checkbox color="#eb3729" value="allSelect" :checked="isAllSelect && cartCount > 0"></checkbox>
<text class="checkAll">全选 ({{ cartCount }})</text>
</label>
</checkbox-group>

8
pages/user/Login/index.vue

@ -62,7 +62,7 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input type="text" placeholder="输入手机号码" v-model="account" />
<input name="account" type="text" placeholder="输入手机号码" v-model="account" />
</view>
</view>
<view class="item">
@ -70,7 +70,7 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
@ -80,7 +80,7 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_" />
</svg>-->
<input type="password" placeholder="填写您的登录密码" v-model="password" />
<input name="password" type="password" placeholder="填写您的登录密码" v-model="password" />
</view>
</view>
<!-- #ifndef H5 -->
@ -89,7 +89,7 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input type="text" placeholder="输入邀请码" v-model="inviteCode" />
<input name="inviteCode" type="text" placeholder="输入邀请码" v-model="inviteCode" />
</view>
</view>
<!-- #endif -->

24
pages/user/Register/index.vue

@ -13,7 +13,7 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg> -->
<input type="text" placeholder="输入手机号码" />
<input name="phone" type="text" placeholder="输入手机号码" />
</view>
</view>
<view class="item">
@ -21,13 +21,9 @@
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1" />
</svg> -->
<input type="text" placeholder="填写验证码" class="codeIput" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<input name="" type="text" placeholder="填写验证码" class="codeIput" />
<button class="verifyCode" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
<view class="item">
@ -50,18 +46,20 @@
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import sendVerifyCode from "@/mixins/SendVerifyCode";
export default {
export default {
name: "Register",
mixins: [sendVerifyCode],
methods: {
code: function() {
code: function () {
this.sendCode();
},
goLogin() {
this.$yrouter.push({ path: "/pages/user/Login/index" });
this.$yrouter.push({
path: "/pages/user/Login/index"
});
}
}
};
};
</script>

30
pages/user/UserAccount/index.vue

@ -97,21 +97,21 @@ export default {
},
getActivity: function() {
let that = this;
getActivityStatus().then(
res => {
that.activity.is_bargin = res.data.is_bargin;
that.activity.is_pink = res.data.is_pink;
that.activity.is_seckill = res.data.is_seckill;
},
err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
// getActivityStatus().then(
// res => {
// that.activity.is_bargin = res.data.is_bargin;
// that.activity.is_pink = res.data.is_pink;
// that.activity.is_seckill = res.data.is_seckill;
// },
// err => {
// uni.showToast({
// title:
// err.msg || err.response.data.msg || err.response.data.message,
// icon: "none",
// duration: 2000
// });
// }
// );
}
}
};

2
pages/user/UserVip/index.vue

@ -178,7 +178,7 @@ export default {
res => {
that.vipRequire = res.data.list;
that.vipComplete = res.data.task;
that.taskCount = res.data.reach_count;
that.taskCount = res.data.reachCount;
},
err => {
uni.showToast({

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

@ -13,22 +13,14 @@
</view>
</view>
<view class="nav acea-row row-around">
<view
class="item"
:class="screen.grade == 0 ? 'on' : ''"
@click="checkGrade(0)"
>一级({{ first||'0' }})</view>
<view
class="item"
:class="screen.grade == 1 ? 'on' : ''"
@click="checkGrade(1)"
>二级({{ second||'0' }})</view>
<view class="item" :class="screen.grade == 0 ? 'on' : ''" @click="checkGrade(0)">一级({{ first||'0' }})</view>
<view class="item" :class="screen.grade == 1 ? 'on' : ''" @click="checkGrade(1)">二级({{ second||'0' }})</view>
</view>
<view class="search acea-row row-between-wrapper">
<form @submit.prevent="submitForm">
<view class="input">
<input placeholder="点击搜索会员名称" v-model="screen.keyword" />
<text class="iconfont icon-guanbi"></text>
<text class="iconfont icon-guanbi" @click="screen.keyword=''"></text>
</view>
</form>
<view class="iconfont icon-sousuo2"></view>
@ -56,11 +48,8 @@
</view>
</view>
<view :class="fixedState === true ? 'sortList' : ''">
<view
class="item acea-row row-between-wrapper"
v-for="(val, spreadListIndex) in spreadList"
:key="spreadListIndex"
>
<view class="item acea-row row-between-wrapper" v-for="(val, spreadListIndex) in spreadList"
:key="spreadListIndex">
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<image :src="val.avatar" />
@ -84,15 +73,17 @@
</view>
</template>
<script>
import { getSpreadUser } from "@/api/user";
import Loading from "@/components/Loading";
export default {
import {
getSpreadUser
} from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "PromoterList",
components: {
Loading
},
props: {},
data: function() {
data: function () {
return {
fixedState: false,
screen: {
@ -113,14 +104,14 @@ export default {
second: ""
};
},
mounted: function() {
mounted: function () {
this.getSpreadUsers();
},
onReachBottom() {
!this.loading && this.getSpreadUsers();
},
watch: {
"screen.sort": function() {
"screen.sort": function () {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
@ -129,7 +120,7 @@ export default {
}
},
methods: {
handleScroll: function() {
handleScroll: function () {
// var scrollTop =
// document.documentElement.scrollTop || document.body.scrollTop;
// var offsetTop = document.querySelector(".header").clientHeight;
@ -139,14 +130,14 @@ export default {
// this.fixedState = false;
// }
},
submitForm: function() {
submitForm: function () {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
this.spreadList = [];
this.getSpreadUsers();
},
getSpreadUsers: function() {
getSpreadUsers: function () {
let that = this,
screen = that.screen;
if (that.loaded || that.loading) return;
@ -163,8 +154,7 @@ export default {
},
err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
@ -172,7 +162,7 @@ export default {
300
);
},
checkGrade: function(val) {
checkGrade: function (val) {
if (val == this.screen.grade) return;
else {
this.screen.page = 1;
@ -183,7 +173,7 @@ export default {
this.getSpreadUsers();
}
},
sort: function(types) {
sort: function (types) {
let that = this;
switch (types) {
case "childCount":
@ -245,5 +235,5 @@ export default {
}
}
}
};
};
</script>

14
store/index.js

@ -39,14 +39,7 @@ const vuexStore = new Vuex.Store({
console.log('清除数据')
state.token = null;
state.userInfo = null
let spread = cookie.get('spread')
let redirect = cookie.get('redirect')
let outTime = setTimeout(() => {
clearTimeout(outTime)
cookie.clearAll()
cookie.set('redirect', redirect)
cookie.set('spread', spread)
}, 100)
},
backgroundColor(state, color) {
state.color = color;
@ -97,7 +90,7 @@ const vuexStore = new Vuex.Store({
userInfo({ state, commit }, force) {
if (state.userInfo !== null && !force) {
return Promise.resolve(state.userInfo);
} else {
}
return new Promise(reslove => {
getUserInfo().then(res => {
commit("updateUserInfo", res.data);
@ -110,9 +103,11 @@ const vuexStore = new Vuex.Store({
duration: 2000,
});
});
}
},
getUser({ state, commit }) {
if (!state.token) {
return Promise.reject('未获取到token');
}
return new Promise(reslove => {
getUserInfo().then(res => {
console.log(res)
@ -163,6 +158,7 @@ const vuexStore = new Vuex.Store({
location: state => state.location,
storeItems: state => state.storeItems,
goName: state => state.goName,
$deviceType: state => state.$deviceType,
},
strict: debug
});

77
utils/index.js

@ -204,7 +204,6 @@ export const authorize = (authorizeStr) => {
}
export const login = () => {
console.log(Vue.prototype)
return new Promise((resolve, reject) => {
if (Vue.prototype.$deviceType == 'weixin') {
// 微信授权登录
@ -212,47 +211,32 @@ export const login = () => {
if (code) {
auth(code)
.then(() => {
// location.replace(
// decodeURIComponent(decodeURIComponent(this.$route.params.url))
// );
location.href = decodeURIComponent(
decodeURIComponent(this.$route.params.url)
);
let redirect = cookie.get('redirect')
console.log(redirect)
if (redirect) {
redirect = redirect.split('/pages')[1]
reLaunch({
path: '/pages' + redirect,
});
cookie.remove('redirect');
} else {
reLaunch({
path: '/pages/home/index',
});
}
})
.catch(() => {
reject('当前运行环境为微信浏览器')
location.replace("/pages/home/index");
reLaunch({
path: '/pages/home/index',
});
});
} else {
// wechat().then(() => oAuth());
}
// if (!code) {
// toAuth("wxc061dee8806ff712")
// } else {
// // wechat().then(() => oAuth().then((code) => {
// // // const { code } = parseQuery()
// // auth(code)
// // .then(() => {
// // // location.replace(
// // // decodeURIComponent(decodeURIComponent(this.$route.params.url))
// // // );
// // location.href = decodeURIComponent(
// // decodeURIComponent(this.$route.params.url)
// // );
// // })
// // .catch(() => {
// // reject('当前运行环境为微信浏览器')
// // location.replace("/pages/home/index");
// // });
// // })).catch(error => {
// // console.log(error)
// // reject('自动登录失败')
// // });
// }
return
}
if (Vue.prototype.$deviceType == 'weixinh5') {
console.log('当前运行环境为H5')
reject('当前运行环境为H5')
return
}
@ -275,7 +259,7 @@ export const login = () => {
console.log('登录接口调用成功')
console.log('开始检查用户信息授权')
let code = loginRes.code;
cookie.set('wxLoginCode',loginRes.code)
cookie.set('wxLoginCode', loginRes.code)
// 检查授权, 检查用户信息授权
authorize('userInfo').then(() => {
console.log('授权通过')
@ -705,7 +689,8 @@ export const _router = {
push,
replace,
go,
back
back,
reLaunch
}
@ -857,14 +842,18 @@ export const handleLoginFailure = () => {
console.log('————————')
store.commit("logout");
// 改为授权取消
store.commit("updateAuthorization", false);
let currentPageUrl = getCurrentPageUrl()
if (store.state.$deviceType == 'weixin') {
if (store.getters.isAuthorizationPage){
// 如果不是授权页面,
if (!store.getters.isAuthorizationPage) {
// 标识当前为授权页面
store.commit("updateAuthorizationPage", true);
toAuth()
}
return
} else {
// token 失效
// 判断当前是不是已经在登录页面或者授权页,防止二次跳转
@ -895,12 +884,14 @@ export const handleLoginFailure = () => {
console.log('————————')
if (qrCode.pinkId) {
path = parseUrl({
path: `/${currentPageUrl}`,
path: `/ ${currentPageUrl} `,
query: {
id: qrCode.pinkId,
}
})
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0);
}
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
@ -917,13 +908,15 @@ export const handleLoginFailure = () => {
if (qrCode.bargainId) {
path = parseUrl({
path: `/${currentPageUrl}`,
path: `/ ${currentPageUrl} `,
query: {
id: qrCode.bargainId,
partake: qrCode.uid
}
})
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0);
}
} else {
handleNoParameters()
console.log('————————')
@ -939,12 +932,14 @@ export const handleLoginFailure = () => {
if (qrCode.productId) {
path = parseUrl({
path: `/${currentPageUrl}`,
path: `/ ${currentPageUrl} `,
query: {
id: qrCode.productId,
}
})
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0);
}
} else {
handleNoParameters()
console.log('————————')
@ -988,7 +983,7 @@ export function chooseImage(callback) {
console.log(image);
uni.showLoading({ title: "图片上传中", mask: true });
uni.uploadFile({
url: `${VUE_APP_API_URL}/api/upload`,
url: `${VUE_APP_API_URL} /api/upload`,
file: image,
filePath: image.path,
header: {

2
utils/request.js

@ -12,7 +12,7 @@ import Fly from "flyio/dist/npm/wx";
import Fly from "flyio/dist/npm/wx";
// #endif
import $store from "../store";
import store from "../store";
import { handleLoginFailure } from "@/utils";
import { VUE_APP_API_URL } from "@/config";
import cookie from "@/utils/store/cookie";

11
utils/store/cookie.js

@ -29,7 +29,16 @@ function remove(key) {
}
function clearAll() {
uni.clearStorage()
const res = uni.getStorageInfoSync();
res.keys.map((item) => {
if (item == 'redirect' || item == 'spread') {
return
}
remove(item)
})
console.log(res)
// debugger
// uni.clearStorageSync()
}
function _has(key) {

Loading…
Cancel
Save