Commit b44f1601 authored by 罗超's avatar 罗超

临时提交

parent 26cbedf8
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
{ {
"path": "pages/webbox/webbox" "path": "pages/webbox/webbox"
} }
], ],
"subPackages": [{ "subPackages": [{
"root": "pages/goods", "root": "pages/goods",
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
"root": "pages/live", "root": "pages/live",
"plugins": { "plugins": {
"live-player-plugin": { "live-player-plugin": {
"version": "1.1.4", "version": "1.1.8",
"provider": "wx2b03c6e691cd7370" "provider": "wx2b03c6e691cd7370"
} }
}, },
...@@ -253,51 +253,51 @@ ...@@ -253,51 +253,51 @@
} }
] ]
}, },
{ {
"root": "pages/microShop", "root": "pages/microShop",
"pages": [{ "pages": [{
"path": "index/index", "path": "index/index",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "myClients/myClients" "path": "myClients/myClients"
}, },
{ {
"path":"wdWithdrawal" "path": "wdWithdrawal"
}, },
{ {
"path":"wdOrder" "path": "wdOrder"
}, },
{ {
"path":"wdCase" "path": "wdCase"
}, },
{ {
"path":"shopSettings" "path": "shopSettings"
}, },
{ {
"path":"storeManagement/storeManagement" "path": "storeManagement/storeManagement"
}, },
{ {
"path":"storeManagement/goodsEdit" "path": "storeManagement/goodsEdit"
}, },
{ {
"path":"storeManagement/addGoods" "path": "storeManagement/addGoods"
}, },
{ {
"path":"storeManagement/index" "path": "storeManagement/index"
} }
] ]
}, },
{ {
"root":"pages/quick_share", "root": "pages/quick_share",
"pages":[{ "pages": [{
"path": "index" "path": "index"
}] }]
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
......
...@@ -462,13 +462,13 @@ export default { ...@@ -462,13 +462,13 @@ export default {
}, },
initImages() { initImages() {
// let that = this; // let that = this;
let info = uni.createSelectorQuery().in(this); // let info = uni.createSelectorQuery().in(this);
info // info
.select(".goods") // .select(".goods")
.boundingClientRect((data) => { // .boundingClientRect((data) => {
console.log("得到布局位置信息" + JSON.stringify(data)); // console.log("得到布局位置信息" + JSON.stringify(data));
}) // })
.exec(); // .exec();
// info // info
// .boundingClientRect(function (data) { // .boundingClientRect(function (data) {
// console.log(data) // console.log(data)
......
<template>
<view class="commit-box">
</view>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
<style> <style>
.quick_top { .quick_top {
display: flex; display: flex;
margin: 10px auto; margin: 10px auto;
} }
.quick_slider { .quick_slider {
padding: 5px 17px; padding: 5px 17px;
border-radius: 20px; border-radius: 20px;
background-color: #EBEBEB; background-color: #ebebeb;
color: #272727; color: #272727;
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
margin-left: 10px; margin-left: 10px;
letter-spacing: 2px; letter-spacing: 2px;
} }
.quick_arrow { .quick_arrow {
width: 10%; width: 10%;
} }
.quick_arrow .u_icon { .quick_arrow .u_icon {
margin-left: 20%; margin-left: 20%;
line-height: 30px; line-height: 30px;
color: #cd9621; color: #cd9621;
font-size: 20px; font-size: 20px;
} }
/* .checkedItem { /* .checkedItem {
background-color: #ff547b; background-color: #ff547b;
color: #fff; color: #fff;
} */ } */
.quick_arrow .allTags { .quick_arrow .allTags {
margin: 20px; margin: 20px;
} }
.allTags_List { .allTags_List {
padding-bottom: 20px; padding-bottom: 20px;
} }
.allTags_List { .allTags_List {
display: flex; display: flex;
} }
.quick_Content { .quick_Content {
width: 100%; width: 100%;
} }
.quick_Inner { .quick_Inner {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding:20px; padding: 20px;
} }
.quick_Inner:last-child {
margin: 0px !important;
}
.quick_ImgDiv {
width: 40px;
height: 40px;
border-radius: 50%;
overflow: hidden;
}
.quick_ImgDiv { .quick_ImgDiv img {
width: 40px; width: 100%;
height: 40px; height: 100%;
border-radius: 50%; }
overflow: hidden;
}
.quick_ImgDiv img { .quick_Center {
width: 100%; position: relative;
height: 100%; width: 85%;
} }
.quick_Center { .share_Content {
position: relative; position: absolute;
width: 85%; right: 0;
} top: 0;
padding: 5px 10px;
background-color: #faf3e3;
border-radius: 20px;
font-size: 12px;
display: flex;
min-width: 50px;
align-items: center;
}
.share_Content { .Quick_Shareicon {
position: absolute; width: 13px;
right: 0; height: 13px;
top: 0; margin-right: 5px;
padding: 5px 10px; }
background-color: #faf3e3;
border-radius: 20px;
font-size: 12px;
display: flex;
min-width: 50px;
align-items: center;
}
.Quick_Shareicon { .Quick_ImgContent {
width: 13px; display: flex;
height: 13px; justify-content: space-between;
margin-right: 5px; }
} .quick_page img {
width: 650rpx;
.Quick_ImgContent { height: 700rpx;
display: flex; }
justify-content: space-between; .quick_page .hotsopt {
} position: absolute;
.quick_page img { background: transparent;
width: 650rpx; border: none;
height: 700rpx; outline: none;
} }
.quick_page .hotsopt { .quick_page .hotsopt::after {
position: absolute; border: none;
background: transparent; }
border: none; .qr_DialogBtn {
outline: none; position: absolute;
} bottom: 30px;
.quick_page .hotsopt::after { width: 80%;
border: none; background-color: #ff4048;
} color: #fff;
.qr_DialogBtn{ margin: auto;
position: absolute; left: 50%;
bottom:30px; margin-left: -40%;
width:80%; border-radius: 20px;
background-color:#FF4048; }
color:#fff; .qr_Line {
margin:auto; width: 100%;
left:50%; height: 1px;
margin-left:-40%; background-color: #f4f4f4;
border-radius: 20px; margin: 10px 0 0 0;
} }
.qr_Line{
width:100%;
height:1px;
background-color: #F4F4F4;
margin:10px 0;
}
</style> </style>
<template> <template>
<view :style="{ height: contentHeight }"> <view
<u-tabs name="Name" :list="dataFirst" :is-scroll="false" :current="active" :bar-width="80" :font-size="32" class="quick-box"
:active-color="mainColor" @change="getChild"></u-tabs> style="height:100vh;"
<scroll-view scroll-x="true" style="white-space: nowrap;display: flex;margin:10px auto;background-color:#EBEBEB;border-radius:20px;width:95%;overflow:hidden;"> :style="{ 'height': `calc(100vh - ${paddingBottm})` }"
<view @click="getSecond(item,index)" style="padding:8px 17px;margin-left:0;" :style="{ color: index==active2 ? '#fff' : '#272727',backgroundColor:index==active2 ? mainColor:'' }" class="quick_slider" v-for="(item,index) in dataSecond" :key="index">{{item.Name}}</view> >
</scroll-view> <view class="quick-head">
<view class="qr_Line"></view> <u-tabs
<view class="quick_top" v-if="dataThird.length>0"> name="Name"
<scroll-view scroll-x="true" style="white-space: nowrap;display: flex;width:90%"> :list="dataFirst"
<view @click="getThird(item,index)" :style="{ color: index==active3 ? '#fff' : '#272727',backgroundColor:index==active3 ? mainColor:'' }" class="quick_slider" v-for="(item,index) in dataThird" :key="index">{{item.Name}}</view> :is-scroll="false"
</scroll-view> :current="active"
<view class="quick_arrow" v-if="dataThird.length>4"> :bar-width="80"
<u-icon class="u_icon" name="arrow-up" v-if="show" @click="show=false"></u-icon> :font-size="28"
<u-icon class="u_icon" name="arrow-down" v-else @click="show=true"></u-icon> :active-color="mainColor"
<u-popup v-model="show" mode="top"> @change="getChild"
<view class="allTags">全部标签</view> ></u-tabs>
<view class="allTags_List"> <view
<view @click="getThird(item,index)" :class="{'checkedItem':index==active3}" class="quick_slider" v-for="(item,index) in dataThird" :key="index">{{item.Name}}</view> style="white-space: nowrap;display: flex;margin:10px auto;background-color:#EBEBEB;border-radius:20px;width:95%;overflow:hidden;"
</view> >
</u-popup> <view
</view> @click="getSecond(item,index)"
</view> style="padding:8px 17px;margin-left:0;flex:1;text-align:center;"
<scroll-view :scroll-y="true" style="background-color: #f0f4f7" :enable-back-to-top="true" :enable-flex="true" @scrolltolower="lower" :style="{ 'height': scrollHeight}"> :style="{ color: index==active2 ? '#fff' : '#272727',backgroundColor:index==active2 ? mainColor:'' }"
<view class="quick_Content" style="width: 100%;min-height:100%"> class="quick_slider"
<view class="quick_Inner" v-for="(item,index) in dataList" :key="index" style="margin-bottom:10px;background-color:#fff;"> v-for="(item,index) in dataSecond"
<view class="quick_ImgDiv"> :key="index"
<img :src="item.HeadImg" alt="" /> >{{item.Name}}</view>
</view> </view>
<view class="quick_Center"> <view class="qr_Line"></view>
<view style="margin-bottom:10px;">{{item.UserName}}</view> <view class="quick_top" v-if="dataThird.length>0">
<view v-html="item.MaterialInfo" @click="goUrl(item)" style="margin-bottom:10px;"></view> <scroll-view scroll-x="true" style="white-space: nowrap;display: flex;width:90%">
<view v-if="item.LinkUrl!=''" @click="goUrl(item)" style="color:#b08b38;margin-bottom:10px;">查看详情</view> <view
<view v-for="(sItem,i) in imgArr" :key="i"> @click="getThird(item,index)"
<view style="flex-direction:row;display:flex;"> :style="{ color: index==active3 ? '#fff' : '#272727',backgroundColor:index==active3 ? mainColor:'' }"
<!-- 横排布局 --> class="quick_slider"
<view v-for="(subItem,index) in item.ImgList" :key="index" style="margin-bottom:3px;"> v-for="(item,index) in dataThird"
<!-- 遍历数组 --> :key="index"
<view v-if="index>=i*3&&index<3*(i+1)" class="flex-item" style="margin-right:5px;"> >{{item.Name}}</view>
<!-- 分段显示 --> </scroll-view>
<img :src="subItem" style="height:190rpx;width:190rpx;"/> <view class="quick_arrow" v-if="dataThird.length>4">
</view> <u-icon class="u_icon" name="arrow-up" v-if="show" @click="show=false"></u-icon>
</view> <u-icon class="u_icon" name="arrow-down" v-else @click="show=true"></u-icon>
</view> <u-popup v-model="show" mode="top">
</view> <view class="allTags">全部标签</view>
<view class="share_Content" @click="openShare(item)"> <view class="allTags_List">
<image src="@/static/images/icon/icon-share.png" class="Quick_Shareicon" /> <view
{{item.ShareCount}} @click="getThird(item,index)"
</view> :class="{'checkedItem':index==active3}"
</view> class="quick_slider"
</view> v-for="(item,index) in dataThird"
</view> :key="index"
<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="20" :margin-bottom="20" bg-color="#f3f4f6" /> >{{item.Name}}</view>
</scroll-view> </view>
<tabbar></tabbar> </u-popup>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth> </view>
<u-popup v-model="showDialog" mode="center" :mask-close-able="false" custom-style="padding:0;background:none;"> </view>
<view style="position: relative;"> </view>
<img src="@/static/images/qrDialog.png" mode="widthFix" /> <scroll-view
<button class="qr_DialogBtn" @click="showDialog=false">确定</button> :scroll-y="true"
</view> style="background-color: #f0f4f7;"
</u-popup> :enable-back-to-top="true"
</view> :enable-flex="true"
@scrolltolower="lower"
:style="{ 'height': `calc(100% - ${scrollHeight})`}"
>
<view class="quick_Content" style="width: 100%;min-height:100%">
<view
class="quick_Inner"
v-for="(item,index) in dataList"
:key="index"
style="margin-bottom:10px;background-color:#fff;"
>
<view class="quick_ImgDiv">
<img :src="item.HeadImg" alt />
</view>
<view class="quick_Center">
<view style="margin-bottom:10px;font-weight:bold">{{item.UserName}}</view>
<view v-html="item.MaterialInfo" @click="goUrl(item)" style="margin-bottom:10px;"></view>
<view
v-if="item.LinkUrl!=''"
@click="goUrl(item)"
style="color:#b08b38;margin-bottom:10px;"
>查看详情</view>
<view v-for="(sItem,i) in imgArr" :key="i">
<view style="flex-direction:row;display:flex;">
<!-- 横排布局 -->
<view
v-for="(subItem,index) in item.ImgList"
:key="index"
style="margin-bottom:3px;"
>
<!-- 遍历数组 -->
<view
v-if="index>=i*3&&index<3*(i+1)"
class="flex-item"
style="margin-right:5px;"
>
<!-- 分段显示 -->
<img :src="subItem" style="height:190rpx;width:190rpx;" />
</view>
</view>
</view>
</view>
<view class="share_Content" @click="openShare(item)">
<image src="@/static/images/icon/icon-share.png" class="Quick_Shareicon" />
{{item.ShareCount}}
</view>
</view>
</view>
</view>
<view style="padding:10px 0;background:#FFF">
<u-loadmore
:status="status"
:load-text="loadText"
:font-size="24"
:margin-top="0"
:margin-bottom="0"
bg-color="#fff"
/>
</view>
</scroll-view>
<tabbar></tabbar>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<u-popup
v-model="showDialog"
mode="center"
:mask-close-able="false"
custom-style="padding:0;background:none;"
>
<view style="position: relative;">
<img src="@/static/images/qrDialog.png" mode="widthFix" />
<button class="qr_DialogBtn" @click="showDialog=false">确定</button>
</view>
</u-popup>
</view>
</template> </template>
<script> <script>
import auth from "@/components/auth/index"; import auth from "@/components/auth/index";
import tabbar from "@/components/tabbar/index"; import tabbar from "@/components/tabbar/index";
export default { export default {
data() { data() {
return { return {
show: false, show: false,
pageTitle: '分享', pageTitle: "分享",
loading: true, loading: true,
showAuth: false, showAuth: false,
mainColor: '', mainColor: "",
u: {}, u: {},
contentHeight: 0, msg: {
msg: { Name: "", //页面名称
Name: "", //页面名称 pageIndex: 1,
pageIndex: 1, pageSize: 10,
pageSize: 10, },
}, active: 0, //一级
active: 0, //一级 active2: -1, //二级选中
active2: -1, //二级选中 active3: -1, //三级选中
active3: -1, //三级选中 conMsg: {
conMsg: { CateId: 0,
CateId: 0, QStartDate: "", //开始时间
QStartDate: "", //开始时间 QEndDate: "", //结束时间
QEndDate: "", //结束时间 KeyWords: "", //页面名称
KeyWords: "", //页面名称 pageIndex: 1,
pageIndex: 1, pageSize: 10,
pageSize: 10, total: 0,
total: 0, },
}, //第一层数据
//第一层数据 dataFirst: [],
dataFirst: [], //第二层
//第二层 dataSecond: [],
dataSecond: [], //第三层
//第三层 dataThird: [],
dataThird: [],
//内容数据 //内容数据
dataList: [], dataList: [],
imgArr: [0, 1, 2], imgArr: [0, 1, 2],
showShare: false, // 显示分享 showShare: false, // 显示分享
showAuth: false, //是否登录弹窗 showAuth: false, //是否登录弹窗
scrollHeight: 0, scrollHeight: 0,
status: "loadmore", status: "loadmore",
pageCount: 1, pageCount: 1,
loadText: { loadText: {
loadmore: "轻轻上拉,加载更多", loadmore: "轻轻上拉,加载更多",
loading: "努力加载中", loading: "努力加载中",
nomore: "没有更多了", nomore: "没有更多了",
}, },
goodTitle:'', //名称=>传子组件 goodTitle: "", //名称=>传子组件
images:[], //图片=>传子组件 images: [], //图片=>传子组件
qrHeight:160, qrHeight: 160,
showDialog:false showDialog: false,
}; paddingBottm: "0px",
}, };
components: { },
auth, components: {
tabbar auth,
}, tabbar,
created() { },
this.contentHeight = this.$utils.calcContentHeight(-40) + 'px'; created() {
this.scrollHeight = this.$utils.calcContentHeight(-40+this.qrHeight) + 'px'; this.mainColor = this.$uiConfig.mainColor;
this.mainColor = this.$uiConfig.mainColor; },
}, mounted() {
mounted() { let currentPages = getCurrentPages();
let currentPages = getCurrentPages(); let u = "/" + currentPages[currentPages.length - 1].route;
let u = '/' + currentPages[currentPages.length - 1].route; let pages = wx.getStorageSync("basedata")
let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : []; ? wx.getStorageSync("basedata").bar_title
pages.forEach(x => { : [];
if (x.value == u) { pages.forEach((x) => {
this.pageTitle = x.new_name ? x.new_name : x.name; if (x.value == u) {
} this.pageTitle = x.new_name ? x.new_name : x.name;
}); }
uni.setNavigationBarTitle({ });
title: this.pageTitle uni.setNavigationBarTitle({
}); title: this.pageTitle,
}, });
onLoad(option) { setTimeout(() => {
this.getList(); this.getTabsHeight();
this.u = uni.getStorageSync("mall_UserInfo"); this.getHeadHeight();
}, }, 1000);
methods: { },
//点击切换 onLoad(option) {
changeHandler(i) { this.getList();
this.active = i; this.u = uni.getStorageSync("mall_UserInfo");
}, },
//获取头部数据 methods: {
getList() { getTabsHeight() {
this.request2({ let that = this;
url: '/api/Share/GetShareCategoryList', const query = uni.createSelectorQuery().in(this);
data: this.msg query
}, .select(".quick-box >>> .tabbarMain")
res => { .boundingClientRect((data) => {
var data = res.data; that.paddingBottm = data.height + "px";
this.dataFirst = data; })
if (data && data.length > 0) { .exec();
this.dataSecond = data[0].children; },
// if (data[0].children && data[0].children.length > 0) { getHeadHeight() {
// this.dataThird = data[0].children[0].children let that = this;
// } const query = uni.createSelectorQuery().in(this);
} query
if(this.dataFirst.length>0){ .select(".quick-head")
this.conMsg.CateId=this.dataFirst[0].Id; .boundingClientRect((data) => {
this.getContent(); that.scrollHeight = data.height + "px";
} })
.exec();
} },
); //点击切换
}, changeHandler(i) {
//获取内容 this.active = i;
getContent() { },
this.request2({ //获取头部数据
url: '/api/Share/AppGetShareFriendPage', getList() {
data: this.conMsg this.request2(
}, {
res => { url: "/api/Share/GetShareCategoryList",
if (res.resultCode == 1) { data: this.msg,
this.dataList = this.dataList.concat(res.data.pageData); },
this.pageCount = res.data.pageCount; (res) => {
} var data = res.data;
} this.dataFirst = data;
); if (data && data.length > 0) {
}, this.dataSecond = data[0].children;
getChang(){ // if (data[0].children && data[0].children.length > 0) {
if(this.dataThird.length==0){ // this.dataThird = data[0].children[0].children
this.qrHeight=160 // }
}else{ }
this.qrHeight=196 if (this.dataFirst.length > 0) {
} this.conMsg.CateId = this.dataFirst[0].Id;
this.scrollHeight = this.$utils.calcContentHeight(-40+this.qrHeight) + 'px'; this.getContent();
}, }
//点击一级分类 }
getChild(index) { );
this.dataList=[]; },
this.active = index; //获取内容
this.dataSecond = this.dataFirst[index].children; getContent() {
this.dataThird = []; this.request2(
this.active2 = -1; {
this.active3 = -1; url: "/api/Share/AppGetShareFriendPage",
this.conMsg.CateId = this.dataFirst[index].Id; data: this.conMsg,
this.getContent(); },
this.getChang(); (res) => {
}, if (res.resultCode == 1) {
//点击二级分类 this.dataList = this.dataList.concat(res.data.pageData);
getSecond(item, index) { this.pageCount = res.data.pageCount;
this.dataList=[]; }
this.active2 = index; }
this.dataThird = item.children; );
this.active3 = -1; },
this.conMsg.CateId = item.Id; getChang() {
this.getContent(); if (this.dataThird.length == 0) {
this.getChang(); this.qrHeight = 160;
}, } else {
//点击三级分类 this.qrHeight = 196;
getThird(item, index) { }
this.dataList=[]; },
this.active3 = index; //点击一级分类
this.show = false; getChild(index) {
this.conMsg.CateId = item.Id; this.dataList = [];
this.getContent(); this.active = index;
this.getChang(); this.dataSecond = this.dataFirst[index].children;
}, this.dataThird = [];
reloadUserinfo() { this.active2 = -1;
this.u = uni.getStorageSync('mall_UserInfo'); this.active3 = -1;
}, this.conMsg.CateId = this.dataFirst[index].Id;
//关闭登录窗口 this.getContent();
gbAuth() { this.getChang();
this.showAuth = false; },
}, //点击二级分类
closeShare() { getSecond(item, index) {
this.showShare = false; this.dataList = [];
}, this.active2 = index;
//点击分享 this.dataThird = item.children;
openShare(item) { this.active3 = -1;
if (this.u) { this.conMsg.CateId = item.Id;
this.request2({ this.getContent();
url: '/api/Share/SetShareCount', this.getChang();
data: { },
Id:item.Id //点击三级分类
} getThird(item, index) {
}, this.dataList = [];
res => { this.active3 = index;
if (res.resultCode == 1) { this.show = false;
item.ShareCount++; this.conMsg.CateId = item.Id;
} this.getContent();
} this.getChang();
); },
this.goodTitle=item.MaterialInfo; reloadUserinfo() {
this.images=item.ImgList; this.u = uni.getStorageSync("mall_UserInfo");
this.sendQuanHandler(); },
this.showShare = true; //关闭登录窗口
} else { gbAuth() {
this.showAuth = true; this.showAuth = false;
} },
}, closeShare() {
//滚动加载 this.showShare = false;
lower(e) { },
if (this.conMsg.pageIndex < this.pageCount) { //点击分享
this.conMsg.pageIndex++; openShare(item) {
this.status = "loading"; if (this.u) {
this.getContent(); this.request2(
} else { {
this.status = "nomore"; url: "/api/Share/SetShareCount",
} data: {
}, Id: item.Id,
//跳转 },
goUrl(item){ },
if (item.LinkUrl && item.LinkUrl.length > 0) { (res) => {
uni.navigateTo({ if (res.resultCode == 1) {
url: item.LinkUrl item.ShareCount++;
}) }
} }
}, );
//分享复制 this.goodTitle = item.MaterialInfo;
sendQuanHandler() { this.images = item.ImgList;
this.copyHandler(); this.sendQuanHandler();
//判断有图片再调用复制图片 this.showShare = true;
if(this.images.length>0){ } else {
setTimeout(() => { this.showAuth = true;
this.savePicHandler(); }
}, 1000); },
} //滚动加载
}, lower(e) {
//复制文字 if (this.conMsg.pageIndex < this.pageCount) {
copyHandler() { this.conMsg.pageIndex++;
uni.setClipboardData({ this.status = "loading";
data: this.goodTitle, this.getContent();
}); } else {
}, this.status = "nomore";
savePicHandler() { }
uni.showLoading({ },
title: "正在下载图片", //跳转
}); goUrl(item) {
let arr = JSON.parse(JSON.stringify(this.images)); if (item.LinkUrl && item.LinkUrl.length > 0) {
this.downLoadImage(arr); uni.navigateTo({
}, url: item.LinkUrl,
downLoadImage(arr) { });
let that = this; }
uni.downloadFile({ },
url: arr[0], //分享复制
success: (res) => { sendQuanHandler() {
if (res.statusCode === 200) { this.copyHandler();
uni.saveImageToPhotosAlbum({ //判断有图片再调用复制图片
filePath: res.tempFilePath, if (this.images.length > 0) {
success: function() { setTimeout(() => {
arr.splice(0, 1); this.savePicHandler();
if (arr.length > 0) { }, 1000);
that.downLoadImage(arr); }
} else { },
uni.hideLoading(); //复制文字
uni.showToast({ copyHandler() {
title: "下载成功", uni.setClipboardData({
}); data: this.goodTitle,
that.showDialog=true; });
} },
}, savePicHandler() {
fail: function(e) { uni.showLoading({
uni.hideLoading(); title: "正在下载图片",
that.$refs.uTips.show({ });
title: "下载失败,请稍后重试", let arr = JSON.parse(JSON.stringify(this.images));
type: "error", this.downLoadImage(arr);
duration: "2300", },
}); downLoadImage(arr) {
}, let that = this;
}); uni.downloadFile({
} else { url: arr[0],
uni.hideLoading(); success: (res) => {
that.$refs.uTips.show({ if (res.statusCode === 200) {
title: "下载失败,请稍后重试", uni.saveImageToPhotosAlbum({
type: "error", filePath: res.tempFilePath,
duration: "2300", success: function () {
}); arr.splice(0, 1);
} if (arr.length > 0) {
}, that.downLoadImage(arr);
}); } else {
}, uni.hideLoading();
} uni.showToast({
}; title: "下载成功",
});
that.showDialog = true;
}
},
fail: function (e) {
uni.hideLoading();
that.$refs.uTips.show({
title: "下载失败,请稍后重试",
type: "error",
duration: "2300",
});
},
});
} else {
uni.hideLoading();
that.$refs.uTips.show({
title: "下载失败,请稍后重试",
type: "error",
duration: "2300",
});
}
},
});
},
},
};
</script> </script>
export default { export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285" Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
// Vue.prototype.host2 = "http://192.168.0.110:8200" // Vue.prototype.host2 = "http://192.168.0.110:8200"
// Vue.prototype.host2 = "https://mallApi.oytour.com" // Vue.prototype.host2 = "https://mallApi.oytour.com"
Vue.prototype.host2 = "http://192.168.2.16:8088" Vue.prototype.host2 = "https://mallApi.oytour.com"
// Vue.prototype.host2 = "http://192.168.2.65" // Vue.prototype.host2 = "http://192.168.2.65"
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
//网络请求
uni.request({
url: this.host + "&r=" + param.data.r,
method: param.method || "GET",
header: param.header || {
'content-type': "application/json"
},
data: param.data,
success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") {
}
typeof success == "function" && success(res.data);
},
fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e));
uni.showModal({
content: "" + res.errMsg
});
typeof failed == "function" && failed(res.data);
}
});
}
Vue.prototype.request2 = function(param, success, failed) {
//网络请求 //网络请求
uni.request({ uni.request({
url: this.host2 + param.url, url: this.host + "&r=" + param.data.r,
method: param.method || "Post", method: param.method || "GET",
header: param.header || { header: param.header || {
'content-type': "application/json" 'content-type': "application/json"
}, },
data: { data: param.data,
MallBaseId: 1,
TenantId: 1,
OpenId: this.GetOpenId().OpenId,
UserId: this.GetOpenId().UserId,
SmallShopsId: this.GetOpenId().SmallShopsId,
MiniAppId: this.GetMiniAppId(),
msg: param.data,
token: this.GetOpenId().token
},
success: res => { success: res => {
if (res.data.code != 0 && res.data.msg != "商品未上架") {
if(res.data.resultCode == 10000){
let u = uni.getStorageSync("mall_UserInfo");
if(u){
this.getLogin_t(u)
typeof failed == "function" && failed(res.data);
}
}else if(res.data.resultCode != 1) {
if( res.data.message!=''){
uni.showToast({
title: res.data.message,
icon: "none",
});
}
typeof failed == "function" && failed(res.data);
}
else{
typeof success == "function" && success(res.data);
} }
typeof success == "function" && success(res.data);
}, },
fail: (e) => { fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e)); console.log("网络请求fail:" + JSON.stringify(e));
...@@ -84,36 +29,89 @@ export default { ...@@ -84,36 +29,89 @@ export default {
} }
}); });
} }
// token失效再次登录接口 Vue.prototype.request2 = function(param, success, failed) {
Vue.prototype.getLogin_t = function(obj) { //网络请求
let pid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0; uni.request({
let SmallShopId = uni.getStorageSync("SmallShopId")?uni.getStorageSync("SmallShopId").SmallShopId:0; url: this.host2 + param.url,
this.request2( method: param.method || "Post",
{ header: param.header || {
url: '/api/AppletLogin/Login', 'content-type': "application/json"
data: { },
Source: 1, data: {
OpenId: obj.OpenId, MallBaseId: 1,
Name: obj.Name, TenantId: 1,
Photo: obj.Photo, OpenId: this.GetOpenId().OpenId,
Moblie: '', UserId: this.GetOpenId().UserId,
SuperiorId: pid, SmallShopsId: this.GetOpenId().SmallShopsId,
SmallShopId:SmallShopId, MiniAppId: this.GetMiniAppId(),
} msg: param.data,
}, token: this.GetOpenId().token
res => { },
if (res.resultCode == 1) { success: res => {
uni.setStorageSync('mall_UserInfo', res.data);
uni.removeStorageSync('pid'); if (res.data.resultCode == 10000) {
uni.removeStorageSync('SmallShopId');
} let u = uni.getStorageSync("mall_UserInfo");
} if (u) {
); this.getLogin_t(u)
} typeof failed == "function" && failed(res.data);
// 获取小程序APPID }
} else if (res.data.resultCode != 1) {
if (res.data.message != '') {
uni.showToast({
title: res.data.message,
icon: "none",
});
}
typeof failed == "function" && failed(res.data);
} else {
typeof success == "function" && success(res.data);
}
},
fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e));
uni.showModal({
content: "" + res.errMsg
});
typeof failed == "function" && failed(res.data);
}
});
}
// token失效再次登录接口
Vue.prototype.getLogin_t = function(obj) {
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ? uni.getStorageSync("SmallShopId").SmallShopId : 0;
this.request2({
url: '/api/AppletLogin/Login',
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: '',
SuperiorId: pid,
SmallShopId: SmallShopId,
}
},
res => {
if (res.resultCode == 1) {
uni.setStorageSync('mall_UserInfo', res.data);
uni.removeStorageSync('pid');
uni.removeStorageSync('SmallShopId');
}
}
);
}
// 获取小程序APPID
Vue.prototype.GetMiniAppId = function() { Vue.prototype.GetMiniAppId = function() {
return 'wxacd9f8cc3480d29e' return 'wxacd9f8cc3480d29e'
// return 'wxcf0727a7c78b501e' //旅小友 // return 'wxcf0727a7c78b501e' //旅小友
} }
//获取OpenId //获取OpenId
Vue.prototype.GetOpenId = function() { Vue.prototype.GetOpenId = function() {
...@@ -122,7 +120,7 @@ export default { ...@@ -122,7 +120,7 @@ export default {
OpenId: '', OpenId: '',
UserId: 0, UserId: 0,
token: '', token: '',
SmallShopsId:0, SmallShopsId: 0,
} }
if (mall_userinfo) { if (mall_userinfo) {
if (mall_userinfo.OpenId) { if (mall_userinfo.OpenId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment