作者 韩昌

配置分享好友和朋友圈

<script>
export default {
onLaunch: function() {
export default {
onLaunch: function () {
console.log('App Launch')
},
onShow: function() {
onShow: function () {
console.log('App Show')
},
onHide: function() {
onHide: function () {
console.log('App Hide')
}
}
}
</script>
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-plus/index.scss";
.flexJ {
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import 'uview-plus/index.scss';
.flexJ {
display: flex;
justify-content: space-between;
align-items: center;
}
}
.flexC {
.flexC {
display: flex;
justify-content: center;
align-items: center;
}
}
.flexA {
.flexA {
display: flex;
align-items: center;
}
}
.flexV {
.flexV {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
}
.flexW {
.flexW {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.ples {
}
.ples {
color: #000000e6;
font-size: 30rpx;
font-weight: 700;
}
.lineFeed {
}
.lineFeed {
word-wrap: break-word;
word-break: break-all;
white-space: pre-line;
}
}
.ellipsis {
.ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
overflow: hidden;
-webkit-line-clamp: 1;
}
}
.ellipsisT {
.ellipsisT {
display: -webkit-box;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
... ... @@ -71,10 +71,10 @@
-webkit-line-clamp: 2;
color: rgba(0, 0, 0, 0.9);
font-size: 24rpx;
}
}
.iosAuto {
padding-bottom:constant(safe-area-inset-bottom);
.iosAuto {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
}
</style>
... ...
import App from './App'
// import share from './utils/share'
import share from './utils/share'
// main.js
import uviewPlus from 'uview-plus'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
// Vue.mixin(share)
try {
function isPromise(obj) {
return (
!!obj &&
(typeof obj === "object" || typeof obj === "function") &&
typeof obj.then === "function"
);
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'
}
// 统一 vue2 API Promise 化返回格式与 vue3 保持一致
uni.addInterceptor({
returnValue(res) {
if (!isPromise(res)) {
return res;
return res
}
return new Promise((resolve, reject) => {
res.then((res) => {
res.then(res => {
if (res[0]) {
reject(res[0]);
reject(res[0])
} else {
resolve(res[1]);
resolve(res[1])
}
})
})
}
});
});
},
});
} catch (error) { }
})
} catch (error) {}
const app = new Vue({
...App
... ... @@ -47,6 +46,7 @@ export function createApp() {
const app = createSSRApp(App)
app.config.globalProperties.$methods = methods
app.use(uviewPlus)
app.mixin(share)
return {
app
}
... ...
... ... @@ -333,8 +333,8 @@ const getShopDetailes = async id => {
background: linear-gradient(139deg, #fb753cff 0%, #fb3e3cff 100%);
}
}
image {
width: 100% !important;
height: 100% !important;
}
// image {
// width: 100% !important;
// height: 100% !important;
// }
</style>
... ...
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./common/vendor.js"),n=require("./api/methods.js"),p={onLaunch:function(){console.log("App Launch")},onShow:function(){console.log("App Show")},onHide:function(){console.log("App Hide")}},o=s._export_sfc(p,[["__file","D:/vue/大健康商城/healthMall/App.vue"]]);function a(){const e=s.createSSRApp(o);return e.config.globalProperties.$methods=n.methods,e.use(s.uviewPlus),{app:e}}a().app.mount("#app");exports.createApp=a;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./common/vendor.js"),n=require("./utils/share.js"),p=require("./api/methods.js"),i={onLaunch:function(){console.log("App Launch")},onShow:function(){console.log("App Show")},onHide:function(){console.log("App Hide")}},o=s._export_sfc(i,[["__file","D:/vue/大健康商城/healthMall/App.vue"]]);function a(){const e=s.createSSRApp(o);return e.config.globalProperties.$methods=p.methods,e.use(s.uviewPlus),e.mixin(n.share),{app:e}}a().app.mount("#app");exports.createApp=a;
... ...
.u-nav-slot image{width:48rpx;height:48rpx}.indicator-num{padding:2px 0;background-color:rgba(0,0,0,.35);border-radius:100px;width:35px;display:flex;flex-direction:row;justify-content:center}.indicator-num__text{color:#fff;font-size:12px}.swiperBox{margin-bottom:32rpx}.info{width:702rpx;margin:0 auto}.line{width:100%;height:6rpx;opacity:1;background:#f7f8faff;margin:32rpx 0}.mainBox{padding:0 24rpx}.mainBox .commentNmu{margin-bottom:40rpx}.mainBox .commentNmu text{color:#1a1a1a;font-size:28rpx;font-weight:700}.mainBox .commentNmu .see{color:#ff7534;font-size:24rpx}.mainBox .commentNmu .see image{margin-left:2rpx;width:24rpx;height:24rpx}.mainBox .commentNull{color:rgba(0,0,0,.4);font-size:26rpx;margin-bottom:212rpx}.mainBox .commentNull image{width:348rpx;height:240rpx;margin-bottom:16rpx}.titles{color:#1a1a1a;font-size:28rpx;font-weight:700}.lineBox{margin:24rpx 0 30rpx}.lineBox .lines{width:149rpx;height:1rpx;opacity:1;border:0 solid #979797ff;background:#dcdee0ff}.lineBox text{margin:0 24rpx;color:#969799;font-size:24rpx}.btnBox{position:fixed;left:0;bottom:0;width:100%;height:120rpx;background:#ffffffff}.btnBox .left{margin-left:32rpx}.btnBox .left .leftIc{margin-right:34rpx;position:relative}.btnBox .left .leftIc .images{position:relative;width:48rpx;height:48rpx;margin-bottom:8rpx}.btnBox .left .leftIc .images image{width:48rpx;height:48rpx}.btnBox .left .leftIc text{color:#323233;font-size:20rpx}.btnBox .left .leftIc button{position:absolute;bottom:0;left:0;top:0;right:0;background:transparent;font-size:20rpx;border:none!important;padding:0!important;line-height:28rpx}.btnBox .left .leftIc button:after{border:none}.btnBox .buy{margin-right:32rpx;width:200rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:24rpx;font-weight:700;background:linear-gradient(139deg,#fb753cff 0%,#fb3e3cff 100%)}.btnBox .add{margin-right:14rpx;width:200rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:24rpx;font-weight:700;background:linear-gradient(139deg,#ffac0bff 0%,#ffc24aff 100%)}.btnBox .exchange{margin-right:32rpx;width:358rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:30rpx;font-weight:700;background:linear-gradient(139deg,#fb753cff 0%,#fb3e3cff 100%)}image{width:100%!important;height:100%!important}
.u-nav-slot image{width:48rpx;height:48rpx}.indicator-num{padding:2px 0;background-color:rgba(0,0,0,.35);border-radius:100px;width:35px;display:flex;flex-direction:row;justify-content:center}.indicator-num__text{color:#fff;font-size:12px}.swiperBox{margin-bottom:32rpx}.info{width:702rpx;margin:0 auto}.line{width:100%;height:6rpx;opacity:1;background:#f7f8faff;margin:32rpx 0}.mainBox{padding:0 24rpx}.mainBox .commentNmu{margin-bottom:40rpx}.mainBox .commentNmu text{color:#1a1a1a;font-size:28rpx;font-weight:700}.mainBox .commentNmu .see{color:#ff7534;font-size:24rpx}.mainBox .commentNmu .see image{margin-left:2rpx;width:24rpx;height:24rpx}.mainBox .commentNull{color:rgba(0,0,0,.4);font-size:26rpx;margin-bottom:212rpx}.mainBox .commentNull image{width:348rpx;height:240rpx;margin-bottom:16rpx}.titles{color:#1a1a1a;font-size:28rpx;font-weight:700}.lineBox{margin:24rpx 0 30rpx}.lineBox .lines{width:149rpx;height:1rpx;opacity:1;border:0 solid #979797ff;background:#dcdee0ff}.lineBox text{margin:0 24rpx;color:#969799;font-size:24rpx}.btnBox{position:fixed;left:0;bottom:0;width:100%;height:120rpx;background:#ffffffff}.btnBox .left{margin-left:32rpx}.btnBox .left .leftIc{margin-right:34rpx;position:relative}.btnBox .left .leftIc .images{position:relative;width:48rpx;height:48rpx;margin-bottom:8rpx}.btnBox .left .leftIc .images image{width:48rpx;height:48rpx}.btnBox .left .leftIc text{color:#323233;font-size:20rpx}.btnBox .left .leftIc button{position:absolute;bottom:0;left:0;top:0;right:0;background:transparent;font-size:20rpx;border:none!important;padding:0!important;line-height:28rpx}.btnBox .left .leftIc button:after{border:none}.btnBox .buy{margin-right:32rpx;width:200rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:24rpx;font-weight:700;background:linear-gradient(139deg,#fb753cff 0%,#fb3e3cff 100%)}.btnBox .add{margin-right:14rpx;width:200rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:24rpx;font-weight:700;background:linear-gradient(139deg,#ffac0bff 0%,#ffc24aff 100%)}.btnBox .exchange{margin-right:32rpx;width:358rpx;height:80rpx;border-radius:80rpx;color:#fff;font-size:30rpx;font-weight:700;background:linear-gradient(139deg,#fb753cff 0%,#fb3e3cff 100%)}
... ...
"use strict";const e=require("../common/vendor.js"),s={data(){return{share:{title:"魅力女人",path:"/pages/login/login",imageUrl:"",desc:"",content:""}}},onShareTimeline(){return{title:this.share.title,path:this.share.path,imageUrl:this.share.imageUrl}},onShareAppMessage(r){return{title:this.share.title,path:this.share.path,imageUrl:this.share.imageUrl,desc:this.share.desc,content:this.share.content,success(t){e.index.showToast({title:"分享成功"})},fail(t){e.index.showToast({title:"分享失败",icon:"none"})}}}};exports.share=s;
... ...
export default {
data() {
return {
//设置默认的分享参数
share: {
title: '魅力女人',
path: '/pages/login/login',
imageUrl: '',
desc: '',
content: ''
}
}
},
onShareTimeline() {
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl
}
},
onShareAppMessage(res) {
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
desc: this.share.desc,
content: this.share.content,
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
}
}
... ...