优化部分代码样式以及bug,新增app升级功能
parent
8fe64bd3c6
commit
533375f056
1
App.vue
1
App.vue
|
@ -21,6 +21,7 @@ export default {
|
|||
onLaunch: function () {
|
||||
// #ifdef APP-PLUS
|
||||
this.checkArguments(); // 检测启动参数
|
||||
APPUpdate();
|
||||
// 重点是以下: 一定要监听后台恢复 !一定要
|
||||
plus.globalEvent.addEventListener("newintent", (e) => {
|
||||
this.checkArguments(); // 检测启动参数
|
||||
|
|
16
api/goods.js
16
api/goods.js
|
@ -30,13 +30,25 @@ export function getGoodsRelated(params) {
|
|||
* @param skuId 商品ID
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export function getGoods(skuId, goodsId, distributionId) {
|
||||
export function getGoods(skuId, goodsId) {
|
||||
return http.request({
|
||||
url: `/goods/sku/${goodsId}/${skuId}${distributionId ? '?distributionId='+distributionId : ''}`,
|
||||
url: `/goods/sku/${goodsId}/${skuId}`,
|
||||
method: Method.GET,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分销
|
||||
* @param distributionId 商品分销ID
|
||||
*/
|
||||
export function getGoodsDistribution(distributionId) {
|
||||
return http.request({
|
||||
url: `/distribution/bindingDistribution/${distributionId}`,
|
||||
method: Method.GET,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
* @param params
|
||||
|
|
|
@ -146,7 +146,7 @@ export function AppendCommentsOrder(params) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
// TODO 第一版本暂未实现此功能
|
||||
/**
|
||||
* 商品咨询
|
||||
* @param goods_id
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import {http,Method} from '@/utils/request.js';
|
||||
const request = http.request
|
||||
|
||||
import api from '@/config/api.js';
|
||||
|
||||
/**
|
||||
* 获取微信消息订阅
|
||||
|
@ -67,16 +68,14 @@ export function getLogisticsMessages(params) {
|
|||
|
||||
/**
|
||||
* TODO 获取版本更新信息 暂无此功能。后续会优化更新
|
||||
* @param params
|
||||
* @param appType
|
||||
* @returns {AxiosPromise}
|
||||
*
|
||||
*/
|
||||
export function getAppVersionList(params) {
|
||||
params = params || {};
|
||||
params.pageSize = params.pageSize || 5;
|
||||
export function getAppVersionList(appType) {
|
||||
return http.request({
|
||||
url: 'members/app/version',
|
||||
url: `/appVersion/${appType}`,
|
||||
method: Method.GET,
|
||||
params,
|
||||
type:"manager"
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,10 +11,11 @@ const dev = {
|
|||
const prod = {
|
||||
common: "https://common-api.pickmall.cn",
|
||||
buyer: "https://buyer-api.pickmall.cn",
|
||||
|
||||
};
|
||||
|
||||
//默认生产环境
|
||||
let api = prod;
|
||||
let api = dev;
|
||||
//如果是开发环境
|
||||
if (process.env.NODE_ENV == "development") {
|
||||
api = dev;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"appid" : "__UNI__C100675",
|
||||
"description" : "",
|
||||
"versionName" : "4.0.14",
|
||||
"versionCode" : 4000013,
|
||||
"versionCode" : 4000014,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"compatible" : {
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
{{ comment.content }}
|
||||
</view>
|
||||
<!-- 如果有图片则会循环显示评价的图片 -->
|
||||
<view class="goods-imgs-view" v-if="comment.image != null && comment.image.length != 0">
|
||||
<view class="img-view" v-for="(img, imgIndex) in comment.image.split(',')" :key="imgIndex">
|
||||
<u-image @click.native="preview(comment.image.split(','),imgIndex)" width="160rpx" height="160rpx" :src="img"></u-image>
|
||||
<view class="goods-imgs-view" v-if="comment.images != null && comment.images.length != 0">
|
||||
<view class="img-view" v-for="(img, imgIndex) in comment.images.split(',')" :key="imgIndex">
|
||||
<u-image @click.native="preview(comment.images.split(','),imgIndex)" width="160rpx" height="160rpx" :src="img"></u-image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-name">
|
||||
|
|
|
@ -117,7 +117,6 @@ export default {
|
|||
this.form.skuId = this.order.orderItems[0].skuId;
|
||||
},
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* 点击评价
|
||||
*/
|
||||
|
@ -134,17 +133,18 @@ export default {
|
|||
});
|
||||
commentsMemberOrder(this.form).then((res) => {
|
||||
uni.hideLoading();
|
||||
|
||||
uni.showToast({
|
||||
title: "发布评价成功",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1000);
|
||||
},
|
||||
});
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: "发布评价成功",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="order.allowOperationVO.showLogistics" @click="navigateToLogistics(order)">
|
||||
查看物流
|
||||
</u-button>
|
||||
<u-button ripple :customStyle="{'background':$lightColor,'color':'#fff' }" shape="circle" class="pay-btn" size="mini" v-if="order.allowOperationVO.rog" @click="onRog(order.sn)">
|
||||
<u-button ripple :customStyle="{'background':lightColor,'color':'#fff' }" shape="circle" class="pay-btn" size="mini" v-if="order.allowOperationVO.rog" @click="onRog(order.sn)">
|
||||
确认收货
|
||||
</u-button>
|
||||
<u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="
|
||||
|
@ -83,7 +83,7 @@
|
|||
<u-radio-group v-model="reason">
|
||||
<view class="value">
|
||||
<view class="radio-view" :key="index" v-for="(item, index) in cancelList">
|
||||
<u-radio :active-color="$lightColor" label-size="25" shape="circle" :name="item.reason" @change="reasonChange">{{ item.reason }}</u-radio>
|
||||
<u-radio :active-color="lightColor" label-size="25" shape="circle" :name="item.reason" @change="reasonChange">{{ item.reason }}</u-radio>
|
||||
</view>
|
||||
</view>
|
||||
</u-radio-group>
|
||||
|
@ -94,7 +94,7 @@
|
|||
</view>
|
||||
</u-popup>
|
||||
<u-toast ref="uToast" />
|
||||
<u-modal v-model="rogShow" :show-cancel-button="true" :content="'是否确认收货?'" @confirm="confirmRog"></u-modal>
|
||||
<u-modal :confirm-color="lightColor" v-model="rogShow" :show-cancel-button="true" :content="'是否确认收货?'" @confirm="confirmRog"></u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -111,6 +111,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
lightColor:this.$lightColor,
|
||||
tabCurrentIndex: 0, //导航栏索引
|
||||
navList: [
|
||||
//导航栏list
|
||||
|
@ -492,7 +493,7 @@ page,
|
|||
}
|
||||
|
||||
.swiper-box {
|
||||
height: calc(100% - 40px);
|
||||
height: calc(100vh - 40px);
|
||||
}
|
||||
|
||||
.list-scroll-content {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<div class="content">{{ item.content }}</div>
|
||||
<view class="img">
|
||||
<!-- 循环出用户评价的图片 -->
|
||||
<u-image width="140rpx" height="140rpx" v-if="item.image" v-for="(img, i) in splitImg(item.image)" :src="img" :key="i" @click="preview(splitImg(item.image), i)">
|
||||
<u-image width="140rpx" height="140rpx" v-if="item.images" v-for="(img, i) in splitImg(item.images)" :src="img" :key="i" @click="preview(splitImg(item.images), i)">
|
||||
</u-image>
|
||||
</view>
|
||||
<view class="bot">
|
||||
|
|
|
@ -223,7 +223,12 @@
|
|||
|
||||
<script>
|
||||
/************接口API***************/
|
||||
import { getGoods, getGoodsList, getMpScene } from "@/api/goods.js";
|
||||
import {
|
||||
getGoods,
|
||||
getGoodsList,
|
||||
getMpScene,
|
||||
getGoodsDistribution,
|
||||
} from "@/api/goods.js";
|
||||
import * as API_trade from "@/api/trade.js";
|
||||
import * as API_Members from "@/api/members.js";
|
||||
import * as API_store from "@/api/store.js";
|
||||
|
@ -393,7 +398,8 @@ export default {
|
|||
},
|
||||
async onLoad(options) {
|
||||
this.routerVal = options;
|
||||
|
||||
},
|
||||
async onShow() {
|
||||
this.goodsDetail = {};
|
||||
//如果有参数ids说明事分销短连接,需要获取参数
|
||||
if (this.routerVal.scene) {
|
||||
|
@ -407,11 +413,11 @@ export default {
|
|||
this.init(
|
||||
this.routerVal.id,
|
||||
this.routerVal.goodsId,
|
||||
this.routerVal.distributionId
|
||||
this.routerVal.distributionId,
|
||||
this.routerVal.whetherPoint
|
||||
);
|
||||
}
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
// 循环出当前促销是否为空
|
||||
emptyPromotion() {
|
||||
|
@ -432,8 +438,16 @@ export default {
|
|||
title: "加载中",
|
||||
mask: true,
|
||||
});
|
||||
let response = await getGoods(id, goodsId, distributionId);
|
||||
|
||||
let response = await getGoods(id, goodsId);
|
||||
|
||||
// 这里是绑定分销员
|
||||
if (distributionId || this.$store.state.distributionId) {
|
||||
let disResult = await getGoodsDistribution(distributionId);
|
||||
if (!disResult.data.success || disResult.statusCode == 403) {
|
||||
this.$store.state.distributionId = distributionId;
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
/**商品信息以及规格信息存储 */
|
||||
this.goodsDetail = response.data.result.data;
|
||||
|
@ -539,16 +553,13 @@ export default {
|
|||
* 返回
|
||||
*/
|
||||
back() {
|
||||
|
||||
if(getCurrentPages().length ==1){
|
||||
if (getCurrentPages().length == 1) {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/index'
|
||||
url: "/pages/tabbar/home/index",
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
else{
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
<view class="store-line">
|
||||
<u-checkbox-group class="store-line-check">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" v-model="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="lightColor" v-model="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
<!-- 微信小程序这里 v-model出现问题,改用:value -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" :value="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="lightColor" :value="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
</u-checkbox-group>
|
||||
<span class="storeName store-line-desc" @click.stop="navigateToStore(item)">{{
|
||||
|
@ -49,11 +49,11 @@
|
|||
<view>
|
||||
<u-checkbox-group v-if="skuItem.invalid == 0">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" class="c-left" v-model="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="lightColor" class="c-left" v-model="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
<!-- 微信小程序这里 v-model出现问题,改用:value -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" class="c-left" :value="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="lightColor" class="c-left" :value="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
</u-checkbox-group>
|
||||
<span class="invalid" v-else style="font-size: 24rpx">失效</span>
|
||||
|
@ -110,7 +110,7 @@
|
|||
<!-- 结账 -->
|
||||
<div class="box box6">
|
||||
<view class="navL">
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" v-model="checkout" @change="checkOut()" label-size="24">全选</u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="lightColor" v-model="checkout" @change="checkOut()" label-size="24">全选</u-checkbox>
|
||||
<span class="price">
|
||||
<div class="prices">
|
||||
<div class="fullPrice">
|
||||
|
|
|
@ -10,9 +10,9 @@ import {
|
|||
|
||||
const platform = uni.getSystemInfoSync().platform;
|
||||
// 主颜色
|
||||
const $mainColor = "#ff6b35";
|
||||
const $mainColor = "#1ABC9C";
|
||||
// 弹窗图标url
|
||||
const $iconUrl = "https://lilistore-oss.oss-cn-beijing.aliyuncs.com/app/upgrade.png";
|
||||
const $iconUrl = "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/app/upgrade.png";
|
||||
|
||||
// 获取当前应用的版本号
|
||||
export const getCurrentNo = function (callback) {
|
||||
|
@ -25,72 +25,27 @@ export const getCurrentNo = function (callback) {
|
|||
});
|
||||
}
|
||||
// 发起ajax请求获取服务端版本号
|
||||
export const getServerNo = function (version, isPrompt = false, callback) {
|
||||
let httpData = {
|
||||
version: version
|
||||
};
|
||||
let params = {
|
||||
pageNumber: 1,
|
||||
pageSize: 5
|
||||
};
|
||||
if (platform == "android") {
|
||||
httpData.type = 1101;
|
||||
params.type = 0;
|
||||
} else {
|
||||
httpData.type = 1102;
|
||||
params.type = 1;
|
||||
}
|
||||
/* 接口入参说明
|
||||
* version: 应用当前版本号(已自动获取)
|
||||
* type:平台(1101是安卓,1102是IOS)
|
||||
*/
|
||||
/****************以下是示例*******************/
|
||||
getAppVersionList(params).then(res => {
|
||||
if (res.statusCode === 200) {
|
||||
const response = res.data.data.find(ele => {
|
||||
let versionDetail = ele.version.replace(/\./g, "");
|
||||
if (versionDetail.length < version.length) {
|
||||
versionDetail = versionDetail.padEnd(version.length, "0");
|
||||
}
|
||||
if (versionDetail > version) {
|
||||
return ele;
|
||||
}
|
||||
});
|
||||
if (response && response.download_url) {
|
||||
let result = {};
|
||||
result.versionCode = response.version;
|
||||
result.versionName = response.version_name;
|
||||
result.versionInfo = response.content;
|
||||
result.forceUpdate = response.force_update;
|
||||
result.downloadUrl = response.download_url;
|
||||
callback && callback(result);
|
||||
}
|
||||
export const getServerNo = function (callback) {
|
||||
let type;
|
||||
|
||||
platform == "android" ? type = "ANDROID" : type = "IOS"
|
||||
|
||||
getAppVersionList(type).then(res => {
|
||||
|
||||
if(res.data.success && res.data.result.downloadUrl){
|
||||
let response = res.data.result
|
||||
let result ={}
|
||||
result.versionCode = response.version;
|
||||
result.versionName = response.versionName;
|
||||
result.versionInfo = response.content || '暂无';
|
||||
result.forceUpdate = response.forceUpdate;
|
||||
result.downloadUrl = response.downloadUrl;
|
||||
|
||||
console.log(result,response)
|
||||
callback && callback(result);
|
||||
}
|
||||
})
|
||||
// 可以用自己项目的请求方法
|
||||
// http.get("api/common/v1/app_version", httpData,{
|
||||
// isPrompt: isPrompt
|
||||
// }).then(res => {
|
||||
// /* res的数据说明
|
||||
// * | 参数名称 | 一定返回 | 类型 | 描述
|
||||
// * | -------------|--------- | --------- | ------------- |
|
||||
// * | versionCode | y | int | 版本号 |
|
||||
// * | versionName | y | String | 版本名称 |
|
||||
// * | versionInfo | y | String | 版本信息 |
|
||||
// * | forceUpdate | y | boolean | 是否强制更新 |
|
||||
// * | downloadUrl | y | String | 版本下载链接(IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接) |
|
||||
// */
|
||||
// if (res && res.downloadUrl) {
|
||||
// callback && callback(res);
|
||||
// } else if (isPrompt) {
|
||||
// uni.showToast({
|
||||
// title: "暂无新版本",
|
||||
// icon: "none"
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
/****************以上是示例*******************/
|
||||
|
||||
}
|
||||
// 从服务器下载应用资源包(wgt文件)
|
||||
export const getDownload = function (data) {
|
||||
|
@ -180,12 +135,16 @@ export const getDownload = function (data) {
|
|||
function drawtext(text, maxWidth) {
|
||||
let textArr = text.split("");
|
||||
let len = textArr.length;
|
||||
|
||||
// 上个节点
|
||||
let previousNode = 0;
|
||||
// 记录节点宽度
|
||||
let nodeWidth = 0;
|
||||
// 文本换行数组
|
||||
let rowText = [];
|
||||
|
||||
|
||||
|
||||
// 如果是字母,侧保存长度
|
||||
let letterWidth = 0;
|
||||
// 汉字宽度
|
||||
|
@ -267,6 +226,7 @@ function drawtext(text, maxWidth) {
|
|||
content: text.substring(previousNode, len)
|
||||
});
|
||||
}
|
||||
|
||||
return rowText;
|
||||
}
|
||||
// 是否更新弹窗
|
||||
|
@ -291,6 +251,7 @@ function updatePopup(data, callback) {
|
|||
const viewContentWidth = parseInt(popupViewWidth - (viewContentPadding * 5));
|
||||
// 描述的列表
|
||||
const descriptionList = drawtext(data.versionInfo, viewContentWidth);
|
||||
|
||||
// 弹窗容器高度
|
||||
let popupViewHeight = 400;
|
||||
let popupViewContentList = [{
|
||||
|
@ -337,7 +298,6 @@ function updatePopup(data, callback) {
|
|||
text: '新版本特性:',
|
||||
textStyles: {
|
||||
size: '20px',
|
||||
color: "#1ABC9C",
|
||||
lineSpacing: "50%",
|
||||
align: "left"
|
||||
},
|
||||
|
@ -841,7 +801,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
|||
}
|
||||
export default function (isPrompt = false) {
|
||||
getCurrentNo(version => {
|
||||
getServerNo(version.versionCode, isPrompt, res => {
|
||||
getServerNo( res => {
|
||||
if (res.forceUpdate) {
|
||||
if (/\.wgt$/i.test(res.downloadUrl)) {
|
||||
getDownload(res);
|
||||
|
|
|
@ -10,7 +10,10 @@ const store = new Vuex.Store({
|
|||
/**
|
||||
* 是否需要强制登录
|
||||
*/
|
||||
|
||||
forcedLogin: false,
|
||||
|
||||
distributionId:"", //分销员Id 如果当前账户从未登录过时记录
|
||||
hasLogin: storage.getHasLogin(),
|
||||
userInfo: storage.getUserInfo(),
|
||||
uuid: storage.getUuid(),
|
||||
|
|
|
@ -120,6 +120,7 @@ http.interceptors.request.use(
|
|||
};
|
||||
let params = config.params || {};
|
||||
params = { ...params, ..._params };
|
||||
|
||||
config.params = params;
|
||||
config.header.accessToken = accessToken;
|
||||
}
|
||||
|
@ -184,7 +185,7 @@ http.interceptors.response.use(
|
|||
return response;
|
||||
},
|
||||
(error) => {
|
||||
return response;
|
||||
return error;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
module.exports = {
|
||||
/**
|
||||
* 此处为发行h5,微信小程序,app中删除console
|
||||
* 如需显示console 需要注释此处重新运行
|
||||
*/
|
||||
chainWebpack: (config) => {
|
||||
// 发行或运行时启用了压缩时会生效
|
||||
config.optimization.minimizer('terser').tap((args) => {
|
||||
const compress = args[0].terserOptions.compress
|
||||
// 非 App 平台移除 console 代码(包含所有 console 方法,如 log,debug,info...)
|
||||
compress.drop_console = true
|
||||
compress.pure_funcs = [
|
||||
'__f__', // App 平台 vue 移除日志代码
|
||||
// 'console.debug' // 可移除指定的 console 方法
|
||||
]
|
||||
return args
|
||||
})
|
||||
}
|
||||
}
|
||||
// module.exports = {
|
||||
// /**
|
||||
// * 此处为发行h5,微信小程序,app中删除console
|
||||
// * 如需显示console 需要注释此处重新运行
|
||||
// */
|
||||
// chainWebpack: (config) => {
|
||||
// // 发行或运行时启用了压缩时会生效
|
||||
// config.optimization.minimizer('terser').tap((args) => {
|
||||
// const compress = args[0].terserOptions.compress
|
||||
// // 非 App 平台移除 console 代码(包含所有 console 方法,如 log,debug,info...)
|
||||
// compress.drop_console = true
|
||||
// compress.pure_funcs = [
|
||||
// '__f__', // App 平台 vue 移除日志代码
|
||||
// // 'console.debug' // 可移除指定的 console 方法
|
||||
// ]
|
||||
// return args
|
||||
// })
|
||||
// }
|
||||
// }
|
Loading…
Reference in New Issue