Explorar el Código

Merge branch 'dev' into dev_YWQ

dev_YWQ
HolyKnightIX hace 1 año
padre
commit
118b13bb6f
Se han modificado 5 ficheros con 124 adiciones y 60 borrados
  1. +13
    -0
      src/api/lookPhoto.js
  2. +11
    -3
      src/pages/index/index.vue
  3. +93
    -57
      src/pages/lookPhoto/index.vue
  4. +2
    -0
      src/pages/uploadPhoto/uploadPhoto.vue
  5. +5
    -0
      src/utils/share.js

+ 13
- 0
src/api/lookPhoto.js Ver fichero

@@ -38,3 +38,16 @@ export function getSupperPhotoStateApi(id) {
method: 'get',
})
}

/**
* @description:生成画报
* @param {appId,img}
* @return: data
*/
export function getUserQrcodeApi(data) {
return request({
url: `/api/miniApp/getUserQrcode`,
method: 'post',
data
})
}

+ 11
- 3
src/pages/index/index.vue Ver fichero

@@ -276,9 +276,17 @@ function goLookPhoto(id, status) {
}
function goCloseStyle() {
uni.navigateTo({
url: `/pages/closeStyle/closeStyle`,
});
if (!userInfoModulesPinia.myAvatar) {
uni.showToast({
title: "请先上传头像",
icon: "none",
mask: true,
});
} else {
uni.navigateTo({
url: `/pages/closeStyle/closeStyle`,
});
}
}
//#endregion


+ 93
- 57
src/pages/lookPhoto/index.vue Ver fichero

@@ -34,9 +34,13 @@
<text>邀请好友可获得2枚金币</text>
</view>
<button open-type="share" class="shareBtn">分享</button>
<view class="shareBtn" @click="inviteFriend">邀请好友</view>
<view class="shareBtn" @click="getUserQrcode">邀请好友</view>
<view class="shareBtn" @click="buyCoin">金币充值</view>
</view>
<!-- 画报 -->
<view v-if="showPictorial" class="pictorialBox">
<image :src="pictorialUrl" mode="scaleToFill" />
</view>
</view>
</template>
@@ -50,6 +54,7 @@ import {
getPhotoListApi,
photoSupperApi,
getSupperPhotoStateApi,
getUserQrcodeApi,
} from "../../api/lookPhoto.js";
//#endregion
const userInfoModulesPinia = userInfoModules();
@@ -159,34 +164,34 @@ function previewImage(index) {
//#endregion ---------------------
//#region 分享
onShareAppMessage((res) => {
// 分享事件来源:button(页面内分享按钮)、menu(右上角分享按钮)
if (res.from === "button") {
// 来自页面内分享按钮
return {
//分享标题
title: "智像",
//页面 path
path: `/pages/login/index`,
// 分享图标
// imageUr: shopDetailsData.value?.GoodsCoverImg,
success: function () {
// 转发成功
console.log("res", res);
},
fail: function () {
// 转发失败
console.log("res", res);
},
};
} else {
return {
title: "智像",
path: "/pages/login/index",
// imageUr: shopDetailsData.value?.GoodsCoverImg,
};
}
});
// onShareAppMessage((res) => {
// // 分享事件来源:button(页面内分享按钮)、menu(右上角分享按钮)
// if (res.from === "button") {
// // 来自页面内分享按钮
// return {
// //分享标题
// title: "智像",
// //页面 path
// path: `/pages/login/index`,
// // 分享图标
// // imageUr: shopDetailsData.value?.GoodsCoverImg,
// success: function () {
// // 转发成功
// console.log("res", res);
// },
// fail: function () {
// // 转发失败
// console.log("res", res);
// },
// };
// } else {
// return {
// title: "智像",
// path: "/pages/login/index",
// // imageUr: shopDetailsData.value?.GoodsCoverImg,
// };
// }
// });
// onShareAppMessage((res) => {
// return {
// title: "页面分享的标题",
@@ -222,34 +227,7 @@ function share() {
// },
// });
}
function inviteFriend() {
uni.showToast({
title: "敬请期待!",
icon: "none",
});
return;
uni.share({
provider: "weixin", //分享服务提供商(即weixin|qq|sinaweibo)
scene: "WXSceneSession", //WXSceneSession(分享到聊天界面)、WXSenceTimeline(分享到朋友圈)、WXSceneFavorite(分享到微信收藏)
type: 5,
title: "分享给好友",
summary: "分享描述",
href: "www.baidu.com", //分享跳转地址
imageUrl: "../static/lovehot.png", //分享图片路径(必须是线上可访问图片)
miniProgram: {
id: "gwx75cf14e3a0d45821",
path: "pages/index/index",
type: 0,
webUrl: "",
},
success: function (res) {
// console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
// console.log("fail:" + JSON.stringify(err));
},
});
}
//#endregion ---------------------
//#region 页面跳转
@@ -342,6 +320,48 @@ watch(
);
//#endregion ---------------------
//#region 生成画报
const pictorialUrl = ref("");
const showPictorial = ref(false);
async function getUserQrcode() {
try {
uni.showLoading({
title: "加载中...",
mask: true,
});
const data = {
appId: userInfoModulesPinia.getAppId(),
img: swiperList.value[swiperIndex.value].imageSuper
? swiperList.value[swiperIndex.value].imageSuper
: swiperList.value[swiperIndex.value].image,
};
const res = await getUserQrcodeApi(data);
if (res.code == 200) {
uni.arrayBufferToBase64(res.data, (base64) => {
pictorialUrl.value = "data:image/jpeg;base64," + base64; // 在前面加上正确的图片格式
});
showPictorial.value = true;
} else {
uni.showToast({
title: "画报生成失败",
icon: "none",
mask: true,
});
}
uni.hideLoading();
} catch (error) {
uni.hideLoading();
uni.showToast({
title: "画报生成失败",
icon: "none",
mask: true,
});
console.log(error);
}
}
//#endregion ---------------------
//#region
//#endregion ---------------------
@@ -467,12 +487,28 @@ watch(
text-align: center;
}
.shareBtn {
margin: 0;
color: #fff;
width: 200rpx;
height: 70rpx;
line-height: 70rpx;
text-align: center;
border-radius: 70rpx;
font-size: 26rpx;
background-color: rgba(255, 255, 255, 0.1);
}
}
.pictorialBox {
position: absolute;
width: 100%;
height: 100vh;
image {
margin-top: 80rpx;
width: 630rpx;
height: 940rpx;
border-radius: 24rpx;
}
z-index: 9;
}
</style>

+ 2
- 0
src/pages/uploadPhoto/uploadPhoto.vue Ver fichero

@@ -345,9 +345,11 @@ onLoad((options) => {
console.log(userInfoModulesPinia.openId, "获取openid");
// 获取头像和金币
const res3 = await findImageApi();
userInfoModulesPinia.myAvatar =
res3.data && res3.data.image ? res3.data.image : "";
const res4 = await findGlodApi();
uni.setStorageSync("userId", res4.data.id);
if (!res4.data) {
userInfoModulesPinia.myGlod = 0;
} else {


+ 5
- 0
src/utils/share.js Ver fichero

@@ -2,6 +2,8 @@ export default {
onShareAppMessage() {
return {
title: "邃芒智像",
path: `/pages/login/index?type=in&userId=${uni.getStorageSync('userId')}`,

};
},

@@ -9,6 +11,8 @@ export default {
onShareTimeline() {
return {
title: "邃芒智像",
path: `/pages/login/index?type=in&userId=${uni.getStorageSync('userId')}`,

};
},

@@ -16,6 +20,7 @@ export default {
onAddToFavorites() {
return {
title: "邃芒智像",

};
}
}

Cargando…
Cancelar
Guardar