瀏覽代碼

多语言支持上传

chenting 3 周之前
父節點
當前提交
dd1e3744e4
共有 11 個文件被更改,包括 384 次插入3 次删除
  1. 15 0
      locale/en.json
  2. 6 0
      locale/index.js
  3. 15 0
      locale/zh-Hans.json
  4. 12 3
      main.js
  5. 7 0
      pages.json
  6. 120 0
      pages/my/M_purchase.scss
  7. 209 0
      pages/my/M_purchase.vue
  8. 二進制
      static/me/icon_alipay.png
  9. 二進制
      static/me/icon_select.png
  10. 二進制
      static/me/icon_unsel.png
  11. 二進制
      static/me/icon_wechat.png

+ 15 - 0
locale/en.json

@@ -0,0 +1,15 @@
+{
+  "locale.auto": "System",
+  "locale.en": "English",
+  "locale.zh-hans": "简体中文",
+
+	"txt.M币充值":"M Coin",
+	"txt.币":"",
+	"txt.¥":"$",
+	"txt.支付方式":"Payment",
+	"txt.立即支付":"Pay",
+	"txt.微信支付":"Wechat Pay",
+	"txt.支付宝支付":"Alipay",
+	"txt.点击支付即代表同意":"Clicking on payment means agreement",
+	"txt.M币充值协议":"M Coin Recharge Agreement"
+}

+ 6 - 0
locale/index.js

@@ -0,0 +1,6 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+export default {
+	en,
+	'zh-Hans': zhHans,
+}

+ 15 - 0
locale/zh-Hans.json

@@ -0,0 +1,15 @@
+{
+	"locale.auto": "系统",
+	"locale.en": "English",
+	"locale.zh-hans": "简体中文",
+	
+	"txt.M币充值":"M币充值",
+	"txt.币":"币",
+	"txt.¥":"¥",
+	"txt.支付方式":"支付方式",
+	"txt.立即支付":"立即支付",
+	"txt.微信支付":"微信支付",
+	"txt.支付宝支付":"支付宝支付",
+	"txt.点击支付即代表同意":"点击支付即代表同意",
+	"txt.M币充值协议":"《M币充值协议》"
+}

+ 12 - 3
main.js

@@ -1,9 +1,17 @@
 import Vue from 'vue';
 import App from './App';
 // 弹出框
-import pubc from '@/common/public.js'
-
+import pubc from '@/common/public.js'
+// 多语言本地化
+import VueI18n from 'vue-i18n'
+import messages from './locale/index'
 
+let i18nConfig = {
+  locale: uni.getLocale(),
+  messages
+}
+Vue.use(VueI18n)
+const i18n = new VueI18n(i18nConfig)
 Vue.config.productionTip = false
 
  Vue.prototype.$apiHost = 'https://gs.duoxiaoduoxue.cn/Gapi';  //审核包
@@ -20,7 +28,8 @@ Vue.prototype.isArray = Array.isArray || function (obj) {
 
 App.mpType = 'app'
 
-const app = new Vue({
+const app = new Vue({
+	i18n,
     ...App
 })
 app.$mount()

+ 7 - 0
pages.json

@@ -91,6 +91,13 @@
 				"navigationBarTitleText": "我的M币",
 				"navigationBarBackgroundColor": "#161616"
 			}
+		},
+		{
+			"path": "pages/my/M_purchase",
+			"style": {
+				"navigationBarTitleText": "txt.M币充值",
+				"navigationBarBackgroundColor": "#161616"
+			}
 		}
 
 	],

+ 120 - 0
pages/my/M_purchase.scss

@@ -0,0 +1,120 @@
+
+page {
+	background-color: #161616;
+}
+.page {
+	background-color: #161616;
+}
+.topbg {
+}
+.topBody {
+	width:750rpx;
+}
+.header {
+	display: flex;flex-direction: row;justify-content: space-between;align-items: center;color:$title;
+
+	.title {
+		font-size: 34rpx;
+	}
+}
+.thread {
+	height:210rpx;
+	padding:50rpx;font-size: 52rpx;color:#6E6A6A;padding-top: 80rpx;
+}
+.myinfo {
+	width: 720rpx;display:flex;flex-direction: column;margin:0rpx 30rpx 60rpx;justify-content: flex-start;
+	
+	.purchaseList {
+		display: flex;flex-direction: row;justify-content: center;align-items: center;
+		flex-wrap: wrap;
+
+		.item {
+			display: flex;justify-content: center;flex-direction: column;
+			border-radius: 28rpx 28rpx 28rpx 28rpx;
+			border: 2rpx solid #28292D;
+			width:214rpx;height:162rpx;
+			margin-right:24rpx;
+			margin-bottom:24rpx;
+			.num1 {
+				text-align: center;display: flex;flex-direction: column;justify-content: center;align-items: center;
+				.name {
+					font-size: 36rpx;color:#FFFFFF;margin-top: 12rpx;
+				}
+			}
+			.num2 {
+				text-align: center;display: flex;flex-direction: column;justify-content: center;align-items: center;
+				.name {
+					font-size: 28rpx;color:#999999;margin-top: 12rpx;
+				}
+			}
+		
+		}
+		.itemSel{
+			background: #321A23;
+			border-radius: 28rpx 28rpx 28rpx 28rpx;
+			border: 4rpx solid #FF3B85;
+			.num1 {
+				.name {
+					color:#FF3B85;
+				}
+			}
+			.num2{
+				.name {
+					color:#FFFFFF;
+				}
+			}
+		}
+			
+	}
+	.mingxiList {
+		display: flex;flex-direction: row;justify-content: space-between;align-items: center;
+		position: relative;
+		.left {
+			display: flex;flex-direction: row;justify-content: flex-start;align-items: center;
+			padding-left:10rpx;
+			padding-top: 20rpx;
+			.icon{
+				padding-left:5rpx;
+				width: 48rpx;
+			}
+			width: 750rpx;
+			height: 112rpx;
+			background: rgba(22,22,22,0);
+			border-radius: 0rpx 0rpx 0rpx 0rpx;
+		}
+		.right{
+			display: flex;flex-direction: row;justify-content: flex-start;align-items: center;
+			padding-right:40rpx;
+			padding-top: 20rpx;
+			.icon{
+				padding-left:5rpx;
+				height: 32rpx;
+			}
+		}
+	
+	}
+	.line{
+		width: 690rpx;
+		height: 2rpx;
+		margin-top: 20rpx;
+		background: #393939;
+		border-radius: 0rpx 0rpx 0rpx 0rpx;
+	}
+	
+	.btn_submit {
+		width: 660rpx;height: 96rpx;position: fixed;bottom:150rpx;left:45rpx;
+		background: linear-gradient( 142deg, #FF5967 0%, #FF2A95 100%);
+		border-radius: 28rpx;font-weight: bold;font-size: 32rpx;color: #FFFFFF;
+		display: flex;flex-direction: row;justify-content: center;align-items: center;
+	}
+	.bottom{
+		width: 660rpx;height: 96rpx;position: fixed;bottom:50rpx;left:45rpx;
+		display: flex;flex-direction: row;justify-content: center;align-items: center;
+	}
+	
+
+	
+}
+.blankHeight {
+	height:100rpx;
+}

+ 209 - 0
pages/my/M_purchase.vue

@@ -0,0 +1,209 @@
+<template>
+	<view class="page">
+		<view class="topBody">
+			<view class="header">
+			</view>
+			<view class="myinfo">
+				<view class="line"></view>
+				
+				<view class="purchaseList" style="margin-top: 60rpx;">
+					<view class="item" :class ="index==sel?'itemSel':''" v-for="(item,index) in purchList">
+						<view class="num1">
+							<view class="name">{{ item.value }}M{{$t('txt.币')}}</view>
+						</view>
+						<view class="num2">
+							<view class="name">{{ item.cost }}{{$t('txt.¥')}}</view>
+						</view>
+					</view>
+				</view>
+				
+				<view style="padding-top: 20rpx;margin-left: 10rpx;" class="jinchu">
+					<text style="color:#FFFFFF;font-size: 32rpx;font-weight: bold;">{{$t('txt.支付方式')}}</text>
+				</view>
+
+				<view class="mingxiList">
+					<view class="left">
+						<image class="icon" src="../../static/me/icon_wechat.png" mode="widthFix" />
+						<text style="font-size: 28rpx;margin-left: 20rpx;color: #ffffff;">{{$t('txt.微信支付')}}</text>
+					</view>
+					<view class="right">
+						<image class="icon" src="../../static/me/icon_select.png" mode="heightFix" />
+					</view>
+				</view>
+				<view class="line"></view>
+				<view class="mingxiList">
+					<view class="left">
+						<image class="icon" src="../../static/me/icon_alipay.png" mode="widthFix" />
+						<text style="font-size: 28rpx;margin-left: 20rpx;color: #ffffff;">{{$t('txt.支付宝支付')}}</text>
+					</view>
+					<view class="right">
+						<image class="icon" src="../../static/me/icon_unsel.png" mode="heightFix" />
+					</view>
+				</view>
+				<view class="line"></view>
+				<view class="btn_submit">{{$t('txt.立即支付')}}{{$t('txt.¥')}}{{ purchList[sel].cost }}</view>
+				<view class="bottom">
+					<text style="font-size: 28rpx;color: #FFFFFF;">{{$t('txt.点击支付即代表同意')}}</text>
+					<text style="font-size: 28rpx;color: #FF2A95;">{{$t('txt.M币充值协议')}}</text>
+				</view>
+			</view>
+
+			
+
+			<view class="blankHeight"></view>
+		</view>
+
+
+		<!-- 提示框 -->
+		<DialogBox ref="DialogBox"></DialogBox>
+	</view>
+</template>
+
+<script>
+	export default {
+		components: {},
+		data() {
+			return {
+				title: '',
+				sel: 1,
+				M_coinInfo: {
+
+					myMcoin: 0
+
+				},
+				purchList: {
+					"0": {
+						value: 50,
+						cost: 5
+					},
+					"1": {
+						value: 100,
+						cost: 10
+					},
+					"2": {
+						value: 250,
+						cost: 25
+					},
+					"3": {
+						value: 500,
+						cost: 50
+					},
+					"4": {
+						value: 1000,
+						cost: 100
+					},
+					"5": {
+						value: 5000,
+						cost: 500
+					},
+					"6": {
+						value: 10000,
+						cost: 1000
+					},
+					"7": {
+						value: 20000,
+						cost: 2000
+					},
+					"8": {
+						value: 50000,
+						cost: 5000
+					},					
+				},
+
+			}
+		},
+		onLoad() {
+			// setTimeout(function() {
+			// 	uni.setNavigationBarColor({
+			// 		frontColor: '#ffffff',
+			// 		backgroundColor: '#00000000',
+			// 		animation: {
+			// 			duration: 400,
+			// 			timingFunc: 'easeIn'
+			// 		}
+			// 	})
+			// }, 200);
+		},
+		onShow() {
+			this.loadData();
+		},
+		methods: {
+			onBack() {},
+			chkSel() {
+				if (this.sel == 1) {
+					this.sel = 0;
+				} else {
+					this.sel = 1;
+				}
+			},
+			loadData() {
+				console.log("this.globalData", getApp().globalData);
+				let obj2 = {
+					is_first: 0
+				}
+				const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
+
+				console.log(postData);
+
+				uni.request({
+					url: this.$apiHost + '/Gushi/getmyinfo', //仅为示例,并非真实接口地址。
+					data: postData,
+					method: 'POST',
+					header: {
+						'content-type': 'application/json', //自定义请求头信息
+						'Access-Control-Allow-Origin': '*'
+					},
+					success: (res) => {
+						console.log('data:', res.data);
+						this.myinfo = res.data;
+					}
+				});
+
+
+
+			},
+			EditNickname() {
+				let that = this;
+				this.$refs['DialogBox'].confirm({
+					title: '更改昵称',
+					placeholder: '请输入修改的昵称',
+					value: that.myinfo.nickname,
+					DialogType: 'input',
+					animation: 0
+				}).then((res) => {
+					if (res.value.length < 1) {
+						uni.showToast({
+							title: "请输入有效的昵称",
+							icon: 'none'
+						});
+						return;
+					}
+					that.myinfo.nickname = res.value;
+					let obj2 = {
+						nickname: res.value
+					}
+					const postData = Object.assign({}, getApp().globalData.postHeader, obj2);
+					uni.request({
+						url: that.$apiHost + '/Gushi/editinfo', //检测是否已绑定
+						data: postData,
+						method: 'POST',
+						header: {
+							'content-type': 'application/json', //自定义请求头信息
+							'Access-Control-Allow-Origin': '*'
+						},
+						success: (res) => {
+							uni.showToast({
+								title: res.data.str,
+								icon: 'none'
+							});
+						}
+					});
+				})
+			},
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	@import 'M_purchase.scss';
+</style>

二進制
static/me/icon_alipay.png


二進制
static/me/icon_select.png


二進制
static/me/icon_unsel.png


二進制
static/me/icon_wechat.png