diff --git a/src/manifest.json b/src/manifest.json index d2d477b3..8d3e124a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,39 +1,39 @@ { - "name" : "荷塘月色", - "appid" : "__UNI__5B53E65", - "description" : "聊天交友app", - "versionName" : "0.0.0", - "versionCode" : 1, - "transformPx" : false, - "app-plus" : { - "usingComponents" : true, - "nvueCompiler" : "uni-app", - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "nvueLaunchMode" : "fast", - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 + "name": "荷塘月色", + "appid": "__UNI__5B53E65", + "description": "聊天交友app", + "versionName": "0.0.0", + "versionCode": 1, + "transformPx": false, + "app-plus": { + "usingComponents": true, + "nvueCompiler": "uni-app", + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "nvueLaunchMode": "fast", + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 }, - "safearea" : { - "bottom" : { - "offset" : "none" + "safearea": { + "bottom": { + "offset": "none" } }, - "modules" : { - "Payment" : {}, - "Share" : {}, - "VideoPlayer" : {}, - "OAuth" : {}, - "Camera" : {}, - "Geolocation" : {}, - "FaceID" : {} + "modules": { + "Payment": {}, + "Share": {}, + "VideoPlayer": {}, + "OAuth": {}, + "Camera": {}, + "Geolocation": {}, + "FaceID": {} }, - "distribute" : { - "android" : { - "permissions" : [ + "distribute": { + "android": { + "permissions": [ "", "", "", @@ -66,184 +66,202 @@ "", "" ], - "minSdkVersion" : 21, - "schemes" : "荷塘月色", - "excludePermissions" : [ + "minSdkVersion": 21, + "schemes": "荷塘月色", + "excludePermissions": [ "" ] }, - "ios" : { - "urlschemewhitelist" : [ "baidumap", "iosamap" ], - "dSYMs" : false, - "privacyDescription" : { - "NSPhotoLibraryUsageDescription" : "需要同意访问您的相册选取图片才能完善该条目", - "NSPhotoLibraryAddUsageDescription" : "需要同意访问您的相册才能保存该图片", - "NSCameraUsageDescription" : "需要同意访问您的摄像头拍摄照片才能完善该条目", - "NSUserTrackingUsageDescription" : "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验" + "ios": { + "urlschemewhitelist": [ + "baidumap", + "iosamap" + ], + "dSYMs": false, + "privacyDescription": { + "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目", + "NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片", + "NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目", + "NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验" }, - "urltypes" : "荷塘月色", - "capabilities" : { - "entitlements" : { - "com.apple.developer.associated-domains" : [ "applinks:shopro.sheepjs.com" ] + "urltypes": "荷塘月色", + "capabilities": { + "entitlements": { + "com.apple.developer.associated-domains": [ + "applinks:shopro.sheepjs.com" + ] } }, - "idfa" : true + "idfa": true }, - "sdkConfigs" : { - "speech" : {}, - "ad" : {}, - "oauth" : {}, - "payment" : { - "weixin" : { - "__platform__" : [ "ios", "android" ], - "appid" : "wx2b4e4d3feff8267f", - "UniversalLinks" : "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" + "sdkConfigs": { + "speech": {}, + "ad": {}, + "oauth": {}, + "payment": { + "weixin": { + "__platform__": [ + "ios", + "android" + ], + "appid": "wx2b4e4d3feff8267f", + "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" }, - "alipay" : { - "__platform__" : [ "ios", "android" ] + "alipay": { + "__platform__": [ + "ios", + "android" + ] } }, - "share" : { - "weixin" : { - "appid" : "wx2b4e4d3feff8267f", - "UniversalLinks" : "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" + "share": { + "weixin": { + "appid": "wx2b4e4d3feff8267f", + "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/" } }, - "maps" : {}, - "geolocation" : { - "system" : { - "__platform__" : [ "ios", "android" ] + "maps": {}, + "geolocation": { + "system": { + "__platform__": [ + "ios", + "android" + ] } } }, - "orientation" : [ "portrait-primary" ], - "splashscreen" : { - "androidStyle" : "default", - "iosStyle" : "common", - "useOriginalMsgbox" : true, - "android" : { - "hdpi" : "unpackage/res/icons/1024x1024.png", - "xhdpi" : "unpackage/res/icons/1024x1024.png", - "xxhdpi" : "unpackage/res/icons/1024x1024.png" + "orientation": [ + "portrait-primary" + ], + "splashscreen": { + "androidStyle": "default", + "iosStyle": "common", + "useOriginalMsgbox": true, + "android": { + "hdpi": "unpackage/res/icons/1024x1024.png", + "xhdpi": "unpackage/res/icons/1024x1024.png", + "xxhdpi": "unpackage/res/icons/1024x1024.png" } }, - "icons" : { - "android" : { - "hdpi" : "unpackage/res/icons/72x72.png", - "xhdpi" : "unpackage/res/icons/96x96.png", - "xxhdpi" : "unpackage/res/icons/144x144.png", - "xxxhdpi" : "unpackage/res/icons/192x192.png" + "icons": { + "android": { + "hdpi": "unpackage/res/icons/72x72.png", + "xhdpi": "unpackage/res/icons/96x96.png", + "xxhdpi": "unpackage/res/icons/144x144.png", + "xxxhdpi": "unpackage/res/icons/192x192.png" }, - "ios" : { - "appstore" : "unpackage/res/icons/1024x1024.png", - "ipad" : { - "app" : "unpackage/res/icons/76x76.png", - "app@2x" : "unpackage/res/icons/152x152.png", - "notification" : "unpackage/res/icons/20x20.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "proapp@2x" : "unpackage/res/icons/167x167.png", - "settings" : "unpackage/res/icons/29x29.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "spotlight" : "unpackage/res/icons/40x40.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png" + "ios": { + "appstore": "unpackage/res/icons/1024x1024.png", + "ipad": { + "app": "unpackage/res/icons/76x76.png", + "app@2x": "unpackage/res/icons/152x152.png", + "notification": "unpackage/res/icons/20x20.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "proapp@2x": "unpackage/res/icons/167x167.png", + "settings": "unpackage/res/icons/29x29.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "spotlight": "unpackage/res/icons/40x40.png", + "spotlight@2x": "unpackage/res/icons/80x80.png" }, - "iphone" : { - "app@2x" : "unpackage/res/icons/120x120.png", - "app@3x" : "unpackage/res/icons/180x180.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "notification@3x" : "unpackage/res/icons/60x60.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "settings@3x" : "unpackage/res/icons/87x87.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png", - "spotlight@3x" : "unpackage/res/icons/120x120.png" + "iphone": { + "app@2x": "unpackage/res/icons/120x120.png", + "app@3x": "unpackage/res/icons/180x180.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "notification@3x": "unpackage/res/icons/60x60.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "settings@3x": "unpackage/res/icons/87x87.png", + "spotlight@2x": "unpackage/res/icons/80x80.png", + "spotlight@3x": "unpackage/res/icons/120x120.png" } } } }, - "nativePlugins" : { - "AP-FaceDetectModule" : { - "__plugin_info__" : { - "name" : "AP-FaceDetectModule", - "description" : "阿里云金融级实人认证SDK", - "platforms" : "Android,iOS", - "url" : "", - "android_package_name" : "", - "ios_bundle_id" : "", - "isCloud" : false, - "bought" : -1, - "pid" : "", - "parameters" : {} + "nativePlugins": { + "AP-FaceDetectModule": { + "__plugin_info__": { + "name": "AP-FaceDetectModule", + "description": "阿里云金融级实人认证SDK", + "platforms": "Android,iOS", + "url": "", + "android_package_name": "", + "ios_bundle_id": "", + "isCloud": false, + "bought": -1, + "pid": "", + "parameters": {} } } } }, - "quickapp" : {}, - "quickapp-native" : { - "icon" : "/static/logo.png", - "package" : "com.example.demo", - "features" : [ + "quickapp": {}, + "quickapp-native": { + "icon": "/static/logo.png", + "package": "com.example.demo", + "features": [ { - "name" : "system.clipboard" + "name": "system.clipboard" } ] }, - "quickapp-webview" : { - "icon" : "/static/logo.png", - "package" : "com.example.demo", - "minPlatformVersion" : 1070, - "versionName" : "1.0.0", - "versionCode" : 100 + "quickapp-webview": { + "icon": "/static/logo.png", + "package": "com.example.demo", + "minPlatformVersion": 1070, + "versionName": "1.0.0", + "versionCode": 100 }, - "mp-weixin" : { - "appid" : "wx66186af0759f47c9", - "setting" : { - "urlCheck" : false, - "minified" : true, - "postcss" : true + "mp-weixin": { + "appid": "wx2b4e4d3feff8267f", + "setting": { + "urlCheck": false, + "minified": true, + "postcss": true }, - "optimization" : { - "subPackages" : true + "optimization": { + "subPackages": true }, - "plugins" : {}, - "lazyCodeLoading" : "requiredComponents", - "usingComponents" : {}, - "permission" : {}, - "requiredPrivateInfos" : [ "chooseAddress" ] + "plugins": {}, + "lazyCodeLoading": "requiredComponents", + "usingComponents": {}, + "permission": {}, + "requiredPrivateInfos": [ + "chooseAddress" + ] }, - "mp-alipay" : { - "usingComponents" : true + "mp-alipay": { + "usingComponents": true }, - "mp-baidu" : { - "usingComponents" : true + "mp-baidu": { + "usingComponents": true }, - "mp-toutiao" : { - "usingComponents" : true + "mp-toutiao": { + "usingComponents": true }, - "mp-jd" : { - "usingComponents" : true + "mp-jd": { + "usingComponents": true }, - "h5" : { - "darkmode" : true, - "template" : "index.html", - "router" : { - "mode" : "history", - "base" : "/" + "h5": { + "darkmode": true, + "template": "index.html", + "router": { + "mode": "history", + "base": "/" }, - "sdkConfigs" : { - "maps" : {} + "sdkConfigs": { + "maps": {} }, - "async" : { - "timeout" : 20000 + "async": { + "timeout": 20000 }, - "title" : "聊天交友", - "optimization" : { - "treeShaking" : { - "enable" : true + "title": "聊天交友", + "optimization": { + "treeShaking": { + "enable": true } } }, - "vueVersion" : "3", - "_spaceID" : "192b4892-5452-4e1d-9f09-eee1ece40639", - "locale" : "zh-Hans", - "fallbackLocale" : "zh-Hans" -} + "vueVersion": "3", + "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", + "locale": "zh-Hans", + "fallbackLocale": "zh-Hans" +} \ No newline at end of file diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index cde566ae..ec16cadc 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -43,18 +43,34 @@ - + + + + 我已阅读并同意 + + 《用户协议》 + + 和 + + 《隐私政策》 + + 并同意授权 + + diff --git a/src/pages/profile/apply-vip.vue b/src/pages/profile/apply-vip.vue index 4d5d4e6f..5a9fb34f 100644 --- a/src/pages/profile/apply-vip.vue +++ b/src/pages/profile/apply-vip.vue @@ -200,6 +200,9 @@ const handleOpenVip = () => { uni.showToast({ title: `不支持${payMethodItem.title}支付`, icon: 'none' }); return } + + jumpToWechatPage() + return messageBox .confirm({ msg: '确认开通?', @@ -238,8 +241,8 @@ const disposeWechatPay = async (openTypeId: any) => { } // 跳转到微信小程序 -const jumpToWechatPage = () => { - jumpToWechatMiniProgram("openVip", { +const jumpToWechatPage = async () => { + await jumpToWechatMiniProgram("openVip", { openTypeId: curOpenTypeId.value, payMethod: payMethod.value }) diff --git a/src/pages/profile/recharge.vue b/src/pages/profile/recharge.vue index 3156ac3a..14e7334f 100644 --- a/src/pages/profile/recharge.vue +++ b/src/pages/profile/recharge.vue @@ -181,7 +181,7 @@ // 跳转到微信小程序 const jumpToWechatPage = async (packageId : any) => { console.log("跳转到微信小程序"); - await jumpToWechatMiniProgram('recharge', { + jumpToWechatMiniProgram('recharge', { packageId, payMethod: payMethod.value, }); diff --git a/src/pages/profile/setting.vue b/src/pages/profile/setting.vue index d39ebeea..13abd8de 100644 --- a/src/pages/profile/setting.vue +++ b/src/pages/profile/setting.vue @@ -12,7 +12,7 @@ - + @@ -97,6 +97,15 @@ const beforeChange = ({ value, resolve }: any) => { resolve(true); }; +const copyEmail = (email: string) => { + uni.setClipboardData({ + data: email, + success: () => { + uni.showToast({ title: '复制成功', icon: 'none', }); + }, + }); +} + // 退出登录 const handleLogout = () => { message diff --git a/src/pages/tabbar/profile.vue b/src/pages/tabbar/profile.vue index 79fa9fa4..db4fa09a 100644 --- a/src/pages/tabbar/profile.vue +++ b/src/pages/tabbar/profile.vue @@ -15,11 +15,8 @@ - + {{ userInfo.nickname }} @@ -27,18 +24,13 @@ ID: {{ userInfo.id }} - + VIP - + {{ userCity?.t || '' }} @@ -59,11 +51,7 @@ 喜欢我 - + {{ fen2yuanSimple(userWallet.balance) }} @@ -76,17 +64,12 @@ + class="text-color-theme-dark mx-4 p-4 rounded-2 bg-gradient-to-b from-#111 to-#222 b-4 b-solid b-t-#D29E52/60 b-l-#D29E52/40 b-r-#D29E52/40 b-b-#D29E52/20 flex justify-between"> VIP 尊享vip免费特权 - + 立即开通 @@ -110,11 +93,7 @@ 邀请福利 邀请用户领会员 - + 查看福利 @@ -123,29 +102,14 @@ - + - + 我的评价 @@ -176,111 +140,106 @@ - + close-position="top-right" :width="300" close-on-click-modal show-menu-by-longpress /> diff --git a/src/pages/wechat-tabbar/index.vue b/src/pages/wechat-tabbar/index.vue index 686387fb..10f4ee62 100644 --- a/src/pages/wechat-tabbar/index.vue +++ b/src/pages/wechat-tabbar/index.vue @@ -13,7 +13,7 @@ - + {{ userInfo.nickname }} ID: {{ userInfo.id }} @@ -21,10 +21,15 @@ - 退出登录 + + 立即登录 + @@ -36,7 +41,8 @@ - + 立即提现 @@ -64,7 +70,7 @@ - + 我的邀请海报 @@ -82,6 +88,7 @@ + @@ -93,9 +100,18 @@ import sheep from '@/sheep'; import { fen2yuan } from '@/sheep/hooks/useGoods'; import BrokerageApi from '@/sheep/api/trade/brokerage'; import TradeConfigApi from '@/sheep/api/trade/config.js'; -import SocialApi from '@/sheep/api/member/social'; +import { useMessage } from '@/uni_modules/wot-design-uni'; -const userInfo = computed(() => sheep.$store('user').userInfo); +const message = useMessage(); + +const userInfo = computed(() => sheep.$store('user')?.userInfo ?? null); +const isLogin = computed(() => sheep.$store('user').isLogin && state.loginInfoStorage != null); +const userGenderImageSrc = computed(() => { + const sex = userInfo.value.sex; + if (sex === 1) return '/static/gender-man.png'; + if (sex === 2) return '/static/gender-woman.png'; + return ''; +}); const data = { menuTab: [ @@ -155,12 +171,16 @@ const state = reactive({ summary: {}, posterPic: '', posterUrl: '', + loginInfoStorage: "", }); onShow(async () => { - await getTradeConfig() - await getBrokerageUserSummary() - getMiniProgramPoster() + state.loginInfoStorage = uni.getStorageSync('loginInfo') ?? null + if (isLogin.value) { + await getTradeConfig() + await getBrokerageUserSummary() + getMiniProgramPoster() + } }); // 获取分销配置 @@ -248,7 +268,53 @@ const savePoster = () => { }); }; +const doLogin = () => { + sheep.$store('user').logout(); + uni.reLaunch({ url: '/pages/login/login' }); +} + +const doLogout = () => { + message + .confirm({ + msg: '', + title: '确定退出登录吗?', + }) + .then(() => { + sheep.$store('user').logout(); + uni.reLaunch({ url: '/pages/login/login' }); + }) + .catch(() => { }); +} + +const doTx = () => { + if (!isLogin.value) { + authDialog() + return; + } +} + +const authDialog = () => { + message + .confirm({ + msg: '', + title: '该功能需要登录,请先登录', + confirmButtonText: '请先登录', + cancelButtonText: '取消', + }) + .then(() => { + sheep.$store('user').logout(); + uni.reLaunch({ url: '/pages/login/login' }); + }) + .catch(() => { + + }); +} + const doTxItem = (item) => { + if (!isLogin.value) { + authDialog() + return; + } if (item.path) { uni.navigateTo({ url: item.path, @@ -257,6 +323,10 @@ const doTxItem = (item) => { }; const doItem = (item) => { + if (!isLogin.value) { + authDialog() + return; + } if (item.path) { uni.navigateTo({ url: item.path, diff --git a/src/pages/wechat-tabbar/me.vue b/src/pages/wechat-tabbar/me.vue index 72c935a2..16ae5616 100644 --- a/src/pages/wechat-tabbar/me.vue +++ b/src/pages/wechat-tabbar/me.vue @@ -1,8 +1,75 @@ \ No newline at end of file diff --git a/src/sheep/api/member/social.js b/src/sheep/api/member/social.js index 14e6edfa..f852a4f7 100644 --- a/src/sheep/api/member/social.js +++ b/src/sheep/api/member/social.js @@ -71,6 +71,14 @@ const SocialApi = { }, }); }, + // 获取微信小程短链 + getWxaQrcode: async (params) => { + return await request({ + url: '/member/social-user/wxa-url-scheme', + method: 'GET', + params, + }); + }, }; export default SocialApi; \ No newline at end of file diff --git a/src/sheep/store/app.js b/src/sheep/store/app.js index f403fa2e..57e01aaf 100644 --- a/src/sheep/store/app.js +++ b/src/sheep/store/app.js @@ -151,8 +151,8 @@ const adaptTenant = async () => { // #ifdef MP const appId = uni.getAccountInfoSync()?.miniProgram?.appId; if (appId) { - const { data } = await getTenantByWebsite(appId); - newTenantId = data?.id; + // const { data } = await getTenantByWebsite(appId); + // newTenantId = data?.id; } // #endif @@ -176,7 +176,7 @@ const adaptTenant = async () => { const adaptTemplate = async (appTemplate, templateId) => { const { data: diyTemplate } = templateId ? // 查询指定模板,一般是预览时使用 - await DiyApi.getDiyTemplate(templateId) + await DiyApi.getDiyTemplate(templateId) : await DiyApi.getUsedDiyTemplate(); // 模板不存在 if (!diyTemplate) { diff --git a/src/sheep/store/user.js b/src/sheep/store/user.js index 5e06b163..ecd80e05 100644 --- a/src/sheep/store/user.js +++ b/src/sheep/store/user.js @@ -127,6 +127,8 @@ const user = defineStore({ this.userInfo = clone(defaultUserInfo); this.userWallet = clone(defaultUserWallet); this.numData = cloneDeep(defaultNumData); + // 清空聊天相关 + uni.removeStorageSync('loginInfo'); // 清空购物车的缓存 cart().emptyList(); }, diff --git a/src/sheep/util/wechat-tool.ts b/src/sheep/util/wechat-tool.ts index 8ac3aefd..068e2b2d 100644 --- a/src/sheep/util/wechat-tool.ts +++ b/src/sheep/util/wechat-tool.ts @@ -1,20 +1,10 @@ // @ts-nocheck import { isEmpty } from 'lodash-es'; +import SocialApi from '@/sheep/api/member/social'; const targetAppId = 'wx2b4e4d3feff8267f'; -const paramsToQuery = (params: Record) => { - if (isEmpty(params)) { - return ''; - } - let query = []; - for (let key in params) { - query.push(key + '=' + params[key]); - } - return query.join('&'); -} - -export const jumpToWechatMiniProgram = ( +export const jumpToWechatMiniProgram = async ( action: 'recharge' | 'openVip', params: Record, ) => { @@ -25,27 +15,14 @@ export const jumpToWechatMiniProgram = ( if (action === 'openVip') { path = 'pages/profile/apply-vip'; } - console.log("weixinShare:", weixinShare) - plus.share.getServices((data) => { - let sweixin = null; - data.forEach(item => { - if (item.id === "weixin") { - sweixin = item - } - }) - console.log("sweixin:", sweixin) - if (!sweixin) { - uni.showToast({ - title: "请安装微信", - icon: "none", - }); - return - } - sweixin.launchMiniProgram({ - id: targetAppId, + try { + // 获取小程序短链 + const { code, data } = await SocialApi.getWxaQrcode({ path: path, - // 可取值:0-正式版; 1-测试版; 2-体验版。默认值为0。 - type: 1, - }); - }) + json: JSON.stringify(params) + }) + console.log("|获取小程序短链|成功code:", code, "data:", data); + } catch (error) { + console.log("|获取小程序短链|意外的错误error:", error); + } } \ No newline at end of file