Commit b176212b authored by Smile's avatar Smile Committed by wux

app站内信修改支持多语言

parent b869a85c
...@@ -27,6 +27,8 @@ const languageData = { ...@@ -27,6 +27,8 @@ const languageData = {
coverImage: 'coverImageZh', coverImage: 'coverImageZh',
activityDesc: 'activityDescZh', activityDesc: 'activityDescZh',
startAddress: 'startAddressZh', startAddress: 'startAddressZh',
msgTitle:'title',
msgContent:'content',
}, },
'en': { 'en': {
label: 'labelEn', label: 'labelEn',
...@@ -45,6 +47,8 @@ const languageData = { ...@@ -45,6 +47,8 @@ const languageData = {
coverImage: 'coverImageEn', coverImage: 'coverImageEn',
activityDesc: 'activityDescEn', activityDesc: 'activityDescEn',
startAddress: 'startAddressEn', startAddress: 'startAddressEn',
msgTitle:'titleEn',
msgContent:'contentEn',
}, },
'fr': { 'fr': {
label: 'labelFr', label: 'labelFr',
...@@ -63,6 +67,8 @@ const languageData = { ...@@ -63,6 +67,8 @@ const languageData = {
coverImage: 'coverImageFr', coverImage: 'coverImageFr',
activityDesc: 'activityDescFr', activityDesc: 'activityDescFr',
startAddress: 'startAddressFr', startAddress: 'startAddressFr',
msgTitle:'titleFr',
msgContent:'contentFr',
} }
}; };
...@@ -89,6 +95,8 @@ function getLanguageData(local = 'zh') { ...@@ -89,6 +95,8 @@ function getLanguageData(local = 'zh') {
coverImage: languageData[local].coverImage, coverImage: languageData[local].coverImage,
activityDesc: languageData[local].activityDesc, activityDesc: languageData[local].activityDesc,
startAddress: languageData[local].startAddress, startAddress: languageData[local].startAddress,
msgTitle: languageData[local].msgTitle,
msgContent: languageData[local].msgContent,
}; };
} }
...@@ -97,7 +105,6 @@ export default { ...@@ -97,7 +105,6 @@ export default {
locale: uni.getStorageSync('locale') || 'zh', locale: uni.getStorageSync('locale') || 'zh',
...getLanguageData(uni.getStorageSync('locale') || 'zh'), ...getLanguageData(uni.getStorageSync('locale') || 'zh'),
setLang(msg) { setLang(msg) {
debugger
this.lang = languages[msg] || languages['zh']; // 默认返回中文语言包 this.lang = languages[msg] || languages['zh']; // 默认返回中文语言包
this.locale = msg this.locale = msg
}, },
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class="notice-list-top"> <view class="notice-list-top">
<image v-if="item.status == 1" src="../../static/img/notice-1.png" mode=""></image> <image v-if="item.status == 1" src="../../static/img/notice-1.png" mode=""></image>
<image v-else src="../../static/img/notice-2.png" mode=""></image> <image v-else src="../../static/img/notice-2.png" mode=""></image>
<view class="">{{item.title}}</view> <view class="">{{item[$lang.msgTitle]}}</view>
</view> </view>
<view class="times"> <view class="times">
<image src="../../static/img/time.png" mode=""></image> <image src="../../static/img/time.png" mode=""></image>
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
<view class="start-bar"></view> <view class="start-bar"></view>
<view class="notice_info"> <view class="notice_info">
<view class="notice_title"> <view class="notice_title">
<text>{{noticeData.title}}</text> <text>{{noticeData[$lang.msgTitle]}}</text>
</view> </view>
<view class="notice_tag"> <view class="notice_tag">
<text>{{getDate(noticeData.createTime)}}</text> <text>{{getDate(noticeData.createTime)}}</text>
</view> </view>
<view class="notice_content"> <view class="notice_content">
<rich-text :nodes="noticeData.content"></rich-text> <rich-text :nodes="noticeData[$lang.msgContent]"></rich-text>
</view> </view>
</view> </view>
</view> </view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment