1. 弹窗点击对应操作 --- 已完成

This commit is contained in:
hejin 2025-09-07 23:38:09 +08:00
parent bb0aeef750
commit c33268d851
10 changed files with 139 additions and 26 deletions

View File

@ -7,13 +7,15 @@
</script>
<script setup>
import { onLaunch } from "@dcloudio/uni-app";
import { onLaunch, onShow } from "@dcloudio/uni-app";
import { ref } from "vue";
import { useIndex } from '@/stores/index.js'
onShow(() => {
useIndex().getAppInfo()
})
onLaunch( async(e) => {
useIndex().menuInit()
useIndex().getAppInfo()
})
</script>
<style lang="scss">

View File

@ -27,6 +27,7 @@
:inputBorder="false"
:clearable="false"
:adjust-position="false"
:disabled="isInputDisabled"
:focus="inputFocus"
v-model="sendVal"
trim="both"
@ -50,7 +51,7 @@
<script setup>
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { ref, nextTick } from 'vue';
import { ref, nextTick, computed } from 'vue';
import dayJs from 'dayjs';
import { useI18n } from 'vue-i18n';
import { useScoketMsg } from '@/stores/index.js';
@ -63,6 +64,15 @@
const { t } = useI18n()
const isInputDisabled = computed(() => {
let lastMessage = {}
let list = useScoketMsg().msgList
if (list.length) {
lastMessage = list[list.length - 1];
}
return lastMessage.type && lastMessage.type === 3
})
const inputFocus = ref(true)
const sendVal = ref('')
const send = async () => {

View File

@ -1,18 +1,21 @@
<template>
<view class="pages">
<view
class="prod-item"
v-for="item in list"
:key="item.id"
@click="goDetails(item)"
>
<view class="cover">
<image :src="item.mainPic"></image>
</view>
<view class="title text-ellipsis">
{{item.title}}
</view>
</view>
<template v-if="list.length">
<view
class="prod-item"
v-for="item in list"
:key="item.id"
@click="goDetails(item)"
>
<view class="cover">
<image :src="item.mainPic"></image>
</view>
<view class="title text-ellipsis">
{{item.title}}
</view>
</view>
</template>
<Empty v-else />
</view>
</template>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

28
src/components/empty.vue Normal file
View File

@ -0,0 +1,28 @@
<template>
<view class="empty-box">
<image src="@/assets/images/icon/empty.png" mode="widthFix"></image>
<view>
{{$t('common.empty')}}
</view>
</view>
</template>
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
</script>
<style lang="scss" scoped>
.empty-box {
width: 100%;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
image {
width: 20%;
}
}
</style>

View File

@ -5,7 +5,7 @@
{{$t('common.Quickcontact')}}
</view>
<view class="contact-box">
<view class="desc-item">
<view class="desc-item" @click="makePhone">
<image class="icon" src="@/assets/images/icon/phone2.png"></image>
<view class="desc">
<label>{{ $t('contactUs.contactUs') }}</label>
@ -17,15 +17,23 @@
<image class="icon" src="@/assets/images/icon/mail2.png"></image>
<view class="desc">
<label>{{ $t('common.E-mail') }}</label>
<view>{{useIndex().appInfo.email}}</view>
<view>
<uni-link
:href="`mailto:${useIndex().appInfo.email}`"
:text="useIndex().appInfo.email"
color="#393c43"
:showUnderLine="false"
>
</uni-link>
</view>
</view>
</view>
<view class="desc-item no-center">
<view class="desc-item no-center" @click="openWhatsApp">
<image class="icon" src="@/assets/images/icon/online.png"></image>
<view class="desc">
<label>{{ $t('common.Online') }}</label>
<view>{{useIndex().appInfo.tel}}</view>
<view>{{useIndex().appInfo.whatsapp}}</view>
</view>
</view>
</view>
@ -40,16 +48,67 @@
<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useIndex } from '@/stores/index.js';
const { t } = useI18n()
const emits = defineEmits(['close'])
const makePhone = () => {
uni.makePhoneCall({
phoneNumber: useIndex().appInfo.tel,
fail: (err) => {
console.log(err)
uni.setClipboardData({
data: useIndex().appInfo.tel,
})
}
})
}
const openWhatsApp = () => {
const installed = plus.runtime.isApplicationExist({
pname: "com.whatsapp",
action: "whatsapp://"
});
const whatsappUrl = `whatsapp://send?phone=${useIndex().appInfo.whatsapp}`;
const pname = "com.whatsapp";
if (installed) {
//
plus.runtime.openURL(whatsappUrl);
} else {
// whatsapp
plus.nativeUI.actionSheet(
{
title: t('common.selectApp'),
cancel: t('common.cancel'),
buttons: [{ title: t('common.AppMarket') }],
},
function ({ index }) {
switch (index) {
case 1:
plus.runtime.openURL(
"market://details?id=" + pname,
function () {
//
plus.nativeUI.alert(t('common.noApp'));
}
);
}
}
);
}
}
const goOnline = () => {
emits('close')
uni.switchTab({
url: '/pages/inquiry/index'
})
}
</script>
<style lang="scss" scoped>

View File

@ -57,7 +57,10 @@
"confirm": "confirm",
"cancel": "cancel",
"KindReminder": "KindReminder",
"Loading": "Loading"
"Loading": "Loading",
"selectApp": "Select App",
"AppMarket": "App Market",
"noApp": "The specified application is not installed on this machine"
},
"menu": {
"Home": "Home",

View File

@ -57,7 +57,10 @@
"confirm": "确认",
"cancel": "取消",
"KindReminder": "温馨提示",
"Loading": "加载中"
"Loading": "加载中",
"selectApp": "选择应用",
"AppMarket": "应用市场",
"noApp": "本机未安装指定的应用"
},
"menu": {
"Home": "首页",

View File

@ -10,6 +10,7 @@ import Tabs from "@/components/tabs.vue";
import SuspensionBtn from "@/components/suspension-btn.vue";
import OnlineModal from "@/components/online-modal.vue";
import Apps from "@/components/apps.vue";
import Empty from "@/components/empty.vue";
uni.$showTost = function (title='加载失败!',duration=1500,mask=false) {
// 变成异步代码,处理一些特殊页面 必须等待消息提示结束后在做操作
@ -47,6 +48,7 @@ export function createApp() {
app.component('SuspensionBtn', SuspensionBtn)
app.component('OnlineModal', OnlineModal)
app.component('Apps', Apps)
app.component('Empty', Empty)
return {
app,

View File

@ -2,8 +2,8 @@
"name" : "HOWO",
"appid" : "__UNI__DADC1D2",
"description" : "Sinotruck Howo Sales Co.,Ltd is one of the most professional trailer, truck, trailer parts, truck parts manufacturers in China. Our factory brings here a great selection of truck for sale. Welcome to consult price with us.",
"versionName" : "1.0.1",
"versionCode" : 101,
"versionName" : "1.0.4",
"versionCode" : 104,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -20,7 +20,9 @@
"ignoreVersion" : true
},
/* */
"modules" : {},
"modules" : {
"Contacts" : {}
},
/* */
"distribute" : {
/* android */
@ -40,7 +42,8 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>"
]
},
/* ios */